From e8c3235c897ead0b4c8cf4af9ab18f2c06fa78aa Mon Sep 17 00:00:00 2001 From: Conrad Chan Date: Wed, 23 Mar 2022 11:34:00 -0700 Subject: [PATCH 1/2] feat(docuworks): Add support for docuworks file types --- package.json | 7 ++++--- src/lib/extensions.js | 2 ++ yarn.lock | 20 ++++++++++++++++---- 3 files changed, 22 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 9e6ccc367..3588d3397 100644 --- a/package.json +++ b/package.json @@ -17,6 +17,7 @@ "@babel/preset-typescript": "^7.7.7", "@box/frontend": "^6.4.0", "@box/languages": "^1.0.0", + "@box/react-virtualized": "9.22.3-rc-box.2", "@commitlint/cli": "^8.2.0", "@commitlint/config-conventional": "^8.2.0", "@commitlint/travis-cli": "^8.2.0", @@ -35,7 +36,7 @@ "babel-loader": "^8.0.6", "babel-plugin-transform-require-ignore": "^0.1.1", "box-annotations": "^2.3.0", - "box-ui-elements": "^13.1.0-beta.62", + "box-ui-elements": "^15.0.0-beta.49", "chai": "^4.2.0", "classnames": "^2.2.6", "conventional-changelog-cli": "^2.0.28", @@ -124,9 +125,9 @@ "release:patch": "./build/release.sh -p", "setup": "yarn install", "start": "yarn setup && yarn build:dev --watch", - "start:linked": "yarn link box-annotations && IS_LINKED=1 yarn start", + "start:linked": "f() { LINKED_LIBS=${@:-box-annotations} && yarn link $LINKED_LIBS && LINKED_LIBS=$LINKED_LIBS IS_LINKED=1 yarn start; }; f", "start:dev": "yarn build:i18n && LANGUAGE=en-US BABEL_ENV=dev NODE_ENV=dev yarn webpack-dev-server --config build/webpack.config.js", - "start:dev:linked": "yarn link box-annotations && IS_LINKED=1 yarn start:dev", + "start:dev:linked": "f() { LINKED_LIBS=${@:-box-annotations} && yarn link $LINKED_LIBS && IS_LINKED=1 yarn start:dev; }; f", "test": "yarn setup && NODE_ENV=test yarn jest", "test:ci": "yarn test --ci --maxWorkers=4", "test:e2e": "npm-run-all -p -r start:dev cy:run", diff --git a/src/lib/extensions.js b/src/lib/extensions.js index 0835a32fa..c11109970 100644 --- a/src/lib/extensions.js +++ b/src/lib/extensions.js @@ -51,6 +51,7 @@ export const CODE_EXTENSIONS = [ 'yaml', ]; +const DOCUWORKS_EXTENSIONS = ['xdw', 'xbd']; // Should not include 'xlsb', since xlsb conversion to pdf is not supported // However, office viewer supports xlsb, xlsm, and xlsx (new formats), but not xls (old) export const EXCEL_EXTENSIONS = ['xls', 'xlsm', 'xlsx']; @@ -62,6 +63,7 @@ export const DOCUMENT_EXTENSIONS = CODE_EXTENSIONS.concat(NON_CODE_EXTENSIONS) .concat(HTML_EXTENSIONS) .concat(EXCEL_EXTENSIONS) .concat(INDESIGN_EXTENSIONS) + .concat(DOCUWORKS_EXTENSIONS) .concat([ 'doc', 'docx', diff --git a/yarn.lock b/yarn.lock index 4f2af0611..57f0bcbca 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1164,6 +1164,18 @@ resolved "https://registry.yarnpkg.com/@box/languages/-/languages-1.0.0.tgz#e59b259b34b1b4c399778682732c3d0038864284" integrity sha512-VdrUJK8tICkE4KrgN9FcRmqI+I72vPiDeRnlzX0Ua06etEzNPUa5E3tBnuZleWfZiBshhSScXfEbZdNCWkDHtQ== +"@box/react-virtualized@9.22.3-rc-box.2": + version "9.22.3-rc-box.2" + resolved "https://registry.yarnpkg.com/@box/react-virtualized/-/react-virtualized-9.22.3-rc-box.2.tgz#51eaa43865ea07636418e72f2333d57d964d7d1b" + integrity sha512-PNgjVpdfODpEEnMAAkfB1CiLmMGfb1vsYPiqiSMASFUjLBMvZ46X9TwAlwgNAyCS1ez8V+20cYwHH1cbE/Mfgw== + dependencies: + "@babel/runtime" "^7.7.2" + clsx "^1.0.4" + dom-helpers "^5.1.3" + loose-envify "^1.4.0" + prop-types "^15.7.2" + react-lifecycles-compat "^3.0.4" + "@cnakazawa/watch@^1.0.3": version "1.0.4" resolved "https://registry.yarnpkg.com/@cnakazawa/watch/-/watch-1.0.4.tgz#f864ae85004d0fcab6f50be9141c4da368d1656a" @@ -2957,10 +2969,10 @@ box-annotations@^2.3.0: resolved "https://registry.yarnpkg.com/box-annotations/-/box-annotations-2.3.0.tgz#5cac38171f7f8d9283659e2b243310f19d5ab7d3" integrity sha512-Ea7tPgyJjX7vcnmZIfCorbzHd6oYx/OHVMPnZVQL/dUHR5vRKhLM0610xqwmVlUpk627sqHw5x/APaa+kt4SXg== -box-ui-elements@^13.1.0-beta.62: - version "13.1.0-beta.62" - resolved "https://registry.yarnpkg.com/box-ui-elements/-/box-ui-elements-13.1.0-beta.62.tgz#d10d76f8b904547d043376e238860b7021af4552" - integrity sha512-NzhnfznDNvDdWJMmktIgGluD9SuU9+E70Fp6iadF2eXXm9MI8Z+nLS1ncBuoywRsluzfs+LD/fW8Mmu38p+5gQ== +box-ui-elements@^15.0.0-beta.49: + version "15.0.0-beta.49" + resolved "https://registry.yarnpkg.com/box-ui-elements/-/box-ui-elements-15.0.0-beta.49.tgz#79d1c7808b16e873a4a9a13cec410f1a35021394" + integrity sha512-xjmWuydoEKZxXagSHzKhp6To8DZDiIUIU+3TgtaGNQ3aRr0ewutoP8wQkwH/VfG9ehB3h+2kIu0cjdCzbYUXvg== brace-expansion@^1.1.7: version "1.1.11" From 919eaae36e8c24dd866107e7657bd30af2f18335 Mon Sep 17 00:00:00 2001 From: Conrad Chan Date: Wed, 23 Mar 2022 13:45:09 -0700 Subject: [PATCH 2/2] chore: address pr comments --- jest.config.js | 1 + package.json | 5 ++--- src/lib/extensions.js | 2 +- src/lib/viewers/archive/ArchiveExplorer.js | 2 +- src/lib/viewers/text/BoxCSV.js | 2 +- yarn.lock | 12 ------------ 6 files changed, 6 insertions(+), 18 deletions(-) diff --git a/jest.config.js b/jest.config.js index 8abe3587f..3c5f276da 100644 --- a/jest.config.js +++ b/jest.config.js @@ -10,6 +10,7 @@ module.exports = { moduleNameMapper: { '\\.(css|scss|less)$': '/build/jest/styleMock.js', '\\.(jpg|jpeg|png|gif|eot|otf|webp|ttf|woff|woff2)$': '/build/jest/fileMock.js', + '@box/react-virtualized/dist/es': '@box/react-virtualized/dist/commonjs', 'box-elements-messages': '/build/jest/i18nMock.js', 'react-intl': '/build/jest/react-intl-mock.js', 'react-intl-locale-data': '/node_modules/react-intl/locale-data/en.js', diff --git a/package.json b/package.json index 3588d3397..a07ac9193 100644 --- a/package.json +++ b/package.json @@ -85,7 +85,6 @@ "react-dom": "^17.0.1", "react-intl": "^2.9.0", "react-tether": "^1.0.5", - "react-virtualized": "^9.22.3", "sass-loader": "^7.1.0", "sinon": "^9.0.3", "style-loader": "^0.23.1", @@ -125,9 +124,9 @@ "release:patch": "./build/release.sh -p", "setup": "yarn install", "start": "yarn setup && yarn build:dev --watch", - "start:linked": "f() { LINKED_LIBS=${@:-box-annotations} && yarn link $LINKED_LIBS && LINKED_LIBS=$LINKED_LIBS IS_LINKED=1 yarn start; }; f", + "start:linked": "yarn link box-annotations && IS_LINKED=1 yarn start", "start:dev": "yarn build:i18n && LANGUAGE=en-US BABEL_ENV=dev NODE_ENV=dev yarn webpack-dev-server --config build/webpack.config.js", - "start:dev:linked": "f() { LINKED_LIBS=${@:-box-annotations} && yarn link $LINKED_LIBS && IS_LINKED=1 yarn start:dev; }; f", + "start:dev:linked": "yarn link box-annotations && IS_LINKED=1 yarn start:dev", "test": "yarn setup && NODE_ENV=test yarn jest", "test:ci": "yarn test --ci --maxWorkers=4", "test:e2e": "npm-run-all -p -r start:dev cy:run", diff --git a/src/lib/extensions.js b/src/lib/extensions.js index c11109970..12892ca88 100644 --- a/src/lib/extensions.js +++ b/src/lib/extensions.js @@ -51,7 +51,7 @@ export const CODE_EXTENSIONS = [ 'yaml', ]; -const DOCUWORKS_EXTENSIONS = ['xdw', 'xbd']; +export const DOCUWORKS_EXTENSIONS = ['xdw', 'xbd']; // Should not include 'xlsb', since xlsb conversion to pdf is not supported // However, office viewer supports xlsb, xlsm, and xlsx (new formats), but not xls (old) export const EXCEL_EXTENSIONS = ['xls', 'xlsm', 'xlsx']; diff --git a/src/lib/viewers/archive/ArchiveExplorer.js b/src/lib/viewers/archive/ArchiveExplorer.js index ac0d65de1..337383b4c 100644 --- a/src/lib/viewers/archive/ArchiveExplorer.js +++ b/src/lib/viewers/archive/ArchiveExplorer.js @@ -9,7 +9,7 @@ import itemNameCellRenderer from 'box-ui-elements/es/features/virtualized-table- import readableTimeCellRenderer from 'box-ui-elements/es/features/virtualized-table-renderers/readableTimeCellRenderer'; import sizeCellRenderer from 'box-ui-elements/es/features/virtualized-table-renderers/sizeCellRenderer'; import sortableColumnHeaderRenderer from 'box-ui-elements/es/features/virtualized-table-renderers/sortableColumnHeaderRenderer'; -import { AutoSizer, Column, SortDirection } from 'react-virtualized'; +import { AutoSizer, Column, SortDirection } from '@box/react-virtualized'; import { addLocaleData } from 'react-intl'; import Breadcrumbs from './Breadcrumbs'; import SearchBar from './SearchBar'; diff --git a/src/lib/viewers/text/BoxCSV.js b/src/lib/viewers/text/BoxCSV.js index 00dd7bb7d..bb8d235c0 100644 --- a/src/lib/viewers/text/BoxCSV.js +++ b/src/lib/viewers/text/BoxCSV.js @@ -1,6 +1,6 @@ import React from 'react'; import ReactDOM from 'react-dom'; -import Grid from 'react-virtualized/dist/es/Grid/Grid'; +import { Grid } from '@box/react-virtualized/dist/es/Grid'; const HEIGHT_ROW = 30; const WIDTH_SCROLLER = 5; diff --git a/yarn.lock b/yarn.lock index 57f0bcbca..ea95ff81d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -12091,18 +12091,6 @@ react-tether@^1.0.5: prop-types "^15.6.2" tether "^1.4.5" -react-virtualized@^9.22.3: - version "9.22.3" - resolved "https://registry.yarnpkg.com/react-virtualized/-/react-virtualized-9.22.3.tgz#f430f16beb0a42db420dbd4d340403c0de334421" - integrity sha512-MKovKMxWTcwPSxE1kK1HcheQTWfuCxAuBoSTf2gwyMM21NdX/PXUhnoP8Uc5dRKd+nKm8v41R36OellhdCpkrw== - dependencies: - "@babel/runtime" "^7.7.2" - clsx "^1.0.4" - dom-helpers "^5.1.3" - loose-envify "^1.4.0" - prop-types "^15.7.2" - react-lifecycles-compat "^3.0.4" - react@^17.0.1: version "17.0.1" resolved "https://registry.yarnpkg.com/react/-/react-17.0.1.tgz#6e0600416bd57574e3f86d92edba3d9008726127"