box-ui-elements 16.0.1-beta.2 → 16.1.0-beta.2
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 +9 -0
- package/es/components/table/makeSelectable.js.flow +9 -0
- package/es/components/table/makeSelectable.js.map +1 -1
- package/i18n/ja-JP.js +2 -2
- package/i18n/ja-JP.properties +2 -2
- package/package.json +1 -1
- package/src/components/table/__tests__/makeSelectable.test.js +25 -0
- package/src/components/table/makeSelectable.js +9 -0
|
@@ -544,6 +544,14 @@ function makeSelectable(BaseTable) {
|
|
|
544
544
|
}
|
|
545
545
|
});
|
|
546
546
|
|
|
547
|
+
_defineProperty(_assertThisInitialized(_this), "handleCheckboxClick", function (event, index) {
|
|
548
|
+
if (event.nativeEvent.shiftKey) {
|
|
549
|
+
_this.selectRange(index);
|
|
550
|
+
} else {
|
|
551
|
+
_this.selectToggle(index);
|
|
552
|
+
}
|
|
553
|
+
});
|
|
554
|
+
|
|
547
555
|
_this.anchorIndex = 0;
|
|
548
556
|
_this.searchString = '';
|
|
549
557
|
_this.searchTimeout = null; // we have to store the previously focused index because a focus event
|
|
@@ -587,6 +595,7 @@ function makeSelectable(BaseTable) {
|
|
|
587
595
|
className: classNames(className, 'is-selectable'),
|
|
588
596
|
focusedIndex: focusedIndex,
|
|
589
597
|
focusedItem: focusedItem,
|
|
598
|
+
onCheckboxClick: this.handleCheckboxClick,
|
|
590
599
|
onRowClick: this.handleRowClick,
|
|
591
600
|
onRowFocus: this.handleRowFocus,
|
|
592
601
|
onTableBlur: this.handleTableBlur,
|
|
@@ -569,6 +569,14 @@ function makeSelectable(BaseTable) {
|
|
|
569
569
|
}
|
|
570
570
|
};
|
|
571
571
|
|
|
572
|
+
handleCheckboxClick = (event, index) => {
|
|
573
|
+
if (event.nativeEvent.shiftKey) {
|
|
574
|
+
this.selectRange(index);
|
|
575
|
+
} else {
|
|
576
|
+
this.selectToggle(index);
|
|
577
|
+
}
|
|
578
|
+
};
|
|
579
|
+
|
|
572
580
|
render() {
|
|
573
581
|
const { className, data } = this.props;
|
|
574
582
|
const { focusedIndex } = this.state;
|
|
@@ -581,6 +589,7 @@ function makeSelectable(BaseTable) {
|
|
|
581
589
|
className={classNames(className, 'is-selectable')}
|
|
582
590
|
focusedIndex={focusedIndex}
|
|
583
591
|
focusedItem={focusedItem}
|
|
592
|
+
onCheckboxClick={this.handleCheckboxClick}
|
|
584
593
|
onRowClick={this.handleRowClick}
|
|
585
594
|
onRowFocus={this.handleRowFocus}
|
|
586
595
|
onTableBlur={this.handleTableBlur}
|
|
@@ -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","selectedItemIndecies","sourceIndex","targetIndex","dataSize","isSourceSelected","isTargetSelected","selectedItemIndices","isContiguousSelection","newSelectedItemIndices","searchStrings","target","hasAttribute","nodeName","which","searchTimeout","searchString","findIndex","string","trim","toLowerCase","indexOf","document","addEventListener","handleKeyboardSearch","prevProps","prevState","onFocus","removeEventListener","className","focusedItem","getHotkeyConfigs","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;AADV,OAhBW;;AAAA,iEAmCR,UAACC,aAAD,EAAgBC,eAAhB,EAAoC;AAAA,YACnCC,QADmC,GACtB,MAAKL,KADiB,CACnCK,QADmC;AAG3C,cAAKC,aAAL,GAAqB,MAAKC,KAAL,CAAWN,YAAX,IAA2B,CAAhD;;AAEA,cAAKO,QAAL,CAAc;AACVP,UAAAA,YAAY,EAAEG;AADJ,SAAd;;AAIA,YAAIC,QAAJ,EAAc;AACV;AACA;AACAA,UAAAA,QAAQ,CAACnB,GAAG,CAACuB,KAAJ,CAAU,MAAKT,KAAL,CAAWG,aAArB,IAAsCA,aAAtC,GAAsDA,aAAa,CAACO,IAAd,EAAvD,CAAR;AACH;AACJ,OAjDkB;;AAAA,+E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AKfvE,IAAAA,UAAU,EAAEpD,SAAS,CAAC4H,IALP;;AAMf;AACAZ,IAAAA,OAAO,EAAEhH,SAAS,CAAC6H,IAPJ;;AAQf;AACAvG,IAAAA,QAAQ,EAAEtB,SAAS,CAAC6H,IAAV,CAAeH,UATV;;AAUf;;;;AAIA3B,IAAAA,aAAa,EAAE/F,SAAS,CAACyH,KAdV;;AAef;;;;;;AAMArG,IAAAA,aAAa,EAAEpB,SAAS,CAAC8H,SAAV,CAAoB,CAAC9H,SAAS,CAACyH,KAAX,EAAkBrH,kBAAkB,CAAC2H,GAArC,CAApB,CArBA;;AAsBf;AACArE,IAAAA,UAAU,EAAE1D,SAAS,CAACyH,KAvBP;AAwBftE,IAAAA,aAAa,EAAEnD,SAAS,CAAC4H,IAxBV;;AAyBf;AACAhG,IAAAA,UAAU,EAAE5B,SAAS,CAACuG;AA1BP,GAHvB,2CAgC0B;AAClBnF,IAAAA,aAAa,EAAE,IAAIjB,GAAJ;AADG,GAhC1B;AAgkBH;;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 // if we're at a boundary of the table and the row is selected, no-op\n if (focusedIndex === boundary && selectedItems.has(data[focusedIndex])) {\n return;\n }\n\n // if target is not selected, select it\n if (!selectedItems.has(data[newFocusedIndex])) {\n this.onSelect(selectedItems.add(data[newFocusedIndex]), newFocusedIndex);\n return;\n }\n\n // if both source and target are selected, deselect source\n if (selectedItems.has(data[newFocusedIndex]) && selectedItems.has(data[focusedIndex])) {\n this.onSelect(selectedItems.delete(data[focusedIndex]), newFocusedIndex);\n return;\n }\n\n // if target is selected and source is not, select source\n this.onSelect(selectedItems.add(data[focusedIndex]), 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 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 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","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","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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EAAE1D,SAAS,CAAC2H,KAvBP;AAwBfxE,IAAAA,aAAa,EAAEnD,SAAS,CAAC8H,IAxBV;;AAyBf;AACAlG,IAAAA,UAAU,EAAE5B,SAAS,CAACuG;AA1BP,GAHvB,2CAgC0B;AAClBnF,IAAAA,aAAa,EAAE,IAAIjB,GAAJ;AADG,GAhC1B;AAykBH;;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 // if we're at a boundary of the table and the row is selected, no-op\n if (focusedIndex === boundary && selectedItems.has(data[focusedIndex])) {\n return;\n }\n\n // if target is not selected, select it\n if (!selectedItems.has(data[newFocusedIndex])) {\n this.onSelect(selectedItems.add(data[newFocusedIndex]), newFocusedIndex);\n return;\n }\n\n // if both source and target are selected, deselect source\n if (selectedItems.has(data[newFocusedIndex]) && selectedItems.has(data[focusedIndex])) {\n this.onSelect(selectedItems.delete(data[focusedIndex]), newFocusedIndex);\n return;\n }\n\n // if target is selected and source is not, select source\n this.onSelect(selectedItems.add(data[focusedIndex]), 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"}
|
package/i18n/ja-JP.js
CHANGED
|
@@ -98,8 +98,8 @@ export default {
|
|
|
98
98
|
"be.contentSidebar.activityFeed.commmon.showOriginalMessage": "オリジナルを表示",
|
|
99
99
|
"be.contentSidebar.activityFeed.common.activityStatusResolved": "解決済み",
|
|
100
100
|
"be.contentSidebar.activityFeed.common.editedMessage": "(編集済み)",
|
|
101
|
-
"be.contentSidebar.activityFeed.common.seeLessMessage": "
|
|
102
|
-
"be.contentSidebar.activityFeed.common.seeMoreMessage": "
|
|
101
|
+
"be.contentSidebar.activityFeed.common.seeLessMessage": "一部を表示",
|
|
102
|
+
"be.contentSidebar.activityFeed.common.seeMoreMessage": "さらに表示",
|
|
103
103
|
"be.contentSidebar.activityFeed.common.translateMessage": "翻訳する",
|
|
104
104
|
"be.contentSidebar.activityFeed.task.taskAnyAffordanceTooltip": "担当者のうち1人がタスクを実行すればこのタスクは完了となります",
|
|
105
105
|
"be.contentSidebar.activityFeed.task.taskDeleteMenuItem": "タスクを削除",
|
package/i18n/ja-JP.properties
CHANGED
|
@@ -197,9 +197,9 @@ be.contentSidebar.activityFeed.common.activityStatusResolved = 解決済み
|
|
|
197
197
|
# Label indicating that message was edited, should be lowercase
|
|
198
198
|
be.contentSidebar.activityFeed.common.editedMessage = (編集済み)
|
|
199
199
|
# See less button for hiding part of long message
|
|
200
|
-
be.contentSidebar.activityFeed.common.seeLessMessage =
|
|
200
|
+
be.contentSidebar.activityFeed.common.seeLessMessage = 一部を表示
|
|
201
201
|
# See more button for showing whole long message
|
|
202
|
-
be.contentSidebar.activityFeed.common.seeMoreMessage =
|
|
202
|
+
be.contentSidebar.activityFeed.common.seeMoreMessage = さらに表示
|
|
203
203
|
# Translate button for translating comment
|
|
204
204
|
be.contentSidebar.activityFeed.common.translateMessage = 翻訳する
|
|
205
205
|
# Tooltip text for any task icon, explaining that the task only needs one assignee to complete.
|
package/package.json
CHANGED
|
@@ -246,6 +246,30 @@ describe('components/table/makeSelectable', () => {
|
|
|
246
246
|
});
|
|
247
247
|
});
|
|
248
248
|
|
|
249
|
+
describe('handleCheckboxClick()', () => {
|
|
250
|
+
test('should call selectRange() when shift key pressed', () => {
|
|
251
|
+
const wrapper = getWrapper();
|
|
252
|
+
const instance = wrapper.instance();
|
|
253
|
+
|
|
254
|
+
const index = 1;
|
|
255
|
+
|
|
256
|
+
instance.selectRange = sandbox.mock().withArgs(index);
|
|
257
|
+
|
|
258
|
+
instance.handleCheckboxClick({ nativeEvent: { shiftKey: true } }, index);
|
|
259
|
+
});
|
|
260
|
+
|
|
261
|
+
test('should call selectToggle() when no modifier key pressed', () => {
|
|
262
|
+
const wrapper = getWrapper();
|
|
263
|
+
const instance = wrapper.instance();
|
|
264
|
+
|
|
265
|
+
const index = 1;
|
|
266
|
+
|
|
267
|
+
instance.selectToggle = sandbox.mock().withArgs(index);
|
|
268
|
+
|
|
269
|
+
instance.handleCheckboxClick({ nativeEvent: {} }, index);
|
|
270
|
+
});
|
|
271
|
+
});
|
|
272
|
+
|
|
249
273
|
describe('handleRowFocus()', () => {
|
|
250
274
|
test('should call onSelect() with correct args', () => {
|
|
251
275
|
const wrapper = getWrapper({
|
|
@@ -1224,6 +1248,7 @@ describe('components/table/makeSelectable', () => {
|
|
|
1224
1248
|
|
|
1225
1249
|
const table = wrapper.find('Table');
|
|
1226
1250
|
expect(table.hasClass('is-selectable')).toBe(true);
|
|
1251
|
+
expect(table.prop('onCheckboxClick')).toEqual(instance.handleCheckboxClick);
|
|
1227
1252
|
expect(table.prop('onRowClick')).toEqual(wrapper.instance().handleRowClick);
|
|
1228
1253
|
expect(table.prop('onRowFocus')).toEqual(wrapper.instance().handleRowFocus);
|
|
1229
1254
|
expect(table.prop('focusedItem')).toEqual('b');
|
|
@@ -569,6 +569,14 @@ function makeSelectable(BaseTable) {
|
|
|
569
569
|
}
|
|
570
570
|
};
|
|
571
571
|
|
|
572
|
+
handleCheckboxClick = (event, index) => {
|
|
573
|
+
if (event.nativeEvent.shiftKey) {
|
|
574
|
+
this.selectRange(index);
|
|
575
|
+
} else {
|
|
576
|
+
this.selectToggle(index);
|
|
577
|
+
}
|
|
578
|
+
};
|
|
579
|
+
|
|
572
580
|
render() {
|
|
573
581
|
const { className, data } = this.props;
|
|
574
582
|
const { focusedIndex } = this.state;
|
|
@@ -581,6 +589,7 @@ function makeSelectable(BaseTable) {
|
|
|
581
589
|
className={classNames(className, 'is-selectable')}
|
|
582
590
|
focusedIndex={focusedIndex}
|
|
583
591
|
focusedItem={focusedItem}
|
|
592
|
+
onCheckboxClick={this.handleCheckboxClick}
|
|
584
593
|
onRowClick={this.handleRowClick}
|
|
585
594
|
onRowFocus={this.handleRowFocus}
|
|
586
595
|
onTableBlur={this.handleTableBlur}
|