@manuscripts/article-editor 1.16.17 → 1.16.19-LEAN-3771.0

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.
Files changed (100) hide show
  1. package/dist/cjs/EditorApp.js +2 -1
  2. package/dist/cjs/EditorApp.js.map +1 -1
  3. package/dist/cjs/components/FileManager/FileActions.js +136 -0
  4. package/dist/cjs/components/FileManager/FileActions.js.map +1 -0
  5. package/dist/cjs/components/FileManager/FileContainer.js +51 -0
  6. package/dist/cjs/components/FileManager/FileContainer.js.map +1 -0
  7. package/dist/cjs/components/FileManager/FileCreatedDate.js +26 -0
  8. package/dist/cjs/components/FileManager/FileCreatedDate.js.map +1 -0
  9. package/dist/cjs/components/FileManager/FileManager.js +68 -0
  10. package/dist/cjs/components/FileManager/FileManager.js.map +1 -0
  11. package/dist/cjs/components/FileManager/FileManagerDragLayer.js +67 -0
  12. package/dist/cjs/components/FileManager/FileManagerDragLayer.js.map +1 -0
  13. package/dist/cjs/components/FileManager/FileName.js +28 -0
  14. package/dist/cjs/components/FileManager/FileName.js.map +1 -0
  15. package/dist/cjs/components/FileManager/FileSectionAlert.js +181 -0
  16. package/dist/cjs/components/FileManager/FileSectionAlert.js.map +1 -0
  17. package/dist/cjs/components/FileManager/FileTypeIcon.js +24 -0
  18. package/dist/cjs/components/FileManager/FileTypeIcon.js.map +1 -0
  19. package/dist/cjs/components/FileManager/FileUploader.js +100 -0
  20. package/dist/cjs/components/FileManager/FileUploader.js.map +1 -0
  21. package/dist/cjs/components/FileManager/InlineFilesSection.js +158 -0
  22. package/dist/cjs/components/FileManager/InlineFilesSection.js.map +1 -0
  23. package/dist/cjs/components/FileManager/OtherFilesSection.js +109 -0
  24. package/dist/cjs/components/FileManager/OtherFilesSection.js.map +1 -0
  25. package/dist/cjs/components/FileManager/SupplementsSection.js +131 -0
  26. package/dist/cjs/components/FileManager/SupplementsSection.js.map +1 -0
  27. package/dist/cjs/components/projects/EditorElement.js +9 -12
  28. package/dist/cjs/components/projects/EditorElement.js.map +1 -1
  29. package/dist/cjs/components/projects/Inspector.js +2 -3
  30. package/dist/cjs/components/projects/Inspector.js.map +1 -1
  31. package/dist/cjs/lib/attrs-change-filter.js.map +1 -1
  32. package/dist/cjs/postgres-data/PsSource.js +11 -0
  33. package/dist/cjs/postgres-data/PsSource.js.map +1 -1
  34. package/dist/cjs/postgres-data/buildUtilities.js +5 -11
  35. package/dist/cjs/postgres-data/buildUtilities.js.map +1 -1
  36. package/dist/cjs/postgres-data/savingUtilities.js +1 -24
  37. package/dist/cjs/postgres-data/savingUtilities.js.map +1 -1
  38. package/dist/cjs/store/Store.js.map +1 -1
  39. package/dist/cjs/store/StoreContext.js +1 -2
  40. package/dist/cjs/store/StoreContext.js.map +1 -1
  41. package/dist/es/EditorApp.js +2 -1
  42. package/dist/es/EditorApp.js.map +1 -1
  43. package/dist/es/components/FileManager/FileActions.js +106 -0
  44. package/dist/es/components/FileManager/FileActions.js.map +1 -0
  45. package/dist/es/components/FileManager/FileContainer.js +45 -0
  46. package/dist/es/components/FileManager/FileContainer.js.map +1 -0
  47. package/dist/es/components/FileManager/FileCreatedDate.js +19 -0
  48. package/dist/es/components/FileManager/FileCreatedDate.js.map +1 -0
  49. package/dist/es/components/FileManager/FileManager.js +61 -0
  50. package/dist/es/components/FileManager/FileManager.js.map +1 -0
  51. package/dist/es/components/FileManager/FileManagerDragLayer.js +60 -0
  52. package/dist/es/components/FileManager/FileManagerDragLayer.js.map +1 -0
  53. package/dist/es/components/FileManager/FileName.js +21 -0
  54. package/dist/es/components/FileManager/FileName.js.map +1 -0
  55. package/dist/es/components/FileManager/FileSectionAlert.js +174 -0
  56. package/dist/es/components/FileManager/FileSectionAlert.js.map +1 -0
  57. package/dist/es/components/FileManager/FileTypeIcon.js +17 -0
  58. package/dist/es/components/FileManager/FileTypeIcon.js.map +1 -0
  59. package/dist/es/components/FileManager/FileUploader.js +73 -0
  60. package/dist/es/components/FileManager/FileUploader.js.map +1 -0
  61. package/dist/es/components/FileManager/InlineFilesSection.js +128 -0
  62. package/dist/es/components/FileManager/InlineFilesSection.js.map +1 -0
  63. package/dist/es/components/FileManager/OtherFilesSection.js +82 -0
  64. package/dist/es/components/FileManager/OtherFilesSection.js.map +1 -0
  65. package/dist/es/components/FileManager/SupplementsSection.js +104 -0
  66. package/dist/es/components/FileManager/SupplementsSection.js.map +1 -0
  67. package/dist/es/components/projects/EditorElement.js +10 -13
  68. package/dist/es/components/projects/EditorElement.js.map +1 -1
  69. package/dist/es/components/projects/Inspector.js +3 -4
  70. package/dist/es/components/projects/Inspector.js.map +1 -1
  71. package/dist/es/lib/attrs-change-filter.js.map +1 -1
  72. package/dist/es/postgres-data/PsSource.js +11 -0
  73. package/dist/es/postgres-data/PsSource.js.map +1 -1
  74. package/dist/es/postgres-data/buildUtilities.js +5 -11
  75. package/dist/es/postgres-data/buildUtilities.js.map +1 -1
  76. package/dist/es/postgres-data/savingUtilities.js +0 -22
  77. package/dist/es/postgres-data/savingUtilities.js.map +1 -1
  78. package/dist/es/store/Store.js.map +1 -1
  79. package/dist/es/store/StoreContext.js +1 -2
  80. package/dist/es/store/StoreContext.js.map +1 -1
  81. package/dist/types/EditorApp.d.ts +1 -1
  82. package/dist/types/components/FileManager/FileActions.d.ts +21 -0
  83. package/dist/types/components/FileManager/FileContainer.d.ts +1 -0
  84. package/dist/types/components/FileManager/FileCreatedDate.d.ts +19 -0
  85. package/dist/types/components/FileManager/FileManager.d.ts +23 -0
  86. package/dist/types/components/FileManager/FileManagerDragLayer.d.ts +13 -0
  87. package/dist/types/components/FileManager/FileName.d.ts +17 -0
  88. package/dist/types/components/FileManager/FileSectionAlert.d.ts +13 -0
  89. package/dist/types/components/FileManager/FileTypeIcon.d.ts +20 -0
  90. package/dist/types/components/FileManager/FileUploader.d.ts +19 -0
  91. package/dist/types/components/FileManager/InlineFilesSection.d.ts +17 -0
  92. package/dist/types/components/FileManager/OtherFilesSection.d.ts +19 -0
  93. package/dist/types/components/FileManager/SupplementsSection.d.ts +20 -0
  94. package/dist/types/lib/attrs-change-filter.d.ts +1 -1
  95. package/dist/types/postgres-data/PsSource.d.ts +1 -1
  96. package/dist/types/postgres-data/savingUtilities.d.ts +0 -1
  97. package/dist/types/store/DataSourceStrategy.d.ts +1 -1
  98. package/dist/types/store/Store.d.ts +1 -2
  99. package/dist/types/store/StoreContext.d.ts +1 -2
  100. package/package.json +3 -3
