box-ui-elements 16.1.0-beta.79 → 16.1.0-beta.80
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/es/components/table/makeSelectable.js +22 -0
- package/es/components/table/makeSelectable.js.flow +18 -0
- package/es/components/table/makeSelectable.js.map +1 -1
- package/package.json +1 -1
- package/src/components/table/__tests__/makeSelectable.test.js +48 -0
- package/src/components/table/makeSelectable.js +18 -0
|
@@ -183,6 +183,10 @@ function makeSelectable(BaseTable) {
|
|
|
183
183
|
key: 'right',
|
|
184
184
|
description: React.createElement(FormattedMessage, messages.downDescription),
|
|
185
185
|
handler: function handler(event) {
|
|
186
|
+
if (_this.isTargetSlider(event)) {
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
|
|
186
190
|
var data = _this.props.data;
|
|
187
191
|
var focusedIndex = _this.state.focusedIndex;
|
|
188
192
|
event.preventDefault();
|
|
@@ -197,6 +201,10 @@ function makeSelectable(BaseTable) {
|
|
|
197
201
|
key: 'left',
|
|
198
202
|
description: React.createElement(FormattedMessage, messages.upDescription),
|
|
199
203
|
handler: function handler(event) {
|
|
204
|
+
if (_this.isTargetSlider(event)) {
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
|
|
200
208
|
var _this$state$focusedIn2 = _this.state.focusedIndex,
|
|
201
209
|
focusedIndex = _this$state$focusedIn2 === void 0 ? 0 : _this$state$focusedIn2;
|
|
202
210
|
event.preventDefault();
|
|
@@ -211,6 +219,10 @@ function makeSelectable(BaseTable) {
|
|
|
211
219
|
key: 'down',
|
|
212
220
|
description: React.createElement(FormattedMessage, messages.downDescription),
|
|
213
221
|
handler: function handler(event) {
|
|
222
|
+
if (_this.isTargetSlider(event)) {
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
225
|
+
|
|
214
226
|
var _this$props = _this.props,
|
|
215
227
|
data = _this$props.data,
|
|
216
228
|
gridColumnCount = _this$props.gridColumnCount;
|
|
@@ -227,6 +239,10 @@ function makeSelectable(BaseTable) {
|
|
|
227
239
|
key: 'up',
|
|
228
240
|
description: React.createElement(FormattedMessage, messages.upDescription),
|
|
229
241
|
handler: function handler(event) {
|
|
242
|
+
if (_this.isTargetSlider(event)) {
|
|
243
|
+
return;
|
|
244
|
+
}
|
|
245
|
+
|
|
230
246
|
var gridColumnCount = _this.props.gridColumnCount;
|
|
231
247
|
var _this$state$focusedIn3 = _this.state.focusedIndex,
|
|
232
248
|
focusedIndex = _this$state$focusedIn3 === void 0 ? 0 : _this$state$focusedIn3;
|
|
@@ -561,6 +577,12 @@ function makeSelectable(BaseTable) {
|
|
|
561
577
|
}
|
|
562
578
|
});
|
|
563
579
|
|
|
580
|
+
_defineProperty(_assertThisInitialized(_this), "isTargetSlider", function (event) {
|
|
581
|
+
var _event$target;
|
|
582
|
+
|
|
583
|
+
return ((_event$target = event.target) === null || _event$target === void 0 ? void 0 : _event$target.role) === 'slider';
|
|
584
|
+
});
|
|
585
|
+
|
|
564
586
|
_this.anchorIndex = 0;
|
|
565
587
|
_this.searchString = '';
|
|
566
588
|
_this.searchTimeout = null; // we have to store the previously focused index because a focus event
|
|
@@ -213,6 +213,10 @@ function makeSelectable(BaseTable) {
|
|
|
213
213
|
key: 'right',
|
|
214
214
|
description: <FormattedMessage {...messages.downDescription} />,
|
|
215
215
|
handler: event => {
|
|
216
|
+
if (this.isTargetSlider(event)) {
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
219
|
+
|
|
216
220
|
const { data } = this.props;
|
|
217
221
|
const { focusedIndex } = this.state;
|
|
218
222
|
|
|
@@ -228,6 +232,10 @@ function makeSelectable(BaseTable) {
|
|
|
228
232
|
key: 'left',
|
|
229
233
|
description: <FormattedMessage {...messages.upDescription} />,
|
|
230
234
|
handler: event => {
|
|
235
|
+
if (this.isTargetSlider(event)) {
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
238
|
+
|
|
231
239
|
const { focusedIndex = 0 } = this.state;
|
|
232
240
|
|
|
233
241
|
event.preventDefault();
|
|
@@ -241,6 +249,10 @@ function makeSelectable(BaseTable) {
|
|
|
241
249
|
key: 'down',
|
|
242
250
|
description: <FormattedMessage {...messages.downDescription} />,
|
|
243
251
|
handler: event => {
|
|
252
|
+
if (this.isTargetSlider(event)) {
|
|
253
|
+
return;
|
|
254
|
+
}
|
|
255
|
+
|
|
244
256
|
const { data, gridColumnCount } = this.props;
|
|
245
257
|
const { focusedIndex } = this.state;
|
|
246
258
|
|
|
@@ -256,6 +268,10 @@ function makeSelectable(BaseTable) {
|
|
|
256
268
|
key: 'up',
|
|
257
269
|
description: <FormattedMessage {...messages.upDescription} />,
|
|
258
270
|
handler: event => {
|
|
271
|
+
if (this.isTargetSlider(event)) {
|
|
272
|
+
return;
|
|
273
|
+
}
|
|
274
|
+
|
|
259
275
|
const { gridColumnCount } = this.props;
|
|
260
276
|
const { focusedIndex = 0 } = this.state;
|
|
261
277
|
|
|
@@ -586,6 +602,8 @@ function makeSelectable(BaseTable) {
|
|
|
586
602
|
}
|
|
587
603
|
};
|
|
588
604
|
|
|
605
|
+
isTargetSlider = event => event.target?.role === 'slider';
|
|
606
|
+
|
|
589
607
|
render() {
|
|
590
608
|
const { className, data } = this.props;
|
|
591
609
|
const { focusedIndex } = this.state;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/table/makeSelectable.js"],"names":["PropTypes","React","Component","Set","ImmutablePropTypes","classNames","FormattedMessage","Hotkeys","HotkeyRecord","messages","shiftSelect","SEARCH_TIMER_DURATION","makeSelectable","BaseTable","originalDisplayName","displayName","name","props","focusedIndex","undefined","selectedItems","newFocusedIndex","onSelect","previousIndex","state","setState","isSet","toJS","hotkeyType","key","description","shiftXDescription","handler","selectToggle","type","selectAllDescription","event","data","preventDefault","deselectAllDescription","downDescription","Math","min","length","upDescription","max","shiftDownDescription","handleShiftKeyDown","shiftUpDescription","gridColumnCount","handleShiftKeyDownForGrid","enableHotkeys","isGridView","hotkeys","viewSpecificHotKeyConfigs","getGridViewHotKeyConfigs","getListViewHotKeyConfigs","getSharedHotkeyConfigs","loadedData","rowIndex","getProcessedProps","has","delete","add","anchorIndex","selectedRows","reduce","rows","item","i","push","newSelectedRows","newSelectedItems","map","size","index","metaKey","ctrlKey","shiftKey","selectRange","selectOne","blurTimerID","setTimeout","clearFocus","clearTimeout","boundary","focusedIndexData","newFocusedIndexData","union","selectedItemIndecies","sourceIndex","targetIndex","dataSize","isSourceSelected","isTargetSelected","selectedItemIndices","isContiguousSelection","newSelectedItemIndices","searchStrings","target","hasAttribute","nodeName","which","searchTimeout","searchString","findIndex","string","trim","toLowerCase","indexOf","nativeEvent","document","addEventListener","handleKeyboardSearch","prevProps","prevState","onFocus","removeEventListener","className","focusedItem","getHotkeyConfigs","handleCheckboxClick","handleRowClick","handleRowFocus","handleTableBlur","handleTableFocus","array","isRequired","number","bool","func","oneOfType","set"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAOA,SAAP,MAAsB,YAAtB;AACA,OAAOC,KAAP,IAAgBC,SAAhB,QAAiC,OAAjC;AACA,SAASC,GAAT,QAAoB,WAApB;AACA,OAAOC,kBAAP,MAA+B,2BAA/B;AACA,OAAOC,UAAP,MAAuB,YAAvB;AACA,SAASC,gBAAT,QAAiC,YAAjC;AAEA,SAASC,OAAT,EAAkBC,YAAlB,QAAsC,YAAtC;AACA,OAAOC,QAAP,MAAqB,YAArB;AACA,OAAOC,WAAP,MAAwB,eAAxB;AAEA,IAAMC,qBAAqB,GAAG,IAA9B;;AAEA,SAASC,cAAT,CAAwBC,SAAxB,EAAmC;AAAA;;AAC/B,MAAMC,mBAAmB,GAAGD,SAAS,CAACE,WAAV,IAAyBF,SAAS,CAACG,IAAnC,IAA2C,OAAvE;AAEA;AAAA;AAAA;AAAA;;AAoCI,6BAAYC,KAAZ,EAAmB;AAAA;;AAAA;;AACf,2FAAMA,KAAN;;AADe,8DAgBX;AACJC,QAAAA,YAAY,EAAEC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MA1G,IAAAA,aAAa,EAAEpB,SAAS,CAACmI,SAAV,CAAoB,CAACnI,SAAS,CAAC8H,KAAX,EAAkB1H,kBAAkB,CAACgI,GAArC,CAApB,CArBA;;AAsBf;AACA1E,IAAAA,UAAU,EAAE1D,SAAS,CAAC8H,KAvBP;AAwBf3E,IAAAA,aAAa,EAAEnD,SAAS,CAACiI,IAxBV;;AAyBf;AACArG,IAAAA,UAAU,EAAE5B,SAAS,CAAC0G;AA1BP,GAHvB,2CAgC0B;AAClBtF,IAAAA,aAAa,EAAE,IAAIjB,GAAJ;AADG,GAhC1B;AAklBH;;AAED,eAAeS,cAAf","sourcesContent":["import PropTypes from 'prop-types';\nimport React, { Component } from 'react';\nimport { Set } from 'immutable';\nimport ImmutablePropTypes from 'react-immutable-proptypes';\nimport classNames from 'classnames';\nimport { FormattedMessage } from 'react-intl';\n\nimport { Hotkeys, HotkeyRecord } from '../hotkeys';\nimport messages from './messages';\nimport shiftSelect from './shiftSelect';\n\nconst SEARCH_TIMER_DURATION = 1000;\n\nfunction makeSelectable(BaseTable) {\n const originalDisplayName = BaseTable.displayName || BaseTable.name || 'Table';\n\n return class SelectableTable extends Component {\n static displayName = `Selectable(${originalDisplayName})`;\n\n static propTypes = {\n className: PropTypes.string,\n /** Array of unique IDs of the items in the table. Each item should be a string or number, in the order they appear in the table. */\n data: PropTypes.array.isRequired,\n gridColumnCount: PropTypes.number,\n isGridView: PropTypes.bool,\n /** Called when focus changes. `(focusedIndex: number) => void` */\n onFocus: PropTypes.func,\n /** Called when selection changes. `(selectedItems: Array<string> | Array<number> | Set<string> | Set<number>) => void` */\n onSelect: PropTypes.func.isRequired,\n /**\n * Array of strings for keyboard search corresponding to the data prop. If not provided, keyboard search won't work.\n * Example: data = ['f_123', 'f_456'], and corresponding searchStrings = ['file.png', 'another file.pdf']\n */\n searchStrings: PropTypes.array,\n /**\n * Array of IDs that are currently selected, in any order.\n * If you pass a native JS array, then your onSelect function will be called with a native JS array;\n * likewise, if you pass an ImmutableJS Set, then your onSelect function will be called\n * with an ImmutableJS Set.\n */\n selectedItems: PropTypes.oneOfType([PropTypes.array, ImmutablePropTypes.set]),\n /** Array of unique IDs of the items in the table that are loaded and accessible. If not provided, this will default to all data */\n loadedData: PropTypes.array,\n enableHotkeys: PropTypes.bool,\n /** Translated type for hotkeys. If not provided, then the hotkeys will not appear in the help modal. */\n hotkeyType: PropTypes.string,\n };\n\n static defaultProps = {\n selectedItems: new Set(),\n };\n\n constructor(props) {\n super(props);\n\n this.anchorIndex = 0;\n\n this.searchString = '';\n this.searchTimeout = null;\n\n // we have to store the previously focused index because a focus event\n // will be fired before the click event; thus, in the click handler,\n // the focusedItem will already be the new item\n this.previousIndex = 0;\n\n this.blurTimerID = null;\n }\n\n state = {\n focusedIndex: undefined,\n };\n\n componentDidMount() {\n document.addEventListener('keypress', this.handleKeyboardSearch);\n }\n\n componentDidUpdate(prevProps, prevState) {\n if (prevState.focusedIndex !== this.state.focusedIndex && this.props.onFocus) {\n this.props.onFocus(this.state.focusedIndex);\n }\n }\n\n componentWillUnmount() {\n document.removeEventListener('keypress', this.handleKeyboardSearch);\n clearTimeout(this.blurTimerID);\n }\n\n onSelect = (selectedItems, newFocusedIndex) => {\n const { onSelect } = this.props;\n\n this.previousIndex = this.state.focusedIndex || 0;\n\n this.setState({\n focusedIndex: newFocusedIndex,\n });\n\n if (onSelect) {\n // If selectedItems were given as an Immutable Set, they should also be returned as one,\n // and vice versa if they were given as a native JS array\n onSelect(Set.isSet(this.props.selectedItems) ? selectedItems : selectedItems.toJS());\n }\n };\n\n getSharedHotkeyConfigs = () => {\n const { hotkeyType } = this.props;\n return [\n new HotkeyRecord({\n key: 'shift+x',\n description: <FormattedMessage {...messages.shiftXDescription} />,\n handler: () => {\n const { focusedIndex } = this.state;\n\n if (focusedIndex === undefined) {\n return;\n }\n\n this.selectToggle(focusedIndex);\n },\n type: hotkeyType,\n }),\n new HotkeyRecord({\n key: ['meta+a', 'ctrl+a'],\n description: <FormattedMessage {...messages.selectAllDescription} />,\n handler: event => {\n const { data } = this.props;\n\n event.preventDefault();\n\n this.onSelect(new Set(data), this.state.focusedIndex);\n },\n type: hotkeyType,\n }),\n new HotkeyRecord({\n key: 'esc',\n description: <FormattedMessage {...messages.deselectAllDescription} />,\n handler: () => {\n this.onSelect(new Set(), this.state.focusedIndex);\n },\n type: hotkeyType,\n }),\n ];\n };\n\n getListViewHotKeyConfigs = () => {\n const { hotkeyType } = this.props;\n return [\n new HotkeyRecord({\n key: 'down',\n description: <FormattedMessage {...messages.downDescription} />,\n handler: event => {\n const { data } = this.props;\n const { focusedIndex } = this.state;\n\n event.preventDefault();\n\n const newFocusedIndex =\n focusedIndex !== undefined ? Math.min(focusedIndex + 1, data.length - 1) : 0;\n this.setState({ focusedIndex: newFocusedIndex });\n },\n type: hotkeyType,\n }),\n new HotkeyRecord({\n key: 'up',\n description: <FormattedMessage {...messages.upDescription} />,\n handler: event => {\n const { focusedIndex = 0 } = this.state;\n\n event.preventDefault();\n\n const newFocusedIndex = Math.max(focusedIndex - 1, 0);\n this.setState({ focusedIndex: newFocusedIndex });\n },\n type: hotkeyType,\n }),\n new HotkeyRecord({\n key: 'shift+down',\n description: <FormattedMessage {...messages.shiftDownDescription} />,\n handler: () => {\n const { data } = this.props;\n const { focusedIndex } = this.state;\n\n if (focusedIndex === undefined) {\n return;\n }\n\n const newFocusedIndex = Math.min(focusedIndex + 1, data.length - 1);\n this.handleShiftKeyDown(newFocusedIndex, data.length - 1);\n },\n type: hotkeyType,\n }),\n new HotkeyRecord({\n key: 'shift+up',\n description: <FormattedMessage {...messages.shiftUpDescription} />,\n handler: () => {\n const { focusedIndex } = this.state;\n\n if (focusedIndex === undefined) {\n return;\n }\n\n const newFocusedIndex = Math.max(focusedIndex - 1, 0);\n this.handleShiftKeyDown(newFocusedIndex, 0);\n },\n type: hotkeyType,\n }),\n ];\n };\n\n getGridViewHotKeyConfigs = () => {\n const { hotkeyType } = this.props;\n return [\n new HotkeyRecord({\n key: 'right',\n description: <FormattedMessage {...messages.downDescription} />,\n handler: event => {\n const { data } = this.props;\n const { focusedIndex } = this.state;\n\n event.preventDefault();\n\n const newFocusedIndex =\n focusedIndex !== undefined ? Math.min(focusedIndex + 1, data.length - 1) : 0;\n this.setState({ focusedIndex: newFocusedIndex });\n },\n type: hotkeyType,\n }),\n new HotkeyRecord({\n key: 'left',\n description: <FormattedMessage {...messages.upDescription} />,\n handler: event => {\n const { focusedIndex = 0 } = this.state;\n\n event.preventDefault();\n\n const newFocusedIndex = Math.max(focusedIndex - 1, 0);\n this.setState({ focusedIndex: newFocusedIndex });\n },\n type: hotkeyType,\n }),\n new HotkeyRecord({\n key: 'down',\n description: <FormattedMessage {...messages.downDescription} />,\n handler: event => {\n const { data, gridColumnCount } = this.props;\n const { focusedIndex } = this.state;\n\n event.preventDefault();\n\n const newFocusedIndex =\n focusedIndex !== undefined ? Math.min(focusedIndex + gridColumnCount, data.length - 1) : 0;\n this.setState({ focusedIndex: newFocusedIndex });\n },\n type: hotkeyType,\n }),\n new HotkeyRecord({\n key: 'up',\n description: <FormattedMessage {...messages.upDescription} />,\n handler: event => {\n const { gridColumnCount } = this.props;\n const { focusedIndex = 0 } = this.state;\n\n event.preventDefault();\n\n const newFocusedIndex = Math.max(focusedIndex - gridColumnCount, 0);\n this.setState({ focusedIndex: newFocusedIndex });\n },\n type: hotkeyType,\n }),\n new HotkeyRecord({\n key: 'shift+right',\n description: <FormattedMessage {...messages.shiftDownDescription} />,\n handler: () => {\n const { data } = this.props;\n const { focusedIndex } = this.state;\n\n if (focusedIndex === undefined) {\n return;\n }\n\n const newFocusedIndex = Math.min(focusedIndex + 1, data.length - 1);\n this.handleShiftKeyDownForGrid(newFocusedIndex, data.length - 1);\n },\n type: hotkeyType,\n }),\n new HotkeyRecord({\n key: 'shift+left',\n description: <FormattedMessage {...messages.shiftUpDescription} />,\n handler: () => {\n const { focusedIndex } = this.state;\n\n if (focusedIndex === undefined) {\n return;\n }\n\n const newFocusedIndex = Math.max(focusedIndex - 1, 0);\n this.handleShiftKeyDownForGrid(newFocusedIndex, 0);\n },\n type: hotkeyType,\n }),\n new HotkeyRecord({\n key: 'shift+down',\n description: <FormattedMessage {...messages.shiftDownDescription} />,\n handler: () => {\n const { data, gridColumnCount } = this.props;\n const { focusedIndex } = this.state;\n\n if (focusedIndex === undefined) {\n return;\n }\n\n const newFocusedIndex = Math.min(focusedIndex + gridColumnCount, data.length - 1);\n this.handleShiftKeyDownForGrid(newFocusedIndex, data.length - 1);\n },\n type: hotkeyType,\n }),\n new HotkeyRecord({\n key: 'shift+up',\n description: <FormattedMessage {...messages.shiftUpDescription} />,\n handler: () => {\n const { gridColumnCount } = this.props;\n const { focusedIndex } = this.state;\n\n if (focusedIndex === undefined) {\n return;\n }\n\n const newFocusedIndex = Math.max(focusedIndex - gridColumnCount, 0);\n this.handleShiftKeyDownForGrid(newFocusedIndex, 0);\n },\n type: hotkeyType,\n }),\n ];\n };\n\n getHotkeyConfigs = () => {\n const { enableHotkeys, isGridView, gridColumnCount } = this.props;\n\n if (!enableHotkeys && !this.hotkeys) {\n this.hotkeys = [];\n }\n\n if (!this.hotkeys) {\n const viewSpecificHotKeyConfigs =\n isGridView && gridColumnCount !== undefined\n ? this.getGridViewHotKeyConfigs()\n : this.getListViewHotKeyConfigs();\n\n this.hotkeys = [...this.getSharedHotkeyConfigs(), ...viewSpecificHotKeyConfigs];\n }\n\n return this.hotkeys;\n };\n\n getProcessedProps = () => {\n const { data, loadedData, selectedItems } = this.props;\n return {\n ...this.props,\n loadedData: loadedData ? Set(loadedData) : Set(data),\n selectedItems: Set.isSet(selectedItems) ? selectedItems : new Set(selectedItems),\n };\n };\n\n hotkeys = null;\n\n selectToggle = rowIndex => {\n const { data, selectedItems } = this.getProcessedProps();\n\n if (selectedItems.has(data[rowIndex])) {\n this.onSelect(selectedItems.delete(data[rowIndex]), rowIndex);\n } else {\n this.onSelect(selectedItems.add(data[rowIndex]), rowIndex);\n }\n\n this.anchorIndex = rowIndex;\n };\n\n selectRange = rowIndex => {\n const { data, selectedItems } = this.getProcessedProps();\n\n // Don't change selection if we're shift-clicking the same row\n if (rowIndex === this.previousIndex) {\n return;\n }\n\n // Converts set of items to set of indices to do some slicing magic\n const selectedRows = new Set(\n data.reduce((rows, item, i) => {\n if (selectedItems.has(item)) {\n rows.push(i);\n }\n return rows;\n }, []),\n );\n\n const newSelectedRows = shiftSelect(selectedRows, this.previousIndex, rowIndex, this.anchorIndex);\n\n // Converts set back to set of items\n const newSelectedItems = newSelectedRows.map(i => data[i]);\n\n this.onSelect(newSelectedItems, rowIndex);\n };\n\n selectOne = rowIndex => {\n const { data, selectedItems } = this.getProcessedProps();\n\n // Don't change selection if we're clicking on a row that we've already selected\n // This allows us to use the native onDoubleClick handler because we're referencing the\n // same DOM node on double-click.\n if (selectedItems.has(data[rowIndex]) && selectedItems.size === 1) {\n return;\n }\n\n this.onSelect(new Set([data[rowIndex]]), rowIndex);\n this.anchorIndex = rowIndex;\n };\n\n clearFocus = () => {\n this.setState({\n focusedIndex: undefined,\n });\n };\n\n handleRowClick = (event, index) => {\n if (event.metaKey || event.ctrlKey) {\n this.selectToggle(index);\n } else if (event.shiftKey) {\n this.selectRange(index);\n } else {\n this.selectOne(index);\n }\n };\n\n handleRowFocus = (event, index) => {\n const { selectedItems } = this.getProcessedProps();\n this.onSelect(selectedItems, index);\n };\n\n handleTableBlur = () => {\n const { focusedIndex } = this.state;\n if (focusedIndex !== undefined) {\n // table may get focus back right away in the same tick, in which case we shouldn't clear focus\n this.blurTimerID = setTimeout(this.clearFocus);\n }\n };\n\n handleTableFocus = () => {\n clearTimeout(this.blurTimerID);\n };\n\n handleShiftKeyDown = (newFocusedIndex, boundary) => {\n const { data, selectedItems } = this.getProcessedProps();\n const { focusedIndex } = this.state;\n\n const focusedIndexData = data[focusedIndex];\n const newFocusedIndexData = data[newFocusedIndex];\n\n // if we're at a boundary of the table and the row is selected, no-op\n if (focusedIndex === boundary && selectedItems.has(focusedIndexData)) {\n return;\n }\n\n // if both the target and source are not selected, select them both\n if (!selectedItems.has(focusedIndexData) && !selectedItems.has(newFocusedIndexData)) {\n this.onSelect(selectedItems.union([focusedIndexData, newFocusedIndexData]), newFocusedIndex);\n return;\n }\n\n // if target is not selected, select it\n if (!selectedItems.has(newFocusedIndexData)) {\n this.onSelect(selectedItems.add(newFocusedIndexData), newFocusedIndex);\n return;\n }\n\n // if both source and target are selected, deselect source\n if (selectedItems.has(newFocusedIndexData) && selectedItems.has(focusedIndexData)) {\n this.onSelect(selectedItems.delete(focusedIndexData), newFocusedIndex);\n return;\n }\n\n // if target is selected and source is not, select source\n this.onSelect(selectedItems.add(focusedIndexData), newFocusedIndex);\n };\n\n isContiguousSelection = (selectedItemIndecies, sourceIndex, targetIndex) => {\n if (sourceIndex < targetIndex && selectedItemIndecies.has(sourceIndex - 1)) {\n return true;\n }\n if (targetIndex < sourceIndex && selectedItemIndecies.has(sourceIndex + 1)) {\n return true;\n }\n return false;\n };\n\n handleShiftKeyDownForGrid = newFocusedIndex => {\n const { data, loadedData, selectedItems } = this.getProcessedProps();\n const { focusedIndex } = this.state;\n\n const dataSize = data.length;\n const targetIndex = newFocusedIndex < 0 ? 0 : Math.min(newFocusedIndex, dataSize - 1);\n const isSourceSelected = selectedItems.has(data[focusedIndex]);\n const isTargetSelected = selectedItems.has(data[targetIndex]);\n\n // if data is not loaded, we don't want it to be able to be selected\n if (!loadedData.has(data[targetIndex])) {\n return;\n }\n\n const selectedItemIndices = new Set(\n data.reduce((rows, item, i) => {\n if (selectedItems.has(item)) {\n rows.push(i);\n }\n return rows;\n }, []),\n );\n\n // reset the anchor on a new selection block\n if (\n !isSourceSelected &&\n !isTargetSelected &&\n // if we are starting a new mass selection adjacent selected block, we want to connect them\n !this.isContiguousSelection(selectedItemIndices, focusedIndex, targetIndex)\n ) {\n this.anchorIndex = focusedIndex;\n }\n\n const newSelectedItemIndices = shiftSelect(\n selectedItemIndices,\n focusedIndex,\n targetIndex,\n this.anchorIndex,\n );\n\n const newSelectedItems = newSelectedItemIndices.map(i => data[i]);\n\n this.onSelect(newSelectedItems, targetIndex);\n };\n\n handleKeyboardSearch = event => {\n const { searchStrings } = this.props;\n\n if (!searchStrings) {\n return;\n }\n\n if (\n event.target.hasAttribute('contenteditable') ||\n event.target.nodeName === 'INPUT' ||\n event.target.nodeName === 'TEXTAREA'\n ) {\n return;\n }\n\n // character keys have a value for event.which\n if (event.which === 0) {\n return;\n }\n\n if (this.searchTimeout) {\n clearTimeout(this.searchTimeout);\n }\n\n this.searchString += event.key;\n this.searchTimeout = setTimeout(() => {\n this.searchString = '';\n }, SEARCH_TIMER_DURATION);\n\n const index = searchStrings.findIndex(\n string =>\n string\n .trim()\n .toLowerCase()\n .indexOf(this.searchString) === 0,\n );\n\n if (index !== -1) {\n this.setState({ focusedIndex: index });\n }\n };\n\n handleCheckboxClick = (event, index) => {\n if (event.nativeEvent.shiftKey) {\n this.selectRange(index);\n } else {\n this.selectToggle(index);\n }\n };\n\n render() {\n const { className, data } = this.props;\n const { focusedIndex } = this.state;\n const focusedItem = data[focusedIndex];\n\n return (\n <Hotkeys configs={this.getHotkeyConfigs()}>\n <BaseTable\n {...this.props}\n className={classNames(className, 'is-selectable')}\n focusedIndex={focusedIndex}\n focusedItem={focusedItem}\n onCheckboxClick={this.handleCheckboxClick}\n onRowClick={this.handleRowClick}\n onRowFocus={this.handleRowFocus}\n onTableBlur={this.handleTableBlur}\n onTableFocus={this.handleTableFocus}\n />\n </Hotkeys>\n );\n }\n };\n}\n\nexport default makeSelectable;\n"],"file":"makeSelectable.js"}
|
|
1
|
+
{"version":3,"sources":["../../../src/components/table/makeSelectable.js"],"names":["PropTypes","React","Component","Set","ImmutablePropTypes","classNames","FormattedMessage","Hotkeys","HotkeyRecord","messages","shiftSelect","SEARCH_TIMER_DURATION","makeSelectable","BaseTable","originalDisplayName","displayName","name","props","focusedIndex","undefined","selectedItems","newFocusedIndex","onSelect","previousIndex","state","setState","isSet","toJS","hotkeyType","key","description","shiftXDescription","handler","selectToggle","type","selectAllDescription","event","data","preventDefault","deselectAllDescription","downDescription","Math","min","length","upDescription","max","shiftDownDescription","handleShiftKeyDown","shiftUpDescription","isTargetSlider","gridColumnCount","handleShiftKeyDownForGrid","enableHotkeys","isGridView","hotkeys","viewSpecificHotKeyConfigs","getGridViewHotKeyConfigs","getListViewHotKeyConfigs","getSharedHotkeyConfigs","loadedData","rowIndex","getProcessedProps","has","delete","add","anchorIndex","selectedRows","reduce","rows","item","i","push","newSelectedRows","newSelectedItems","map","size","index","metaKey","ctrlKey","shiftKey","selectRange","selectOne","blurTimerID","setTimeout","clearFocus","clearTimeout","boundary","focusedIndexData","newFocusedIndexData","union","selectedItemIndecies","sourceIndex","targetIndex","dataSize","isSourceSelected","isTargetSelected","selectedItemIndices","isContiguousSelection","newSelectedItemIndices","searchStrings","target","hasAttribute","nodeName","which","searchTimeout","searchString","findIndex","string","trim","toLowerCase","indexOf","nativeEvent","role","document","addEventListener","handleKeyboardSearch","prevProps","prevState","onFocus","removeEventListener","className","focusedItem","getHotkeyConfigs","handleCheckboxClick","handleRowClick","handleRowFocus","handleTableBlur","handleTableFocus","array","isRequired","number","bool","func","oneOfType","set"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAOA,SAAP,MAAsB,YAAtB;AACA,OAAOC,KAAP,IAAgBC,SAAhB,QAAiC,OAAjC;AACA,SAASC,GAAT,QAAoB,WAApB;AACA,OAAOC,kBAAP,MAA+B,2BAA/B;AACA,OAAOC,UAAP,MAAuB,YAAvB;AACA,SAASC,gBAAT,QAAiC,YAAjC;AAEA,SAASC,OAAT,EAAkBC,YAAlB,QAAsC,YAAtC;AACA,OAAOC,QAAP,MAAqB,YAArB;AACA,OAAOC,WAAP,MAAwB,eAAxB;AAEA,IAAMC,qBAAqB,GAAG,IAA9B;;AAEA,SAASC,cAAT,CAAwBC,SAAxB,EAAmC;AAAA;;AAC/B,MAAMC,mBAAmB,G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A,UAAU,EAAE,KAAKC,cANrB;AAOI,UAAA,UAAU,EAAE,KAAKC,cAPrB;AAQI,UAAA,WAAW,EAAE,KAAKC,eARtB;AASI,UAAA,YAAY,EAAE,KAAKC;AATvB,WADJ,CADJ;AAeH;AAlmBL;;AAAA;AAAA,IAAqC7H,SAArC,+DACuCY,mBADvC,8CAGuB;AACf0G,IAAAA,SAAS,EAAExH,SAAS,CAAC2G,MADN;;AAEf;AACAtE,IAAAA,IAAI,EAAErC,SAAS,CAACgI,KAAV,CAAgBC,UAHP;AAIf/E,IAAAA,eAAe,EAAElD,SAAS,CAACkI,MAJZ;AAKf7E,IAAAA,UAAU,EAAErD,SAAS,CAACmI,IALP;;AAMf;AACAb,IAAAA,OAAO,EAAEtH,SAAS,CAACoI,IAPJ;;AAQf;AACA9G,IAAAA,QAAQ,EAAEtB,SAAS,CAACoI,IAAV,CAAeH,UATV;;AAUf;;;;AAIA9B,IAAAA,aAAa,EAAEnG,SAAS,CAACgI,KAdV;;AAef;;;;;;AAMA5G,IAAAA,aAAa,EAAEpB,SAAS,CAACqI,SAAV,CAAoB,CAACrI,SAAS,CAACgI,KAAX,EAAkB5H,kBAAkB,CAACkI,GAArC,CAApB,CArBA;;AAsBf;AACA3E,IAAAA,UAAU,EAAE3D,SAAS,CAACgI,KAvBP;AAwBf5E,IAAAA,aAAa,EAAEpD,SAAS,CAACmI,IAxBV;;AAyBf;AACAvG,IAAAA,UAAU,EAAE5B,SAAS,CAAC2G;AA1BP,GAHvB,2CAgC0B;AAClBvF,IAAAA,aAAa,EAAE,IAAIjB,GAAJ;AADG,GAhC1B;AAomBH;;AAED,eAAeS,cAAf","sourcesContent":["import PropTypes from 'prop-types';\nimport React, { Component } from 'react';\nimport { Set } from 'immutable';\nimport ImmutablePropTypes from 'react-immutable-proptypes';\nimport classNames from 'classnames';\nimport { FormattedMessage } from 'react-intl';\n\nimport { Hotkeys, HotkeyRecord } from '../hotkeys';\nimport messages from './messages';\nimport shiftSelect from './shiftSelect';\n\nconst SEARCH_TIMER_DURATION = 1000;\n\nfunction makeSelectable(BaseTable) {\n const originalDisplayName = BaseTable.displayName || BaseTable.name || 'Table';\n\n return class SelectableTable extends Component {\n static displayName = `Selectable(${originalDisplayName})`;\n\n static propTypes = {\n className: PropTypes.string,\n /** Array of unique IDs of the items in the table. Each item should be a string or number, in the order they appear in the table. */\n data: PropTypes.array.isRequired,\n gridColumnCount: PropTypes.number,\n isGridView: PropTypes.bool,\n /** Called when focus changes. `(focusedIndex: number) => void` */\n onFocus: PropTypes.func,\n /** Called when selection changes. `(selectedItems: Array<string> | Array<number> | Set<string> | Set<number>) => void` */\n onSelect: PropTypes.func.isRequired,\n /**\n * Array of strings for keyboard search corresponding to the data prop. If not provided, keyboard search won't work.\n * Example: data = ['f_123', 'f_456'], and corresponding searchStrings = ['file.png', 'another file.pdf']\n */\n searchStrings: PropTypes.array,\n /**\n * Array of IDs that are currently selected, in any order.\n * If you pass a native JS array, then your onSelect function will be called with a native JS array;\n * likewise, if you pass an ImmutableJS Set, then your onSelect function will be called\n * with an ImmutableJS Set.\n */\n selectedItems: PropTypes.oneOfType([PropTypes.array, ImmutablePropTypes.set]),\n /** Array of unique IDs of the items in the table that are loaded and accessible. If not provided, this will default to all data */\n loadedData: PropTypes.array,\n enableHotkeys: PropTypes.bool,\n /** Translated type for hotkeys. If not provided, then the hotkeys will not appear in the help modal. */\n hotkeyType: PropTypes.string,\n };\n\n static defaultProps = {\n selectedItems: new Set(),\n };\n\n constructor(props) {\n super(props);\n\n this.anchorIndex = 0;\n\n this.searchString = '';\n this.searchTimeout = null;\n\n // we have to store the previously focused index because a focus event\n // will be fired before the click event; thus, in the click handler,\n // the focusedItem will already be the new item\n this.previousIndex = 0;\n\n this.blurTimerID = null;\n }\n\n state = {\n focusedIndex: undefined,\n };\n\n componentDidMount() {\n document.addEventListener('keypress', this.handleKeyboardSearch);\n }\n\n componentDidUpdate(prevProps, prevState) {\n if (prevState.focusedIndex !== this.state.focusedIndex && this.props.onFocus) {\n this.props.onFocus(this.state.focusedIndex);\n }\n }\n\n componentWillUnmount() {\n document.removeEventListener('keypress', this.handleKeyboardSearch);\n clearTimeout(this.blurTimerID);\n }\n\n onSelect = (selectedItems, newFocusedIndex) => {\n const { onSelect } = this.props;\n\n this.previousIndex = this.state.focusedIndex || 0;\n\n this.setState({\n focusedIndex: newFocusedIndex,\n });\n\n if (onSelect) {\n // If selectedItems were given as an Immutable Set, they should also be returned as one,\n // and vice versa if they were given as a native JS array\n onSelect(Set.isSet(this.props.selectedItems) ? selectedItems : selectedItems.toJS());\n }\n };\n\n getSharedHotkeyConfigs = () => {\n const { hotkeyType } = this.props;\n return [\n new HotkeyRecord({\n key: 'shift+x',\n description: <FormattedMessage {...messages.shiftXDescription} />,\n handler: () => {\n const { focusedIndex } = this.state;\n\n if (focusedIndex === undefined) {\n return;\n }\n\n this.selectToggle(focusedIndex);\n },\n type: hotkeyType,\n }),\n new HotkeyRecord({\n key: ['meta+a', 'ctrl+a'],\n description: <FormattedMessage {...messages.selectAllDescription} />,\n handler: event => {\n const { data } = this.props;\n\n event.preventDefault();\n\n this.onSelect(new Set(data), this.state.focusedIndex);\n },\n type: hotkeyType,\n }),\n new HotkeyRecord({\n key: 'esc',\n description: <FormattedMessage {...messages.deselectAllDescription} />,\n handler: () => {\n this.onSelect(new Set(), this.state.focusedIndex);\n },\n type: hotkeyType,\n }),\n ];\n };\n\n getListViewHotKeyConfigs = () => {\n const { hotkeyType } = this.props;\n return [\n new HotkeyRecord({\n key: 'down',\n description: <FormattedMessage {...messages.downDescription} />,\n handler: event => {\n const { data } = this.props;\n const { focusedIndex } = this.state;\n\n event.preventDefault();\n\n const newFocusedIndex =\n focusedIndex !== undefined ? Math.min(focusedIndex + 1, data.length - 1) : 0;\n this.setState({ focusedIndex: newFocusedIndex });\n },\n type: hotkeyType,\n }),\n new HotkeyRecord({\n key: 'up',\n description: <FormattedMessage {...messages.upDescription} />,\n handler: event => {\n const { focusedIndex = 0 } = this.state;\n\n event.preventDefault();\n\n const newFocusedIndex = Math.max(focusedIndex - 1, 0);\n this.setState({ focusedIndex: newFocusedIndex });\n },\n type: hotkeyType,\n }),\n new HotkeyRecord({\n key: 'shift+down',\n description: <FormattedMessage {...messages.shiftDownDescription} />,\n handler: () => {\n const { data } = this.props;\n const { focusedIndex } = this.state;\n\n if (focusedIndex === undefined) {\n return;\n }\n\n const newFocusedIndex = Math.min(focusedIndex + 1, data.length - 1);\n this.handleShiftKeyDown(newFocusedIndex, data.length - 1);\n },\n type: hotkeyType,\n }),\n new HotkeyRecord({\n key: 'shift+up',\n description: <FormattedMessage {...messages.shiftUpDescription} />,\n handler: () => {\n const { focusedIndex } = this.state;\n\n if (focusedIndex === undefined) {\n return;\n }\n\n const newFocusedIndex = Math.max(focusedIndex - 1, 0);\n this.handleShiftKeyDown(newFocusedIndex, 0);\n },\n type: hotkeyType,\n }),\n ];\n };\n\n getGridViewHotKeyConfigs = () => {\n const { hotkeyType } = this.props;\n return [\n new HotkeyRecord({\n key: 'right',\n description: <FormattedMessage {...messages.downDescription} />,\n handler: event => {\n if (this.isTargetSlider(event)) {\n return;\n }\n\n const { data } = this.props;\n const { focusedIndex } = this.state;\n\n event.preventDefault();\n\n const newFocusedIndex =\n focusedIndex !== undefined ? Math.min(focusedIndex + 1, data.length - 1) : 0;\n this.setState({ focusedIndex: newFocusedIndex });\n },\n type: hotkeyType,\n }),\n new HotkeyRecord({\n key: 'left',\n description: <FormattedMessage {...messages.upDescription} />,\n handler: event => {\n if (this.isTargetSlider(event)) {\n return;\n }\n\n const { focusedIndex = 0 } = this.state;\n\n event.preventDefault();\n\n const newFocusedIndex = Math.max(focusedIndex - 1, 0);\n this.setState({ focusedIndex: newFocusedIndex });\n },\n type: hotkeyType,\n }),\n new HotkeyRecord({\n key: 'down',\n description: <FormattedMessage {...messages.downDescription} />,\n handler: event => {\n if (this.isTargetSlider(event)) {\n return;\n }\n\n const { data, gridColumnCount } = this.props;\n const { focusedIndex } = this.state;\n\n event.preventDefault();\n\n const newFocusedIndex =\n focusedIndex !== undefined ? Math.min(focusedIndex + gridColumnCount, data.length - 1) : 0;\n this.setState({ focusedIndex: newFocusedIndex });\n },\n type: hotkeyType,\n }),\n new HotkeyRecord({\n key: 'up',\n description: <FormattedMessage {...messages.upDescription} />,\n handler: event => {\n if (this.isTargetSlider(event)) {\n return;\n }\n\n const { gridColumnCount } = this.props;\n const { focusedIndex = 0 } = this.state;\n\n event.preventDefault();\n\n const newFocusedIndex = Math.max(focusedIndex - gridColumnCount, 0);\n this.setState({ focusedIndex: newFocusedIndex });\n },\n type: hotkeyType,\n }),\n new HotkeyRecord({\n key: 'shift+right',\n description: <FormattedMessage {...messages.shiftDownDescription} />,\n handler: () => {\n const { data } = this.props;\n const { focusedIndex } = this.state;\n\n if (focusedIndex === undefined) {\n return;\n }\n\n const newFocusedIndex = Math.min(focusedIndex + 1, data.length - 1);\n this.handleShiftKeyDownForGrid(newFocusedIndex, data.length - 1);\n },\n type: hotkeyType,\n }),\n new HotkeyRecord({\n key: 'shift+left',\n description: <FormattedMessage {...messages.shiftUpDescription} />,\n handler: () => {\n const { focusedIndex } = this.state;\n\n if (focusedIndex === undefined) {\n return;\n }\n\n const newFocusedIndex = Math.max(focusedIndex - 1, 0);\n this.handleShiftKeyDownForGrid(newFocusedIndex, 0);\n },\n type: hotkeyType,\n }),\n new HotkeyRecord({\n key: 'shift+down',\n description: <FormattedMessage {...messages.shiftDownDescription} />,\n handler: () => {\n const { data, gridColumnCount } = this.props;\n const { focusedIndex } = this.state;\n\n if (focusedIndex === undefined) {\n return;\n }\n\n const newFocusedIndex = Math.min(focusedIndex + gridColumnCount, data.length - 1);\n this.handleShiftKeyDownForGrid(newFocusedIndex, data.length - 1);\n },\n type: hotkeyType,\n }),\n new HotkeyRecord({\n key: 'shift+up',\n description: <FormattedMessage {...messages.shiftUpDescription} />,\n handler: () => {\n const { gridColumnCount } = this.props;\n const { focusedIndex } = this.state;\n\n if (focusedIndex === undefined) {\n return;\n }\n\n const newFocusedIndex = Math.max(focusedIndex - gridColumnCount, 0);\n this.handleShiftKeyDownForGrid(newFocusedIndex, 0);\n },\n type: hotkeyType,\n }),\n ];\n };\n\n getHotkeyConfigs = () => {\n const { enableHotkeys, isGridView, gridColumnCount } = this.props;\n\n if (!enableHotkeys && !this.hotkeys) {\n this.hotkeys = [];\n }\n\n if (!this.hotkeys) {\n const viewSpecificHotKeyConfigs =\n isGridView && gridColumnCount !== undefined\n ? this.getGridViewHotKeyConfigs()\n : this.getListViewHotKeyConfigs();\n\n this.hotkeys = [...this.getSharedHotkeyConfigs(), ...viewSpecificHotKeyConfigs];\n }\n\n return this.hotkeys;\n };\n\n getProcessedProps = () => {\n const { data, loadedData, selectedItems } = this.props;\n return {\n ...this.props,\n loadedData: loadedData ? Set(loadedData) : Set(data),\n selectedItems: Set.isSet(selectedItems) ? selectedItems : new Set(selectedItems),\n };\n };\n\n hotkeys = null;\n\n selectToggle = rowIndex => {\n const { data, selectedItems } = this.getProcessedProps();\n\n if (selectedItems.has(data[rowIndex])) {\n this.onSelect(selectedItems.delete(data[rowIndex]), rowIndex);\n } else {\n this.onSelect(selectedItems.add(data[rowIndex]), rowIndex);\n }\n\n this.anchorIndex = rowIndex;\n };\n\n selectRange = rowIndex => {\n const { data, selectedItems } = this.getProcessedProps();\n\n // Don't change selection if we're shift-clicking the same row\n if (rowIndex === this.previousIndex) {\n return;\n }\n\n // Converts set of items to set of indices to do some slicing magic\n const selectedRows = new Set(\n data.reduce((rows, item, i) => {\n if (selectedItems.has(item)) {\n rows.push(i);\n }\n return rows;\n }, []),\n );\n\n const newSelectedRows = shiftSelect(selectedRows, this.previousIndex, rowIndex, this.anchorIndex);\n\n // Converts set back to set of items\n const newSelectedItems = newSelectedRows.map(i => data[i]);\n\n this.onSelect(newSelectedItems, rowIndex);\n };\n\n selectOne = rowIndex => {\n const { data, selectedItems } = this.getProcessedProps();\n\n // Don't change selection if we're clicking on a row that we've already selected\n // This allows us to use the native onDoubleClick handler because we're referencing the\n // same DOM node on double-click.\n if (selectedItems.has(data[rowIndex]) && selectedItems.size === 1) {\n return;\n }\n\n this.onSelect(new Set([data[rowIndex]]), rowIndex);\n this.anchorIndex = rowIndex;\n };\n\n clearFocus = () => {\n this.setState({\n focusedIndex: undefined,\n });\n };\n\n handleRowClick = (event, index) => {\n if (event.metaKey || event.ctrlKey) {\n this.selectToggle(index);\n } else if (event.shiftKey) {\n this.selectRange(index);\n } else {\n this.selectOne(index);\n }\n };\n\n handleRowFocus = (event, index) => {\n const { selectedItems } = this.getProcessedProps();\n this.onSelect(selectedItems, index);\n };\n\n handleTableBlur = () => {\n const { focusedIndex } = this.state;\n if (focusedIndex !== undefined) {\n // table may get focus back right away in the same tick, in which case we shouldn't clear focus\n this.blurTimerID = setTimeout(this.clearFocus);\n }\n };\n\n handleTableFocus = () => {\n clearTimeout(this.blurTimerID);\n };\n\n handleShiftKeyDown = (newFocusedIndex, boundary) => {\n const { data, selectedItems } = this.getProcessedProps();\n const { focusedIndex } = this.state;\n\n const focusedIndexData = data[focusedIndex];\n const newFocusedIndexData = data[newFocusedIndex];\n\n // if we're at a boundary of the table and the row is selected, no-op\n if (focusedIndex === boundary && selectedItems.has(focusedIndexData)) {\n return;\n }\n\n // if both the target and source are not selected, select them both\n if (!selectedItems.has(focusedIndexData) && !selectedItems.has(newFocusedIndexData)) {\n this.onSelect(selectedItems.union([focusedIndexData, newFocusedIndexData]), newFocusedIndex);\n return;\n }\n\n // if target is not selected, select it\n if (!selectedItems.has(newFocusedIndexData)) {\n this.onSelect(selectedItems.add(newFocusedIndexData), newFocusedIndex);\n return;\n }\n\n // if both source and target are selected, deselect source\n if (selectedItems.has(newFocusedIndexData) && selectedItems.has(focusedIndexData)) {\n this.onSelect(selectedItems.delete(focusedIndexData), newFocusedIndex);\n return;\n }\n\n // if target is selected and source is not, select source\n this.onSelect(selectedItems.add(focusedIndexData), newFocusedIndex);\n };\n\n isContiguousSelection = (selectedItemIndecies, sourceIndex, targetIndex) => {\n if (sourceIndex < targetIndex && selectedItemIndecies.has(sourceIndex - 1)) {\n return true;\n }\n if (targetIndex < sourceIndex && selectedItemIndecies.has(sourceIndex + 1)) {\n return true;\n }\n return false;\n };\n\n handleShiftKeyDownForGrid = newFocusedIndex => {\n const { data, loadedData, selectedItems } = this.getProcessedProps();\n const { focusedIndex } = this.state;\n\n const dataSize = data.length;\n const targetIndex = newFocusedIndex < 0 ? 0 : Math.min(newFocusedIndex, dataSize - 1);\n const isSourceSelected = selectedItems.has(data[focusedIndex]);\n const isTargetSelected = selectedItems.has(data[targetIndex]);\n\n // if data is not loaded, we don't want it to be able to be selected\n if (!loadedData.has(data[targetIndex])) {\n return;\n }\n\n const selectedItemIndices = new Set(\n data.reduce((rows, item, i) => {\n if (selectedItems.has(item)) {\n rows.push(i);\n }\n return rows;\n }, []),\n );\n\n // reset the anchor on a new selection block\n if (\n !isSourceSelected &&\n !isTargetSelected &&\n // if we are starting a new mass selection adjacent selected block, we want to connect them\n !this.isContiguousSelection(selectedItemIndices, focusedIndex, targetIndex)\n ) {\n this.anchorIndex = focusedIndex;\n }\n\n const newSelectedItemIndices = shiftSelect(\n selectedItemIndices,\n focusedIndex,\n targetIndex,\n this.anchorIndex,\n );\n\n const newSelectedItems = newSelectedItemIndices.map(i => data[i]);\n\n this.onSelect(newSelectedItems, targetIndex);\n };\n\n handleKeyboardSearch = event => {\n const { searchStrings } = this.props;\n\n if (!searchStrings) {\n return;\n }\n\n if (\n event.target.hasAttribute('contenteditable') ||\n event.target.nodeName === 'INPUT' ||\n event.target.nodeName === 'TEXTAREA'\n ) {\n return;\n }\n\n // character keys have a value for event.which\n if (event.which === 0) {\n return;\n }\n\n if (this.searchTimeout) {\n clearTimeout(this.searchTimeout);\n }\n\n this.searchString += event.key;\n this.searchTimeout = setTimeout(() => {\n this.searchString = '';\n }, SEARCH_TIMER_DURATION);\n\n const index = searchStrings.findIndex(\n string =>\n string\n .trim()\n .toLowerCase()\n .indexOf(this.searchString) === 0,\n );\n\n if (index !== -1) {\n this.setState({ focusedIndex: index });\n }\n };\n\n handleCheckboxClick = (event, index) => {\n if (event.nativeEvent.shiftKey) {\n this.selectRange(index);\n } else {\n this.selectToggle(index);\n }\n };\n\n isTargetSlider = event => event.target?.role === 'slider';\n\n render() {\n const { className, data } = this.props;\n const { focusedIndex } = this.state;\n const focusedItem = data[focusedIndex];\n\n return (\n <Hotkeys configs={this.getHotkeyConfigs()}>\n <BaseTable\n {...this.props}\n className={classNames(className, 'is-selectable')}\n focusedIndex={focusedIndex}\n focusedItem={focusedItem}\n onCheckboxClick={this.handleCheckboxClick}\n onRowClick={this.handleRowClick}\n onRowFocus={this.handleRowFocus}\n onTableBlur={this.handleTableBlur}\n onTableFocus={this.handleTableFocus}\n />\n </Hotkeys>\n );\n }\n };\n}\n\nexport default makeSelectable;\n"],"file":"makeSelectable.js"}
|
package/package.json
CHANGED
|
@@ -836,6 +836,18 @@ describe('components/table/makeSelectable', () => {
|
|
|
836
836
|
shortcut.handler({ preventDefault: sandbox.stub() });
|
|
837
837
|
expect(wrapper.state('focusedIndex')).toEqual(0);
|
|
838
838
|
});
|
|
839
|
+
test('should not set focus to first row if target has role of slider', () => {
|
|
840
|
+
const wrapper = getWrapper({
|
|
841
|
+
gridColumnCount,
|
|
842
|
+
isGridView: true,
|
|
843
|
+
selectedItems: ['a'],
|
|
844
|
+
});
|
|
845
|
+
wrapper.setState({ focusedIndex: undefined });
|
|
846
|
+
const instance = wrapper.instance();
|
|
847
|
+
const shortcut = instance.getHotkeyConfigs().find(h => h.get('key') === hotKey);
|
|
848
|
+
shortcut.handler({ target: { role: 'slider' } });
|
|
849
|
+
expect(wrapper.state('focusedIndex')).toEqual(undefined);
|
|
850
|
+
});
|
|
839
851
|
test('should call event.preventDefault() and set focus to next item', () => {
|
|
840
852
|
const wrapper = getWrapper({
|
|
841
853
|
gridColumnCount,
|
|
@@ -863,6 +875,18 @@ describe('components/table/makeSelectable', () => {
|
|
|
863
875
|
});
|
|
864
876
|
describe('left', () => {
|
|
865
877
|
const hotKey = 'left';
|
|
878
|
+
test('should not set focus to first row if target has role of slider', () => {
|
|
879
|
+
const wrapper = getWrapper({
|
|
880
|
+
gridColumnCount,
|
|
881
|
+
isGridView: true,
|
|
882
|
+
selectedItems: ['a'],
|
|
883
|
+
});
|
|
884
|
+
wrapper.setState({ focusedIndex: undefined });
|
|
885
|
+
const instance = wrapper.instance();
|
|
886
|
+
const shortcut = instance.getHotkeyConfigs().find(h => h.get('key') === hotKey);
|
|
887
|
+
shortcut.handler({ target: { role: 'slider' } });
|
|
888
|
+
expect(wrapper.state('focusedIndex')).toEqual(undefined);
|
|
889
|
+
});
|
|
866
890
|
test('should call event.preventDefault() and call onSelect with new focused item', () => {
|
|
867
891
|
const wrapper = getWrapper({
|
|
868
892
|
gridColumnCount,
|
|
@@ -914,6 +938,18 @@ describe('components/table/makeSelectable', () => {
|
|
|
914
938
|
shortcut.handler({ preventDefault: sandbox.stub() });
|
|
915
939
|
expect(wrapper.state('focusedIndex')).toEqual(0);
|
|
916
940
|
});
|
|
941
|
+
test('should not set focus to first row if target has role of slider', () => {
|
|
942
|
+
const wrapper = getWrapper({
|
|
943
|
+
gridColumnCount,
|
|
944
|
+
isGridView: true,
|
|
945
|
+
selectedItems: ['a'],
|
|
946
|
+
});
|
|
947
|
+
wrapper.setState({ focusedIndex: undefined });
|
|
948
|
+
const instance = wrapper.instance();
|
|
949
|
+
const shortcut = instance.getHotkeyConfigs().find(h => h.get('key') === hotKey);
|
|
950
|
+
shortcut.handler({ target: { role: 'slider' } });
|
|
951
|
+
expect(wrapper.state('focusedIndex')).toEqual(undefined);
|
|
952
|
+
});
|
|
917
953
|
test('should call event.preventDefault() and set focus to next row item', () => {
|
|
918
954
|
const wrapper = getWrapper({
|
|
919
955
|
gridColumnCount,
|
|
@@ -941,6 +977,18 @@ describe('components/table/makeSelectable', () => {
|
|
|
941
977
|
});
|
|
942
978
|
describe('up', () => {
|
|
943
979
|
const hotKey = 'up';
|
|
980
|
+
test('should not set focus to first row if target has role of slider', () => {
|
|
981
|
+
const wrapper = getWrapper({
|
|
982
|
+
gridColumnCount,
|
|
983
|
+
isGridView: true,
|
|
984
|
+
selectedItems: ['a'],
|
|
985
|
+
});
|
|
986
|
+
wrapper.setState({ focusedIndex: undefined });
|
|
987
|
+
const instance = wrapper.instance();
|
|
988
|
+
const shortcut = instance.getHotkeyConfigs().find(h => h.get('key') === hotKey);
|
|
989
|
+
shortcut.handler({ target: { role: 'slider' } });
|
|
990
|
+
expect(wrapper.state('focusedIndex')).toEqual(undefined);
|
|
991
|
+
});
|
|
944
992
|
test('should call event.preventDefault() and call onSelect with new focused item', () => {
|
|
945
993
|
const wrapper = getWrapper({
|
|
946
994
|
gridColumnCount,
|
|
@@ -213,6 +213,10 @@ function makeSelectable(BaseTable) {
|
|
|
213
213
|
key: 'right',
|
|
214
214
|
description: <FormattedMessage {...messages.downDescription} />,
|
|
215
215
|
handler: event => {
|
|
216
|
+
if (this.isTargetSlider(event)) {
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
219
|
+
|
|
216
220
|
const { data } = this.props;
|
|
217
221
|
const { focusedIndex } = this.state;
|
|
218
222
|
|
|
@@ -228,6 +232,10 @@ function makeSelectable(BaseTable) {
|
|
|
228
232
|
key: 'left',
|
|
229
233
|
description: <FormattedMessage {...messages.upDescription} />,
|
|
230
234
|
handler: event => {
|
|
235
|
+
if (this.isTargetSlider(event)) {
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
238
|
+
|
|
231
239
|
const { focusedIndex = 0 } = this.state;
|
|
232
240
|
|
|
233
241
|
event.preventDefault();
|
|
@@ -241,6 +249,10 @@ function makeSelectable(BaseTable) {
|
|
|
241
249
|
key: 'down',
|
|
242
250
|
description: <FormattedMessage {...messages.downDescription} />,
|
|
243
251
|
handler: event => {
|
|
252
|
+
if (this.isTargetSlider(event)) {
|
|
253
|
+
return;
|
|
254
|
+
}
|
|
255
|
+
|
|
244
256
|
const { data, gridColumnCount } = this.props;
|
|
245
257
|
const { focusedIndex } = this.state;
|
|
246
258
|
|
|
@@ -256,6 +268,10 @@ function makeSelectable(BaseTable) {
|
|
|
256
268
|
key: 'up',
|
|
257
269
|
description: <FormattedMessage {...messages.upDescription} />,
|
|
258
270
|
handler: event => {
|
|
271
|
+
if (this.isTargetSlider(event)) {
|
|
272
|
+
return;
|
|
273
|
+
}
|
|
274
|
+
|
|
259
275
|
const { gridColumnCount } = this.props;
|
|
260
276
|
const { focusedIndex = 0 } = this.state;
|
|
261
277
|
|
|
@@ -586,6 +602,8 @@ function makeSelectable(BaseTable) {
|
|
|
586
602
|
}
|
|
587
603
|
};
|
|
588
604
|
|
|
605
|
+
isTargetSlider = event => event.target?.role === 'slider';
|
|
606
|
+
|
|
589
607
|
render() {
|
|
590
608
|
const { className, data } = this.props;
|
|
591
609
|
const { focusedIndex } = this.state;
|