@manuscripts/style-guide 1.13.12-LEAN-3771.0 → 1.13.12-LEAN-3645
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/cjs/components/FileManager/FileActions.js +134 -0
- package/dist/cjs/components/FileManager/FileContainer.js +39 -0
- package/dist/cjs/components/FileManager/FileCreatedDate.js +25 -0
- package/dist/cjs/components/FileManager/FileManager.js +60 -0
- package/dist/cjs/components/FileManager/FileManagerDragLayer.js +55 -0
- package/dist/cjs/components/FileManager/FileManagerProvider.js +39 -0
- package/dist/cjs/components/FileManager/FileName.js +27 -0
- package/dist/cjs/components/FileManager/FileSectionAlert.js +170 -0
- package/dist/cjs/components/FileManager/FileTypeIcon.js +20 -0
- package/dist/cjs/components/FileManager/FileUploader.js +85 -0
- package/dist/cjs/components/FileManager/InlineFilesSection.js +133 -0
- package/dist/cjs/components/FileManager/OtherFilesSection.js +101 -0
- package/dist/cjs/components/FileManager/SupplementsSection.js +118 -0
- package/dist/cjs/components/FileManager/index.js +32 -0
- package/dist/cjs/components/FileManager/util.js +138 -0
- package/dist/cjs/components/{TableFootnotesSelector.js → FootnotesSelector.js} +7 -7
- package/dist/cjs/components/InsertTableDialog.js +130 -0
- package/dist/cjs/components/Menus/Menus.js +19 -2
- package/dist/cjs/hooks/use-files.js +39 -0
- package/dist/cjs/hooks/use-menus.js +2 -2
- package/dist/cjs/index.js +5 -1
- package/dist/cjs/lib/files.js +77 -125
- package/dist/es/components/FileManager/FileActions.js +104 -0
- package/dist/es/components/FileManager/FileContainer.js +33 -0
- package/dist/es/components/FileManager/FileCreatedDate.js +18 -0
- package/dist/es/components/FileManager/FileManager.js +33 -0
- package/dist/es/components/FileManager/FileManagerDragLayer.js +48 -0
- package/dist/es/components/FileManager/FileManagerProvider.js +12 -0
- package/dist/es/components/FileManager/FileName.js +20 -0
- package/dist/es/components/FileManager/FileSectionAlert.js +163 -0
- package/dist/es/components/FileManager/FileTypeIcon.js +13 -0
- package/dist/es/components/FileManager/FileUploader.js +58 -0
- package/dist/es/components/FileManager/InlineFilesSection.js +103 -0
- package/dist/es/components/FileManager/OtherFilesSection.js +74 -0
- package/dist/es/components/FileManager/SupplementsSection.js +91 -0
- package/dist/es/components/FileManager/index.js +16 -0
- package/dist/es/components/FileManager/util.js +128 -0
- package/dist/es/components/{TableFootnotesSelector.js → FootnotesSelector.js} +5 -5
- package/dist/es/components/InsertTableDialog.js +100 -0
- package/dist/es/components/Menus/Menus.js +19 -2
- package/dist/es/hooks/use-files.js +35 -0
- package/dist/es/hooks/use-menus.js +2 -2
- package/dist/es/index.js +5 -1
- package/dist/es/lib/files.js +73 -117
- package/dist/types/components/FileManager/FileActions.d.ts +19 -0
- package/dist/types/components/FileManager/FileContainer.d.ts +1 -0
- package/dist/types/components/FileManager/FileCreatedDate.d.ts +8 -0
- package/dist/types/components/FileManager/FileManager.d.ts +30 -0
- package/dist/types/components/FileManager/FileManagerDragLayer.d.ts +2 -0
- package/dist/types/components/FileManager/FileManagerProvider.d.ts +15 -0
- package/dist/types/components/FileManager/FileName.d.ts +6 -0
- package/dist/types/components/FileManager/FileSectionAlert.d.ts +13 -0
- package/dist/types/components/FileManager/FileTypeIcon.d.ts +5 -0
- package/dist/types/components/FileManager/FileUploader.d.ts +5 -0
- package/dist/types/components/FileManager/InlineFilesSection.d.ts +6 -0
- package/dist/types/components/FileManager/OtherFilesSection.d.ts +5 -0
- package/dist/types/components/FileManager/SupplementsSection.d.ts +5 -0
- package/dist/types/components/FileManager/index.d.ts +16 -0
- package/dist/types/components/FileManager/util.d.ts +25 -0
- package/dist/types/components/{TableFootnotesSelector.d.ts → FootnotesSelector.d.ts} +2 -1
- package/dist/types/components/InsertTableDialog.d.ts +22 -0
- package/dist/types/components/Menus/Menus.d.ts +2 -2
- package/dist/types/hooks/use-files.d.ts +8 -0
- package/dist/types/hooks/use-menus.d.ts +2 -2
- package/dist/types/index.d.ts +5 -1
- package/dist/types/lib/files.d.ts +24 -19
- package/dist/types/lib/menus.d.ts +6 -1
- package/package.json +2 -2
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Model } from '@manuscripts/json-schema';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { DeleteModel, FileManagement, SaveModel } from './FileManager';
|
|
4
|
+
export declare const FileManagerContext: React.Context<{
|
|
5
|
+
saveModel: SaveModel;
|
|
6
|
+
deleteModel: DeleteModel;
|
|
7
|
+
modelMap: Map<string, Model>;
|
|
8
|
+
fileManagement: FileManagement;
|
|
9
|
+
}>;
|
|
10
|
+
export declare const FileManagerProvider: React.FC<{
|
|
11
|
+
saveModel: SaveModel;
|
|
12
|
+
deleteModel: DeleteModel;
|
|
13
|
+
modelMap: Map<string, Model>;
|
|
14
|
+
fileManagement: FileManagement;
|
|
15
|
+
}>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { FileAttachment } from '../../lib/files';
|
|
3
|
+
export declare const FileName: React.FC<{
|
|
4
|
+
file: FileAttachment;
|
|
5
|
+
}>;
|
|
6
|
+
export declare const FileNameText: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export declare enum FileSectionAlertType {
|
|
3
|
+
NONE = 0,
|
|
4
|
+
UPLOAD_IN_PROGRESS = 1,
|
|
5
|
+
UPLOAD_SUCCESSFUL = 2,
|
|
6
|
+
MOVE_SUCCESSFUL = 3
|
|
7
|
+
}
|
|
8
|
+
export declare const FileSectionAlert: React.FC<{
|
|
9
|
+
alert: {
|
|
10
|
+
type: FileSectionAlertType;
|
|
11
|
+
message: string;
|
|
12
|
+
};
|
|
13
|
+
}>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* © 2020 Atypon Systems LLC
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
export * from './FileManager';
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { FileAttachment } from '../../lib/files';
|
|
3
|
+
export declare enum FileSectionType {
|
|
4
|
+
Inline = "Inline files",
|
|
5
|
+
Supplements = "Supplements",
|
|
6
|
+
OtherFile = "Other files"
|
|
7
|
+
}
|
|
8
|
+
export declare enum FileType {
|
|
9
|
+
Image = 0,
|
|
10
|
+
Audio = 1,
|
|
11
|
+
Video = 2,
|
|
12
|
+
PlainDocument = 3,
|
|
13
|
+
SheetsWorkbooks = 4,
|
|
14
|
+
Latex = 5,
|
|
15
|
+
CodeFile = 6,
|
|
16
|
+
PdfFile = 7,
|
|
17
|
+
CompressedFile = 8,
|
|
18
|
+
PlainText = 9,
|
|
19
|
+
Figure = 10,
|
|
20
|
+
GraphicalAbstract = 11
|
|
21
|
+
}
|
|
22
|
+
export declare const getFileType: (file: FileAttachment) => FileType | undefined;
|
|
23
|
+
export declare const getFileIcon: (file: FileAttachment) => JSX.Element | undefined;
|
|
24
|
+
export declare const getFileTypeIcon: (type: FileType) => JSX.Element | undefined;
|
|
25
|
+
export declare const isImageFile: (file: FileAttachment) => boolean;
|
|
@@ -19,10 +19,11 @@ export type FootnoteWithIndex = {
|
|
|
19
19
|
node: FootnoteNode;
|
|
20
20
|
index?: string;
|
|
21
21
|
};
|
|
22
|
-
export declare const
|
|
22
|
+
export declare const FootnotesSelector: React.FC<{
|
|
23
23
|
notes: FootnoteWithIndex[];
|
|
24
24
|
inlineFootnote?: InlineFootnoteNode;
|
|
25
25
|
onAdd: () => void;
|
|
26
26
|
onInsert: (notes: FootnoteWithIndex[]) => void;
|
|
27
27
|
onCancel: () => void;
|
|
28
|
+
addNewLabel?: string;
|
|
28
29
|
}>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* © 2024 Atypon Systems LLC
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import React from 'react';
|
|
17
|
+
import { TableConfig } from '../lib/menus';
|
|
18
|
+
export declare const InsertTableDialog: React.FC<{
|
|
19
|
+
run: (tableConfig: TableConfig) => void;
|
|
20
|
+
open: boolean;
|
|
21
|
+
onClose: () => void;
|
|
22
|
+
}>;
|
|
@@ -14,11 +14,11 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import React, { Ref } from 'react';
|
|
17
|
-
import { Menu } from '../../lib/menus';
|
|
17
|
+
import { Menu, TableConfig } from '../../lib/menus';
|
|
18
18
|
interface MenusProps {
|
|
19
19
|
menus: Menu[];
|
|
20
20
|
innerRef: Ref<HTMLDivElement>;
|
|
21
|
-
handleClick: (position: number[]) => void;
|
|
21
|
+
handleClick: (position: number[], tableConfig?: TableConfig) => void;
|
|
22
22
|
}
|
|
23
23
|
export declare const Menus: React.FC<MenusProps>;
|
|
24
24
|
export declare const orderedListContextMenu: {
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Model } from '@manuscripts/json-schema';
|
|
2
|
+
import { ElementFiles, FileAttachment, ModelFile } from '../lib/files';
|
|
3
|
+
export declare const useFiles: (modelMap: Map<string, Model>, files: FileAttachment[]) => {
|
|
4
|
+
inlineFiles: ElementFiles[];
|
|
5
|
+
supplements: ModelFile[];
|
|
6
|
+
otherFiles: FileAttachment[];
|
|
7
|
+
};
|
|
8
|
+
export default useFiles;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { Menu, MenuSpec } from '../lib/menus';
|
|
2
|
+
import { Menu, MenuSpec, TableConfig } from '../lib/menus';
|
|
3
3
|
export declare const useMenus: (menus: MenuSpec[]) => {
|
|
4
4
|
menus: Menu[];
|
|
5
|
-
handleClick: (indices: number[]) => void;
|
|
5
|
+
handleClick: (indices: number[], tableConfig?: TableConfig) => void;
|
|
6
6
|
ref: import("react").RefObject<HTMLDivElement>;
|
|
7
7
|
};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -21,12 +21,15 @@ export * from './components/RadioButton';
|
|
|
21
21
|
export * from './components/AutoSaveInput';
|
|
22
22
|
export * from './components/Avatar';
|
|
23
23
|
export * from './components/Dialog';
|
|
24
|
+
export * from './components/InsertTableDialog';
|
|
24
25
|
export * from './components/Checkbox';
|
|
25
26
|
export * from './components/Form';
|
|
27
|
+
export * from './components/FileManager';
|
|
28
|
+
export * from './components/FileManager/util';
|
|
26
29
|
export * from './components/Resizer';
|
|
27
30
|
export * from './components/SaveStatus';
|
|
28
31
|
export * from './components/StyledModal';
|
|
29
|
-
export * from './components/
|
|
32
|
+
export * from './components/FootnotesSelector';
|
|
30
33
|
export * from './components/Sidebar';
|
|
31
34
|
export * from './components/RichText';
|
|
32
35
|
export * from './components/TextField';
|
|
@@ -47,6 +50,7 @@ export * from './components/RelativeDate';
|
|
|
47
50
|
export * from './components/Menus';
|
|
48
51
|
export * from './components/SelectField';
|
|
49
52
|
export * from './hooks/use-dropdown';
|
|
53
|
+
export * from './hooks/use-files';
|
|
50
54
|
export * from './hooks/use-menus';
|
|
51
55
|
export * from './hooks/use-scroll-detection';
|
|
52
56
|
export { useDeepCompareMemo, useDeepCompareCallback, } from './hooks/use-deep-compare';
|
|
@@ -1,19 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
export
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
1
|
+
import { Model } from '@manuscripts/json-schema';
|
|
2
|
+
import { FileType } from '../components/FileManager/util';
|
|
3
|
+
export type FileDesignation = {
|
|
4
|
+
id: string;
|
|
5
|
+
label?: string;
|
|
6
|
+
};
|
|
7
|
+
export type FileAttachment = {
|
|
8
|
+
id: string;
|
|
9
|
+
name: string;
|
|
10
|
+
type: FileDesignation;
|
|
11
|
+
createdDate?: Date;
|
|
12
|
+
};
|
|
13
|
+
export type ModelFile = FileAttachment & {
|
|
14
|
+
modelId: string;
|
|
15
|
+
};
|
|
16
|
+
export type ElementFiles = {
|
|
17
|
+
modelId: string;
|
|
18
|
+
label: string;
|
|
19
|
+
type: FileType;
|
|
20
|
+
files: ModelFile[];
|
|
21
|
+
};
|
|
22
|
+
export declare const isModelFile: (file: FileAttachment) => file is ModelFile;
|
|
23
|
+
export declare const getInlineFiles: (modelMap: Map<string, Model>, files: FileAttachment[]) => ElementFiles[];
|
|
24
|
+
export declare const getSupplements: (modelMap: Map<string, Model>, files: FileAttachment[]) => ModelFile[];
|
|
@@ -19,6 +19,11 @@ export interface MenuShortcut {
|
|
|
19
19
|
mac: string;
|
|
20
20
|
pc: string;
|
|
21
21
|
}
|
|
22
|
+
export type TableConfig = {
|
|
23
|
+
numberOfColumns: number;
|
|
24
|
+
numberOfRows: number;
|
|
25
|
+
includeHeader: boolean;
|
|
26
|
+
};
|
|
22
27
|
export interface MenuSpec {
|
|
23
28
|
id: string;
|
|
24
29
|
label: string;
|
|
@@ -26,7 +31,7 @@ export interface MenuSpec {
|
|
|
26
31
|
shortcut?: MenuShortcut;
|
|
27
32
|
isActive?: boolean;
|
|
28
33
|
isEnabled: boolean;
|
|
29
|
-
run?: () => void;
|
|
34
|
+
run?: (tableConfig?: TableConfig) => void;
|
|
30
35
|
submenu?: (MenuSpec | MenuSeparator)[];
|
|
31
36
|
options?: {
|
|
32
37
|
[key: string]: () => void;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@manuscripts/style-guide",
|
|
3
3
|
"description": "Shared components for Manuscripts applications",
|
|
4
|
-
"version": "1.13.12-LEAN-
|
|
4
|
+
"version": "1.13.12-LEAN-3645",
|
|
5
5
|
"repository": "github:Atypon-OpenSource/manuscripts-style-guide",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|
|
@@ -109,4 +109,4 @@
|
|
|
109
109
|
"@types/react": "^17.0.2",
|
|
110
110
|
"jackspeak": "2.1.1"
|
|
111
111
|
}
|
|
112
|
-
}
|
|
112
|
+
}
|