@@ -0,0 +1,60 @@
1
+ /*!
2
+ * The contents of this file are subject to the Common Public Attribution License Version 1.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://mpapp-public.gitlab.io/manuscripts-frontend/LICENSE. The License is based on the Mozilla Public License Version 1.1 but Sections 14 and 15 have been added to cover use of software over a computer network and provide for limited attribution for the Original Developer. In addition, Exhibit A has been modified to be consistent with Exhibit B.
3
+ *
4
+ * Software distributed under the License is distributed on an “AS IS” basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License.
5
+ *
6
+ * The Original Code is manuscripts-frontend.
7
+ *
8
+ * The Original Developer is the Initial Developer. The Initial Developer of the Original Code is Atypon Systems LLC.
9
+ *
10
+ * All portions of the code written by Atypon Systems LLC are Copyright (c) 2024 Atypon Systems LLC. All Rights Reserved.
11
+ */
12
+ import React from 'react';
13
+ import { useDragLayer } from 'react-dnd';
14
+ import styled from 'styled-components';
15
+ import { FileContainer } from './FileContainer';
16
+ import { FileCreatedDate } from './FileCreatedDate';
17
+ import { FileName } from './FileName';
18
+ const Container = styled.div `
19
+ position: fixed;
20
+ pointer-events: none;
21
+ z-index: 999;
22
+ left: 0;
23
+ top: 0;
24
+ max-width: 400px;
25
+ `;
26
+ const DraggableFileContainer = styled(FileContainer) `
27
+ padding: 16px 32px;
28
+ background: #f2fbfc;
29
+ border: 1px solid #bce7f6;
30
+ box-shadow: 0 4px 9px rgba(0, 0, 0, 0.3);
31
+ border-radius: 6px;
32
+ `;
33
+ const getItemStyles = (currentOffset) => {
34
+ if (!currentOffset) {
35
+ return {
36
+ display: 'none',
37
+ };
38
+ }
39
+ const { x, y } = currentOffset;
40
+ const transform = `translate(${x}px, ${y}px)`;
41
+ return {
42
+ transform,
43
+ WebkitTransform: transform,
44
+ };
45
+ };
46
+ export const FileManagerDragLayer = () => {
47
+ const { itemType, isDragging, item, currentOffset } = useDragLayer((monitor) => ({
48
+ item: monitor.getItem(),
49
+ itemType: monitor.getItemType(),
50
+ currentOffset: monitor.getSourceClientOffset(),
51
+ isDragging: monitor.isDragging(),
52
+ }));
53
+ if (!isDragging) {
54
+ return null;
55
+ }
56
+ return (React.createElement(Container, { style: getItemStyles(currentOffset) }, itemType === 'file' && (React.createElement(DraggableFileContainer, null,
57
+ React.createElement(FileName, { file: item.file }),
58
+ item.file.createdDate && React.createElement(FileCreatedDate, { file: item.file })))));
59
+ };
60
+ //# sourceMappingURL=FileManagerDragLayer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FileManagerDragLayer.js","sourceRoot":"","sources":["../../../../src/components/FileManager/FileManagerDragLayer.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,YAAY,EAAW,MAAM,WAAW,CAAA;AACjD,OAAO,MAAM,MAAM,mBAAmB,CAAA;AAEtC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAErC,MAAM,SAAS,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;;;CAO3B,CAAA;AAED,MAAM,sBAAsB,GAAG,MAAM,CAAC,aAAa,CAAC,CAAA;;;;;;CAMnD,CAAA;AAED,MAAM,aAAa,GAAG,CAAC,aAA6B,EAAE,EAAE;IACtD,IAAI,CAAC,aAAa,EAAE;QAClB,OAAO;YACL,OAAO,EAAE,MAAM;SAChB,CAAA;KACF;IAED,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,aAAa,CAAA;IAE9B,MAAM,SAAS,GAAG,aAAa,CAAC,OAAO,CAAC,KAAK,CAAA;IAC7C,OAAO;QACL,SAAS;QACT,eAAe,EAAE,SAAS;KAC3B,CAAA;AACH,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,oBAAoB,GAAa,GAAG,EAAE;IACjD,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,IAAI,EAAE,aAAa,EAAE,GAAG,YAAY,CAChE,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;QACZ,IAAI,EAAE,OAAO,CAAC,OAAO,EAAE;QACvB,QAAQ,EAAE,OAAO,CAAC,WAAW,EAAE;QAC/B,aAAa,EAAE,OAAO,CAAC,qBAAqB,EAAE;QAC9C,UAAU,EAAE,OAAO,CAAC,UAAU,EAAE;KACjC,CAAC,CACH,CAAA;IAED,IAAI,CAAC,UAAU,EAAE;QACf,OAAO,IAAI,CAAA;KACZ;IAED,OAAO,CACL,oBAAC,SAAS,IAAC,KAAK,EAAE,aAAa,CAAC,aAAa,CAAC,IAC3C,QAAQ,KAAK,MAAM,IAAI,CACtB,oBAAC,sBAAsB;QACrB,oBAAC,QAAQ,IAAC,IAAI,EAAE,IAAI,CAAC,IAAI,GAAI;QAC5B,IAAI,CAAC,IAAI,CAAC,WAAW,IAAI,oBAAC,eAAe,IAAC,IAAI,EAAE,IAAI,CAAC,IAAI,GAAI,CACvC,CAC1B,CACS,CACb,CAAA;AACH,CAAC,CAAA"}
@@ -0,0 +1,21 @@
1
+ import React from 'react';
2
+ import styled from 'styled-components';
3
+ import { FileTypeIcon } from './FileTypeIcon';
4
+ export const FileName = ({ file }) => {
5
+ return (React.createElement(React.Fragment, null,
6
+ React.createElement(FileTypeIcon, { file: file }),
7
+ React.createElement(FileNameText, { "data-cy": "filename" }, file.name)));
8
+ };
9
+ export const FileNameText = styled.div `
10
+ font-family: ${(props) => props.theme.font.family.Lato};
11
+ font-size: ${(props) => props.theme.font.size.medium};
12
+ line-height: ${(props) => props.theme.font.lineHeight.large};
13
+ font-weight: ${(props) => props.theme.font.weight.normal};
14
+ color: ${(props) => props.theme.colors.text.primary};
15
+ margin-left: ${(props) => props.theme.grid.unit * 2}px;
16
+ flex-grow: 1;
17
+ overflow: hidden;
18
+ white-space: nowrap;
19
+ text-overflow: ellipsis;
20
+ `;
21
+ //# sourceMappingURL=FileName.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FileName.js","sourceRoot":"","sources":["../../../../src/components/FileManager/FileName.tsx"],"names":[],"mappings":"AAYA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,MAAM,MAAM,mBAAmB,CAAA;AAEtC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAE7C,MAAM,CAAC,MAAM,QAAQ,GAEhB,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE;IAChB,OAAO,CACL;QACE,oBAAC,YAAY,IAAC,IAAI,EAAE,IAAI,GAAI;QAC5B,oBAAC,YAAY,eAAS,UAAU,IAAE,IAAI,CAAC,IAAI,CAAgB,CAC1D,CACJ,CAAA;AACH,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,YAAY,GAAG,MAAM,CAAC,GAAG,CAAA;iBACrB,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI;eACzC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM;iBACrC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK;iBAC5C,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM;WAC/C,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO;iBACpC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC;;;;;CAKpD,CAAA"}
@@ -0,0 +1,174 @@
1
+ /*!
2
+ * The contents of this file are subject to the Common Public Attribution License Version 1.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://mpapp-public.gitlab.io/manuscripts-frontend/LICENSE. The License is based on the Mozilla Public License Version 1.1 but Sections 14 and 15 have been added to cover use of software over a computer network and provide for limited attribution for the Original Developer. In addition, Exhibit A has been modified to be consistent with Exhibit B.
3
+ *
4
+ * Software distributed under the License is distributed on an “AS IS” basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License.
5
+ *
6
+ * The Original Code is manuscripts-frontend.
7
+ *
8
+ * The Original Developer is the Initial Developer. The Initial Developer of the Original Code is Atypon Systems LLC.
9
+ *
10
+ * All portions of the code written by Atypon Systems LLC are Copyright (c) 2024 Atypon Systems LLC. All Rights Reserved.
11
+ */
12
+ import { AlertMessage, AlertMessageType, FileUnknownIcon, } from '@manuscripts/style-guide';
13
+ import React from 'react';
14
+ import styled from 'styled-components';
15
+ import { FileContainer } from './FileContainer';
16
+ import { FileNameText } from './FileName';
17
+ export var FileSectionAlertType;
18
+ (function (FileSectionAlertType) {
19
+ FileSectionAlertType[FileSectionAlertType["NONE"] = 0] = "NONE";
20
+ FileSectionAlertType[FileSectionAlertType["UPLOAD_IN_PROGRESS"] = 1] = "UPLOAD_IN_PROGRESS";
21
+ FileSectionAlertType[FileSectionAlertType["UPLOAD_SUCCESSFUL"] = 2] = "UPLOAD_SUCCESSFUL";
22
+ FileSectionAlertType[FileSectionAlertType["MOVE_SUCCESSFUL"] = 3] = "MOVE_SUCCESSFUL";
23
+ })(FileSectionAlertType || (FileSectionAlertType = {}));
24
+ export const FileSectionAlert = ({ alert }) => {
25
+ return (React.createElement(React.Fragment, null,
26
+ alert.type === FileSectionAlertType.UPLOAD_IN_PROGRESS && (React.createElement(FileUploadInProgressAlert, { name: alert.message })),
27
+ alert.type === FileSectionAlertType.UPLOAD_SUCCESSFUL && (React.createElement(FileUploadSuccessful, null)),
28
+ alert.type === FileSectionAlertType.MOVE_SUCCESSFUL && (React.createElement(FileMoveSuccessful, { name: alert.message }))));
29
+ };
30
+ const FileUploadInProgressAlert = ({ name }) => {
31
+ return (React.createElement(FileUploadContainer, null,
32
+ React.createElement(FileUnknownIcon, null),
33
+ React.createElement(FileUploadNameContainer, null,
34
+ React.createElement(UploadFileNameText, null, name),
35
+ React.createElement(FileUploadProgressBar, null))));
36
+ };
37
+ const FileUploadSuccessful = () => {
38
+ return (React.createElement(AlertMessageContainer, null,
39
+ React.createElement(AlertMessage, { type: AlertMessageType.success, hideCloseButton: true, dismissButton: {
40
+ text: 'OK',
41
+ } }, "File uploaded successfully")));
42
+ };
43
+ const FileMoveSuccessful = ({ name }) => {
44
+ return (React.createElement(AlertMessageContainer, null,
45
+ React.createElement(AlertMessage, { type: AlertMessageType.success, hideCloseButton: true, dismissButton: {
46
+ text: 'OK',
47
+ } },
48
+ "File moved to ",
49
+ name)));
50
+ };
51
+ const AlertMessageContainer = styled.div `
52
+ margin-left: 16px;
53
+ margin-right: 16px;
54
+ `;
55
+ const FileUploadContainer = styled(FileContainer) `
56
+ background: #f2fbfc;
57
+ `;
58
+ const FileUploadNameContainer = styled.div `
59
+ flex-grow: 1;
60
+ margin-left: 8px;
61
+ `;
62
+ const UploadFileNameText = styled(FileNameText) `
63
+ margin: 0;
64
+ `;
65
+ const FileUploadProgressBar = () => {
66
+ return (React.createElement(LinearProgress, null,
67
+ React.createElement(Bar, { className: "bar1" }),
68
+ React.createElement(Bar, { className: "bar2" })));
69
+ };
70
+ const LinearProgress = styled.div `
71
+ background: ${(props) => props.theme.colors.background.tertiary};
72
+ opacity: 0.7;
73
+ height: 4px;
74
+ position: relative;
75
+ width: 100%;
76
+ margin: 8px auto 0;
77
+ overflow: hidden;
78
+ border-radius: 8px;
79
+ animation: start 0.3s ease-in;
80
+ `;
81
+ const Bar = styled.div `
82
+ position: absolute;
83
+ opacity: 0.7;
84
+ background: #1a9bc7;
85
+ transition: transform 0.2s linear;
86
+ left: 0;
87
+ top: 0;
88
+ bottom: 0;
89
+ width: 100%;
90
+
91
+ &.bar1 {
92
+ animation: growBar1 2.5s infinite, moveBar1 2.5s infinite;
93
+ }
94
+
95
+ &.bar2 {
96
+ animation: growBar2 2.5s infinite, moveBar2 2.5s infinite;
97
+ }
98
+
99
+ @keyframes growBar1 {
100
+ 0% {
101
+ animation-timing-function: linear;
102
+ transform: scaleX(0.1);
103
+ }
104
+ 35% {
105
+ animation-timing-function: cubic-bezier(0.3, 0.1, 0.7, 1);
106
+ transform: scaleX(0.1);
107
+ }
108
+ 70% {
109
+ animation-timing-function: cubic-bezier(0.2, 0, 0.2, 1.4);
110
+ transform: scaleX(0.8);
111
+ }
112
+ 100% {
113
+ transform: scaleX(0.1);
114
+ }
115
+ }
116
+
117
+ @keyframes moveBar1 {
118
+ 0% {
119
+ left: -105%;
120
+ animation-timing-function: linear;
121
+ }
122
+ 20% {
123
+ left: -105%;
124
+ animation-timing-function: cubic-bezier(0.5, 0, 0.7, 0.4);
125
+ }
126
+ 60% {
127
+ left: 21%;
128
+ animation-timing-function: cubic-bezier(0.3, 0.4, 0.55, 0.9);
129
+ }
130
+ 80% {
131
+ left: 40%;
132
+ animation-timing-function: cubic-bezier(0.1, 0.2, 0.3, 0.95);
133
+ }
134
+ 100% {
135
+ left: 90%;
136
+ }
137
+ }
138
+
139
+ @keyframes growBar2 {
140
+ 0% {
141
+ animation-timing-function: cubic-bezier(0.2, 0, 0.5, 0.4);
142
+ transform: scaleX(0.1);
143
+ }
144
+ 20% {
145
+ animation-timing-function: cubic-bezier(0.1, 0.2, 0.6, 1);
146
+ transform: scaleX(0.3);
147
+ }
148
+ 60% {
149
+ animation-timing-function: cubic-bezier(0.2, 0, 0.2, 1.4);
150
+ transform: scaleX(0.6);
151
+ }
152
+ 100% {
153
+ transform: scaleX(0.1);
154
+ }
155
+ }
156
+ @keyframes moveBar2 {
157
+ 0% {
158
+ left: -100%;
159
+ animation-timing-function: cubic-bezier(0.15, 0, 0.5, 0.4);
160
+ }
161
+ 25% {
162
+ left: -50%;
163
+ animation-timing-function: cubic-bezier(0.3, 0.3, 0.8, 0.7);
164
+ }
165
+ 50% {
166
+ left: 45%;
167
+ animation-timing-function: cubic-bezier(0.1, 0.6, 0.6, 0.9);
168
+ }
169
+ 100% {
170
+ left: 95%;
171
+ }
172
+ }
173
+ `;
174
+ //# sourceMappingURL=FileSectionAlert.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FileSectionAlert.js","sourceRoot":"","sources":["../../../../src/components/FileManager/FileSectionAlert.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,eAAe,GAChB,MAAM,0BAA0B,CAAA;AACjC,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,MAAM,MAAM,mBAAmB,CAAA;AAEtC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAEzC,MAAM,CAAN,IAAY,oBAKX;AALD,WAAY,oBAAoB;IAC9B,+DAAI,CAAA;IACJ,2FAAkB,CAAA;IAClB,yFAAiB,CAAA;IACjB,qFAAe,CAAA;AACjB,CAAC,EALW,oBAAoB,KAApB,oBAAoB,QAK/B;AAED,MAAM,CAAC,MAAM,gBAAgB,GAExB,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;IACjB,OAAO,CACL;QACG,KAAK,CAAC,IAAI,KAAK,oBAAoB,CAAC,kBAAkB,IAAI,CACzD,oBAAC,yBAAyB,IAAC,IAAI,EAAE,KAAK,CAAC,OAAO,GAAI,CACnD;QACA,KAAK,CAAC,IAAI,KAAK,oB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AC,CAAA;;CAE9C,CAAA;AAED,MAAM,qBAAqB,GAAa,GAAG,EAAE;IAC3C,OAAO,CACL,oBAAC,cAAc;QACb,oBAAC,GAAG,IAAC,SAAS,EAAC,MAAM,GAAO;QAC5B,oBAAC,GAAG,IAAC,SAAS,EAAC,MAAM,GAAO,CACb,CAClB,CAAA;AACH,CAAC,CAAA;AAED,MAAM,cAAc,GAAG,MAAM,CAAC,GAAG,CAAA;gBACjB,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,QAAQ;;;;;;;;;CAShE,CAAA;AACD,MAAM,GAAG,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4FrB,CAAA"}
@@ -0,0 +1,17 @@
1
+ import { FileCorruptedIcon, FileMainDocumentIcon, FileUnknownIcon, getFileIcon, } from '@manuscripts/style-guide';
2
+ import React from 'react';
3
+ /**
4
+ * Each file item has an icon to represent besides the file info based on the file extension,
5
+ * in case the file type is an image or video then the icon should be the preview image or video thumbnail.
6
+ */
7
+ export const FileTypeIcon = ({ file }) => {
8
+ if (file.type.id === 'missing') {
9
+ return React.createElement(FileCorruptedIcon, { className: "file-icon" });
10
+ }
11
+ if (file.type.id === 'main-manuscript') {
12
+ return React.createElement(FileMainDocumentIcon, { className: "file-icon" });
13
+ }
14
+ const icon = getFileIcon(file.name);
15
+ return icon || React.createElement(FileUnknownIcon, { className: "file-icon" });
16
+ };
17
+ //# sourceMappingURL=FileTypeIcon.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FileTypeIcon.js","sourceRoot":"","sources":["../../../../src/components/FileManager/FileTypeIcon.tsx"],"names":[],"mappings":"AAYA,OAAO,EACL,iBAAiB,EACjB,oBAAoB,EACpB,eAAe,EACf,WAAW,GACZ,MAAM,0BAA0B,CAAA;AACjC,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB;;;GAGG;AACH,MAAM,CAAC,MAAM,YAAY,GAEpB,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE;IAChB,IAAI,IAAI,CAAC,IAAI,CAAC,EAAE,KAAK,SAAS,EAAE;QAC9B,OAAO,oBAAC,iBAAiB,IAAC,SAAS,EAAC,WAAW,GAAG,CAAA;KACnD;IACD,IAAI,IAAI,CAAC,IAAI,CAAC,EAAE,KAAK,iBAAiB,EAAE;QACtC,OAAO,oBAAC,oBAAoB,IAAC,SAAS,EAAC,WAAW,GAAG,CAAA;KACtD;IAED,MAAM,IAAI,GAAG,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IAEnC,OAAO,IAAI,IAAI,oBAAC,eAAe,IAAC,SAAS,EAAC,WAAW,GAAG,CAAA;AAC1D,CAAC,CAAA"}
@@ -0,0 +1,73 @@
1
+ /*!
2
+ * The contents of this file are subject to the Common Public Attribution License Version 1.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://mpapp-public.gitlab.io/manuscripts-frontend/LICENSE. The License is based on the Mozilla Public License Version 1.1 but Sections 14 and 15 have been added to cover use of software over a computer network and provide for limited attribution for the Original Developer. In addition, Exhibit A has been modified to be consistent with Exhibit B.
3
+ *
4
+ * Software distributed under the License is distributed on an “AS IS” basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License.
5
+ *
6
+ * The Original Code is manuscripts-frontend.
7
+ *
8
+ * The Original Developer is the Initial Developer. The Initial Developer of the Original Code is Atypon Systems LLC.
9
+ *
10
+ * All portions of the code written by Atypon Systems LLC are Copyright (c) 2024 Atypon Systems LLC. All Rights Reserved.
11
+ */
12
+ import React, { useRef } from 'react';
13
+ import { useDrop } from 'react-dnd';
14
+ import { NativeTypes } from 'react-dnd-html5-backend';
15
+ import styled, { css } from 'styled-components';
16
+ /**
17
+ * This component will show the drag or upload file area
18
+ */
19
+ export const FileUploader = ({ onUpload }) => {
20
+ const fileInputRef = useRef(null);
21
+ const openFileDialog = () => {
22
+ if (fileInputRef && fileInputRef.current) {
23
+ fileInputRef.current.click();
24
+ }
25
+ };
26
+ const handleChange = (event) => {
27
+ if (event && event.target && event.target.files) {
28
+ const file = event.target.files[0];
29
+ onUpload(file);
30
+ }
31
+ };
32
+ const [{ canDrop, isOver }, dropRef] = useDrop({
33
+ accept: [NativeTypes.FILE],
34
+ drop: (item) => {
35
+ const file = item.files[0];
36
+ onUpload(file);
37
+ },
38
+ collect: (monitor) => ({
39
+ isOver: monitor.isOver(),
40
+ canDrop: monitor.canDrop(),
41
+ }),
42
+ });
43
+ const isActive = canDrop && isOver;
44
+ return (React.createElement(Container, { ref: dropRef, "data-cy": "file-uploader", active: isActive, onClick: openFileDialog },
45
+ React.createElement("input", { ref: fileInputRef, type: "file", style: { display: 'none' }, onChange: handleChange, value: '' }),
46
+ "Drag or click to upload a new file"));
47
+ };
48
+ const activeBoxStyle = css `
49
+ background: #f2fbfc;
50
+ border: 1px dashed #bce7f6;
51
+ `;
52
+ const Container = styled.div `
53
+ background: ${(props) => props.theme.colors.background.secondary};
54
+ border: 1px dashed #e2e2e2;
55
+ box-sizing: border-box;
56
+ border-radius: 8px;
57
+ height: 80px;
58
+ display: flex;
59
+ align-items: center;
60
+ justify-content: center;
61
+ font-size: 14px;
62
+ line-height: 24px;
63
+ font-family: ${(props) => props.theme.font.family.Lato};
64
+ color: ${(props) => props.theme.colors.text.onLight};
65
+ cursor: pointer;
66
+ margin: 16px 16px 8px;
67
+ ${(props) => props.active
68
+ ? css `
69
+ ${activeBoxStyle}
70
+ `
71
+ : css ``}
72
+ `;
73
+ //# sourceMappingURL=FileUploader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FileUploader.js","sourceRoot":"","sources":["../../../../src/components/FileManager/FileUploader.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,KAAK,EAAE,EAAe,MAAM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QAAQ,GAAG,OAAO,IAAI,MAAM,CAAA;IAElC,OAAO,CACL,oBAAC,SAAS,IACR,GAAG,EAAE,OAAO,aACJ,eAAe,EACvB,MAAM,EAAE,QAAQ,EAChB,OAAO,EAAE,cAAc;QAEvB,+BACE,GAAG,EAAE,YAAY,EACjB,IAAI,EAAC,MAAM,EACX,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,EAC1B,QAAQ,EAAE,YAAY,EACtB,KAAK,EAAE,EAAE,GACT;6CAEQ,CACb,CAAA;AACH,CAAC,CAAA;AAED,MAAM,cAAc,GAAG,GAAG,CAAA;;;CAGzB,CAAA;AAED,MAAM,SAAS,GAAG,MAAM,CAAC,GAAG,CAAqB;gBACjC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,SAAS;;;;;;;;;;iBAUjD,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI;WAC7C,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO;;;IAGjD,CAAC,KAAK,EAAE,EAAE,CACV,KAAK,CAAC,MAAM;IACV,CAAC,CAAC,GAAG,CAAA;YACC,cAAc;SACjB;IACH,CAAC,CAAC,GAAG,CAAA,EAAE;CACZ,CAAA"}
@@ -0,0 +1,128 @@
1
+ /*!
2
+ * The contents of this file are subject to the Common Public Attribution License Version 1.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://mpapp-public.gitlab.io/manuscripts-frontend/LICENSE. The License is based on the Mozilla Public License Version 1.1 but Sections 14 and 15 have been added to cover use of software over a computer network and provide for limited attribution for the Original Developer. In addition, Exhibit A has been modified to be consistent with Exhibit B.
3
+ *
4
+ * Software distributed under the License is distributed on an “AS IS” basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License.
5
+ *
6
+ * The Original Code is manuscripts-frontend.
7
+ *
8
+ * The Original Developer is the Initial Developer. The Initial Developer of the Original Code is Atypon Systems LLC.
9
+ *
10
+ * All portions of the code written by Atypon Systems LLC are Copyright (c) 2024 Atypon Systems LLC. All Rights Reserved.
11
+ */
12
+ import { findAbstractsNode, } from '@manuscripts/body-editor';
13
+ import { FileType, getFileTypeIcon } from '@manuscripts/style-guide';
14
+ import { schema } from '@manuscripts/transform';
15
+ import { NodeSelection } from 'prosemirror-state';
16
+ import { findChildrenByType } from 'prosemirror-utils';
17
+ import React, { useMemo } from 'react';
18
+ import styled from 'styled-components';
19
+ import { useStore } from '../../store';
20
+ import { FileActions } from './FileActions';
21
+ import { FileContainer } from './FileContainer';
22
+ import { FileCreatedDate } from './FileCreatedDate';
23
+ import { FileSectionType } from './FileManager';
24
+ import { FileName } from './FileName';
25
+ const findGraphicalAbstractFigureElement = (doc) => {
26
+ const abstracts = findAbstractsNode(doc);
27
+ return findChildrenByType(abstracts.node, schema.nodes.figure_element)[0];
28
+ };
29
+ export const InlineFilesSection = ({ elements, }) => {
30
+ const [{ view, fileManagement }] = useStore((s) => ({
31
+ view: s.view,
32
+ fileManagement: s.fileManagement,
33
+ }));
34
+ const ga = useMemo(() => findGraphicalAbstractFigureElement(view.state.doc), [view.state.doc]);
35
+ const handleClick = (element) => {
36
+ const tr = view.state.tr;
37
+ tr.setSelection(NodeSelection.create(view.state.doc, element.pos));
38
+ tr.scrollIntoView();
39
+ view.focus();
40
+ view.dispatch(tr);
41
+ };
42
+ const handleDetach = async (figure) => {
43
+ const tr = view.state.tr;
44
+ tr.setNodeAttribute(figure.pos, 'src', '');
45
+ tr.setSelection(NodeSelection.create(view.state.doc, figure.pos));
46
+ tr.scrollIntoView();
47
+ view.focus();
48
+ view.dispatch(tr);
49
+ };
50
+ const handleReplace = async (figure, file) => {
51
+ const uploaded = await fileManagement.upload(file);
52
+ const tr = view.state.tr;
53
+ tr.setNodeAttribute(figure.pos, 'src', uploaded.id);
54
+ tr.setSelection(NodeSelection.create(view.state.doc, figure.pos));
55
+ tr.scrollIntoView();
56
+ view.focus();
57
+ view.dispatch(tr);
58
+ };
59
+ const getElementFileType = (element) => {
60
+ if (element.node.attrs.id === ga?.node.attrs.id) {
61
+ return FileType.GraphicalAbstract;
62
+ }
63
+ return FileType.Figure;
64
+ };
65
+ const getElementFileLabel = (index) => {
66
+ if (index === 0 && ga) {
67
+ return 'Graphical Abstract';
68
+ }
69
+ if (!ga) {
70
+ index++;
71
+ }
72
+ return `Figure ${index}`;
73
+ };
74
+ return (React.createElement(React.Fragment, null, elements.map((element, index) => (React.createElement(Element, { key: index, onClick: () => handleClick(element) },
75
+ React.createElement(ElementLabelContainer, null,
76
+ getFileTypeIcon(getElementFileType(element)),
77
+ React.createElement(ElementLabel, null, getElementFileLabel(index))),
78
+ React.createElement(ElementFilesContainer, { "data-cy": "file-elements-container" }, element.files?.map((figure) => (React.createElement(ElementFile, { key: figure.file.id, figure: figure, onReplace: async (f) => await handleReplace(figure, f), onDetach: async () => await handleDetach(figure), onDownload: () => fileManagement.download(figure.file) })))))))));
79
+ };
80
+ const ElementFile = ({ figure, onDownload, onReplace, onDetach }) => {
81
+ return (React.createElement(ModelFileContainer, { "data-cy": "file-container" },
82
+ React.createElement(FileName, { file: figure.file }),
83
+ React.createElement(FileCreatedDate, { file: figure.file, className: "show-on-hover" }),
84
+ React.createElement(FileActions, { "data-cy": "file-actions", sectionType: FileSectionType.Inline, onDownload: figure.file ? onDownload : undefined, onDetach: figure.file ? onDetach : undefined, onReplace: onReplace })));
85
+ };
86
+ const Element = styled.div `
87
+ display: flex;
88
+ flex-direction: column;
89
+ padding: 0;
90
+
91
+ border-bottom: 1px dashed #f0f0f0;
92
+
93
+ svg {
94
+ width: 24px;
95
+ }
96
+
97
+ :last-child {
98
+ border-bottom: 0;
99
+ }
100
+ `;
101
+ const ElementLabelContainer = styled.div `
102
+ display: flex;
103
+ padding: 20px 16px;
104
+ cursor: pointer;
105
+ `;
106
+ const ElementLabel = styled.div `
107
+ color: ${(props) => props.theme.colors.text.primary};
108
+ font-weight: bold;
109
+ font-size: 16px;
110
+ line-height: 20px;
111
+ white-space: nowrap;
112
+ margin-left: ${(props) => props.theme.grid.unit * 2}px;
113
+ `;
114
+ const ElementFilesContainer = styled.div `
115
+ width: 100%;
116
+ > :last-child {
117
+ margin-bottom: 25px;
118
+ }
119
+ `;
120
+ const ModelFileContainer = styled(FileContainer) `
121
+ padding: 8px 16px;
122
+ height: 40px;
123
+
124
+ path {
125
+ fill: #6e6e6e;
126
+ }
127
+ `;
128
+ //# sourceMappingURL=InlineFilesSection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InlineFilesSection.js","sourceRoot":"","sources":["../../../../src/components/FileManager/InlineFilesSection.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAEL,iBAAiB,GAElB,MAAM,0BAA0B,CAAA;AACjC,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAA;AACpE,OAAO,EAAkB,MAAM,EAAE,MAAM,wBAAwB,CAAA;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AACjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AACtD,OAAO,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AACtC,OAAO,MAAM,MAAM,mBAAmB,CAAA;AAEtC,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,EAAE,eAAe,EAAW,MAAM,eAAe,CAAA;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAMrC,MAAM,kCAAkC,GAAG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AE,SAAS,EAAC,eAAe,GAAG;QAChE,oBAAC,WAAW,eACF,cAAc,EACtB,WAAW,EAAE,eAAe,CAAC,MAAM,EACnC,UAAU,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS,EAChD,QAAQ,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,EAC5C,SAAS,EAAE,SAAS,GACpB,CACiB,CACtB,CAAA;AACH,CAAC,CAAA;AAED,MAAM,OAAO,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;;;;;;;;;;CAczB,CAAA;AAED,MAAM,qBAAqB,GAAG,MAAM,CAAC,GAAG,CAAA;;;;CAIvC,CAAA;AAED,MAAM,YAAY,GAAG,MAAM,CAAC,GAAG,CAAA;WACpB,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO;;;;;iBAKpC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC;CACpD,CAAA;AAED,MAAM,qBAAqB,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;CAKvC,CAAA;AAED,MAAM,kBAAkB,GAAG,MAAM,CAAC,aAAa,CAAC,CAAA;;;;;;;CAO/C,CAAA"}
@@ -0,0 +1,82 @@
1
+ /*!
2
+ * The contents of this file are subject to the Common Public Attribution License Version 1.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://mpapp-public.gitlab.io/manuscripts-frontend/LICENSE. The License is based on the Mozilla Public License Version 1.1 but Sections 14 and 15 have been added to cover use of software over a computer network and provide for limited attribution for the Original Developer. In addition, Exhibit A has been modified to be consistent with Exhibit B.
3
+ *
4
+ * Software distributed under the License is distributed on an “AS IS” basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License.
5
+ *
6
+ * The Original Code is manuscripts-frontend.
7
+ *
8
+ * The Original Developer is the Initial Developer. The Initial Developer of the Original Code is Atypon Systems LLC.
9
+ *
10
+ * All portions of the code written by Atypon Systems LLC are Copyright (c) 2024 Atypon Systems LLC. All Rights Reserved.
11
+ */
12
+ import { insertSupplement } from '@manuscripts/body-editor';
13
+ import { usePermissions } from '@manuscripts/style-guide';
14
+ import React, { useEffect, useState } from 'react';
15
+ import { useDrag } from 'react-dnd';
16
+ import { getEmptyImage } from 'react-dnd-html5-backend';
17
+ import { useStore } from '../../store';
18
+ import { FileActions } from './FileActions';
19
+ import { FileContainer } from './FileContainer';
20
+ import { FileCreatedDate } from './FileCreatedDate';
21
+ import { FileSectionType } from './FileManager';
22
+ import { FileName } from './FileName';
23
+ import { FileSectionAlert, FileSectionAlertType } from './FileSectionAlert';
24
+ import { FileUploader } from './FileUploader';
25
+ /**
26
+ * This component represents the other files in the file section.
27
+ */
28
+ export const OtherFilesSection = ({ files }) => {
29
+ const [{ view, fileManagement }] = useStore((s) => ({
30
+ view: s.view,
31
+ fileManagement: s.fileManagement,
32
+ }));
33
+ const can = usePermissions();
34
+ const [alert, setAlert] = useState({
35
+ type: FileSectionAlertType.NONE,
36
+ message: '',
37
+ });
38
+ const handleUpload = async (file) => {
39
+ setAlert({
40
+ type: FileSectionAlertType.UPLOAD_IN_PROGRESS,
41
+ message: file.name,
42
+ });
43
+ await fileManagement.upload(file);
44
+ setAlert({
45
+ type: FileSectionAlertType.UPLOAD_SUCCESSFUL,
46
+ message: '',
47
+ });
48
+ };
49
+ const moveToSupplements = async (file) => {
50
+ insertSupplement(file, view.state, view.dispatch);
51
+ setAlert({
52
+ type: FileSectionAlertType.MOVE_SUCCESSFUL,
53
+ message: FileSectionType.Supplements,
54
+ });
55
+ };
56
+ return (React.createElement("div", null,
57
+ can?.uploadFile && React.createElement(FileUploader, { onUpload: handleUpload }),
58
+ React.createElement(FileSectionAlert, { alert: alert }),
59
+ files.map((file) => (React.createElement(OtherFile, { key: file.id, file: file, onDownload: () => fileManagement.download(file), onMoveToSupplements: async () => await moveToSupplements(file) })))));
60
+ };
61
+ const OtherFile = ({ file, onDownload, onMoveToSupplements }) => {
62
+ const [{ isDragging }, dragRef, preview] = useDrag({
63
+ type: 'file',
64
+ item: {
65
+ file,
66
+ },
67
+ collect: (monitor) => ({
68
+ isDragging: monitor.isDragging(),
69
+ }),
70
+ });
71
+ useEffect(() => {
72
+ preview(getEmptyImage());
73
+ }, [preview]);
74
+ return (React.createElement(FileContainer, { key: file.id, "data-cy": "file-container", ref: dragRef, className: isDragging ? 'dragging' : '' },
75
+ React.createElement(FileName, { file: file }),
76
+ React.createElement(FileCreatedDate, { file: file, className: "show-on-hover" }),
77
+ React.createElement(FileActions, { sectionType: FileSectionType.OtherFile, onDownload: onDownload, move: {
78
+ sectionType: FileSectionType.Supplements,
79
+ handler: onMoveToSupplements,
80
+ } })));
81
+ };
82
+ //# sourceMappingURL=OtherFilesSection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OtherFilesSection.js","sourceRoot":"","sources":["../../../../src/components/FileManager/OtherFilesSection.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAkB,gBAAgB,EAAE,MAAM,0BAA0B,CAAA;AAC3E,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AACzD,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAA;AAEvD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,EAAE,eAAe,EA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