Skip to content

Commit 197375a

Browse files
jfox-boxbfoxx1906
authored andcommitted
fix(content-explorer): Fix grid selection (box#4267)
* fix(content-explorer): Bump metadata-view version to fix grid selection * fix: remove external function name
1 parent caf64f0 commit 197375a

6 files changed

Lines changed: 49 additions & 40 deletions

File tree

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@
136136
"@box/languages": "^1.0.0",
137137
"@box/metadata-editor": "^0.122.12",
138138
"@box/metadata-filter": "^1.19.2",
139-
"@box/metadata-view": "^0.48.6",
139+
"@box/metadata-view": "^0.48.14",
140140
"@box/react-virtualized": "^9.22.3-rc-box.10",
141141
"@box/types": "^0.2.1",
142142
"@cfaester/enzyme-adapter-react-18": "^0.8.0",
@@ -303,7 +303,7 @@
303303
"@box/item-icon": "^0.17.15",
304304
"@box/metadata-editor": "^0.122.12",
305305
"@box/metadata-filter": "^1.19.2",
306-
"@box/metadata-view": "^0.48.6",
306+
"@box/metadata-view": "^0.48.14",
307307
"@box/react-virtualized": "^9.22.3-rc-box.10",
308308
"@box/types": "^0.2.1",
309309
"@hapi/address": "^2.1.4",

src/elements/content-explorer/ContentExplorer.tsx

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1614,23 +1614,19 @@ class ContentExplorer extends Component<ContentExplorerProps, State> {
16141614

16151615
getMetadataViewProps = (): ContentExplorerProps['metadataViewProps'] => {
16161616
const { metadataViewProps } = this.props;
1617-
const { tableProps } = metadataViewProps ?? {};
1618-
const { onSelectionChange } = tableProps ?? {};
1617+
const { onSelectionChange } = metadataViewProps ?? {};
16191618
const { selectedItemIds } = this.state;
16201619

16211620
return {
16221621
...metadataViewProps,
1623-
tableProps: {
1624-
...tableProps,
1625-
selectedKeys: selectedItemIds,
1626-
onSelectionChange: (ids: Selection) => {
1627-
onSelectionChange?.(ids);
1628-
const isSelectionEmpty = ids !== 'all' && ids.size === 0;
1629-
this.setState({
1630-
selectedItemIds: ids,
1631-
...(isSelectionEmpty && { isMetadataSidePanelOpen: false }),
1632-
});
1633-
},
1622+
selectedKeys: selectedItemIds,
1623+
onSelectionChange: (ids: Selection) => {
1624+
onSelectionChange?.(ids);
1625+
const isSelectionEmpty = ids !== 'all' && ids.size === 0;
1626+
this.setState({
1627+
selectedItemIds: ids,
1628+
...(isSelectionEmpty && { isMetadataSidePanelOpen: false }),
1629+
});
16341630
},
16351631
};
16361632
};

src/elements/content-explorer/__tests__/ContentExplorer.test.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -471,9 +471,7 @@ describe('elements/content-explorer/ContentExplorer', () => {
471471
const metadataViewV2ElementProps: Partial<ContentExplorerProps> = {
472472
metadataViewProps: {
473473
columns,
474-
tableProps: {
475-
isSelectAllEnabled: true,
476-
},
474+
isSelectionEnabled: true,
477475
},
478476
metadataQuery,
479477
fieldsToShow,

src/elements/content-explorer/stories/MetadataView.stories.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,7 @@ export const metadataView: Story = {
6565
args: {
6666
metadataViewProps: {
6767
columns,
68-
tableProps: {
69-
isSelectAllEnabled: true,
70-
},
68+
isSelectionEnabled: true,
7169
},
7270
metadataQuery,
7371
defaultView,

src/elements/content-explorer/stories/tests/MetadataView-visual.stories.tsx

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,7 @@ const metadataViewV2WithInlineCustomActionsElementProps = {
8383
...metadataViewV2ElementProps,
8484
metadataViewProps: {
8585
columns,
86-
tableProps: {
87-
isSelectAllEnabled: true,
88-
},
86+
isSelectionEnabled: true,
8987
itemActionMenuProps: {
9088
actions: [
9189
{
@@ -119,9 +117,7 @@ const metadataViewV2WithBulkItemActions = {
119117
],
120118
metadataViewProps: {
121119
columns,
122-
tableProps: {
123-
isSelectAllEnabled: true,
124-
},
120+
isSelectionEnabled: true,
125121
},
126122
};
127123

@@ -189,9 +185,7 @@ export const sidePanelOpenWithSingleItemSelected: Story = {
189185
...metadataViewV2ElementProps,
190186
metadataViewProps: {
191187
columns,
192-
tableProps: {
193-
isSelectAllEnabled: true,
194-
},
188+
isSelectionEnabled: true,
195189
},
196190
},
197191
play: async ({ canvas }) => {
@@ -232,9 +226,7 @@ export const sidePanelOpenWithMultipleItemsSelected: Story = {
232226
...metadataViewV2ElementProps,
233227
metadataViewProps: {
234228
columns,
235-
tableProps: {
236-
isSelectAllEnabled: true,
237-
},
229+
isSelectionEnabled: true,
238230
},
239231
},
240232

yarn.lock

Lines changed: 32 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1517,10 +1517,10 @@
15171517
resolved "https://registry.yarnpkg.com/@box/metadata-filter/-/metadata-filter-1.19.3.tgz#87364bea4cbb1417866e65639f3b1e137a6d9b6a"
15181518
integrity sha512-5cSY8yLW7S1zsiqBHAuKkHjcyHFBuBUBHGTnYigV0eKyLH4Dm9ozjon23P3Z9HXVB5IMHwTM3I9TRDFAZuP7vw==
15191519

1520-
"@box/metadata-view@^0.48.6":
1521-
version "0.48.6"
1522-
resolved "https://registry.yarnpkg.com/@box/metadata-view/-/metadata-view-0.48.6.tgz#c1c5735280f368a15e418c1128c8b0d63b5f5ecb"
1523-
integrity sha512-HbUEffdbJawUwkBWxoZoC3AbhG2Agzis3ehcXBDJSeDIypRN+UZSWqHnG1fNJ7f3ngK8JAu/s+FMl/i0nCZAnA==
1520+
"@box/metadata-view@^0.48.14":
1521+
version "0.48.14"
1522+
resolved "https://registry.yarnpkg.com/@box/metadata-view/-/metadata-view-0.48.14.tgz#d8850ecc3a66d94e717c081ed31b348991328232"
1523+
integrity sha512-qtH+Z+PiaZtdTtaEuMr19WNH8pqmwwHJCt501r6ZyCJD5mzQY1Qw6le7HpLO+oG0ex9Lcxe/q7LVH9QoHJy5Fg==
15241524

15251525
"@box/react-virtualized@^9.22.3-rc-box.10":
15261526
version "9.22.3-rc-box.10"
@@ -18221,7 +18221,7 @@ string-replace-loader@^3.1.0:
1822118221
loader-utils "^2.0.0"
1822218222
schema-utils "^3.0.0"
1822318223

18224-
"string-width-cjs@npm:string-width@^4.2.0", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
18224+
"string-width-cjs@npm:string-width@^4.2.0":
1822518225
version "4.2.3"
1822618226
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
1822718227
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
@@ -18256,6 +18256,15 @@ string-width@^3.0.0, string-width@^3.1.0:
1825618256
is-fullwidth-code-point "^2.0.0"
1825718257
strip-ansi "^5.1.0"
1825818258

18259+
string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
18260+
version "4.2.3"
18261+
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
18262+
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
18263+
dependencies:
18264+
emoji-regex "^8.0.0"
18265+
is-fullwidth-code-point "^3.0.0"
18266+
strip-ansi "^6.0.1"
18267+
1825918268
string-width@^5.0.1, string-width@^5.1.2:
1826018269
version "5.1.2"
1826118270
resolved "https://registry.yarnpkg.com/string-width/-/string-width-5.1.2.tgz#14f8daec6d81e7221d2a357e668cab73bdbca794"
@@ -18362,7 +18371,7 @@ stringify-object@^3.3.0:
1836218371
is-obj "^1.0.1"
1836318372
is-regexp "^1.0.0"
1836418373

18365-
"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1:
18374+
"strip-ansi-cjs@npm:strip-ansi@^6.0.1":
1836618375
version "6.0.1"
1836718376
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
1836818377
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
@@ -18390,6 +18399,13 @@ strip-ansi@^5.0.0, strip-ansi@^5.1.0, strip-ansi@^5.2.0:
1839018399
dependencies:
1839118400
ansi-regex "^4.1.0"
1839218401

18402+
strip-ansi@^6.0.0, strip-ansi@^6.0.1:
18403+
version "6.0.1"
18404+
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
18405+
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
18406+
dependencies:
18407+
ansi-regex "^5.0.1"
18408+
1839318409
strip-ansi@^7.0.1, strip-ansi@^7.1.0:
1839418410
version "7.1.0"
1839518411
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-7.1.0.tgz#d5b6568ca689d8561370b0707685d22434faff45"
@@ -19942,7 +19958,7 @@ wordwrap@^1.0.0:
1994219958
resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-1.0.0.tgz#27584810891456a4171c8d0226441ade90cbcaeb"
1994319959
integrity sha512-gvVzJFlPycKc5dZN4yPkP8w7Dc37BtP1yczEneOb4uq34pXZcvrtRTmWV8W+Ume+XCxKgbjM+nevkyFPMybd4Q==
1994419960

19945-
"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0:
19961+
"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0":
1994619962
version "7.0.0"
1994719963
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
1994819964
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
@@ -19977,6 +19993,15 @@ wrap-ansi@^6.2.0:
1997719993
string-width "^4.1.0"
1997819994
strip-ansi "^6.0.0"
1997919995

19996+
wrap-ansi@^7.0.0:
19997+
version "7.0.0"
19998+
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
19999+
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
20000+
dependencies:
20001+
ansi-styles "^4.0.0"
20002+
string-width "^4.1.0"
20003+
strip-ansi "^6.0.0"
20004+
1998020005
wrap-ansi@^8.1.0:
1998120006
version "8.1.0"
1998220007
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214"

0 commit comments

Comments
 (0)