@deephaven/iris-grid 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.
- package/dist/AdvancedFilterCreator.js +1 -1
- package/dist/AdvancedFilterCreator.js.map +1 -1
- package/dist/AdvancedFilterCreatorSelectValueList.js +1 -1
- package/dist/AdvancedFilterCreatorSelectValueList.js.map +1 -1
- package/dist/ColumnStatistics.js +2 -2
- package/dist/ColumnStatistics.js.map +1 -1
- package/dist/FilterInputField.d.ts.map +1 -1
- package/dist/FilterInputField.js +2 -2
- package/dist/FilterInputField.js.map +1 -1
- package/dist/IrisGrid.d.ts +1 -1
- package/dist/IrisGrid.d.ts.map +1 -1
- package/dist/IrisGrid.js +8 -6
- package/dist/IrisGrid.js.map +1 -1
- package/dist/IrisGridCopyHandler.d.ts.map +1 -1
- package/dist/IrisGridCopyHandler.js +1 -1
- package/dist/IrisGridCopyHandler.js.map +1 -1
- package/dist/IrisGridMetricCalculator.js +2 -2
- package/dist/IrisGridMetricCalculator.js.map +1 -1
- package/dist/IrisGridRenderer.d.ts.map +1 -1
- package/dist/IrisGridRenderer.js +23 -20
- package/dist/IrisGridRenderer.js.map +1 -1
- package/dist/IrisGridTableModel.d.ts.map +1 -1
- package/dist/IrisGridTableModel.js +10 -2
- package/dist/IrisGridTableModel.js.map +1 -1
- package/dist/IrisGridTableModelTemplate.js +34 -26
- package/dist/IrisGridTableModelTemplate.js.map +1 -1
- package/dist/IrisGridTestUtils.d.ts.map +1 -1
- package/dist/IrisGridTestUtils.js +2 -1
- package/dist/IrisGridTestUtils.js.map +1 -1
- package/dist/IrisGridTreeTableModel.js +1 -1
- package/dist/IrisGridTreeTableModel.js.map +1 -1
- package/dist/IrisGridUtils.js +4 -4
- package/dist/IrisGridUtils.js.map +1 -1
- package/dist/PendingDataBottomBar.d.ts.map +1 -1
- package/dist/PendingDataBottomBar.js +3 -3
- package/dist/PendingDataBottomBar.js.map +1 -1
- package/dist/format-context-menus/CustomFormatAction.js +1 -1
- package/dist/format-context-menus/CustomFormatAction.js.map +1 -1
- package/dist/format-context-menus/DecimalFormatContextMenu.js +1 -1
- package/dist/format-context-menus/DecimalFormatContextMenu.js.map +1 -1
- package/dist/format-context-menus/FormatContextMenuUtils.js +1 -1
- package/dist/format-context-menus/FormatContextMenuUtils.js.map +1 -1
- package/dist/format-context-menus/IntegerFormatContextMenu.js +1 -1
- package/dist/format-context-menus/IntegerFormatContextMenu.js.map +1 -1
- package/dist/mousehandlers/IrisGridCellOverflowMouseHandler.d.ts.map +1 -1
- package/dist/mousehandlers/IrisGridCellOverflowMouseHandler.js +2 -2
- package/dist/mousehandlers/IrisGridCellOverflowMouseHandler.js.map +1 -1
- package/dist/mousehandlers/IrisGridColumnSelectMouseHandler.js +2 -2
- package/dist/mousehandlers/IrisGridColumnSelectMouseHandler.js.map +1 -1
- package/dist/mousehandlers/IrisGridContextMenuHandler.js +3 -3
- package/dist/mousehandlers/IrisGridContextMenuHandler.js.map +1 -1
- package/dist/mousehandlers/IrisGridFilterMouseHandler.js +2 -2
- package/dist/mousehandlers/IrisGridFilterMouseHandler.js.map +1 -1
- package/dist/sidebar/CustomColumnBuilder.d.ts +0 -1
- package/dist/sidebar/CustomColumnBuilder.d.ts.map +1 -1
- package/dist/sidebar/CustomColumnBuilder.js +0 -6
- package/dist/sidebar/CustomColumnBuilder.js.map +1 -1
- package/dist/sidebar/CustomColumnInput.js +1 -1
- package/dist/sidebar/CustomColumnInput.js.map +1 -1
- package/dist/sidebar/InputEditor.js +2 -2
- package/dist/sidebar/InputEditor.js.map +1 -1
- package/dist/sidebar/RollupRows.d.ts.map +1 -1
- package/dist/sidebar/RollupRows.js +10 -10
- package/dist/sidebar/RollupRows.js.map +1 -1
- package/dist/sidebar/TableCsvExporter.d.ts +1 -1
- package/dist/sidebar/TableCsvExporter.d.ts.map +1 -1
- package/dist/sidebar/TableCsvExporter.js +51 -27
- package/dist/sidebar/TableCsvExporter.js.map +1 -1
- package/dist/sidebar/TableSaver.d.ts +4 -1
- package/dist/sidebar/TableSaver.d.ts.map +1 -1
- package/dist/sidebar/TableSaver.js +8 -6
- package/dist/sidebar/TableSaver.js.map +1 -1
- package/dist/sidebar/VisibilityOrderingBuilder.d.ts +3 -3
- package/dist/sidebar/VisibilityOrderingBuilder.d.ts.map +1 -1
- package/dist/sidebar/VisibilityOrderingBuilder.js +2 -2
- package/dist/sidebar/VisibilityOrderingBuilder.js.map +1 -1
- package/dist/sidebar/aggregations/Aggregations.js +1 -1
- package/dist/sidebar/aggregations/Aggregations.js.map +1 -1
- package/dist/sidebar/conditional-formatting/ConditionEditor.d.ts.map +1 -1
- package/dist/sidebar/conditional-formatting/ConditionEditor.js +2 -2
- package/dist/sidebar/conditional-formatting/ConditionEditor.js.map +1 -1
- package/dist/sidebar/conditional-formatting/ConditionalFormatEditor.js.map +1 -1
- package/dist/sidebar/conditional-formatting/ConditionalFormattingMenu.d.ts.map +1 -1
- package/dist/sidebar/conditional-formatting/ConditionalFormattingMenu.js +1 -1
- package/dist/sidebar/conditional-formatting/ConditionalFormattingMenu.js.map +1 -1
- package/package.json +15 -15
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PendingDataBottomBar.js","names":["React","useEffect","useMemo","useRef","useState","FontAwesomeIcon","vsPass","vsWarning","Button","LoadingSpinner","usePrevious","IrisGridBottomBar","HIDE_TIMEOUT","MAX_NUMBER_ROWS_SHOWN","PendingDataBottomBar","isSaving","onSave","onDiscard","discardTooltip","saveTooltip","error","pendingDataErrors","pendingDataMap","onEntering","onEntered","onExiting","onExited","isSuccessShown","setIsSuccessShown","wasSuccessShown","setWasSuccessShown","successTimeout","prevIsSaving","errorMessage","size","Array","from","keys","join","trim","showSuccessMessage","current","setTimeout","hideSuccessMessage","clearTimeout","cleanupTimeout","undefined","pendingRowCount","commitIcon"],"sources":["../src/PendingDataBottomBar.tsx"],"sourcesContent":["import React, { useEffect, useMemo, useRef, useState } from 'react';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport { vsPass, vsWarning } from '@deephaven/icons';\nimport { Button, LoadingSpinner } from '@deephaven/components';\nimport { usePrevious } from '@deephaven/react-hooks';\nimport IrisGridBottomBar from './IrisGridBottomBar';\nimport './PendingDataBottomBar.scss';\nimport { PendingDataMap } from './CommonTypes';\n\nconst HIDE_TIMEOUT = 3000;\n\nconst MAX_NUMBER_ROWS_SHOWN = 5;\n\nexport type PendingDataBottomBarProps = {\n onSave: () => Promise<void>;\n onDiscard: () => Promise<void>;\n discardTooltip?: string;\n saveTooltip?: string;\n isSaving?: boolean;\n error?: string | null;\n pendingDataErrors: Map<number, Error[]>;\n pendingDataMap: PendingDataMap;\n onEntering?: () => void;\n onEntered?: () => void;\n onExiting?: () => void;\n onExited?: () => void;\n};\n\nexport const PendingDataBottomBar = ({\n isSaving = false,\n onSave,\n onDiscard,\n discardTooltip,\n saveTooltip,\n error,\n pendingDataErrors,\n pendingDataMap,\n onEntering,\n onEntered,\n onExiting,\n onExited,\n}: PendingDataBottomBarProps): JSX.Element => {\n const [isSuccessShown, setIsSuccessShown] = useState(false);\n const [wasSuccessShown, setWasSuccessShown] = useState(false);\n const successTimeout = useRef<ReturnType<typeof setTimeout>>();\n const prevIsSaving = usePrevious(isSaving);\n const errorMessage = useMemo(() => {\n if (pendingDataErrors.size === 0) {\n return error;\n }\n if (pendingDataErrors.size <= MAX_NUMBER_ROWS_SHOWN) {\n return `Key can't be empty (on pending row${\n pendingDataErrors.size > 1 ? 's' : ''\n } ${Array.from(pendingDataErrors.keys()).join(', ').trim()})`;\n }\n return `Key can't be empty (on ${pendingDataErrors.size} rows)`;\n }, [error, pendingDataErrors]);\n\n useEffect(\n function showSuccessMessage() {\n if (prevIsSaving
|
|
1
|
+
{"version":3,"file":"PendingDataBottomBar.js","names":["React","useEffect","useMemo","useRef","useState","FontAwesomeIcon","vsPass","vsWarning","Button","LoadingSpinner","usePrevious","IrisGridBottomBar","HIDE_TIMEOUT","MAX_NUMBER_ROWS_SHOWN","PendingDataBottomBar","isSaving","onSave","onDiscard","discardTooltip","saveTooltip","error","pendingDataErrors","pendingDataMap","onEntering","onEntered","onExiting","onExited","isSuccessShown","setIsSuccessShown","wasSuccessShown","setWasSuccessShown","successTimeout","prevIsSaving","errorMessage","size","Array","from","keys","join","trim","showSuccessMessage","current","setTimeout","hideSuccessMessage","clearTimeout","cleanupTimeout","undefined","pendingRowCount","commitIcon"],"sources":["../src/PendingDataBottomBar.tsx"],"sourcesContent":["import React, { useEffect, useMemo, useRef, useState } from 'react';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport { vsPass, vsWarning } from '@deephaven/icons';\nimport { Button, LoadingSpinner } from '@deephaven/components';\nimport { usePrevious } from '@deephaven/react-hooks';\nimport IrisGridBottomBar from './IrisGridBottomBar';\nimport './PendingDataBottomBar.scss';\nimport { PendingDataMap } from './CommonTypes';\n\nconst HIDE_TIMEOUT = 3000;\n\nconst MAX_NUMBER_ROWS_SHOWN = 5;\n\nexport type PendingDataBottomBarProps = {\n onSave: () => Promise<void>;\n onDiscard: () => Promise<void>;\n discardTooltip?: string;\n saveTooltip?: string;\n isSaving?: boolean;\n error?: string | null;\n pendingDataErrors: Map<number, Error[]>;\n pendingDataMap: PendingDataMap;\n onEntering?: () => void;\n onEntered?: () => void;\n onExiting?: () => void;\n onExited?: () => void;\n};\n\nexport const PendingDataBottomBar = ({\n isSaving = false,\n onSave,\n onDiscard,\n discardTooltip,\n saveTooltip,\n error,\n pendingDataErrors,\n pendingDataMap,\n onEntering,\n onEntered,\n onExiting,\n onExited,\n}: PendingDataBottomBarProps): JSX.Element => {\n const [isSuccessShown, setIsSuccessShown] = useState(false);\n const [wasSuccessShown, setWasSuccessShown] = useState(false);\n const successTimeout = useRef<ReturnType<typeof setTimeout>>();\n const prevIsSaving = usePrevious(isSaving);\n const errorMessage = useMemo(() => {\n if (pendingDataErrors.size === 0) {\n return error;\n }\n if (pendingDataErrors.size <= MAX_NUMBER_ROWS_SHOWN) {\n return `Key can't be empty (on pending row${\n pendingDataErrors.size > 1 ? 's' : ''\n } ${Array.from(pendingDataErrors.keys()).join(', ').trim()})`;\n }\n return `Key can't be empty (on ${pendingDataErrors.size} rows)`;\n }, [error, pendingDataErrors]);\n\n useEffect(\n function showSuccessMessage() {\n if (\n prevIsSaving != null &&\n prevIsSaving &&\n !isSaving &&\n errorMessage == null\n ) {\n setIsSuccessShown(true);\n setWasSuccessShown(true);\n successTimeout.current = setTimeout(() => {\n setIsSuccessShown(false);\n }, HIDE_TIMEOUT);\n }\n },\n [errorMessage, isSaving, prevIsSaving]\n );\n\n useEffect(\n function hideSuccessMessage() {\n if (successTimeout.current && pendingDataMap.size > 0) {\n // A change just occurred while the success message was still being shown, just hide the success message\n clearTimeout(successTimeout.current);\n setIsSuccessShown(false);\n setWasSuccessShown(false);\n }\n },\n [pendingDataMap]\n );\n\n useEffect(function cleanupTimeout() {\n return () =>\n successTimeout.current ? clearTimeout(successTimeout.current) : undefined;\n }, []);\n\n const pendingRowCount = pendingDataMap.size;\n let commitIcon;\n if (isSaving) {\n commitIcon = <LoadingSpinner />;\n } else if (wasSuccessShown) {\n commitIcon = vsPass;\n }\n\n return (\n <IrisGridBottomBar\n className=\"pending-data-bottom-bar\"\n isShown={pendingRowCount > 0 || isSuccessShown || errorMessage != null}\n onEntering={onEntering}\n onEntered={onEntered}\n onExiting={onExiting}\n onExited={() => {\n setWasSuccessShown(false);\n if (onExited) {\n onExited();\n }\n }}\n >\n {errorMessage != null && errorMessage !== '' && (\n <div className=\"error-message\">\n <FontAwesomeIcon icon={vsWarning} />\n <span>{`${errorMessage}`}</span>\n </div>\n )}\n {(errorMessage == null || errorMessage === '') && (\n <div className=\"status-message\">\n {pendingRowCount > 0 && (\n <span>{`${pendingRowCount} row${\n pendingRowCount > 1 ? 's' : ''\n } pending`}</span>\n )}\n </div>\n )}\n <div className=\"buttons-container\">\n {!isSaving && !wasSuccessShown && (\n <Button kind=\"secondary\" onClick={onDiscard} tooltip={discardTooltip}>\n Discard\n </Button>\n )}\n <Button\n kind={wasSuccessShown ? 'success' : 'primary'}\n onClick={onSave}\n icon={commitIcon}\n disabled={isSaving || wasSuccessShown || errorMessage != null}\n tooltip={saveTooltip}\n >\n {isSaving && `Committing...`}\n {!isSaving && wasSuccessShown && `Success`}\n {!isSaving && !wasSuccessShown && `Commit`}\n </Button>\n </div>\n </IrisGridBottomBar>\n );\n};\n\nexport default PendingDataBottomBar;\n"],"mappings":"AAAA,OAAOA,KAAP,IAAgBC,SAAhB,EAA2BC,OAA3B,EAAoCC,MAApC,EAA4CC,QAA5C,QAA4D,OAA5D;AACA,SAASC,eAAT,QAAgC,gCAAhC;AACA,SAASC,MAAT,EAAiBC,SAAjB,QAAkC,kBAAlC;AACA,SAASC,MAAT,EAAiBC,cAAjB,QAAuC,uBAAvC;AACA,SAASC,WAAT,QAA4B,wBAA5B;OACOC,iB;;AAIP,IAAMC,YAAY,GAAG,IAArB;AAEA,IAAMC,qBAAqB,GAAG,CAA9B;AAiBA,OAAO,IAAMC,oBAAoB,GAAG,QAaU;EAAA,IAbT;IACnCC,QAAQ,GAAG,KADwB;IAEnCC,MAFmC;IAGnCC,SAHmC;IAInCC,cAJmC;IAKnCC,WALmC;IAMnCC,KANmC;IAOnCC,iBAPmC;IAQnCC,cARmC;IASnCC,UATmC;IAUnCC,SAVmC;IAWnCC,SAXmC;IAYnCC,QAAQ,EAARA;EAZmC,CAaS;EAC5C,IAAM,CAACC,cAAD,EAAiBC,iBAAjB,IAAsCxB,QAAQ,CAAC,KAAD,CAApD;EACA,IAAM,CAACyB,eAAD,EAAkBC,kBAAlB,IAAwC1B,QAAQ,CAAC,KAAD,CAAtD;EACA,IAAM2B,cAAc,GAAG5B,MAAM,EAA7B;EACA,IAAM6B,YAAY,GAAGtB,WAAW,CAACK,QAAD,CAAhC;EACA,IAAMkB,YAAY,GAAG/B,OAAO,CAAC,MAAM;IACjC,IAAImB,iBAA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C,UAHR;IAIE,QAAQ,EAAEjC,QAAQ,IAAIc,eAAZ,IAA+BI,YAAY,IAAI,IAJ3D;IAKE,OAAO,EAAEd;EALX,GAOGJ,QAAQ,mBAPX,EAQG,CAACA,QAAD,IAAac,eAAb,aARH,EASG,CAACd,QAAD,IAAa,CAACc,eAAd,YATH,CANF,CA5BF,CADF;AAiDD,CA1HM;AA4HP,eAAef,oBAAf"}
|
|
@@ -109,7 +109,7 @@ class CustomFormatAction extends Component {
|
|
|
109
109
|
}, iconElement), /*#__PURE__*/React.createElement("label", {
|
|
110
110
|
className: "title mb-0",
|
|
111
111
|
htmlFor: "custom-format-input"
|
|
112
|
-
}, title, description && /*#__PURE__*/React.createElement(Tooltip, null, description))), /*#__PURE__*/React.createElement("div", {
|
|
112
|
+
}, title, description != null && /*#__PURE__*/React.createElement(Tooltip, null, description))), /*#__PURE__*/React.createElement("div", {
|
|
113
113
|
className: "pl-2 pr-2 pb-2"
|
|
114
114
|
}, /*#__PURE__*/React.createElement("input", {
|
|
115
115
|
id: "custom-format-input",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CustomFormatAction.js","names":["React","Component","Tooltip","DOMUtils","CustomFormatAction","constructor","props","defaultProps","handleInputChange","bind","handleKeyDown","inputRef","createRef","onChange","current","value","closeContextMenu","forwardedProps","closeMenu","revertToDefault","returnFocusToContextMenu","parentContextMenu","getClosestByClassName","HTMLElement","focus","event","key","stopPropagation","render","formatString","placeholder","title","menuItem","description","iconElement","focusInput"],"sources":["../../src/format-context-menus/CustomFormatAction.tsx"],"sourcesContent":["import React, { Component } from 'react';\nimport { Tooltip } from '@deephaven/components';\nimport { DOMUtils } from '@deephaven/utils';\n\nimport './CustomFormatAction.scss';\n\ntype CustomFormatActionProps = typeof CustomFormatAction.defaultProps & {\n forwardedProps: {\n menuItem: {\n title?: string;\n description?: string;\n };\n };\n};\n\n/**\n * Renders menuElement option with custom format input for use in formatting context menus\n *\n * TODO:\n * - capture focus when this menu action is selected via ArrowUp/ArrowDown keys\n * - dynamically update selected menu item when clicking on the input box\n */\nclass CustomFormatAction extends Component<CustomFormatActionProps> {\n static defaultProps = {\n formatString: '',\n forwardedProps: {\n menuItem: {},\n closeMenu(focusInput: boolean): void {\n // no-op\n },\n iconElement: null,\n },\n placeholder: '',\n title: '',\n onChange(value: string | null): void {\n // no-op\n },\n };\n\n constructor(\n props: CustomFormatActionProps = CustomFormatAction.defaultProps\n ) {\n super(props);\n\n this.handleInputChange = this.handleInputChange.bind(this);\n this.handleKeyDown = this.handleKeyDown.bind(this);\n\n this.inputRef = React.createRef();\n }\n\n inputRef: React.RefObject<HTMLInputElement>;\n\n handleInputChange(): void {\n const { onChange } = this.props;\n if (this.inputRef.current) {\n onChange(this.inputRef.current.value);\n }\n }\n\n closeContextMenu(): void {\n const { forwardedProps } = this.props;\n const { closeMenu } = forwardedProps;\n closeMenu(true);\n }\n\n revertToDefault(): void {\n const { onChange } = this.props;\n onChange(null);\n }\n\n returnFocusToContextMenu(): void {\n const parentContextMenu = DOMUtils.getClosestByClassName(\n this.inputRef.current,\n 'context-menu-container'\n );\n if (parentContextMenu instanceof HTMLElement) {\n parentContextMenu.focus();\n }\n }\n\n handleKeyDown(event: React.KeyboardEvent<HTMLInputElement>): void {\n switch (event.key) {\n case 'Enter':\n event.stopPropagation();\n this.closeContextMenu();\n break;\n case 'Escape':\n event.stopPropagation();\n this.revertToDefault();\n this.closeContextMenu();\n break;\n case 'ArrowRight':\n case 'ArrowLeft':\n event.stopPropagation();\n break;\n case 'ArrowUp':\n case 'ArrowDown':\n this.returnFocusToContextMenu();\n break;\n default:\n event.stopPropagation();\n }\n }\n\n render(): JSX.Element {\n const { formatString, forwardedProps, placeholder, title } = this.props;\n const {\n menuItem: { description },\n iconElement,\n } = forwardedProps;\n return (\n <div className=\"form-group flex-grow mb-0\">\n <div className=\"custom-format-title\">\n <span className=\"icon\">{iconElement}</span>\n <label className=\"title mb-0\" htmlFor=\"custom-format-input\">\n {title}\n {description && <Tooltip>{description}</Tooltip>}\n </label>\n </div>\n <div className=\"pl-2 pr-2 pb-2\">\n <input\n id=\"custom-format-input\"\n className=\"form-control text-right mb-0\"\n type=\"text\"\n defaultValue={formatString}\n ref={this.inputRef}\n placeholder={placeholder}\n onKeyDown={this.handleKeyDown}\n onChange={this.handleInputChange}\n autoComplete=\"off\"\n autoCorrect=\"off\"\n autoCapitalize=\"off\"\n spellCheck=\"false\"\n />\n </div>\n </div>\n );\n }\n}\n\nexport default CustomFormatAction;\n"],"mappings":";;AAAA,OAAOA,KAAP,IAAgBC,SAAhB,QAAiC,OAAjC;AACA,SAASC,OAAT,QAAwB,uBAAxB;AACA,SAASC,QAAT,QAAyB,kBAAzB;;;AAaA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,kBAAN,SAAiCH,SAAjC,CAAoE;EAiBlEI,WAAW,GAET;IAAA,IADAC,KACA,uEADiCF,kBAAkB,CAACG,YACpD;IACA,MAAMD,KAAN;;IADA;;IAGA,KAAKE,iBAAL,GAAyB,KAAKA,iBAAL,CAAuBC,IAAvB,CAA4B,IAA5B,CAAzB;IACA,KAAKC,aAAL,GAAqB,KAAKA,aAAL,CAAmBD,IAAnB,CAAwB,IAAxB,CAArB;IAEA,KAAKE,QAAL,gBAAgBX,KAAK,CAACY,SAAN,EAAhB;EACD;;EAIDJ,iBAAiB,GAAS;IACxB,IAAM;MAAEK;IAAF,IAAe,KAAKP,KAA1B;;IACA,IAAI,KAAKK,QAAL,CAAcG,OAAlB,EAA2B;MACzBD,QAAQ,CAAC,KAAKF,QAAL,CAAcG,OAAd,CAAsBC,KAAvB,CAAR;IACD;EACF;;EAEDC,gBAAgB,GAAS;IACvB,IAAM;MAAEC;IAAF,IAAqB,KAAKX,KAAhC;IACA,IAAM;MAAEY;IAAF,IAAgBD,cAAtB;IACAC,SAAS,CAAC,IAAD,CAAT;EACD;;EAEDC,eAAe,GAAS;IACtB,IAAM;MAAEN;IAAF,IAAe,KAAKP,KAA1B;IACAO,QAAQ,CAAC,IAAD,CAAR;EACD;;EAEDO,wBAAwB,GAAS;IAC/B,IAAMC,iBAAiB,GAAGlB,QAAQ,CAACmB,qBAAT,CACxB,KAAKX,QAAL,CAAcG,OADU,EAExB,wBAFwB,CAA1B;;IAIA,IAAIO,iBAAiB,YAAYE,WAAjC,EAA8C;MAC5CF,iBAAiB,CAACG,KAAlB;IACD;EACF;;EAEDd,aAAa,CAACe,KAAD,EAAqD;IAChE,QAAQA,KAAK,CAACC,GAAd;MACE,KAAK,OAAL;QACED,KAAK,CAACE,eAAN;QACA,KAAKX,gBAAL;QACA;;MACF,KAAK,QAAL;QACES,KAAK,CAACE,eAAN;QACA,KAAKR,eAAL;QACA,KAAKH,gBAAL;QACA;;MACF,KAAK,YAAL;MACA,KAAK,WAAL;QACES,KAAK,CAACE,eAAN;QACA;;MACF,KAAK,SAAL;MACA,KAAK,WAAL;QACE,KAAKP,wBAAL;QACA;;MACF;QACEK,KAAK,CAACE,eAAN;IAnBJ;EAqBD;;EAEDC,MAAM,GAAgB;IACpB,IAAM;MAAEC,YAAF;MAAgBZ,cAAhB;MAAgCa,WAAhC;MAA6CC;IAA7C,IAAuD,KAAKzB,KAAlE;IACA,IAAM;MACJ0B,QAAQ,EAAE;QAAEC;MAAF,CADN;MAEJC;IAFI,IAGFjB,cAHJ;IAIA,oBACE;MAAK,SAAS,EAAC;IAAf,gBACE;MAAK,SAAS,EAAC;IAAf,gBACE;MAAM,SAAS,EAAC;IAAhB,GAAwBiB,WAAxB,CADF,eAEE;MAAO,SAAS,EAAC,YAAjB;MAA8B,OAAO,EAAC;IAAtC,GACGH,KADH,EAEGE,WAAW,
|
|
1
|
+
{"version":3,"file":"CustomFormatAction.js","names":["React","Component","Tooltip","DOMUtils","CustomFormatAction","constructor","props","defaultProps","handleInputChange","bind","handleKeyDown","inputRef","createRef","onChange","current","value","closeContextMenu","forwardedProps","closeMenu","revertToDefault","returnFocusToContextMenu","parentContextMenu","getClosestByClassName","HTMLElement","focus","event","key","stopPropagation","render","formatString","placeholder","title","menuItem","description","iconElement","focusInput"],"sources":["../../src/format-context-menus/CustomFormatAction.tsx"],"sourcesContent":["import React, { Component } from 'react';\nimport { Tooltip } from '@deephaven/components';\nimport { DOMUtils } from '@deephaven/utils';\n\nimport './CustomFormatAction.scss';\n\ntype CustomFormatActionProps = typeof CustomFormatAction.defaultProps & {\n forwardedProps: {\n menuItem: {\n title?: string;\n description?: string;\n };\n };\n};\n\n/**\n * Renders menuElement option with custom format input for use in formatting context menus\n *\n * TODO:\n * - capture focus when this menu action is selected via ArrowUp/ArrowDown keys\n * - dynamically update selected menu item when clicking on the input box\n */\nclass CustomFormatAction extends Component<CustomFormatActionProps> {\n static defaultProps = {\n formatString: '',\n forwardedProps: {\n menuItem: {},\n closeMenu(focusInput: boolean): void {\n // no-op\n },\n iconElement: null,\n },\n placeholder: '',\n title: '',\n onChange(value: string | null): void {\n // no-op\n },\n };\n\n constructor(\n props: CustomFormatActionProps = CustomFormatAction.defaultProps\n ) {\n super(props);\n\n this.handleInputChange = this.handleInputChange.bind(this);\n this.handleKeyDown = this.handleKeyDown.bind(this);\n\n this.inputRef = React.createRef();\n }\n\n inputRef: React.RefObject<HTMLInputElement>;\n\n handleInputChange(): void {\n const { onChange } = this.props;\n if (this.inputRef.current) {\n onChange(this.inputRef.current.value);\n }\n }\n\n closeContextMenu(): void {\n const { forwardedProps } = this.props;\n const { closeMenu } = forwardedProps;\n closeMenu(true);\n }\n\n revertToDefault(): void {\n const { onChange } = this.props;\n onChange(null);\n }\n\n returnFocusToContextMenu(): void {\n const parentContextMenu = DOMUtils.getClosestByClassName(\n this.inputRef.current,\n 'context-menu-container'\n );\n if (parentContextMenu instanceof HTMLElement) {\n parentContextMenu.focus();\n }\n }\n\n handleKeyDown(event: React.KeyboardEvent<HTMLInputElement>): void {\n switch (event.key) {\n case 'Enter':\n event.stopPropagation();\n this.closeContextMenu();\n break;\n case 'Escape':\n event.stopPropagation();\n this.revertToDefault();\n this.closeContextMenu();\n break;\n case 'ArrowRight':\n case 'ArrowLeft':\n event.stopPropagation();\n break;\n case 'ArrowUp':\n case 'ArrowDown':\n this.returnFocusToContextMenu();\n break;\n default:\n event.stopPropagation();\n }\n }\n\n render(): JSX.Element {\n const { formatString, forwardedProps, placeholder, title } = this.props;\n const {\n menuItem: { description },\n iconElement,\n } = forwardedProps;\n return (\n <div className=\"form-group flex-grow mb-0\">\n <div className=\"custom-format-title\">\n <span className=\"icon\">{iconElement}</span>\n <label className=\"title mb-0\" htmlFor=\"custom-format-input\">\n {title}\n {description != null && <Tooltip>{description}</Tooltip>}\n </label>\n </div>\n <div className=\"pl-2 pr-2 pb-2\">\n <input\n id=\"custom-format-input\"\n className=\"form-control text-right mb-0\"\n type=\"text\"\n defaultValue={formatString}\n ref={this.inputRef}\n placeholder={placeholder}\n onKeyDown={this.handleKeyDown}\n onChange={this.handleInputChange}\n autoComplete=\"off\"\n autoCorrect=\"off\"\n autoCapitalize=\"off\"\n spellCheck=\"false\"\n />\n </div>\n </div>\n );\n }\n}\n\nexport default CustomFormatAction;\n"],"mappings":";;AAAA,OAAOA,KAAP,IAAgBC,SAAhB,QAAiC,OAAjC;AACA,SAASC,OAAT,QAAwB,uBAAxB;AACA,SAASC,QAAT,QAAyB,kBAAzB;;;AAaA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,kBAAN,SAAiCH,SAAjC,CAAoE;EAiBlEI,WAAW,GAET;IAAA,IADAC,KACA,uEADiCF,kBAAkB,CAACG,YACpD;IACA,MAAMD,KAAN;;IADA;;IAGA,KAAKE,iBAAL,GAAyB,KAAKA,iBAAL,CAAuBC,IAAvB,CAA4B,IAA5B,CAAzB;IACA,KAAKC,aAAL,GAAqB,KAAKA,aAAL,CAAmBD,IAAnB,CAAwB,IAAxB,CAArB;IAEA,KAAKE,QAAL,gBAAgBX,KAAK,CAACY,SAAN,EAAhB;EACD;;EAIDJ,iBAAiB,GAAS;IACxB,IAAM;MAAEK;IAAF,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AS,EAAC;IAAf,gBACE;MAAM,SAAS,EAAC;IAAhB,GAAwBiB,WAAxB,CADF,eAEE;MAAO,SAAS,EAAC,YAAjB;MAA8B,OAAO,EAAC;IAAtC,GACGH,KADH,EAEGE,WAAW,IAAI,IAAf,iBAAuB,oBAAC,OAAD,QAAUA,WAAV,CAF1B,CAFF,CADF,eAQE;MAAK,SAAS,EAAC;IAAf,gBACE;MACE,EAAE,EAAC,qBADL;MAEE,SAAS,EAAC,8BAFZ;MAGE,IAAI,EAAC,MAHP;MAIE,YAAY,EAAEJ,YAJhB;MAKE,GAAG,EAAE,KAAKlB,QALZ;MAME,WAAW,EAAEmB,WANf;MAOE,SAAS,EAAE,KAAKpB,aAPlB;MAQE,QAAQ,EAAE,KAAKF,iBARjB;MASE,YAAY,EAAC,KATf;MAUE,WAAW,EAAC,KAVd;MAWE,cAAc,EAAC,KAXjB;MAYE,UAAU,EAAC;IAZb,EADF,CARF,CADF;EA2BD;;AAnHiE;;gBAA9DJ,kB,kBACkB;EACpByB,YAAY,EAAE,EADM;EAEpBZ,cAAc,EAAE;IACde,QAAQ,EAAE,EADI;;IAEdd,SAAS,CAACiB,UAAD,EAA4B,CACnC;IACD,CAJa;;IAKdD,WAAW,EAAE;EALC,CAFI;EASpBJ,WAAW,EAAE,EATO;EAUpBC,KAAK,EAAE,EAVa;;EAWpBlB,QAAQ,CAACE,KAAD,EAA6B,CACnC;EACD;;AAbmB,C;;AAqHxB,eAAeX,kBAAf"}
|
|
@@ -35,7 +35,7 @@ class DecimalFormatContextMenu {
|
|
|
35
35
|
var isCustomSelected = FormatContextMenuUtils.isCustomSelected(selectedFormat);
|
|
36
36
|
var customFormat = isCustomSelected ? selectedFormat : DecimalColumnFormatter.makeCustomFormat();
|
|
37
37
|
var customFormatOption = FormatContextMenuUtils.makeCustomFormatOption(customFormat, DecimalFormatContextMenu.customGroup, DecimalColumnFormatter.DEFAULT_FORMAT_STRING, isCustomSelected, formatString => {
|
|
38
|
-
if (formatString) {
|
|
38
|
+
if (formatString != null) {
|
|
39
39
|
var newCustomFormat = DecimalColumnFormatter.makeCustomFormat(formatString);
|
|
40
40
|
|
|
41
41
|
if (DecimalColumnFormatter.isValid(newCustomFormat)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DecimalFormatContextMenu.js","names":["DecimalColumnFormatter","FormatContextMenuUtils","DecimalFormatContextMenu","getOptions","selectedFormat","onCustomFormatChange","formatItems","format","FORMAT_PERCENT","group","presetGroup","FORMAT_BASIS_POINTS","FORMAT_MILLIONS","FORMAT_ROUND","presetRoundGroup","FORMAT_ROUND_TWO_DECIMALS","FORMAT_ROUND_FOUR_DECIMALS","defaultFormatOption","makeOption","defaultGroup","isDefaultSelected","presetFormatOptions","map","item","label","isSameFormat","isCustomSelected","customFormat","makeCustomFormat","customFormatOption","makeCustomFormatOption","customGroup","DEFAULT_FORMAT_STRING","formatString","newCustomFormat","isValid"],"sources":["../../src/format-context-menus/DecimalFormatContextMenu.ts"],"sourcesContent":["import {\n DecimalColumnFormat,\n DecimalColumnFormatter,\n} from '@deephaven/jsapi-utils';\nimport FormatContextMenuUtils, {\n FormatContextMenuOption,\n} from './FormatContextMenuUtils';\n\nclass DecimalFormatContextMenu {\n static defaultGroup = 10;\n\n static presetGroup = 20;\n\n static presetRoundGroup = 30;\n\n static customGroup = 40;\n\n /**\n * Creates list of formatting options for Decimal context menu\n * @param selectedFormat Selected format object, null for no selected format\n * @param onCustomFormatChange Callback to call when the custom format is changed\n * @returns Array of formatting options for the context menu\n */\n static getOptions(\n selectedFormat: DecimalColumnFormat,\n onCustomFormatChange: (value: DecimalColumnFormat | null) => void\n ): FormatContextMenuOption[] {\n const formatItems = [\n {\n format: DecimalColumnFormatter.FORMAT_PERCENT,\n group: DecimalFormatContextMenu.presetGroup,\n },\n {\n format: DecimalColumnFormatter.FORMAT_BASIS_POINTS,\n group: DecimalFormatContextMenu.presetGroup,\n },\n {\n format: DecimalColumnFormatter.FORMAT_MILLIONS,\n group: DecimalFormatContextMenu.presetGroup,\n },\n {\n format: DecimalColumnFormatter.FORMAT_ROUND,\n group: DecimalFormatContextMenu.presetRoundGroup,\n },\n {\n format: DecimalColumnFormatter.FORMAT_ROUND_TWO_DECIMALS,\n group: DecimalFormatContextMenu.presetRoundGroup,\n },\n {\n format: DecimalColumnFormatter.FORMAT_ROUND_FOUR_DECIMALS,\n group: DecimalFormatContextMenu.presetRoundGroup,\n },\n ];\n\n const defaultFormatOption = FormatContextMenuUtils.makeOption(\n 'Default',\n null,\n DecimalFormatContextMenu.defaultGroup,\n FormatContextMenuUtils.isDefaultSelected(selectedFormat)\n );\n\n const presetFormatOptions = formatItems.map(item =>\n FormatContextMenuUtils.makeOption(\n item.format.label,\n item.format,\n item.group,\n DecimalColumnFormatter.isSameFormat(item.format, selectedFormat)\n )\n );\n\n const isCustomSelected = FormatContextMenuUtils.isCustomSelected(\n selectedFormat\n );\n\n const customFormat = isCustomSelected\n ? selectedFormat\n : DecimalColumnFormatter.makeCustomFormat();\n\n const customFormatOption = FormatContextMenuUtils.makeCustomFormatOption(\n customFormat,\n DecimalFormatContextMenu.customGroup,\n DecimalColumnFormatter.DEFAULT_FORMAT_STRING,\n isCustomSelected,\n formatString => {\n if (formatString) {\n const newCustomFormat = DecimalColumnFormatter.makeCustomFormat(\n formatString\n );\n if (DecimalColumnFormatter.isValid(newCustomFormat)) {\n onCustomFormatChange(newCustomFormat);\n }\n } else {\n onCustomFormatChange(null);\n }\n }\n );\n\n return [defaultFormatOption, ...presetFormatOptions, customFormatOption];\n }\n}\n\nexport default DecimalFormatContextMenu;\n"],"mappings":";;AAAA,SAEEA,sBAFF,QAGO,wBAHP;OAIOC,sB;;AAIP,MAAMC,wBAAN,CAA+B;EAS7B;AACF;AACA;AACA;AACA;AACA;EACmB,OAAVC,UAAU,CACfC,cADe,EAEfC,oBAFe,EAGY;IAC3B,IAAMC,WAAW,GAAG,CAClB;MACEC,MAAM,EAAEP,sBAAsB,CAACQ,cADjC;M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H,YADyB,EAEzBzB,wBAAwB,CAAC6B,WAFA,EAGzB/B,sBAAsB,CAACgC,qBAHE,EAIzBN,gBAJyB,EAKzBO,YAAY,IAAI;MACd,IAAIA,
|
|
1
|
+
{"version":3,"file":"DecimalFormatContextMenu.js","names":["DecimalColumnFormatter","FormatContextMenuUtils","DecimalFormatContextMenu","getOptions","selectedFormat","onCustomFormatChange","formatItems","format","FORMAT_PERCENT","group","presetGroup","FORMAT_BASIS_POINTS","FORMAT_MILLIONS","FORMAT_ROUND","presetRoundGroup","FORMAT_ROUND_TWO_DECIMALS","FORMAT_ROUND_FOUR_DECIMALS","defaultFormatOption","makeOption","defaultGroup","isDefaultSelected","presetFormatOptions","map","item","label","isSameFormat","isCustomSelected","customFormat","makeCustomFormat","customFormatOption","makeCustomFormatOption","customGroup","DEFAULT_FORMAT_STRING","formatString","newCustomFormat","isValid"],"sources":["../../src/format-context-menus/DecimalFormatContextMenu.ts"],"sourcesContent":["import {\n DecimalColumnFormat,\n DecimalColumnFormatter,\n} from '@deephaven/jsapi-utils';\nimport FormatContextMenuUtils, {\n FormatContextMenuOption,\n} from './FormatContextMenuUtils';\n\nclass DecimalFormatContextMenu {\n static defaultGroup = 10;\n\n static presetGroup = 20;\n\n static presetRoundGroup = 30;\n\n static customGroup = 40;\n\n /**\n * Creates list of formatting options for Decimal context menu\n * @param selectedFormat Selected format object, null for no selected format\n * @param onCustomFormatChange Callback to call when the custom format is changed\n * @returns Array of formatting options for the context menu\n */\n static getOptions(\n selectedFormat: DecimalColumnFormat,\n onCustomFormatChange: (value: DecimalColumnFormat | null) => void\n ): FormatContextMenuOption[] {\n const formatItems = [\n {\n format: DecimalColumnFormatter.FORMAT_PERCENT,\n group: DecimalFormatContextMenu.presetGroup,\n },\n {\n format: DecimalColumnFormatter.FORMAT_BASIS_POINTS,\n group: DecimalFormatContextMenu.presetGroup,\n },\n {\n format: DecimalColumnFormatter.FORMAT_MILLIONS,\n group: DecimalFormatContextMenu.presetGroup,\n },\n {\n format: DecimalColumnFormatter.FORMAT_ROUND,\n group: DecimalFormatContextMenu.presetRoundGroup,\n },\n {\n format: DecimalColumnFormatter.FORMAT_ROUND_TWO_DECIMALS,\n group: DecimalFormatContextMenu.presetRoundGroup,\n },\n {\n format: DecimalColumnFormatter.FORMAT_ROUND_FOUR_DECIMALS,\n group: DecimalFormatContextMenu.presetRoundGroup,\n },\n ];\n\n const defaultFormatOption = FormatContextMenuUtils.makeOption(\n 'Default',\n null,\n DecimalFormatContextMenu.defaultGroup,\n FormatContextMenuUtils.isDefaultSelected(selectedFormat)\n );\n\n const presetFormatOptions = formatItems.map(item =>\n FormatContextMenuUtils.makeOption(\n item.format.label,\n item.format,\n item.group,\n DecimalColumnFormatter.isSameFormat(item.format, selectedFormat)\n )\n );\n\n const isCustomSelected = FormatContextMenuUtils.isCustomSelected(\n selectedFormat\n );\n\n const customFormat = isCustomSelected\n ? selectedFormat\n : DecimalColumnFormatter.makeCustomFormat();\n\n const customFormatOption = FormatContextMenuUtils.makeCustomFormatOption(\n customFormat,\n DecimalFormatContextMenu.customGroup,\n DecimalColumnFormatter.DEFAULT_FORMAT_STRING,\n isCustomSelected,\n formatString => {\n if (formatString != null) {\n const newCustomFormat = DecimalColumnFormatter.makeCustomFormat(\n formatString\n );\n if (DecimalColumnFormatter.isValid(newCustomFormat)) {\n onCustomFormatChange(newCustomFormat);\n }\n } else {\n onCustomFormatChange(null);\n }\n }\n );\n\n return [defaultFormatOption, ...presetFormatOptions, customFormatOption];\n }\n}\n\nexport default DecimalFormatContextMenu;\n"],"mappings":";;AAAA,SAEEA,sBAFF,QAGO,wBAHP;OAIOC,sB;;AAIP,MAAMC,wBAAN,CAA+B;EAS7B;AACF;AACA;AACA;AACA;AACA;EACmB,OAAVC,UAAU,CACfC,cADe,EAEfC,oBAFe,EAGY;IAC3B,IAAMC,WAAW,GAAG,CAClB;MACEC,MAAM,EAAEP,sBAAsB,CAACQ,cADjC;MAEEC,KAAK,EAAEP,wBAAwB,CAAC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6B,WAFA,EAGzB/B,sBAAsB,CAACgC,qBAHE,EAIzBN,gBAJyB,EAKzBO,YAAY,IAAI;MACd,IAAIA,YAAY,IAAI,IAApB,EAA0B;QACxB,IAAMC,eAAe,GAAGlC,sBAAsB,CAAC4B,gBAAvB,CACtBK,YADsB,CAAxB;;QAGA,IAAIjC,sBAAsB,CAACmC,OAAvB,CAA+BD,eAA/B,CAAJ,EAAqD;UACnD7B,oBAAoB,CAAC6B,eAAD,CAApB;QACD;MACF,CAPD,MAOO;QACL7B,oBAAoB,CAAC,IAAD,CAApB;MACD;IACF,CAhBwB,CAA3B;IAmBA,OAAO,CAACY,mBAAD,EAAsB,GAAGI,mBAAzB,EAA8CQ,kBAA9C,CAAP;EACD;;AA1F4B;;gBAAzB3B,wB,kBACkB,E;;gBADlBA,wB,iBAGiB,E;;gBAHjBA,wB,sBAKsB,E;;gBALtBA,wB,iBAOiB,E;;AAsFvB,eAAeA,wBAAf"}
|
|
@@ -17,7 +17,7 @@ class FormatContextMenuUtils {
|
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
static isCustomSelected(selectedFormat) {
|
|
20
|
-
return selectedFormat && selectedFormat.type === TableColumnFormatter.TYPE_CONTEXT_CUSTOM;
|
|
20
|
+
return selectedFormat != null && selectedFormat.type === TableColumnFormatter.TYPE_CONTEXT_CUSTOM;
|
|
21
21
|
}
|
|
22
22
|
/**
|
|
23
23
|
* Creates context menu option
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormatContextMenuUtils.js","names":["React","TableColumnFormatter","CustomFormatAction","FormatContextMenuUtils","isDefaultSelected","selectedFormat","TYPE_CONTEXT_CUSTOM","TYPE_CONTEXT_PRESET","includes","type","isCustomSelected","makeOption","title","format","group","isSelected","description","makeCustomFormatOption","placeholder","onChange","label","menuElement","formatString"],"sources":["../../src/format-context-menus/FormatContextMenuUtils.tsx"],"sourcesContent":["import React from 'react';\nimport {\n TableColumnFormat,\n TableColumnFormatter,\n} from '@deephaven/jsapi-utils';\nimport CustomFormatAction from './CustomFormatAction';\n\nexport interface FormatContextMenuOption {\n title: string;\n description: string;\n group: number;\n format: TableColumnFormat | null;\n isSelected: boolean;\n}\n\nexport interface CustomFormatOption extends FormatContextMenuOption {\n menuElement: React.ReactElement;\n}\n\nclass FormatContextMenuUtils {\n /**\n * Returns true if default option should be active in the context menu\n * @param selectedFormat selected format object or null\n */\n static isDefaultSelected(selectedFormat: TableColumnFormat | null): boolean {\n return (\n !selectedFormat ||\n ![\n TableColumnFormatter.TYPE_CONTEXT_CUSTOM,\n TableColumnFormatter.TYPE_CONTEXT_PRESET,\n ].includes(selectedFormat.type)\n );\n }\n\n /**\n * Returns true if custom format option should be active in the context menu\n * @param selectedFormat selected format object or null\n */\n static isCustomSelected(selectedFormat: TableColumnFormat): boolean {\n return (\n selectedFormat &&\n selectedFormat.type === TableColumnFormatter.TYPE_CONTEXT_CUSTOM\n );\n }\n\n /**\n * Creates context menu option\n * @param title Context menu title\n * @param format Format object\n * @param group Context menu group\n * @param isSelected Is current option selected\n */\n static makeOption(\n title: string,\n format: TableColumnFormat | null,\n group: number,\n isSelected: boolean\n ): FormatContextMenuOption {\n return {\n title,\n description: title,\n group,\n format,\n isSelected,\n };\n }\n\n /**\n * Creates context menu option with an input element\n * @param format Format object\n * @param group Context menu group\n * @param placeholder Input element placeholder\n * @param isSelected Is current option selected\n * @param onChange Input element onChange callback\n */\n static makeCustomFormatOption(\n format: TableColumnFormat,\n group: number,\n placeholder: string,\n isSelected: boolean,\n onChange: (value: string | null) => void\n ): CustomFormatOption {\n return {\n title: format.label,\n description: format.label,\n format,\n group,\n isSelected,\n menuElement: (\n <CustomFormatAction\n formatString={format.formatString}\n title={format.label}\n placeholder={placeholder}\n onChange={onChange}\n />\n ),\n };\n }\n}\n\nexport default FormatContextMenuUtils;\n"],"mappings":"AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SAEEC,oBAFF,QAGO,wBAHP;OAIOC,kB;;AAcP,MAAMC,sBAAN,CAA6B;EAC3B;AACF;AACA;AACA;EAC0B,OAAjBC,iBAAiB,CAACC,cAAD,EAAoD;IAC1E,OACE,CAACA,cAAD,IACA,CAAC,CACCJ,oBAAoB,CAACK,mBADtB,EAECL,oBAAoB,CAACM,mBAFtB,EAGCC,QAHD,CAGUH,cAAc,CAACI,IAHzB,CAFH;EAOD;EAED;AACF;AACA;AACA;;;EACyB,OAAhBC,gBAAgB,CAACL,cAAD,EAA6C;IAClE,OACEA,cAAc,
|
|
1
|
+
{"version":3,"file":"FormatContextMenuUtils.js","names":["React","TableColumnFormatter","CustomFormatAction","FormatContextMenuUtils","isDefaultSelected","selectedFormat","TYPE_CONTEXT_CUSTOM","TYPE_CONTEXT_PRESET","includes","type","isCustomSelected","makeOption","title","format","group","isSelected","description","makeCustomFormatOption","placeholder","onChange","label","menuElement","formatString"],"sources":["../../src/format-context-menus/FormatContextMenuUtils.tsx"],"sourcesContent":["import React from 'react';\nimport {\n TableColumnFormat,\n TableColumnFormatter,\n} from '@deephaven/jsapi-utils';\nimport CustomFormatAction from './CustomFormatAction';\n\nexport interface FormatContextMenuOption {\n title: string;\n description: string;\n group: number;\n format: TableColumnFormat | null;\n isSelected: boolean;\n}\n\nexport interface CustomFormatOption extends FormatContextMenuOption {\n menuElement: React.ReactElement;\n}\n\nclass FormatContextMenuUtils {\n /**\n * Returns true if default option should be active in the context menu\n * @param selectedFormat selected format object or null\n */\n static isDefaultSelected(selectedFormat: TableColumnFormat | null): boolean {\n return (\n !selectedFormat ||\n ![\n TableColumnFormatter.TYPE_CONTEXT_CUSTOM,\n TableColumnFormatter.TYPE_CONTEXT_PRESET,\n ].includes(selectedFormat.type)\n );\n }\n\n /**\n * Returns true if custom format option should be active in the context menu\n * @param selectedFormat selected format object or null\n */\n static isCustomSelected(selectedFormat: TableColumnFormat): boolean {\n return (\n selectedFormat != null &&\n selectedFormat.type === TableColumnFormatter.TYPE_CONTEXT_CUSTOM\n );\n }\n\n /**\n * Creates context menu option\n * @param title Context menu title\n * @param format Format object\n * @param group Context menu group\n * @param isSelected Is current option selected\n */\n static makeOption(\n title: string,\n format: TableColumnFormat | null,\n group: number,\n isSelected: boolean\n ): FormatContextMenuOption {\n return {\n title,\n description: title,\n group,\n format,\n isSelected,\n };\n }\n\n /**\n * Creates context menu option with an input element\n * @param format Format object\n * @param group Context menu group\n * @param placeholder Input element placeholder\n * @param isSelected Is current option selected\n * @param onChange Input element onChange callback\n */\n static makeCustomFormatOption(\n format: TableColumnFormat,\n group: number,\n placeholder: string,\n isSelected: boolean,\n onChange: (value: string | null) => void\n ): CustomFormatOption {\n return {\n title: format.label,\n description: format.label,\n format,\n group,\n isSelected,\n menuElement: (\n <CustomFormatAction\n formatString={format.formatString}\n title={format.label}\n placeholder={placeholder}\n onChange={onChange}\n />\n ),\n };\n }\n}\n\nexport default FormatContextMenuUtils;\n"],"mappings":"AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SAEEC,oBAFF,QAGO,wBAHP;OAIOC,kB;;AAcP,MAAMC,sBAAN,CAA6B;EAC3B;AACF;AACA;AACA;EAC0B,OAAjBC,iBAAiB,CAACC,cAAD,EAAoD;IAC1E,OACE,CAACA,cAAD,IACA,CAAC,CACCJ,oBAAoB,CAACK,mBADtB,EAECL,oBAAoB,CAACM,mBAFtB,EAGCC,QAHD,CAGUH,cAAc,CAACI,IAHzB,CAFH;EAOD;EAED;AACF;AACA;AACA;;;EACyB,OAAhBC,gBAAgB,CAACL,cAAD,EAA6C;IAClE,OACEA,cAAc,IAAI,IAAlB,IACAA,cAAc,CAACI,IAAf,KAAwBR,oBAAoB,CAACK,mBAF/C;EAID;EAED;AACF;AACA;AACA;AACA;AACA;AACA;;;EACmB,OAAVK,UAAU,CACfC,KADe,EAEfC,MAFe,EAGfC,KAHe,EAIfC,UAJe,EAKU;IACzB,OAAO;MACLH,KADK;MAELI,WAAW,EAAEJ,KAFR;MAGLE,KAHK;MAILD,MAJK;MAKLE;IALK,CAAP;EAOD;EAED;AACF;AACA;AACA;AACA;AACA;AACA;AACA;;;EAC+B,OAAtBE,sBAAsB,CAC3BJ,MAD2B,EAE3BC,KAF2B,EAG3BI,WAH2B,EAI3BH,UAJ2B,EAK3BI,QAL2B,EAMP;IACpB,OAAO;MACLP,KAAK,EAAEC,MAAM,CAACO,KADT;MAELJ,WAAW,EAAEH,MAAM,CAACO,KAFf;MAGLP,MAHK;MAILC,KAJK;MAKLC,UALK;MAMLM,WAAW,eACT,oBAAC,kBAAD;QACE,YAAY,EAAER,MAAM,CAACS,YADvB;QAEE,KAAK,EAAET,MAAM,CAACO,KAFhB;QAGE,WAAW,EAAEF,WAHf;QAIE,QAAQ,EAAEC;MAJZ;IAPG,CAAP;EAeD;;AA9E0B;;AAiF7B,eAAehB,sBAAf"}
|
|
@@ -20,7 +20,7 @@ class IntegerFormatContextMenu {
|
|
|
20
20
|
var isCustomSelected = FormatContextMenuUtils.isCustomSelected(selectedFormat);
|
|
21
21
|
var customFormat = isCustomSelected ? selectedFormat : IntegerColumnFormatter.makeCustomFormat();
|
|
22
22
|
var customFormatOption = FormatContextMenuUtils.makeCustomFormatOption(customFormat, IntegerFormatContextMenu.customGroup, IntegerColumnFormatter.DEFAULT_FORMAT_STRING, isCustomSelected, formatString => {
|
|
23
|
-
if (formatString) {
|
|
23
|
+
if (formatString != null) {
|
|
24
24
|
var newCustomFormat = IntegerColumnFormatter.makeCustomFormat(formatString);
|
|
25
25
|
|
|
26
26
|
if (IntegerColumnFormatter.isValid(newCustomFormat)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IntegerFormatContextMenu.js","names":["IntegerColumnFormatter","FormatContextMenuUtils","IntegerFormatContextMenu","getOptions","selectedFormat","onCustomFormatChange","formatItems","format","FORMAT_MILLIONS","group","presetGroup","defaultFormatOption","makeOption","defaultGroup","isDefaultSelected","presetFormatOptions","map","item","label","isSameFormat","isCustomSelected","customFormat","makeCustomFormat","customFormatOption","makeCustomFormatOption","customGroup","DEFAULT_FORMAT_STRING","formatString","newCustomFormat","isValid"],"sources":["../../src/format-context-menus/IntegerFormatContextMenu.ts"],"sourcesContent":["import {\n IntegerColumnFormat,\n IntegerColumnFormatter,\n} from '@deephaven/jsapi-utils';\nimport FormatContextMenuUtils, {\n FormatContextMenuOption,\n} from './FormatContextMenuUtils';\n\nclass IntegerFormatContextMenu {\n static defaultGroup = 10;\n\n static presetGroup = 20;\n\n static customGroup = 30;\n\n /**\n * Creates list of formatting options for Integer context menu\n * @param selectedFormat Selected format object, null for no selected format\n * @param onCustomFormatChange Callback to call when the custom format is changed\n * @returns Array of formatting options for the context menu\n */\n static getOptions(\n selectedFormat: IntegerColumnFormat,\n onCustomFormatChange: (value: IntegerColumnFormat | null) => void\n ): FormatContextMenuOption[] {\n const formatItems = [\n {\n format: IntegerColumnFormatter.FORMAT_MILLIONS,\n group: IntegerFormatContextMenu.presetGroup,\n },\n ];\n\n const defaultFormatOption = FormatContextMenuUtils.makeOption(\n 'Default',\n null,\n IntegerFormatContextMenu.defaultGroup,\n FormatContextMenuUtils.isDefaultSelected(selectedFormat)\n );\n\n const presetFormatOptions = formatItems.map(item =>\n FormatContextMenuUtils.makeOption(\n item.format.label,\n item.format,\n item.group,\n IntegerColumnFormatter.isSameFormat(item.format, selectedFormat)\n )\n );\n\n const isCustomSelected = FormatContextMenuUtils.isCustomSelected(\n selectedFormat\n );\n\n const customFormat = isCustomSelected\n ? selectedFormat\n : IntegerColumnFormatter.makeCustomFormat();\n\n const customFormatOption = FormatContextMenuUtils.makeCustomFormatOption(\n customFormat,\n IntegerFormatContextMenu.customGroup,\n IntegerColumnFormatter.DEFAULT_FORMAT_STRING,\n isCustomSelected,\n formatString => {\n if (formatString) {\n const newCustomFormat = IntegerColumnFormatter.makeCustomFormat(\n formatString\n );\n if (IntegerColumnFormatter.isValid(newCustomFormat)) {\n onCustomFormatChange(newCustomFormat);\n }\n } else {\n onCustomFormatChange(null);\n }\n }\n );\n\n return [defaultFormatOption, ...presetFormatOptions, customFormatOption];\n }\n}\n\nexport default IntegerFormatContextMenu;\n"],"mappings":";;AAAA,SAEEA,sBAFF,QAGO,wBAHP;OAIOC,sB;;AAIP,MAAMC,wBAAN,CAA+B;EAO7B;AACF;AACA;AACA;AACA;AACA;EACmB,OAAVC,UAAU,CACfC,cADe,EAEfC,oBAFe,EAGY;IAC3B,IAAMC,WAAW,GAAG,CAClB;MACEC,MAAM,EAAEP,sBAAsB,CAACQ,eADjC;MAEEC,KAAK,EAAEP,wBAAwB,CAACQ;IAFlC,CADkB,CAApB;IAOA,IAAMC,mBAAmB,GAAGV,sBAAsB,CAACW,UAAvB,CAC1B,SAD0B,EAE1B,IAF0B,EAG1BV,wBAAwB,CAACW,YAHC,EAI1BZ,sBAAsB,CAACa,iBAAvB,CAAyCV,cAAzC,CAJ0B,CAA5B;IAOA,IAAMW,mBAAmB,GAAGT,WAAW,CAACU,GAAZ,CAAgBC,IAAI,IAC9ChB,sBAAsB,CAACW,UAAvB,CACEK,IAAI,CAACV,MAAL,CAAYW,KADd,EAEED,IAAI,CAACV,MAFP,EAGEU,IAAI,CAACR,KAHP,EAIET,sBAAsB,CAACmB,YAAvB,CAAoCF,IAAI,CAACV,MAAzC,EAAiDH,cAAjD,CAJF,CAD0B,CAA5B;IASA,IAAMgB,gBAAgB,GAAGnB,sBAAsB,CAACmB,gBAAvB,CACvBhB,cADuB,CAAzB;IAIA,IAAMiB,YAAY,GAAGD,gBAAgB,GACjChB,cADiC,GAEjCJ,sBAAsB,CAACsB,gBAAvB,EAFJ;IAIA,IAAMC,kBAAkB,GAAGtB,sBAAsB,CAACuB,sBAAvB,CACzBH,YADyB,EAEzBnB,wBAAwB,CAACuB,WAFA,EAGzBzB,sBAAsB,CAAC0B,qBAHE,EAIzBN,gBAJyB,EAKzBO,YAAY,IAAI;MACd,IAAIA,
|
|
1
|
+
{"version":3,"file":"IntegerFormatContextMenu.js","names":["IntegerColumnFormatter","FormatContextMenuUtils","IntegerFormatContextMenu","getOptions","selectedFormat","onCustomFormatChange","formatItems","format","FORMAT_MILLIONS","group","presetGroup","defaultFormatOption","makeOption","defaultGroup","isDefaultSelected","presetFormatOptions","map","item","label","isSameFormat","isCustomSelected","customFormat","makeCustomFormat","customFormatOption","makeCustomFormatOption","customGroup","DEFAULT_FORMAT_STRING","formatString","newCustomFormat","isValid"],"sources":["../../src/format-context-menus/IntegerFormatContextMenu.ts"],"sourcesContent":["import {\n IntegerColumnFormat,\n IntegerColumnFormatter,\n} from '@deephaven/jsapi-utils';\nimport FormatContextMenuUtils, {\n FormatContextMenuOption,\n} from './FormatContextMenuUtils';\n\nclass IntegerFormatContextMenu {\n static defaultGroup = 10;\n\n static presetGroup = 20;\n\n static customGroup = 30;\n\n /**\n * Creates list of formatting options for Integer context menu\n * @param selectedFormat Selected format object, null for no selected format\n * @param onCustomFormatChange Callback to call when the custom format is changed\n * @returns Array of formatting options for the context menu\n */\n static getOptions(\n selectedFormat: IntegerColumnFormat,\n onCustomFormatChange: (value: IntegerColumnFormat | null) => void\n ): FormatContextMenuOption[] {\n const formatItems = [\n {\n format: IntegerColumnFormatter.FORMAT_MILLIONS,\n group: IntegerFormatContextMenu.presetGroup,\n },\n ];\n\n const defaultFormatOption = FormatContextMenuUtils.makeOption(\n 'Default',\n null,\n IntegerFormatContextMenu.defaultGroup,\n FormatContextMenuUtils.isDefaultSelected(selectedFormat)\n );\n\n const presetFormatOptions = formatItems.map(item =>\n FormatContextMenuUtils.makeOption(\n item.format.label,\n item.format,\n item.group,\n IntegerColumnFormatter.isSameFormat(item.format, selectedFormat)\n )\n );\n\n const isCustomSelected = FormatContextMenuUtils.isCustomSelected(\n selectedFormat\n );\n\n const customFormat = isCustomSelected\n ? selectedFormat\n : IntegerColumnFormatter.makeCustomFormat();\n\n const customFormatOption = FormatContextMenuUtils.makeCustomFormatOption(\n customFormat,\n IntegerFormatContextMenu.customGroup,\n IntegerColumnFormatter.DEFAULT_FORMAT_STRING,\n isCustomSelected,\n formatString => {\n if (formatString != null) {\n const newCustomFormat = IntegerColumnFormatter.makeCustomFormat(\n formatString\n );\n if (IntegerColumnFormatter.isValid(newCustomFormat)) {\n onCustomFormatChange(newCustomFormat);\n }\n } else {\n onCustomFormatChange(null);\n }\n }\n );\n\n return [defaultFormatOption, ...presetFormatOptions, customFormatOption];\n }\n}\n\nexport default IntegerFormatContextMenu;\n"],"mappings":";;AAAA,SAEEA,sBAFF,QAGO,wBAHP;OAIOC,sB;;AAIP,MAAMC,wBAAN,CAA+B;EAO7B;AACF;AACA;AACA;AACA;AACA;EACmB,OAAVC,UAAU,CACfC,cADe,EAEfC,oBAFe,EAGY;IAC3B,IAAMC,WAAW,GAAG,CAClB;MACEC,MAAM,EAAEP,sBAAsB,CAACQ,eADjC;MAEEC,KAAK,EAAEP,wBAAwB,CAACQ;IAFlC,CADkB,CAApB;IAOA,IAAMC,mBAAmB,GAAGV,sBAAsB,CAACW,UAAvB,CAC1B,SAD0B,EAE1B,IAF0B,EAG1BV,wBAAwB,CAACW,YAHC,EAI1BZ,sBAAsB,CAACa,iBAAvB,CAAyCV,cAAzC,CAJ0B,CAA5B;IAOA,IAAMW,mBAAmB,GAAGT,WAAW,CAACU,GAAZ,CAAgBC,IAAI,IAC9ChB,sBAAsB,CAACW,UAAvB,CACEK,IAAI,CAACV,MAAL,CAAYW,KADd,EAEED,IAAI,CAACV,MAFP,EAGEU,IAAI,CAACR,KAHP,EAIET,sBAAsB,CAACmB,YAAvB,CAAoCF,IAAI,CAACV,MAAzC,EAAiDH,cAAjD,CAJF,CAD0B,CAA5B;IASA,IAAMgB,gBAAgB,GAAGnB,sBAAsB,CAACmB,gBAAvB,CACvBhB,cADuB,CAAzB;IAIA,IAAMiB,YAAY,GAAGD,gBAAgB,GACjChB,cADiC,GAEjCJ,sBAAsB,CAACsB,gBAAvB,EAFJ;IAIA,IAAMC,kBAAkB,GAAGtB,sBAAsB,CAACuB,sBAAvB,CACzBH,YADyB,EAEzBnB,wBAAwB,CAACuB,WAFA,EAGzBzB,sBAAsB,CAAC0B,qBAHE,EAIzBN,gBAJyB,EAKzBO,YAAY,IAAI;MACd,IAAIA,YAAY,IAAI,IAApB,EAA0B;QACxB,IAAMC,eAAe,GAAG5B,sBAAsB,CAACsB,gBAAvB,CACtBK,YADsB,CAAxB;;QAGA,IAAI3B,sBAAsB,CAAC6B,OAAvB,CAA+BD,eAA/B,CAAJ,EAAqD;UACnDvB,oBAAoB,CAACuB,eAAD,CAApB;QACD;MACF,CAPD,MAOO;QACLvB,oBAAoB,CAAC,IAAD,CAApB;MACD;IACF,CAhBwB,CAA3B;IAmBA,OAAO,CAACM,mBAAD,EAAsB,GAAGI,mBAAzB,EAA8CQ,kBAA9C,CAAP;EACD;;AApE4B;;gBAAzBrB,wB,kBACkB,E;;gBADlBA,wB,iBAGiB,E;;gBAHjBA,wB,iBAKiB,E;;AAkEvB,eAAeA,wBAAf"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IrisGridCellOverflowMouseHandler.d.ts","sourceRoot":"","sources":["../../src/mousehandlers/IrisGridCellOverflowMouseHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,gBAAgB,EAChB,kBAAkB,EACnB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,KAAK,QAAQ,MAAM,aAAa,CAAC;AAGxC;;;GAGG;AACH,cAAM,gCAAiC,SAAQ,gBAAgB;IAC7D,OAAO,CAAC,QAAQ,CAAW;gBAEf,QAAQ,EAAE,QAAQ;IAM9B,OAAO,CAAC,oBAAoB;IAI5B,OAAO,CAAC,SAAS;IAUjB,OAAO,CAAC,iBAAiB;
|
|
1
|
+
{"version":3,"file":"IrisGridCellOverflowMouseHandler.d.ts","sourceRoot":"","sources":["../../src/mousehandlers/IrisGridCellOverflowMouseHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,gBAAgB,EAChB,kBAAkB,EACnB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,KAAK,QAAQ,MAAM,aAAa,CAAC;AAGxC;;;GAGG;AACH,cAAM,gCAAiC,SAAQ,gBAAgB;IAC7D,OAAO,CAAC,QAAQ,CAAW;gBAEf,QAAQ,EAAE,QAAQ;IAM9B,OAAO,CAAC,oBAAoB;IAI5B,OAAO,CAAC,SAAS;IAUjB,OAAO,CAAC,iBAAiB;IA0CzB,OAAO,CAAC,wBAAwB;IAiChC,MAAM,CAAC,KAAK,EAAE,SAAS,GAAG,kBAAkB;IAa5C,OAAO,CAAC,KAAK,EAAE,SAAS,GAAG,kBAAkB;IAM7C,MAAM,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO;IAcjC,aAAa,IAAI,kBAAkB;IAKnC,OAAO,IAAI,kBAAkB;CAI9B;AAED,eAAe,gCAAgC,CAAC"}
|
|
@@ -66,7 +66,7 @@ class IrisGridCellOverflowMouseHandler extends GridMouseHandler {
|
|
|
66
66
|
} = props;
|
|
67
67
|
var {
|
|
68
68
|
canvasContext: context
|
|
69
|
-
} = grid
|
|
69
|
+
} = grid;
|
|
70
70
|
var theme = grid.getTheme();
|
|
71
71
|
var rendererState = {
|
|
72
72
|
context,
|
|
@@ -132,7 +132,7 @@ class IrisGridCellOverflowMouseHandler extends GridMouseHandler {
|
|
|
132
132
|
} = props;
|
|
133
133
|
var {
|
|
134
134
|
canvasContext: context
|
|
135
|
-
} = grid
|
|
135
|
+
} = grid;
|
|
136
136
|
var theme = grid.getTheme();
|
|
137
137
|
var rendererState = {
|
|
138
138
|
context,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IrisGridCellOverflowMouseHandler.js","names":["GridMouseHandler","deepEqual","IrisGridCellOverflowMouseHandler","constructor","irisGrid","destroyColumnTooltip","setState","overflowButtonTooltipProps","setCursor","point","isHoveringOverflowButton","cursor","stopPropagation","preventDefault","getButtonPosition","x","y","column","row","renderer","grid","state","props","metrics","model","canvasContext","context","theme","getTheme","rendererState","mouseX","mouseY","left","top","width","height","getCellOverflowButtonPosition","shouldRenderOverflowButton","onMove","newProps","onWheel","onDown","showOverflowModal","overflowText","getValueForCell","onContextMenu","onLeave"],"sources":["../../src/mousehandlers/IrisGridCellOverflowMouseHandler.ts"],"sourcesContent":["import {\n GridPoint,\n GridMouseHandler,\n EventHandlerResult,\n} from '@deephaven/grid';\nimport deepEqual from 'deep-equal';\nimport type IrisGrid from '../IrisGrid';\nimport { IrisGridRenderState } from '../IrisGridRenderer';\n\n/**\n * Handles cursor and click action for cell overflow button\n * The button is rendered via IrisGridRenderer\n */\nclass IrisGridCellOverflowMouseHandler extends GridMouseHandler {\n private irisGrid: IrisGrid;\n\n constructor(irisGrid: IrisGrid) {\n super(850); // Needs to be before GridSelectionMouseHandler\n\n this.irisGrid = irisGrid;\n }\n\n private destroyColumnTooltip(): void {\n this.irisGrid.setState({ overflowButtonTooltipProps: null });\n }\n\n private setCursor(point: GridPoint): EventHandlerResult {\n if (this.isHoveringOverflowButton(point)) {\n this.cursor = 'pointer';\n return { stopPropagation: false, preventDefault: false };\n }\n\n this.cursor = null;\n return false;\n }\n\n private getButtonPosition({\n x,\n y,\n column,\n row,\n }: GridPoint): {\n left: number;\n top: number;\n width: number;\n height: number;\n } | null {\n if (column == null || row == null) {\n return null;\n }\n const { renderer, grid, state, props } = this.irisGrid;\n if (!grid) {\n return null;\n }\n const { metrics } = state;\n const { model } = props;\n const { canvasContext: context } = grid
|
|
1
|
+
{"version":3,"file":"IrisGridCellOverflowMouseHandler.js","names":["GridMouseHandler","deepEqual","IrisGridCellOverflowMouseHandler","constructor","irisGrid","destroyColumnTooltip","setState","overflowButtonTooltipProps","setCursor","point","isHoveringOverflowButton","cursor","stopPropagation","preventDefault","getButtonPosition","x","y","column","row","renderer","grid","state","props","metrics","model","canvasContext","context","theme","getTheme","rendererState","mouseX","mouseY","left","top","width","height","getCellOverflowButtonPosition","shouldRenderOverflowButton","onMove","newProps","onWheel","onDown","showOverflowModal","overflowText","getValueForCell","onContextMenu","onLeave"],"sources":["../../src/mousehandlers/IrisGridCellOverflowMouseHandler.ts"],"sourcesContent":["import {\n GridPoint,\n GridMouseHandler,\n EventHandlerResult,\n} from '@deephaven/grid';\nimport deepEqual from 'deep-equal';\nimport type IrisGrid from '../IrisGrid';\nimport { IrisGridRenderState } from '../IrisGridRenderer';\n\n/**\n * Handles cursor and click action for cell overflow button\n * The button is rendered via IrisGridRenderer\n */\nclass IrisGridCellOverflowMouseHandler extends GridMouseHandler {\n private irisGrid: IrisGrid;\n\n constructor(irisGrid: IrisGrid) {\n super(850); // Needs to be before GridSelectionMouseHandler\n\n this.irisGrid = irisGrid;\n }\n\n private destroyColumnTooltip(): void {\n this.irisGrid.setState({ overflowButtonTooltipProps: null });\n }\n\n private setCursor(point: GridPoint): EventHandlerResult {\n if (this.isHoveringOverflowButton(point)) {\n this.cursor = 'pointer';\n return { stopPropagation: false, preventDefault: false };\n }\n\n this.cursor = null;\n return false;\n }\n\n private getButtonPosition({\n x,\n y,\n column,\n row,\n }: GridPoint): {\n left: number;\n top: number;\n width: number;\n height: number;\n } | null {\n if (column == null || row == null) {\n return null;\n }\n const { renderer, grid, state, props } = this.irisGrid;\n if (!grid) {\n return null;\n }\n const { metrics } = state;\n const { model } = props;\n\n const { canvasContext: context } = grid;\n const theme = grid.getTheme();\n const rendererState = {\n context,\n mouseX: x,\n mouseY: y,\n metrics,\n model,\n theme,\n };\n\n const { left, top, width, height } = renderer.getCellOverflowButtonPosition(\n rendererState\n );\n if (left == null || width == null || top == null || height == null) {\n return null;\n }\n\n return { left, top, width, height };\n }\n\n private isHoveringOverflowButton(point: GridPoint): boolean {\n const { x, y } = point;\n const { left, top, width, height } = this.getButtonPosition(point) ?? {};\n if (left == null || width == null || top == null || height == null) {\n return false;\n }\n\n const { renderer, grid, state, props } = this.irisGrid;\n if (!grid) {\n return false;\n }\n const { metrics } = state;\n const { model } = props;\n const { canvasContext: context } = grid;\n const theme = grid.getTheme();\n const rendererState = {\n context,\n mouseX: x,\n mouseY: y,\n metrics,\n model,\n theme,\n } as IrisGridRenderState;\n\n return (\n renderer.shouldRenderOverflowButton(rendererState) &&\n x >= left &&\n x <= left + width &&\n y >= top &&\n y <= top + height\n );\n }\n\n onMove(point: GridPoint): EventHandlerResult {\n if (this.isHoveringOverflowButton(point)) {\n const { overflowButtonTooltipProps } = this.irisGrid.state;\n const newProps = this.getButtonPosition(point);\n if (!deepEqual(overflowButtonTooltipProps, newProps)) {\n this.irisGrid.setState({ overflowButtonTooltipProps: newProps });\n }\n } else {\n this.destroyColumnTooltip();\n }\n return this.setCursor(point);\n }\n\n onWheel(point: GridPoint): EventHandlerResult {\n this.destroyColumnTooltip();\n return this.onMove(point);\n }\n\n // Needs to be onDown and not onClick b/c of GridSelectionMouseHandler shifting cell onDown\n onDown(point: GridPoint): boolean {\n this.destroyColumnTooltip();\n const { column, row } = point;\n\n if (this.isHoveringOverflowButton(point)) {\n this.irisGrid.setState({\n showOverflowModal: true,\n overflowText: this.irisGrid.getValueForCell(column, row) as string,\n });\n }\n\n return false;\n }\n\n onContextMenu(): EventHandlerResult {\n this.destroyColumnTooltip();\n return false;\n }\n\n onLeave(): EventHandlerResult {\n this.destroyColumnTooltip();\n return false;\n }\n}\n\nexport default IrisGridCellOverflowMouseHandler;\n"],"mappings":";;AAAA,SAEEA,gBAFF,QAIO,iBAJP;AAKA,OAAOC,SAAP,MAAsB,YAAtB;;AAIA;AACA;AACA;AACA;AACA,MAAMC,gCAAN,SAA+CF,gBAA/C,CAAgE;EAG9DG,WAAW,CAACC,QAAD,EAAqB;IAC9B,MAAM,GAAN,EAD8B,CAClB;;IADkB;;IAG9B,KAAKA,QAAL,GAAgBA,QAAhB;EACD;;EAEOC,oBAAoB,GAAS;IACnC,KAAKD,QAAL,CAAcE,QAAd,CAAuB;MAAEC,0BAA0B,EAAE;IAA9B,CAAvB;EACD;;EAEOC,SAAS,CAACC,KAAD,EAAuC;IACtD,IAAI,KAAKC,wBAAL,CAA8BD,KAA9B,CAAJ,EAA0C;MACxC,KAAKE,MAAL,GAAc,SAAd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AAKnC,QAAL,CAAcE,QAAd,CAAuB;UAAEC,0BAA0B,EAAEgC;QAA9B,CAAvB;MACD;IACF,CAND,MAMO;MACL,KAAKlC,oBAAL;IACD;;IACD,OAAO,KAAKG,SAAL,CAAeC,KAAf,CAAP;EACD;;EAED+B,OAAO,CAAC/B,KAAD,EAAuC;IAC5C,KAAKJ,oBAAL;IACA,OAAO,KAAKiC,MAAL,CAAY7B,KAAZ,CAAP;EACD,CAlH6D,CAoH9D;;;EACAgC,MAAM,CAAChC,KAAD,EAA4B;IAChC,KAAKJ,oBAAL;IACA,IAAM;MAAEY,MAAF;MAAUC;IAAV,IAAkBT,KAAxB;;IAEA,IAAI,KAAKC,wBAAL,CAA8BD,KAA9B,CAAJ,EAA0C;MACxC,KAAKL,QAAL,CAAcE,QAAd,CAAuB;QACrBoC,iBAAiB,EAAE,IADE;QAErBC,YAAY,EAAE,KAAKvC,QAAL,CAAcwC,eAAd,CAA8B3B,MAA9B,EAAsCC,GAAtC;MAFO,CAAvB;IAID;;IAED,OAAO,KAAP;EACD;;EAED2B,aAAa,GAAuB;IAClC,KAAKxC,oBAAL;IACA,OAAO,KAAP;EACD;;EAEDyC,OAAO,GAAuB;IAC5B,KAAKzC,oBAAL;IACA,OAAO,KAAP;EACD;;AA3I6D;;AA8IhE,eAAeH,gCAAf"}
|
|
@@ -32,7 +32,7 @@ class IrisGridColumnSelectMouseHandler extends GridMouseHandler {
|
|
|
32
32
|
columnSelectionValidator
|
|
33
33
|
} = this.irisGrid.props;
|
|
34
34
|
|
|
35
|
-
if (columnSelectionValidator) {
|
|
35
|
+
if (columnSelectionValidator != null) {
|
|
36
36
|
return columnSelectionValidator(tableColumn);
|
|
37
37
|
}
|
|
38
38
|
|
|
@@ -44,7 +44,7 @@ class IrisGridColumnSelectMouseHandler extends GridMouseHandler {
|
|
|
44
44
|
columnSelectionValidator
|
|
45
45
|
} = this.irisGrid.props;
|
|
46
46
|
|
|
47
|
-
if (columnSelectionValidator) {
|
|
47
|
+
if (columnSelectionValidator != null) {
|
|
48
48
|
columnSelectionValidator(null);
|
|
49
49
|
}
|
|
50
50
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IrisGridColumnSelectMouseHandler.js","names":["GridMouseHandler","IrisGridColumnSelectMouseHandler","constructor","irisGrid","cursor","isActive","isSelectingColumn","props","isValidColumn","tableColumn","columnSelectionValidator","updateColumnSelectionStatus","getTableColumn","columnIndex","model","modelColumn","getModelColumn","columns","onMove","gridPoint","columnAllowedCursor","columnNotAllowedCursor","column","setState","hoverSelectColumn","onWheel","preventDefault","stopPropagation","onLeave","onDown","onClick","selectColumn"],"sources":["../../src/mousehandlers/IrisGridColumnSelectMouseHandler.ts"],"sourcesContent":["/* eslint class-methods-use-this: \"off\" */\nimport {\n GridMouseHandler,\n GridPoint,\n EventHandlerResult,\n} from '@deephaven/grid';\nimport type { Column } from '@deephaven/jsapi-shim';\nimport { IrisGrid } from '../IrisGrid';\n\n/**\n * Handles interaction with tables when the Linker tool is active\n */\nclass IrisGridColumnSelectMouseHandler extends GridMouseHandler {\n constructor(irisGrid: IrisGrid) {\n super();\n\n this.irisGrid = irisGrid;\n this.cursor = null;\n }\n\n private irisGrid: IrisGrid;\n\n private isActive(): boolean {\n const { isSelectingColumn } = this.irisGrid.props;\n return isSelectingColumn;\n }\n\n private isValidColumn(tableColumn: Column | null): boolean {\n if (tableColumn == null) {\n return false;\n }\n\n const { columnSelectionValidator } = this.irisGrid.props;\n if (columnSelectionValidator) {\n return columnSelectionValidator(tableColumn);\n }\n return true;\n }\n\n private updateColumnSelectionStatus(): void {\n const { columnSelectionValidator } = this.irisGrid.props;\n if (columnSelectionValidator) {\n columnSelectionValidator(null);\n }\n }\n\n private getTableColumn(columnIndex: number | null): Column | null {\n if (columnIndex == null) {\n return null;\n }\n\n const { model } = this.irisGrid.props;\n const modelColumn = this.irisGrid.getModelColumn(columnIndex);\n if (modelColumn == null) {\n return null;\n }\n\n return model.columns[modelColumn];\n }\n\n onMove(gridPoint: GridPoint): EventHandlerResult {\n if (!this.isActive()) {\n return false;\n }\n\n const { columnAllowedCursor, columnNotAllowedCursor } = this.irisGrid.props;\n const { column } = gridPoint;\n const tableColumn = this.getTableColumn(column);\n\n if (this.isValidColumn(tableColumn)) {\n this.cursor = columnAllowedCursor;\n this.irisGrid.setState({ hoverSelectColumn: column });\n } else {\n this.cursor = columnNotAllowedCursor;\n this.irisGrid.setState({ hoverSelectColumn: null });\n }\n\n return true;\n }\n\n // keeps linker cursor state during wheel event\n onWheel(gridPoint: GridPoint): EventHandlerResult {\n if (!this.isActive()) {\n return false;\n }\n\n const { columnAllowedCursor, columnNotAllowedCursor } = this.irisGrid.props;\n const { column } = gridPoint;\n const tableColumn = this.getTableColumn(column);\n\n if (this.isValidColumn(tableColumn)) {\n this.cursor = columnAllowedCursor;\n } else {\n this.cursor = columnNotAllowedCursor;\n }\n\n // don't block wheel event from scrolling\n return { preventDefault: false, stopPropagation: false };\n }\n\n onLeave(): EventHandlerResult {\n if (this.isActive()) {\n this.irisGrid.setState({ hoverSelectColumn: null });\n }\n\n this.updateColumnSelectionStatus();\n\n return false;\n }\n\n onDown(): EventHandlerResult {\n return this.isActive();\n }\n\n onClick(gridPoint: GridPoint): EventHandlerResult {\n if (!this.isActive()) {\n return false;\n }\n\n const { column } = gridPoint;\n const tableColumn = this.getTableColumn(column);\n if (tableColumn != null && this.isValidColumn(tableColumn)) {\n this.irisGrid.selectColumn(tableColumn);\n }\n\n return true;\n }\n}\n\nexport default IrisGridColumnSelectMouseHandler;\n"],"mappings":";;AAAA;AACA,SACEA,gBADF,QAIO,iBAJP;;AAQA;AACA;AACA;AACA,MAAMC,gCAAN,SAA+CD,gBAA/C,CAAgE;EAC9DE,WAAW,CAACC,QAAD,EAAqB;IAC9B;;IAD8B;;IAG9B,KAAKA,QAAL,GAAgBA,QAAhB;IACA,KAAKC,MAAL,GAAc,IAAd;EACD;;EAIOC,QAAQ,GAAY;IAC1B,IAAM;MAAEC;IAAF,IAAwB,KAAKH,QAAL,CAAcI,KAA5C;IACA,OAAOD,iBAAP;EACD;;EAEOE,aAAa,CAACC,WAAD,EAAsC;IACzD,IAAIA,WAAW,IAAI,IAAnB,EAAyB;MACvB,OAAO,KAAP;IACD;;IAED,IAAM;MAAEC;IAAF,IAA+B,KAAKP,QAAL,CAAcI,KAAnD;;IACA,IAAIG,
|
|
1
|
+
{"version":3,"file":"IrisGridColumnSelectMouseHandler.js","names":["GridMouseHandler","IrisGridColumnSelectMouseHandler","constructor","irisGrid","cursor","isActive","isSelectingColumn","props","isValidColumn","tableColumn","columnSelectionValidator","updateColumnSelectionStatus","getTableColumn","columnIndex","model","modelColumn","getModelColumn","columns","onMove","gridPoint","columnAllowedCursor","columnNotAllowedCursor","column","setState","hoverSelectColumn","onWheel","preventDefault","stopPropagation","onLeave","onDown","onClick","selectColumn"],"sources":["../../src/mousehandlers/IrisGridColumnSelectMouseHandler.ts"],"sourcesContent":["/* eslint class-methods-use-this: \"off\" */\nimport {\n GridMouseHandler,\n GridPoint,\n EventHandlerResult,\n} from '@deephaven/grid';\nimport type { Column } from '@deephaven/jsapi-shim';\nimport { IrisGrid } from '../IrisGrid';\n\n/**\n * Handles interaction with tables when the Linker tool is active\n */\nclass IrisGridColumnSelectMouseHandler extends GridMouseHandler {\n constructor(irisGrid: IrisGrid) {\n super();\n\n this.irisGrid = irisGrid;\n this.cursor = null;\n }\n\n private irisGrid: IrisGrid;\n\n private isActive(): boolean {\n const { isSelectingColumn } = this.irisGrid.props;\n return isSelectingColumn;\n }\n\n private isValidColumn(tableColumn: Column | null): boolean {\n if (tableColumn == null) {\n return false;\n }\n\n const { columnSelectionValidator } = this.irisGrid.props;\n if (columnSelectionValidator != null) {\n return columnSelectionValidator(tableColumn);\n }\n return true;\n }\n\n private updateColumnSelectionStatus(): void {\n const { columnSelectionValidator } = this.irisGrid.props;\n if (columnSelectionValidator != null) {\n columnSelectionValidator(null);\n }\n }\n\n private getTableColumn(columnIndex: number | null): Column | null {\n if (columnIndex == null) {\n return null;\n }\n\n const { model } = this.irisGrid.props;\n const modelColumn = this.irisGrid.getModelColumn(columnIndex);\n if (modelColumn == null) {\n return null;\n }\n\n return model.columns[modelColumn];\n }\n\n onMove(gridPoint: GridPoint): EventHandlerResult {\n if (!this.isActive()) {\n return false;\n }\n\n const { columnAllowedCursor, columnNotAllowedCursor } = this.irisGrid.props;\n const { column } = gridPoint;\n const tableColumn = this.getTableColumn(column);\n\n if (this.isValidColumn(tableColumn)) {\n this.cursor = columnAllowedCursor;\n this.irisGrid.setState({ hoverSelectColumn: column });\n } else {\n this.cursor = columnNotAllowedCursor;\n this.irisGrid.setState({ hoverSelectColumn: null });\n }\n\n return true;\n }\n\n // keeps linker cursor state during wheel event\n onWheel(gridPoint: GridPoint): EventHandlerResult {\n if (!this.isActive()) {\n return false;\n }\n\n const { columnAllowedCursor, columnNotAllowedCursor } = this.irisGrid.props;\n const { column } = gridPoint;\n const tableColumn = this.getTableColumn(column);\n\n if (this.isValidColumn(tableColumn)) {\n this.cursor = columnAllowedCursor;\n } else {\n this.cursor = columnNotAllowedCursor;\n }\n\n // don't block wheel event from scrolling\n return { preventDefault: false, stopPropagation: false };\n }\n\n onLeave(): EventHandlerResult {\n if (this.isActive()) {\n this.irisGrid.setState({ hoverSelectColumn: null });\n }\n\n this.updateColumnSelectionStatus();\n\n return false;\n }\n\n onDown(): EventHandlerResult {\n return this.isActive();\n }\n\n onClick(gridPoint: GridPoint): EventHandlerResult {\n if (!this.isActive()) {\n return false;\n }\n\n const { column } = gridPoint;\n const tableColumn = this.getTableColumn(column);\n if (tableColumn != null && this.isValidColumn(tableColumn)) {\n this.irisGrid.selectColumn(tableColumn);\n }\n\n return true;\n }\n}\n\nexport default IrisGridColumnSelectMouseHandler;\n"],"mappings":";;AAAA;AACA,SACEA,gBADF,QAIO,iBAJP;;AAQA;AACA;AACA;AACA,MAAMC,gCAAN,SAA+CD,gBAA/C,CAAgE;EAC9DE,WAAW,CAACC,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AP;IACD;;IAED,IAAM;MAAEiB;IAAF,IAAaH,SAAnB;IACA,IAAMV,WAAW,GAAG,KAAKG,cAAL,CAAoBU,MAApB,CAApB;;IACA,IAAIb,WAAW,IAAI,IAAf,IAAuB,KAAKD,aAAL,CAAmBC,WAAnB,CAA3B,EAA4D;MAC1D,KAAKN,QAAL,CAAc4B,YAAd,CAA2BtB,WAA3B;IACD;;IAED,OAAO,IAAP;EACD;;AAlH6D;;AAqHhE,eAAeR,gCAAf"}
|
|
@@ -53,7 +53,7 @@ class IrisGridContextMenuHandler extends GridMouseHandler {
|
|
|
53
53
|
|
|
54
54
|
|
|
55
55
|
static getQuickFilterText(filterText, newFilterText, operator) {
|
|
56
|
-
return operator && filterText ? "".concat(filterText, " ").concat(operator, " ").concat(newFilterText) : newFilterText;
|
|
56
|
+
return operator && filterText != null ? "".concat(filterText, " ").concat(operator, " ").concat(newFilterText) : newFilterText;
|
|
57
57
|
}
|
|
58
58
|
/**
|
|
59
59
|
* Converts operator to text string,
|
|
@@ -652,7 +652,7 @@ class IrisGridContextMenuHandler extends GridMouseHandler {
|
|
|
652
652
|
icon: isSelected ? vsCheck : undefined,
|
|
653
653
|
order: i,
|
|
654
654
|
action: () => {
|
|
655
|
-
if (
|
|
655
|
+
if (columnIndex === undefined && format && format.type === TableColumnFormatter.TYPE_CONTEXT_CUSTOM) {
|
|
656
656
|
return;
|
|
657
657
|
}
|
|
658
658
|
|
|
@@ -858,7 +858,7 @@ class IrisGridContextMenuHandler extends GridMouseHandler {
|
|
|
858
858
|
actions.push({
|
|
859
859
|
menuElement: /*#__PURE__*/React.createElement("div", {
|
|
860
860
|
className: "iris-grid-filter-menu-item-value"
|
|
861
|
-
}, operator ? IrisGridContextMenuHandler.getOperatorAsText(operator) : '', ' ', "\"", valueText
|
|
861
|
+
}, operator ? IrisGridContextMenuHandler.getOperatorAsText(operator) : '', ' ', "\"", valueText !== null && valueText !== void 0 ? valueText : 'null', "\""),
|
|
862
862
|
order: 1,
|
|
863
863
|
group: ContextActions.groups.high
|
|
864
864
|
});
|