box-ui-elements 24.0.0-beta.3 → 24.0.0-beta.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/explorer.js +1 -1
- package/dist/openwith.js +1 -1
- package/dist/picker.js +1 -1
- package/dist/preview.js +1 -1
- package/dist/sharing.js +1 -1
- package/dist/sidebar.js +1 -1
- package/dist/uploader.js +1 -1
- package/es/api/Metadata.js +98 -13
- package/es/api/Metadata.js.flow +110 -12
- package/es/api/Metadata.js.map +1 -1
- package/es/elements/common/messages.js +16 -0
- package/es/elements/common/messages.js.flow +25 -0
- package/es/elements/common/messages.js.map +1 -1
- package/es/elements/common/withBlueprintModernization.js +16 -0
- package/es/elements/common/withBlueprintModernization.js.map +1 -0
- package/es/elements/content-explorer/Content.js +2 -1
- package/es/elements/content-explorer/Content.js.map +1 -1
- package/es/elements/content-explorer/ContentExplorer.js +21 -6
- package/es/elements/content-explorer/ContentExplorer.js.map +1 -1
- package/es/elements/content-explorer/MetadataQueryAPIHelper.js +61 -4
- package/es/elements/content-explorer/MetadataQueryAPIHelper.js.map +1 -1
- package/es/elements/content-explorer/MetadataSidePanel.js +40 -14
- package/es/elements/content-explorer/MetadataSidePanel.js.map +1 -1
- package/es/elements/content-explorer/MetadataViewContainer.js +55 -4
- package/es/elements/content-explorer/MetadataViewContainer.js.map +1 -1
- package/es/elements/content-explorer/stories/tests/ContentExplorer-visual.stories.js +5 -0
- package/es/elements/content-explorer/stories/tests/ContentExplorer-visual.stories.js.flow +6 -0
- package/es/elements/content-explorer/stories/tests/ContentExplorer-visual.stories.js.map +1 -1
- package/es/elements/content-explorer/stories/tests/MetadataView-visual.stories.js +61 -13
- package/es/elements/content-explorer/stories/tests/MetadataView-visual.stories.js.map +1 -1
- package/es/elements/content-explorer/utils.js +140 -12
- package/es/elements/content-explorer/utils.js.map +1 -1
- package/es/elements/content-picker/ContentPicker.js +4 -1
- package/es/elements/content-picker/ContentPicker.js.flow +4 -1
- package/es/elements/content-picker/ContentPicker.js.map +1 -1
- package/es/elements/content-picker/stories/tests/ContentPicker-visual.stories.js +5 -0
- package/es/elements/content-picker/stories/tests/ContentPicker-visual.stories.js.flow +6 -0
- package/es/elements/content-picker/stories/tests/ContentPicker-visual.stories.js.map +1 -1
- package/es/elements/content-preview/ContentPreview.js +3 -1
- package/es/elements/content-preview/ContentPreview.js.flow +3 -0
- package/es/elements/content-preview/ContentPreview.js.map +1 -1
- package/es/elements/content-preview/stories/tests/ContentPreview-visual.stories.js +5 -0
- package/es/elements/content-preview/stories/tests/ContentPreview-visual.stories.js.flow +7 -1
- package/es/elements/content-preview/stories/tests/ContentPreview-visual.stories.js.map +1 -1
- package/es/elements/content-sharing/ContentSharing.js +4 -1
- package/es/elements/content-sharing/ContentSharing.js.flow +4 -1
- package/es/elements/content-sharing/ContentSharing.js.map +1 -1
- package/es/elements/content-sidebar/ContentSidebar.js +3 -1
- package/es/elements/content-sidebar/ContentSidebar.js.flow +3 -0
- package/es/elements/content-sidebar/ContentSidebar.js.map +1 -1
- package/es/elements/content-sidebar/stories/tests/ContentSidebar-visual.stories.js +5 -0
- package/es/elements/content-sidebar/stories/tests/ContentSidebar-visual.stories.js.map +1 -1
- package/es/elements/content-uploader/ContentUploader.js +3 -1
- package/es/elements/content-uploader/ContentUploader.js.map +1 -1
- package/es/elements/content-uploader/stories/tests/ContentUploader-visual.stories.js +5 -0
- package/es/elements/content-uploader/stories/tests/ContentUploader-visual.stories.js.flow +6 -0
- package/es/elements/content-uploader/stories/tests/ContentUploader-visual.stories.js.map +1 -1
- package/es/features/classification/applied-by-ai-classification-reason/AppliedByAiClassificationReason.js +51 -0
- package/es/features/classification/applied-by-ai-classification-reason/AppliedByAiClassificationReason.js.map +1 -0
- package/es/features/classification/applied-by-ai-classification-reason/AppliedByAiClassificationReason.scss +29 -0
- package/es/features/classification/applied-by-ai-classification-reason/messages.js +13 -0
- package/es/features/classification/applied-by-ai-classification-reason/messages.js.map +1 -0
- package/es/features/classification/types.js +2 -0
- package/es/features/classification/types.js.map +1 -0
- package/es/src/elements/common/__tests__/withBlueprintModernization.test.d.ts +1 -0
- package/es/src/elements/common/withBlueprintModernization.d.ts +3 -0
- package/es/src/elements/content-explorer/ContentExplorer.d.ts +11 -3
- package/es/src/elements/content-explorer/MetadataQueryAPIHelper.d.ts +11 -1
- package/es/src/elements/content-explorer/MetadataSidePanel.d.ts +6 -3
- package/es/src/elements/content-explorer/MetadataViewContainer.d.ts +3 -1
- package/es/src/elements/content-explorer/stories/tests/MetadataView-visual.stories.d.ts +1 -0
- package/es/src/elements/content-explorer/utils.d.ts +9 -3
- package/es/src/elements/content-sidebar/stories/tests/ContentSidebar-visual.stories.d.ts +5 -0
- package/es/src/features/classification/applied-by-ai-classification-reason/AppliedByAiClassificationReason.d.ts +6 -0
- package/es/src/features/classification/applied-by-ai-classification-reason/__tests__/AppliedByAiClassificationReason.test.d.ts +1 -0
- package/es/src/features/classification/applied-by-ai-classification-reason/messages.d.ts +13 -0
- package/es/src/features/classification/types.d.ts +6 -0
- package/i18n/bn-IN.js +8 -2
- package/i18n/bn-IN.properties +6 -2
- package/i18n/da-DK.js +8 -2
- package/i18n/da-DK.properties +6 -2
- package/i18n/de-DE.js +8 -2
- package/i18n/de-DE.properties +6 -2
- package/i18n/en-AU.js +6 -0
- package/i18n/en-AU.properties +4 -0
- package/i18n/en-CA.js +6 -0
- package/i18n/en-CA.properties +4 -0
- package/i18n/en-GB.js +6 -0
- package/i18n/en-GB.properties +4 -0
- package/i18n/en-US.js +6 -0
- package/i18n/en-US.properties +12 -0
- package/i18n/en-x-pseudo.js +6 -0
- package/i18n/es-419.js +8 -2
- package/i18n/es-419.properties +6 -2
- package/i18n/es-ES.js +8 -2
- package/i18n/es-ES.properties +6 -2
- package/i18n/fi-FI.js +8 -2
- package/i18n/fi-FI.properties +6 -2
- package/i18n/fr-CA.js +8 -2
- package/i18n/fr-CA.properties +6 -2
- package/i18n/fr-FR.js +8 -2
- package/i18n/fr-FR.properties +6 -2
- package/i18n/hi-IN.js +8 -2
- package/i18n/hi-IN.properties +6 -2
- package/i18n/it-IT.js +8 -2
- package/i18n/it-IT.properties +6 -2
- package/i18n/ja-JP.js +8 -2
- package/i18n/ja-JP.properties +6 -2
- package/i18n/ko-KR.js +8 -2
- package/i18n/ko-KR.properties +6 -2
- package/i18n/nb-NO.js +8 -2
- package/i18n/nb-NO.properties +6 -2
- package/i18n/nl-NL.js +8 -2
- package/i18n/nl-NL.properties +6 -2
- package/i18n/pl-PL.js +8 -2
- package/i18n/pl-PL.properties +6 -2
- package/i18n/pt-BR.js +8 -2
- package/i18n/pt-BR.properties +6 -2
- package/i18n/ru-RU.js +8 -2
- package/i18n/ru-RU.properties +6 -2
- package/i18n/sv-SE.js +8 -2
- package/i18n/sv-SE.properties +6 -2
- package/i18n/tr-TR.js +8 -2
- package/i18n/tr-TR.properties +6 -2
- package/i18n/zh-CN.js +8 -2
- package/i18n/zh-CN.properties +6 -2
- package/i18n/zh-TW.js +8 -2
- package/i18n/zh-TW.properties +6 -2
- package/package.json +1 -1
- package/src/api/Metadata.js +110 -12
- package/src/api/__tests__/Metadata.test.js +120 -0
- package/src/elements/common/__tests__/withBlueprintModernization.test.tsx +91 -0
- package/src/elements/common/messages.js +25 -0
- package/src/elements/common/withBlueprintModernization.tsx +24 -0
- package/src/elements/content-explorer/Content.tsx +1 -0
- package/src/elements/content-explorer/ContentExplorer.tsx +224 -182
- package/src/elements/content-explorer/MetadataQueryAPIHelper.ts +89 -4
- package/src/elements/content-explorer/MetadataSidePanel.tsx +55 -14
- package/src/elements/content-explorer/MetadataViewContainer.tsx +61 -1
- package/src/elements/content-explorer/__tests__/ContentExplorer.test.tsx +36 -2
- package/src/elements/content-explorer/__tests__/MetadataQueryAPIHelper.test.ts +8 -5
- package/src/elements/content-explorer/__tests__/MetadataSidePanel.test.tsx +145 -3
- package/src/elements/content-explorer/stories/tests/ContentExplorer-visual.stories.js +6 -0
- package/src/elements/content-explorer/stories/tests/MetadataView-visual.stories.tsx +54 -8
- package/src/elements/content-explorer/utils.ts +150 -13
- package/src/elements/content-picker/ContentPicker.js +4 -1
- package/src/elements/content-picker/stories/tests/ContentPicker-visual.stories.js +6 -0
- package/src/elements/content-preview/ContentPreview.js +3 -0
- package/src/elements/content-preview/stories/tests/ContentPreview-visual.stories.js +7 -1
- package/src/elements/content-sharing/ContentSharing.js +4 -1
- package/src/elements/content-sidebar/ContentSidebar.js +3 -0
- package/src/elements/content-sidebar/stories/tests/ContentSidebar-visual.stories.tsx +6 -0
- package/src/elements/content-uploader/ContentUploader.tsx +3 -1
- package/src/elements/content-uploader/stories/tests/ContentUploader-visual.stories.js +6 -0
- package/src/features/classification/applied-by-ai-classification-reason/AppliedByAiClassificationReason.scss +29 -0
- package/src/features/classification/applied-by-ai-classification-reason/AppliedByAiClassificationReason.tsx +55 -0
- package/src/features/classification/applied-by-ai-classification-reason/__tests__/AppliedByAiClassificationReason.test.tsx +105 -0
- package/src/features/classification/applied-by-ai-classification-reason/messages.ts +18 -0
- package/src/features/classification/types.ts +7 -0
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { BlueprintModernizationContext } from '@box/blueprint-web';
|
|
3
|
+
import { render } from '../../../test-utils/testing-library';
|
|
4
|
+
import { withBlueprintModernization } from '../withBlueprintModernization';
|
|
5
|
+
|
|
6
|
+
// Mock the Blueprint Web package with simple components
|
|
7
|
+
jest.mock('@box/blueprint-web', () => {
|
|
8
|
+
const ReactMock = jest.requireActual('react');
|
|
9
|
+
const mockContext = ReactMock.createContext({ enableModernizedComponents: false });
|
|
10
|
+
|
|
11
|
+
return {
|
|
12
|
+
BlueprintModernizationContext: mockContext,
|
|
13
|
+
BlueprintModernizationProvider: ({ children, enableModernizedComponents }) =>
|
|
14
|
+
ReactMock.createElement(
|
|
15
|
+
'div',
|
|
16
|
+
{
|
|
17
|
+
'data-testid': 'blueprint-provider',
|
|
18
|
+
'data-enabled': String(enableModernizedComponents),
|
|
19
|
+
},
|
|
20
|
+
children,
|
|
21
|
+
),
|
|
22
|
+
TooltipProvider: ({ children }) =>
|
|
23
|
+
ReactMock.createElement('div', { 'data-testid': 'tooltip-provider' }, children),
|
|
24
|
+
BlueprintModernizationContextValue: {},
|
|
25
|
+
};
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
type TestComponentProps = {
|
|
29
|
+
value?: string;
|
|
30
|
+
enableModernizedComponents?: boolean;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
describe('src/elements/common/withBlueprintModernization', () => {
|
|
34
|
+
const TestComponent = ({ value }: TestComponentProps) => (
|
|
35
|
+
<div data-testid="test-component">{`Test ${value || 'default'}`}</div>
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
const WrappedComponent = withBlueprintModernization(TestComponent);
|
|
39
|
+
|
|
40
|
+
const renderComponent = (props?: TestComponentProps) => render(<WrappedComponent {...props} />);
|
|
41
|
+
|
|
42
|
+
test('should wrap component with BlueprintModernizationProvider', () => {
|
|
43
|
+
const { getByTestId } = renderComponent();
|
|
44
|
+
|
|
45
|
+
expect(getByTestId('test-component')).toBeInTheDocument();
|
|
46
|
+
expect(getByTestId('test-component')).toHaveTextContent('Test default');
|
|
47
|
+
expect(getByTestId('blueprint-provider')).toBeInTheDocument();
|
|
48
|
+
expect(getByTestId('blueprint-provider')).toHaveAttribute('data-enabled', 'false');
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
test('should pass props to wrapped component', () => {
|
|
52
|
+
const { getByTestId } = renderComponent({ value: 'test-value' });
|
|
53
|
+
|
|
54
|
+
expect(getByTestId('test-component')).toBeInTheDocument();
|
|
55
|
+
expect(getByTestId('test-component')).toHaveTextContent('Test test-value');
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
test('should handle enableModernizedComponents prop', () => {
|
|
59
|
+
const { getByTestId } = renderComponent({
|
|
60
|
+
value: 'modernized',
|
|
61
|
+
enableModernizedComponents: true,
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
expect(getByTestId('test-component')).toBeInTheDocument();
|
|
65
|
+
expect(getByTestId('test-component')).toHaveTextContent('Test modernized');
|
|
66
|
+
expect(getByTestId('blueprint-provider')).toBeInTheDocument();
|
|
67
|
+
expect(getByTestId('blueprint-provider')).toHaveAttribute('data-enabled', 'true');
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
test('should not wrap component when upstream BlueprintModernizationProvider exists', () => {
|
|
71
|
+
// Create a parent component with existing BlueprintModernizationContext
|
|
72
|
+
const ParentWithContext = ({ children }) => (
|
|
73
|
+
<BlueprintModernizationContext.Provider value={{ enableModernizedComponents: true }}>
|
|
74
|
+
{children}
|
|
75
|
+
</BlueprintModernizationContext.Provider>
|
|
76
|
+
);
|
|
77
|
+
|
|
78
|
+
const { getByTestId, queryByTestId } = render(
|
|
79
|
+
<ParentWithContext>
|
|
80
|
+
<WrappedComponent value="with-context" enableModernizedComponents={false} />
|
|
81
|
+
</ParentWithContext>,
|
|
82
|
+
);
|
|
83
|
+
|
|
84
|
+
// Component should render
|
|
85
|
+
expect(getByTestId('test-component')).toBeInTheDocument();
|
|
86
|
+
expect(getByTestId('test-component')).toHaveTextContent('Test with-context');
|
|
87
|
+
|
|
88
|
+
// HOC should NOT add its own BlueprintModernizationProvider since upstream context exists
|
|
89
|
+
expect(queryByTestId('blueprint-provider')).not.toBeInTheDocument();
|
|
90
|
+
});
|
|
91
|
+
});
|
|
@@ -27,6 +27,11 @@ const messages = defineMessages({
|
|
|
27
27
|
description: 'Generic error label.',
|
|
28
28
|
defaultMessage: 'Error',
|
|
29
29
|
},
|
|
30
|
+
success: {
|
|
31
|
+
id: 'be.success',
|
|
32
|
+
description: 'Generic success label.',
|
|
33
|
+
defaultMessage: 'Success',
|
|
34
|
+
},
|
|
30
35
|
preview: {
|
|
31
36
|
id: 'be.preview',
|
|
32
37
|
description: 'Label for preview action.',
|
|
@@ -1105,6 +1110,26 @@ const messages = defineMessages({
|
|
|
1105
1110
|
}
|
|
1106
1111
|
`,
|
|
1107
1112
|
},
|
|
1113
|
+
multipleValues: {
|
|
1114
|
+
id: 'be.multipleValues',
|
|
1115
|
+
description: 'Display text for field when there are multiple items selected and have different value',
|
|
1116
|
+
defaultMessage: 'Multiple Values',
|
|
1117
|
+
},
|
|
1118
|
+
metadataUpdateErrorNotification: {
|
|
1119
|
+
id: 'be.metadataUpdateErrorNotification',
|
|
1120
|
+
description: 'Text shown in error notification banner',
|
|
1121
|
+
defaultMessage: 'Unable to save changes. Please try again.',
|
|
1122
|
+
},
|
|
1123
|
+
metadataUpdateSuccessNotification: {
|
|
1124
|
+
id: 'be.metadataUpdateSuccessNotification',
|
|
1125
|
+
description: 'Text shown in success notification banner',
|
|
1126
|
+
defaultMessage: `
|
|
1127
|
+
{numSelected, plural,
|
|
1128
|
+
=1 {1 document updated}
|
|
1129
|
+
other {# documents updated}
|
|
1130
|
+
}
|
|
1131
|
+
`,
|
|
1132
|
+
},
|
|
1108
1133
|
});
|
|
1109
1134
|
|
|
1110
1135
|
export default messages;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React, { useContext } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
BlueprintModernizationContext,
|
|
4
|
+
BlueprintModernizationContextValue,
|
|
5
|
+
BlueprintModernizationProvider,
|
|
6
|
+
} from '@box/blueprint-web';
|
|
7
|
+
|
|
8
|
+
export function withBlueprintModernization<P>(
|
|
9
|
+
Component: React.ComponentType<P & BlueprintModernizationContextValue>,
|
|
10
|
+
): React.FC<(P & BlueprintModernizationContextValue) | P> {
|
|
11
|
+
return function WithBlueprintModernization(props: P & BlueprintModernizationContextValue) {
|
|
12
|
+
const context = useContext(BlueprintModernizationContext);
|
|
13
|
+
// no context found from the parent component, so we need to provide our own
|
|
14
|
+
if (!context.enableModernizedComponents) {
|
|
15
|
+
return (
|
|
16
|
+
<BlueprintModernizationProvider enableModernizedComponents={!!props.enableModernizedComponents}>
|
|
17
|
+
<Component {...props} />
|
|
18
|
+
</BlueprintModernizationProvider>
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
// context found, so load the component with the existing context
|
|
22
|
+
return <Component {...props} />;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
@@ -8,9 +8,10 @@ import getProp from 'lodash/get';
|
|
|
8
8
|
import noop from 'lodash/noop';
|
|
9
9
|
import throttle from 'lodash/throttle';
|
|
10
10
|
import uniqueid from 'lodash/uniqueId';
|
|
11
|
-
import { TooltipProvider } from '@box/blueprint-web';
|
|
11
|
+
import { Notification, TooltipProvider } from '@box/blueprint-web';
|
|
12
12
|
import { AxiosRequestConfig, AxiosResponse } from 'axios';
|
|
13
|
-
import type { Selection } from 'react-aria-components';
|
|
13
|
+
import type { Key, Selection } from 'react-aria-components';
|
|
14
|
+
import type { MetadataTemplateField } from '@box/metadata-editor';
|
|
14
15
|
|
|
15
16
|
import CreateFolderDialog from '../common/create-folder-dialog';
|
|
16
17
|
import UploadDialog from '../common/upload-dialog';
|
|
@@ -77,6 +78,7 @@ import {
|
|
|
77
78
|
import type { ViewMode } from '../common/flowTypes';
|
|
78
79
|
import type { ItemAction } from '../common/item';
|
|
79
80
|
import type { Theme } from '../common/theming';
|
|
81
|
+
import type { JSONPatchOperations } from '../../common/types/api';
|
|
80
82
|
import type { MetadataQuery, FieldsToShow } from '../../common/types/metadataQueries';
|
|
81
83
|
import type { MetadataFieldValue, MetadataTemplate } from '../../common/types/metadata';
|
|
82
84
|
import type {
|
|
@@ -100,6 +102,7 @@ import '../common/fonts.scss';
|
|
|
100
102
|
import '../common/base.scss';
|
|
101
103
|
import '../common/modal.scss';
|
|
102
104
|
import './ContentExplorer.scss';
|
|
105
|
+
import { withBlueprintModernization } from '../common/withBlueprintModernization';
|
|
103
106
|
|
|
104
107
|
const GRID_VIEW_MAX_COLUMNS = 7;
|
|
105
108
|
const GRID_VIEW_MIN_COLUMNS = 1;
|
|
@@ -152,7 +155,7 @@ export interface ContentExplorerProps {
|
|
|
152
155
|
rootFolderId?: string;
|
|
153
156
|
sharedLink?: string;
|
|
154
157
|
sharedLinkPassword?: string;
|
|
155
|
-
sortBy?: SortBy;
|
|
158
|
+
sortBy?: SortBy | Key;
|
|
156
159
|
sortDirection?: SortDirection;
|
|
157
160
|
staticHost?: string;
|
|
158
161
|
staticPath?: string;
|
|
@@ -491,6 +494,38 @@ class ContentExplorer extends Component<ContentExplorerProps, State> {
|
|
|
491
494
|
);
|
|
492
495
|
}
|
|
493
496
|
|
|
497
|
+
/**
|
|
498
|
+
* Update selected items' metadata instances based on original and new field values in the metadata instance form
|
|
499
|
+
*
|
|
500
|
+
* @private
|
|
501
|
+
* @return {void}
|
|
502
|
+
*/
|
|
503
|
+
updateMetadataV2 = async (
|
|
504
|
+
items: BoxItem[],
|
|
505
|
+
operations: JSONPatchOperations,
|
|
506
|
+
templateOldFields: MetadataTemplateField[],
|
|
507
|
+
templateNewFields: MetadataTemplateField[],
|
|
508
|
+
successCallback: () => void,
|
|
509
|
+
errorCallback: ErrorCallback,
|
|
510
|
+
) => {
|
|
511
|
+
if (items.length === 1) {
|
|
512
|
+
await this.metadataQueryAPIHelper.updateMetadataWithOperations(
|
|
513
|
+
items[0],
|
|
514
|
+
operations,
|
|
515
|
+
successCallback,
|
|
516
|
+
errorCallback,
|
|
517
|
+
);
|
|
518
|
+
} else {
|
|
519
|
+
await this.metadataQueryAPIHelper.bulkUpdateMetadata(
|
|
520
|
+
items,
|
|
521
|
+
templateOldFields,
|
|
522
|
+
templateNewFields,
|
|
523
|
+
successCallback,
|
|
524
|
+
errorCallback,
|
|
525
|
+
);
|
|
526
|
+
}
|
|
527
|
+
};
|
|
528
|
+
|
|
494
529
|
/**
|
|
495
530
|
* Resets the collection so that the loading bar starts showing
|
|
496
531
|
*
|
|
@@ -895,7 +930,7 @@ class ContentExplorer extends Component<ContentExplorerProps, State> {
|
|
|
895
930
|
* @param {string} sortDirection - sort direction
|
|
896
931
|
* @return {void}
|
|
897
932
|
*/
|
|
898
|
-
sort = (sortBy: SortBy, sortDirection: SortDirection) => {
|
|
933
|
+
sort = (sortBy: SortBy | Key, sortDirection: SortDirection) => {
|
|
899
934
|
const {
|
|
900
935
|
currentCollection: { id },
|
|
901
936
|
view,
|
|
@@ -1784,188 +1819,193 @@ class ContentExplorer extends Component<ContentExplorerProps, State> {
|
|
|
1784
1819
|
/* eslint-disable jsx-a11y/no-noninteractive-tabindex */
|
|
1785
1820
|
return (
|
|
1786
1821
|
<Internationalize language={language} messages={messages}>
|
|
1787
|
-
<
|
|
1788
|
-
<
|
|
1789
|
-
|
|
1790
|
-
<div
|
|
1791
|
-
<
|
|
1792
|
-
|
|
1793
|
-
|
|
1822
|
+
<Notification.Provider>
|
|
1823
|
+
<Notification.Viewport />
|
|
1824
|
+
<TooltipProvider container={this.rootElement}>
|
|
1825
|
+
<div id={this.id} className={styleClassName} ref={measureRef} data-testid="content-explorer">
|
|
1826
|
+
<ThemingStyles selector={`#${this.id}`} theme={theme} />
|
|
1827
|
+
<div className="be-app-element" onKeyDown={this.onKeyDown} tabIndex={0}>
|
|
1828
|
+
<div className="bce-ContentExplorer-main">
|
|
1829
|
+
{!isDefaultViewMetadata && (
|
|
1830
|
+
<Header view={view} logoUrl={logoUrl} onSearch={this.search} />
|
|
1831
|
+
)}
|
|
1832
|
+
|
|
1833
|
+
<SubHeader
|
|
1834
|
+
bulkItemActions={bulkItemActions}
|
|
1835
|
+
view={view}
|
|
1836
|
+
viewMode={viewMode}
|
|
1837
|
+
rootId={rootFolderId}
|
|
1838
|
+
isSmall={isSmall}
|
|
1839
|
+
rootName={rootName}
|
|
1840
|
+
currentCollection={currentCollection}
|
|
1841
|
+
canUpload={allowUpload}
|
|
1842
|
+
canCreateNewFolder={allowCreate}
|
|
1843
|
+
gridColumnCount={gridColumnCount}
|
|
1844
|
+
gridMaxColumns={GRID_VIEW_MAX_COLUMNS}
|
|
1845
|
+
gridMinColumns={GRID_VIEW_MIN_COLUMNS}
|
|
1846
|
+
maxGridColumnCountForWidth={maxGridColumnCount}
|
|
1847
|
+
onUpload={this.upload}
|
|
1848
|
+
onClearSelectedItemIds={this.clearSelectedItemIds}
|
|
1849
|
+
onCreate={this.createFolder}
|
|
1850
|
+
onGridViewSliderChange={this.onGridViewSliderChange}
|
|
1851
|
+
onItemClick={this.fetchFolder}
|
|
1852
|
+
onSortChange={this.sort}
|
|
1853
|
+
onMetadataSidePanelToggle={this.onMetadataSidePanelToggle}
|
|
1854
|
+
onViewModeChange={this.changeViewMode}
|
|
1855
|
+
portalElement={this.rootElement}
|
|
1856
|
+
selectedItemIds={selectedItemIds}
|
|
1857
|
+
title={title}
|
|
1858
|
+
/>
|
|
1859
|
+
|
|
1860
|
+
<Content
|
|
1861
|
+
canDelete={canDelete}
|
|
1862
|
+
canDownload={canDownload}
|
|
1863
|
+
canPreview={canPreview}
|
|
1864
|
+
canRename={canRename}
|
|
1865
|
+
canShare={canShare}
|
|
1866
|
+
currentCollection={currentCollection}
|
|
1867
|
+
features={features}
|
|
1868
|
+
gridColumnCount={Math.min(gridColumnCount, maxGridColumnCount)}
|
|
1869
|
+
isMedium={isMedium}
|
|
1870
|
+
isSmall={isSmall}
|
|
1871
|
+
isTouch={isTouch}
|
|
1872
|
+
itemActions={itemActions}
|
|
1873
|
+
fieldsToShow={fieldsToShow}
|
|
1874
|
+
metadataTemplate={metadataTemplate}
|
|
1875
|
+
metadataViewProps={metadataViewProps}
|
|
1876
|
+
onItemClick={this.onItemClick}
|
|
1877
|
+
onItemDelete={this.delete}
|
|
1878
|
+
onItemDownload={this.download}
|
|
1879
|
+
onItemPreview={this.preview}
|
|
1880
|
+
onItemRename={this.rename}
|
|
1881
|
+
onItemSelect={this.select}
|
|
1882
|
+
onItemShare={this.share}
|
|
1883
|
+
onMetadataUpdate={this.updateMetadata}
|
|
1884
|
+
onSortChange={this.sort}
|
|
1885
|
+
portalElement={this.rootElement}
|
|
1886
|
+
view={view}
|
|
1887
|
+
viewMode={viewMode}
|
|
1888
|
+
/>
|
|
1889
|
+
|
|
1890
|
+
{!isErrorView && (
|
|
1891
|
+
<Footer>
|
|
1892
|
+
<Pagination
|
|
1893
|
+
hasNextMarker={hasNextMarker}
|
|
1894
|
+
hasPrevMarker={hasPreviousMarker}
|
|
1895
|
+
isSmall={isSmall}
|
|
1896
|
+
offset={offset}
|
|
1897
|
+
onOffsetChange={this.paginate}
|
|
1898
|
+
pageSize={currentPageSize}
|
|
1899
|
+
totalCount={totalCount}
|
|
1900
|
+
onMarkerBasedPageChange={this.markerBasedPaginate}
|
|
1901
|
+
/>
|
|
1902
|
+
</Footer>
|
|
1903
|
+
)}
|
|
1904
|
+
</div>
|
|
1905
|
+
{isDefaultViewMetadata && isMetadataViewV2Feature && isMetadataSidePanelOpen && (
|
|
1906
|
+
<MetadataSidePanel
|
|
1907
|
+
currentCollection={currentCollection}
|
|
1908
|
+
metadataTemplate={metadataTemplate}
|
|
1909
|
+
onClose={this.closeMetadataSidePanel}
|
|
1910
|
+
onUpdate={this.updateMetadataV2}
|
|
1911
|
+
refreshCollection={this.refreshCollection}
|
|
1912
|
+
selectedItemIds={selectedItemIds}
|
|
1913
|
+
/>
|
|
1794
1914
|
)}
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
onCreate={this.createFolder}
|
|
1813
|
-
onGridViewSliderChange={this.onGridViewSliderChange}
|
|
1814
|
-
onItemClick={this.fetchFolder}
|
|
1815
|
-
onSortChange={this.sort}
|
|
1816
|
-
onMetadataSidePanelToggle={this.onMetadataSidePanelToggle}
|
|
1817
|
-
onViewModeChange={this.changeViewMode}
|
|
1818
|
-
portalElement={this.rootElement}
|
|
1819
|
-
selectedItemIds={selectedItemIds}
|
|
1820
|
-
title={title}
|
|
1915
|
+
</div>
|
|
1916
|
+
{allowUpload && !!this.appElement ? (
|
|
1917
|
+
<UploadDialog
|
|
1918
|
+
isOpen={isUploadModalOpen}
|
|
1919
|
+
currentFolderId={id}
|
|
1920
|
+
token={token}
|
|
1921
|
+
sharedLink={sharedLink}
|
|
1922
|
+
sharedLinkPassword={sharedLinkPassword}
|
|
1923
|
+
apiHost={apiHost}
|
|
1924
|
+
uploadHost={uploadHost}
|
|
1925
|
+
onClose={this.uploadSuccessHandler}
|
|
1926
|
+
parentElement={this.rootElement}
|
|
1927
|
+
appElement={this.appElement}
|
|
1928
|
+
onUpload={onUpload}
|
|
1929
|
+
contentUploaderProps={contentUploaderProps}
|
|
1930
|
+
requestInterceptor={requestInterceptor}
|
|
1931
|
+
responseInterceptor={responseInterceptor}
|
|
1821
1932
|
/>
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
isMedium={isMedium}
|
|
1833
|
-
isSmall={isSmall}
|
|
1834
|
-
isTouch={isTouch}
|
|
1835
|
-
itemActions={itemActions}
|
|
1836
|
-
fieldsToShow={fieldsToShow}
|
|
1837
|
-
metadataTemplate={metadataTemplate}
|
|
1838
|
-
metadataViewProps={metadataViewProps}
|
|
1839
|
-
onItemClick={this.onItemClick}
|
|
1840
|
-
onItemDelete={this.delete}
|
|
1841
|
-
onItemDownload={this.download}
|
|
1842
|
-
onItemPreview={this.preview}
|
|
1843
|
-
onItemRename={this.rename}
|
|
1844
|
-
onItemSelect={this.select}
|
|
1845
|
-
onItemShare={this.share}
|
|
1846
|
-
onMetadataUpdate={this.updateMetadata}
|
|
1847
|
-
onSortChange={this.sort}
|
|
1848
|
-
portalElement={this.rootElement}
|
|
1849
|
-
view={view}
|
|
1850
|
-
viewMode={viewMode}
|
|
1933
|
+
) : null}
|
|
1934
|
+
{allowCreate && !!this.appElement ? (
|
|
1935
|
+
<CreateFolderDialog
|
|
1936
|
+
isOpen={isCreateFolderModalOpen}
|
|
1937
|
+
onCreate={this.throttledCreateFolderCallback}
|
|
1938
|
+
onCancel={this.closeModals}
|
|
1939
|
+
isLoading={isLoading}
|
|
1940
|
+
errorCode={errorCode}
|
|
1941
|
+
parentElement={this.rootElement}
|
|
1942
|
+
appElement={this.appElement}
|
|
1851
1943
|
/>
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1944
|
+
) : null}
|
|
1945
|
+
{canDelete && selected && !!this.appElement ? (
|
|
1946
|
+
<DeleteConfirmationDialog
|
|
1947
|
+
isOpen={isDeleteModalOpen}
|
|
1948
|
+
onDelete={this.deleteCallback}
|
|
1949
|
+
onCancel={this.closeModals}
|
|
1950
|
+
item={selected}
|
|
1951
|
+
isLoading={isLoading}
|
|
1952
|
+
parentElement={this.rootElement}
|
|
1953
|
+
appElement={this.appElement}
|
|
1954
|
+
/>
|
|
1955
|
+
) : null}
|
|
1956
|
+
{canRename && selected && !!this.appElement ? (
|
|
1957
|
+
<RenameDialog
|
|
1958
|
+
isOpen={isRenameModalOpen}
|
|
1959
|
+
onRename={this.renameCallback}
|
|
1960
|
+
onCancel={this.closeModals}
|
|
1961
|
+
item={selected}
|
|
1962
|
+
isLoading={isLoading}
|
|
1963
|
+
errorCode={errorCode}
|
|
1964
|
+
parentElement={this.rootElement}
|
|
1965
|
+
appElement={this.appElement}
|
|
1966
|
+
/>
|
|
1967
|
+
) : null}
|
|
1968
|
+
{canShare && selected && !!this.appElement ? (
|
|
1969
|
+
<ShareDialog
|
|
1970
|
+
isOpen={isShareModalOpen}
|
|
1971
|
+
canSetShareAccess={canSetShareAccess}
|
|
1972
|
+
onShareAccessChange={this.changeShareAccess}
|
|
1973
|
+
onCancel={this.refreshCollection}
|
|
1974
|
+
item={selected}
|
|
1975
|
+
isLoading={isLoading}
|
|
1976
|
+
parentElement={this.rootElement}
|
|
1977
|
+
appElement={this.appElement}
|
|
1978
|
+
/>
|
|
1979
|
+
) : null}
|
|
1980
|
+
{canPreview && selected && !!this.appElement ? (
|
|
1981
|
+
<PreviewDialog
|
|
1982
|
+
isOpen={isPreviewModalOpen}
|
|
1983
|
+
isTouch={isTouch}
|
|
1984
|
+
onCancel={this.closeModals}
|
|
1985
|
+
item={selected}
|
|
1986
|
+
currentCollection={cloneDeep(currentCollection)}
|
|
1987
|
+
token={token}
|
|
1988
|
+
parentElement={this.rootElement}
|
|
1989
|
+
appElement={this.appElement}
|
|
1990
|
+
onPreview={onPreview}
|
|
1991
|
+
onDownload={onDownload}
|
|
1992
|
+
canDownload={canDownload}
|
|
1993
|
+
cache={this.api.getCache()}
|
|
1994
|
+
apiHost={apiHost}
|
|
1995
|
+
appHost={appHost}
|
|
1996
|
+
staticHost={staticHost}
|
|
1997
|
+
staticPath={staticPath}
|
|
1998
|
+
previewLibraryVersion={previewLibraryVersion}
|
|
1999
|
+
sharedLink={sharedLink}
|
|
2000
|
+
sharedLinkPassword={sharedLinkPassword}
|
|
2001
|
+
contentPreviewProps={contentPreviewProps}
|
|
2002
|
+
requestInterceptor={requestInterceptor}
|
|
2003
|
+
responseInterceptor={responseInterceptor}
|
|
1874
2004
|
/>
|
|
1875
|
-
)}
|
|
2005
|
+
) : null}
|
|
1876
2006
|
</div>
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
isOpen={isUploadModalOpen}
|
|
1880
|
-
currentFolderId={id}
|
|
1881
|
-
token={token}
|
|
1882
|
-
sharedLink={sharedLink}
|
|
1883
|
-
sharedLinkPassword={sharedLinkPassword}
|
|
1884
|
-
apiHost={apiHost}
|
|
1885
|
-
uploadHost={uploadHost}
|
|
1886
|
-
onClose={this.uploadSuccessHandler}
|
|
1887
|
-
parentElement={this.rootElement}
|
|
1888
|
-
appElement={this.appElement}
|
|
1889
|
-
onUpload={onUpload}
|
|
1890
|
-
contentUploaderProps={contentUploaderProps}
|
|
1891
|
-
requestInterceptor={requestInterceptor}
|
|
1892
|
-
responseInterceptor={responseInterceptor}
|
|
1893
|
-
/>
|
|
1894
|
-
) : null}
|
|
1895
|
-
{allowCreate && !!this.appElement ? (
|
|
1896
|
-
<CreateFolderDialog
|
|
1897
|
-
isOpen={isCreateFolderModalOpen}
|
|
1898
|
-
onCreate={this.throttledCreateFolderCallback}
|
|
1899
|
-
onCancel={this.closeModals}
|
|
1900
|
-
isLoading={isLoading}
|
|
1901
|
-
errorCode={errorCode}
|
|
1902
|
-
parentElement={this.rootElement}
|
|
1903
|
-
appElement={this.appElement}
|
|
1904
|
-
/>
|
|
1905
|
-
) : null}
|
|
1906
|
-
{canDelete && selected && !!this.appElement ? (
|
|
1907
|
-
<DeleteConfirmationDialog
|
|
1908
|
-
isOpen={isDeleteModalOpen}
|
|
1909
|
-
onDelete={this.deleteCallback}
|
|
1910
|
-
onCancel={this.closeModals}
|
|
1911
|
-
item={selected}
|
|
1912
|
-
isLoading={isLoading}
|
|
1913
|
-
parentElement={this.rootElement}
|
|
1914
|
-
appElement={this.appElement}
|
|
1915
|
-
/>
|
|
1916
|
-
) : null}
|
|
1917
|
-
{canRename && selected && !!this.appElement ? (
|
|
1918
|
-
<RenameDialog
|
|
1919
|
-
isOpen={isRenameModalOpen}
|
|
1920
|
-
onRename={this.renameCallback}
|
|
1921
|
-
onCancel={this.closeModals}
|
|
1922
|
-
item={selected}
|
|
1923
|
-
isLoading={isLoading}
|
|
1924
|
-
errorCode={errorCode}
|
|
1925
|
-
parentElement={this.rootElement}
|
|
1926
|
-
appElement={this.appElement}
|
|
1927
|
-
/>
|
|
1928
|
-
) : null}
|
|
1929
|
-
{canShare && selected && !!this.appElement ? (
|
|
1930
|
-
<ShareDialog
|
|
1931
|
-
isOpen={isShareModalOpen}
|
|
1932
|
-
canSetShareAccess={canSetShareAccess}
|
|
1933
|
-
onShareAccessChange={this.changeShareAccess}
|
|
1934
|
-
onCancel={this.refreshCollection}
|
|
1935
|
-
item={selected}
|
|
1936
|
-
isLoading={isLoading}
|
|
1937
|
-
parentElement={this.rootElement}
|
|
1938
|
-
appElement={this.appElement}
|
|
1939
|
-
/>
|
|
1940
|
-
) : null}
|
|
1941
|
-
{canPreview && selected && !!this.appElement ? (
|
|
1942
|
-
<PreviewDialog
|
|
1943
|
-
isOpen={isPreviewModalOpen}
|
|
1944
|
-
isTouch={isTouch}
|
|
1945
|
-
onCancel={this.closeModals}
|
|
1946
|
-
item={selected}
|
|
1947
|
-
currentCollection={cloneDeep(currentCollection)}
|
|
1948
|
-
token={token}
|
|
1949
|
-
parentElement={this.rootElement}
|
|
1950
|
-
appElement={this.appElement}
|
|
1951
|
-
onPreview={onPreview}
|
|
1952
|
-
onDownload={onDownload}
|
|
1953
|
-
canDownload={canDownload}
|
|
1954
|
-
cache={this.api.getCache()}
|
|
1955
|
-
apiHost={apiHost}
|
|
1956
|
-
appHost={appHost}
|
|
1957
|
-
staticHost={staticHost}
|
|
1958
|
-
staticPath={staticPath}
|
|
1959
|
-
previewLibraryVersion={previewLibraryVersion}
|
|
1960
|
-
sharedLink={sharedLink}
|
|
1961
|
-
sharedLinkPassword={sharedLinkPassword}
|
|
1962
|
-
contentPreviewProps={contentPreviewProps}
|
|
1963
|
-
requestInterceptor={requestInterceptor}
|
|
1964
|
-
responseInterceptor={responseInterceptor}
|
|
1965
|
-
/>
|
|
1966
|
-
) : null}
|
|
1967
|
-
</div>
|
|
1968
|
-
</TooltipProvider>
|
|
2007
|
+
</TooltipProvider>
|
|
2008
|
+
</Notification.Provider>
|
|
1969
2009
|
</Internationalize>
|
|
1970
2010
|
);
|
|
1971
2011
|
/* eslint-enable jsx-a11y/no-static-element-interactions */
|
|
@@ -1974,4 +2014,6 @@ class ContentExplorer extends Component<ContentExplorerProps, State> {
|
|
|
1974
2014
|
}
|
|
1975
2015
|
|
|
1976
2016
|
export { ContentExplorer as ContentExplorerComponent };
|
|
1977
|
-
export default flow([makeResponsive, withFeatureConsumer, withFeatureProvider])(
|
|
2017
|
+
export default flow([makeResponsive, withFeatureConsumer, withFeatureProvider, withBlueprintModernization])(
|
|
2018
|
+
ContentExplorer,
|
|
2019
|
+
);
|