@kitconcept/core 2.0.0-alpha.3 → 2.0.0-alpha.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/.changelog.draft +5 -3
- package/CHANGELOG.md +14 -0
- package/babel.config.js +1 -1
- package/package.json +2 -2
- package/src/components/Contents/Contents.jsx +2006 -0
- package/src/components/Contents/DropZoneContent.jsx +307 -0
- package/src/customizations/volto/components/manage/Contents/Contents.jsx +20 -0
- package/src/theme/_main.scss +1 -0
- package/src/theme/components/dragDropFolderContent.scss +62 -0
|
@@ -0,0 +1,2006 @@
|
|
|
1
|
+
import React, { Component } from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { connect } from 'react-redux';
|
|
4
|
+
import { compose } from 'redux';
|
|
5
|
+
import { createPortal } from 'react-dom';
|
|
6
|
+
import { Link } from 'react-router-dom';
|
|
7
|
+
import {
|
|
8
|
+
Button,
|
|
9
|
+
Container as SemanticContainer,
|
|
10
|
+
Divider,
|
|
11
|
+
Dropdown,
|
|
12
|
+
Menu,
|
|
13
|
+
Input,
|
|
14
|
+
Segment,
|
|
15
|
+
Table,
|
|
16
|
+
Loader,
|
|
17
|
+
Dimmer,
|
|
18
|
+
} from 'semantic-ui-react';
|
|
19
|
+
import concat from 'lodash/concat';
|
|
20
|
+
import filter from 'lodash/filter';
|
|
21
|
+
import find from 'lodash/find';
|
|
22
|
+
import indexOf from 'lodash/indexOf';
|
|
23
|
+
import keys from 'lodash/keys';
|
|
24
|
+
import map from 'lodash/map';
|
|
25
|
+
import mapValues from 'lodash/mapValues';
|
|
26
|
+
import pull from 'lodash/pull';
|
|
27
|
+
import move from 'lodash-move';
|
|
28
|
+
import { FormattedMessage, defineMessages, injectIntl } from 'react-intl';
|
|
29
|
+
import { asyncConnect } from '@plone/volto/helpers/AsyncConnect';
|
|
30
|
+
import { getBaseUrl } from '@plone/volto/helpers/Url/Url';
|
|
31
|
+
|
|
32
|
+
import { searchContent } from '@plone/volto/actions/search/search';
|
|
33
|
+
import {
|
|
34
|
+
deleteContent,
|
|
35
|
+
orderContent,
|
|
36
|
+
sortContent,
|
|
37
|
+
updateColumnsContent,
|
|
38
|
+
getContent,
|
|
39
|
+
} from '@plone/volto/actions/content/content';
|
|
40
|
+
import {
|
|
41
|
+
copyContent,
|
|
42
|
+
moveContent,
|
|
43
|
+
cut,
|
|
44
|
+
copy,
|
|
45
|
+
} from '@plone/volto/actions/clipboard/clipboard';
|
|
46
|
+
import { listActions } from '@plone/volto/actions/actions/actions';
|
|
47
|
+
import Indexes, { defaultIndexes } from '@plone/volto/constants/Indexes';
|
|
48
|
+
import Pagination from '@plone/volto/components/theme/Pagination/Pagination';
|
|
49
|
+
import Popup from '@plone/volto/components/theme/Popup/Popup';
|
|
50
|
+
import Toolbar from '@plone/volto/components/manage/Toolbar/Toolbar';
|
|
51
|
+
import Toast from '@plone/volto/components/manage/Toast/Toast';
|
|
52
|
+
import Icon from '@plone/volto/components/theme/Icon/Icon';
|
|
53
|
+
import Unauthorized from '@plone/volto/components/theme/Unauthorized/Unauthorized';
|
|
54
|
+
import ContentsBreadcrumbs from '@plone/volto/components/manage/Contents/ContentsBreadcrumbs';
|
|
55
|
+
import ContentsIndexHeader from '@plone/volto/components/manage/Contents/ContentsIndexHeader';
|
|
56
|
+
import ContentsItem from '@plone/volto/components/manage/Contents/ContentsItem';
|
|
57
|
+
import { ContentsRenameModal } from '@plone/volto/components/manage/Contents';
|
|
58
|
+
import ContentsUploadModal from '@plone/volto/components/manage/Contents/ContentsUploadModal';
|
|
59
|
+
import ContentsDeleteModal from '@plone/volto/components/manage/Contents/ContentsDeleteModal';
|
|
60
|
+
import ContentsWorkflowModal from '@plone/volto/components/manage/Contents/ContentsWorkflowModal';
|
|
61
|
+
import ContentsTagsModal from '@plone/volto/components/manage/Contents/ContentsTagsModal';
|
|
62
|
+
import ContentsPropertiesModal from '@plone/volto/components/manage/Contents/ContentsPropertiesModal';
|
|
63
|
+
|
|
64
|
+
import Helmet from '@plone/volto/helpers/Helmet/Helmet';
|
|
65
|
+
import { injectLazyLibs } from '@plone/volto/helpers/Loadable/Loadable';
|
|
66
|
+
import config from '@plone/volto/registry';
|
|
67
|
+
|
|
68
|
+
import backSVG from '@plone/volto/icons/back.svg';
|
|
69
|
+
import cutSVG from '@plone/volto/icons/cut.svg';
|
|
70
|
+
import deleteSVG from '@plone/volto/icons/delete.svg';
|
|
71
|
+
import copySVG from '@plone/volto/icons/copy.svg';
|
|
72
|
+
import tagSVG from '@plone/volto/icons/tag.svg';
|
|
73
|
+
import renameSVG from '@plone/volto/icons/rename.svg';
|
|
74
|
+
import semaphoreSVG from '@plone/volto/icons/semaphore.svg';
|
|
75
|
+
import uploadSVG from '@plone/volto/icons/upload.svg';
|
|
76
|
+
import propertiesSVG from '@plone/volto/icons/properties.svg';
|
|
77
|
+
import pasteSVG from '@plone/volto/icons/paste.svg';
|
|
78
|
+
import zoomSVG from '@plone/volto/icons/zoom.svg';
|
|
79
|
+
import checkboxUncheckedSVG from '@plone/volto/icons/checkbox-unchecked.svg';
|
|
80
|
+
import checkboxCheckedSVG from '@plone/volto/icons/checkbox-checked.svg';
|
|
81
|
+
import checkboxIndeterminateSVG from '@plone/volto/icons/checkbox-indeterminate.svg';
|
|
82
|
+
import configurationSVG from '@plone/volto/icons/configuration-app.svg';
|
|
83
|
+
import sortDownSVG from '@plone/volto/icons/sort-down.svg';
|
|
84
|
+
import sortUpSVG from '@plone/volto/icons/sort-up.svg';
|
|
85
|
+
import downKeySVG from '@plone/volto/icons/down-key.svg';
|
|
86
|
+
import moreSVG from '@plone/volto/icons/more.svg';
|
|
87
|
+
import clearSVG from '@plone/volto/icons/clear.svg';
|
|
88
|
+
import DropzoneContent from './DropZoneContent';
|
|
89
|
+
|
|
90
|
+
const messages = defineMessages({
|
|
91
|
+
back: {
|
|
92
|
+
id: 'Back',
|
|
93
|
+
defaultMessage: 'Back',
|
|
94
|
+
},
|
|
95
|
+
contents: {
|
|
96
|
+
id: 'Contents',
|
|
97
|
+
defaultMessage: 'Contents',
|
|
98
|
+
},
|
|
99
|
+
copy: {
|
|
100
|
+
id: 'Copy',
|
|
101
|
+
defaultMessage: 'Copy',
|
|
102
|
+
},
|
|
103
|
+
cut: {
|
|
104
|
+
id: 'Cut',
|
|
105
|
+
defaultMessage: 'Cut',
|
|
106
|
+
},
|
|
107
|
+
error: {
|
|
108
|
+
id: "You can't paste this content here",
|
|
109
|
+
defaultMessage: "You can't paste this content here",
|
|
110
|
+
},
|
|
111
|
+
delete: {
|
|
112
|
+
id: 'Delete',
|
|
113
|
+
defaultMessage: 'Delete',
|
|
114
|
+
},
|
|
115
|
+
deleteError: {
|
|
116
|
+
id: 'The item could not be deleted.',
|
|
117
|
+
defaultMessage: 'The item could not be deleted.',
|
|
118
|
+
},
|
|
119
|
+
loading: {
|
|
120
|
+
id: 'loading',
|
|
121
|
+
defaultMessage: 'Loading',
|
|
122
|
+
},
|
|
123
|
+
home: {
|
|
124
|
+
id: 'Home',
|
|
125
|
+
defaultMessage: 'Home',
|
|
126
|
+
},
|
|
127
|
+
filter: {
|
|
128
|
+
id: 'Filter…',
|
|
129
|
+
defaultMessage: 'Filter…',
|
|
130
|
+
},
|
|
131
|
+
messageCopied: {
|
|
132
|
+
id: 'Item(s) copied.',
|
|
133
|
+
defaultMessage: 'Item(s) copied.',
|
|
134
|
+
},
|
|
135
|
+
messageCut: {
|
|
136
|
+
id: 'Item(s) cut.',
|
|
137
|
+
defaultMessage: 'Item(s) cut.',
|
|
138
|
+
},
|
|
139
|
+
messageUpdate: {
|
|
140
|
+
id: 'Item(s) has been updated.',
|
|
141
|
+
defaultMessage: 'Item(s) has been updated.',
|
|
142
|
+
},
|
|
143
|
+
messageReorder: {
|
|
144
|
+
id: 'Item successfully moved.',
|
|
145
|
+
defaultMessage: 'Item successfully moved.',
|
|
146
|
+
},
|
|
147
|
+
messagePasted: {
|
|
148
|
+
id: 'Item(s) pasted.',
|
|
149
|
+
defaultMessage: 'Item(s) pasted.',
|
|
150
|
+
},
|
|
151
|
+
messageWorkflowUpdate: {
|
|
152
|
+
id: 'Item(s) state has been updated.',
|
|
153
|
+
defaultMessage: 'Item(s) state has been updated.',
|
|
154
|
+
},
|
|
155
|
+
paste: {
|
|
156
|
+
id: 'Paste',
|
|
157
|
+
defaultMessage: 'Paste',
|
|
158
|
+
},
|
|
159
|
+
properties: {
|
|
160
|
+
id: 'Properties',
|
|
161
|
+
defaultMessage: 'Properties',
|
|
162
|
+
},
|
|
163
|
+
rearrangeBy: {
|
|
164
|
+
id: 'Rearrange items by…',
|
|
165
|
+
defaultMessage: 'Rearrange items by…',
|
|
166
|
+
},
|
|
167
|
+
rename: {
|
|
168
|
+
id: 'Rename',
|
|
169
|
+
defaultMessage: 'Rename',
|
|
170
|
+
},
|
|
171
|
+
select: {
|
|
172
|
+
id: 'Select…',
|
|
173
|
+
defaultMessage: 'Select…',
|
|
174
|
+
},
|
|
175
|
+
selected: {
|
|
176
|
+
id: '{count} selected',
|
|
177
|
+
defaultMessage: '{count} selected',
|
|
178
|
+
},
|
|
179
|
+
selectColumns: {
|
|
180
|
+
id: 'Select columns to show',
|
|
181
|
+
defaultMessage: 'Select columns to show',
|
|
182
|
+
},
|
|
183
|
+
sort: {
|
|
184
|
+
id: 'sort',
|
|
185
|
+
defaultMessage: 'sort',
|
|
186
|
+
},
|
|
187
|
+
state: {
|
|
188
|
+
id: 'State',
|
|
189
|
+
defaultMessage: 'State',
|
|
190
|
+
},
|
|
191
|
+
tags: {
|
|
192
|
+
id: 'Tags',
|
|
193
|
+
defaultMessage: 'Tags',
|
|
194
|
+
},
|
|
195
|
+
upload: {
|
|
196
|
+
id: 'Upload',
|
|
197
|
+
defaultMessage: 'Upload',
|
|
198
|
+
},
|
|
199
|
+
success: {
|
|
200
|
+
id: 'Success',
|
|
201
|
+
defaultMessage: 'Success',
|
|
202
|
+
},
|
|
203
|
+
publicationDate: {
|
|
204
|
+
id: 'Publication date',
|
|
205
|
+
defaultMessage: 'Publication date',
|
|
206
|
+
},
|
|
207
|
+
createdOn: {
|
|
208
|
+
id: 'Created on',
|
|
209
|
+
defaultMessage: 'Created on',
|
|
210
|
+
},
|
|
211
|
+
expirationDate: {
|
|
212
|
+
id: 'Expiration date',
|
|
213
|
+
defaultMessage: 'Expiration date',
|
|
214
|
+
},
|
|
215
|
+
id: {
|
|
216
|
+
id: 'ID',
|
|
217
|
+
defaultMessage: 'ID',
|
|
218
|
+
},
|
|
219
|
+
uid: {
|
|
220
|
+
id: 'UID',
|
|
221
|
+
defaultMessage: 'UID',
|
|
222
|
+
},
|
|
223
|
+
reviewState: {
|
|
224
|
+
id: 'Review state',
|
|
225
|
+
defaultMessage: 'Review state',
|
|
226
|
+
},
|
|
227
|
+
folder: {
|
|
228
|
+
id: 'Folder',
|
|
229
|
+
defaultMessage: 'Folder',
|
|
230
|
+
},
|
|
231
|
+
excludedFromNavigation: {
|
|
232
|
+
id: 'Excluded from navigation',
|
|
233
|
+
defaultMessage: 'Excluded from navigation',
|
|
234
|
+
},
|
|
235
|
+
objectSize: {
|
|
236
|
+
id: 'Object Size',
|
|
237
|
+
defaultMessage: 'Object Size',
|
|
238
|
+
},
|
|
239
|
+
lastCommentedDate: {
|
|
240
|
+
id: 'Last comment date',
|
|
241
|
+
defaultMessage: 'Last comment date',
|
|
242
|
+
},
|
|
243
|
+
totalComments: {
|
|
244
|
+
id: 'Total comments',
|
|
245
|
+
defaultMessage: 'Total comments',
|
|
246
|
+
},
|
|
247
|
+
creator: {
|
|
248
|
+
id: 'Creator',
|
|
249
|
+
defaultMessage: 'Creator',
|
|
250
|
+
},
|
|
251
|
+
endDate: {
|
|
252
|
+
id: 'End Date',
|
|
253
|
+
defaultMessage: 'End Date',
|
|
254
|
+
},
|
|
255
|
+
startDate: {
|
|
256
|
+
id: 'Start Date',
|
|
257
|
+
defaultMessage: 'Start Date',
|
|
258
|
+
},
|
|
259
|
+
all: {
|
|
260
|
+
id: 'All',
|
|
261
|
+
defaultMessage: 'All',
|
|
262
|
+
},
|
|
263
|
+
resultCount: {
|
|
264
|
+
id: 'resultCount',
|
|
265
|
+
defaultMessage: 'Result count',
|
|
266
|
+
},
|
|
267
|
+
});
|
|
268
|
+
|
|
269
|
+
/**
|
|
270
|
+
* Contents class.
|
|
271
|
+
* @class Contents
|
|
272
|
+
* @extends Component
|
|
273
|
+
*/
|
|
274
|
+
class Contents extends Component {
|
|
275
|
+
/**
|
|
276
|
+
* Property types.
|
|
277
|
+
* @property {Object} propTypes Property types.
|
|
278
|
+
* @static
|
|
279
|
+
*/
|
|
280
|
+
static propTypes = {
|
|
281
|
+
action: PropTypes.string,
|
|
282
|
+
source: PropTypes.arrayOf(PropTypes.string),
|
|
283
|
+
searchContent: PropTypes.func.isRequired,
|
|
284
|
+
cut: PropTypes.func.isRequired,
|
|
285
|
+
copy: PropTypes.func.isRequired,
|
|
286
|
+
copyContent: PropTypes.func.isRequired,
|
|
287
|
+
deleteContent: PropTypes.func.isRequired,
|
|
288
|
+
moveContent: PropTypes.func.isRequired,
|
|
289
|
+
orderContent: PropTypes.func.isRequired,
|
|
290
|
+
sortContent: PropTypes.func.isRequired,
|
|
291
|
+
updateColumnsContent: PropTypes.func.isRequired,
|
|
292
|
+
clipboardRequest: PropTypes.shape({
|
|
293
|
+
loading: PropTypes.bool,
|
|
294
|
+
loaded: PropTypes.bool,
|
|
295
|
+
}).isRequired,
|
|
296
|
+
deleteRequest: PropTypes.shape({
|
|
297
|
+
loading: PropTypes.bool,
|
|
298
|
+
loaded: PropTypes.bool,
|
|
299
|
+
}).isRequired,
|
|
300
|
+
updateRequest: PropTypes.shape({
|
|
301
|
+
loading: PropTypes.bool,
|
|
302
|
+
loaded: PropTypes.bool,
|
|
303
|
+
}).isRequired,
|
|
304
|
+
searchRequest: PropTypes.shape({
|
|
305
|
+
loading: PropTypes.bool,
|
|
306
|
+
loaded: PropTypes.bool,
|
|
307
|
+
}).isRequired,
|
|
308
|
+
items: PropTypes.arrayOf(
|
|
309
|
+
PropTypes.shape({
|
|
310
|
+
'@id': PropTypes.string,
|
|
311
|
+
'@type': PropTypes.string,
|
|
312
|
+
title: PropTypes.string,
|
|
313
|
+
description: PropTypes.string,
|
|
314
|
+
}),
|
|
315
|
+
),
|
|
316
|
+
breadcrumbs: PropTypes.arrayOf(
|
|
317
|
+
PropTypes.shape({
|
|
318
|
+
title: PropTypes.string,
|
|
319
|
+
url: PropTypes.string,
|
|
320
|
+
}),
|
|
321
|
+
).isRequired,
|
|
322
|
+
total: PropTypes.number.isRequired,
|
|
323
|
+
pathname: PropTypes.string.isRequired,
|
|
324
|
+
};
|
|
325
|
+
|
|
326
|
+
/**
|
|
327
|
+
* Default properties.
|
|
328
|
+
* @property {Object} defaultProps Default properties.
|
|
329
|
+
* @static
|
|
330
|
+
*/
|
|
331
|
+
static defaultProps = {
|
|
332
|
+
items: [],
|
|
333
|
+
action: null,
|
|
334
|
+
source: null,
|
|
335
|
+
index: {
|
|
336
|
+
order: keys(Indexes),
|
|
337
|
+
values: mapValues(Indexes, (value, key) => ({
|
|
338
|
+
...value,
|
|
339
|
+
selected: indexOf(defaultIndexes, key) !== -1,
|
|
340
|
+
})),
|
|
341
|
+
selectedCount: defaultIndexes.length + 1,
|
|
342
|
+
},
|
|
343
|
+
};
|
|
344
|
+
|
|
345
|
+
/**
|
|
346
|
+
* Constructor
|
|
347
|
+
* @method constructor
|
|
348
|
+
* @param {Object} props Component properties
|
|
349
|
+
* @constructs ContentsComponent
|
|
350
|
+
*/
|
|
351
|
+
constructor(props) {
|
|
352
|
+
super(props);
|
|
353
|
+
this.onDeselect = this.onDeselect.bind(this);
|
|
354
|
+
this.onSelect = this.onSelect.bind(this);
|
|
355
|
+
this.onSelectAll = this.onSelectAll.bind(this);
|
|
356
|
+
this.onSelectIndex = this.onSelectIndex.bind(this);
|
|
357
|
+
this.onSelectNone = this.onSelectNone.bind(this);
|
|
358
|
+
this.onDeleteOk = this.onDeleteOk.bind(this);
|
|
359
|
+
this.onDeleteCancel = this.onDeleteCancel.bind(this);
|
|
360
|
+
this.onUploadOk = this.onUploadOk.bind(this);
|
|
361
|
+
this.onUploadCancel = this.onUploadCancel.bind(this);
|
|
362
|
+
this.onRenameOk = this.onRenameOk.bind(this);
|
|
363
|
+
this.onRenameCancel = this.onRenameCancel.bind(this);
|
|
364
|
+
this.onTagsOk = this.onTagsOk.bind(this);
|
|
365
|
+
this.onTagsCancel = this.onTagsCancel.bind(this);
|
|
366
|
+
this.onPropertiesOk = this.onPropertiesOk.bind(this);
|
|
367
|
+
this.onPropertiesCancel = this.onPropertiesCancel.bind(this);
|
|
368
|
+
this.onWorkflowOk = this.onWorkflowOk.bind(this);
|
|
369
|
+
this.onWorkflowCancel = this.onWorkflowCancel.bind(this);
|
|
370
|
+
this.onChangeFilter = this.onChangeFilter.bind(this);
|
|
371
|
+
this.onChangePage = this.onChangePage.bind(this);
|
|
372
|
+
this.onChangePageSize = this.onChangePageSize.bind(this);
|
|
373
|
+
this.onOrderIndex = this.onOrderIndex.bind(this);
|
|
374
|
+
this.onOrderItem = this.onOrderItem.bind(this);
|
|
375
|
+
this.onSortItems = this.onSortItems.bind(this);
|
|
376
|
+
this.onMoveToTop = this.onMoveToTop.bind(this);
|
|
377
|
+
this.onChangeSelected = this.onChangeSelected.bind(this);
|
|
378
|
+
this.onMoveToBottom = this.onMoveToBottom.bind(this);
|
|
379
|
+
this.cut = this.cut.bind(this);
|
|
380
|
+
this.copy = this.copy.bind(this);
|
|
381
|
+
this.delete = this.delete.bind(this);
|
|
382
|
+
this.upload = this.upload.bind(this);
|
|
383
|
+
this.rename = this.rename.bind(this);
|
|
384
|
+
this.tags = this.tags.bind(this);
|
|
385
|
+
this.properties = this.properties.bind(this);
|
|
386
|
+
this.workflow = this.workflow.bind(this);
|
|
387
|
+
this.paste = this.paste.bind(this);
|
|
388
|
+
this.fetchContents = this.fetchContents.bind(this);
|
|
389
|
+
this.orderTimeout = null;
|
|
390
|
+
|
|
391
|
+
this.state = {
|
|
392
|
+
selected: [],
|
|
393
|
+
showDelete: false,
|
|
394
|
+
showUpload: false,
|
|
395
|
+
showRename: false,
|
|
396
|
+
showTags: false,
|
|
397
|
+
showProperties: false,
|
|
398
|
+
showWorkflow: false,
|
|
399
|
+
itemsToDelete: [],
|
|
400
|
+
items: this.props.items,
|
|
401
|
+
filter: '',
|
|
402
|
+
currentPage: 0,
|
|
403
|
+
pageSize: 50,
|
|
404
|
+
index: this.props.index || {
|
|
405
|
+
order: keys(Indexes),
|
|
406
|
+
values: mapValues(Indexes, (value, key) => ({
|
|
407
|
+
...value,
|
|
408
|
+
selected: indexOf(defaultIndexes, key) !== -1,
|
|
409
|
+
})),
|
|
410
|
+
selectedCount: defaultIndexes.length + 1,
|
|
411
|
+
},
|
|
412
|
+
sort_on: this.props.sort?.on || 'getObjPositionInParent',
|
|
413
|
+
sort_order: this.props.sort?.order || 'ascending',
|
|
414
|
+
isClient: false,
|
|
415
|
+
};
|
|
416
|
+
this.filterTimeout = null;
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
/**
|
|
420
|
+
* Component did mount
|
|
421
|
+
* @method componentDidMount
|
|
422
|
+
* @returns {undefined}
|
|
423
|
+
*/
|
|
424
|
+
componentDidMount() {
|
|
425
|
+
this.fetchContents();
|
|
426
|
+
this.setState({ isClient: true });
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
/**
|
|
430
|
+
* Component will receive props
|
|
431
|
+
* @method componentWillReceiveProps
|
|
432
|
+
* @param {Object} nextProps Next properties
|
|
433
|
+
* @returns {undefined}
|
|
434
|
+
*/
|
|
435
|
+
UNSAFE_componentWillReceiveProps(nextProps) {
|
|
436
|
+
if (
|
|
437
|
+
(this.props.clipboardRequest.loading &&
|
|
438
|
+
nextProps.clipboardRequest.loaded) ||
|
|
439
|
+
(this.props.deleteRequest.loading && nextProps.deleteRequest.loaded) ||
|
|
440
|
+
(this.props.updateRequest.loading && nextProps.updateRequest.loaded)
|
|
441
|
+
) {
|
|
442
|
+
this.fetchContents(nextProps.pathname);
|
|
443
|
+
}
|
|
444
|
+
if (this.props.updateRequest.loading && nextProps.updateRequest.loaded) {
|
|
445
|
+
this.props.toastify.toast.success(
|
|
446
|
+
<Toast
|
|
447
|
+
success
|
|
448
|
+
title={this.props.intl.formatMessage(messages.success)}
|
|
449
|
+
content={this.props.intl.formatMessage(messages.messageUpdate)}
|
|
450
|
+
/>,
|
|
451
|
+
);
|
|
452
|
+
}
|
|
453
|
+
if (this.props.pathname !== nextProps.pathname) {
|
|
454
|
+
// Refetching content to sync the current object in the toolbar
|
|
455
|
+
this.props.getContent(getBaseUrl(nextProps.pathname));
|
|
456
|
+
this.setState(
|
|
457
|
+
{
|
|
458
|
+
currentPage: 0,
|
|
459
|
+
selected: [],
|
|
460
|
+
},
|
|
461
|
+
() =>
|
|
462
|
+
this.setState({ filter: '' }, () =>
|
|
463
|
+
this.fetchContents(nextProps.pathname),
|
|
464
|
+
),
|
|
465
|
+
);
|
|
466
|
+
}
|
|
467
|
+
if (this.props.searchRequest.loading && nextProps.searchRequest.loaded) {
|
|
468
|
+
this.setState({
|
|
469
|
+
items: nextProps.items,
|
|
470
|
+
});
|
|
471
|
+
}
|
|
472
|
+
if (
|
|
473
|
+
this.props.clipboardRequest.loading &&
|
|
474
|
+
nextProps.clipboardRequest.error
|
|
475
|
+
) {
|
|
476
|
+
const msgBody =
|
|
477
|
+
nextProps.clipboardRequest.error?.response?.body?.message ||
|
|
478
|
+
this.props.intl.formatMessage(messages.error);
|
|
479
|
+
this.props.toastify.toast.error(
|
|
480
|
+
<Toast
|
|
481
|
+
error
|
|
482
|
+
title={this.props.intl.formatMessage(messages.error)}
|
|
483
|
+
content={msgBody}
|
|
484
|
+
/>,
|
|
485
|
+
);
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
if (
|
|
489
|
+
this.props.clipboardRequest.loading &&
|
|
490
|
+
nextProps.clipboardRequest.loaded
|
|
491
|
+
) {
|
|
492
|
+
this.props.toastify.toast.success(
|
|
493
|
+
<Toast
|
|
494
|
+
success
|
|
495
|
+
title={this.props.intl.formatMessage(messages.success)}
|
|
496
|
+
content={this.props.intl.formatMessage(messages.messagePasted)}
|
|
497
|
+
/>,
|
|
498
|
+
);
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
if (this.props.deleteRequest.loading && nextProps.deleteRequest.error) {
|
|
502
|
+
this.props.toastify.toast.error(
|
|
503
|
+
<Toast
|
|
504
|
+
error
|
|
505
|
+
title={this.props.intl.formatMessage(messages.deleteError)}
|
|
506
|
+
content={this.props.intl.formatMessage(messages.deleteError)}
|
|
507
|
+
/>,
|
|
508
|
+
);
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
if (this.props.orderRequest.loading && nextProps.orderRequest.loaded) {
|
|
512
|
+
this.props.toastify.toast.success(
|
|
513
|
+
<Toast
|
|
514
|
+
success
|
|
515
|
+
title={this.props.intl.formatMessage(messages.success)}
|
|
516
|
+
content={this.props.intl.formatMessage(messages.messageReorder)}
|
|
517
|
+
/>,
|
|
518
|
+
);
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
/**
|
|
523
|
+
* On deselect handler
|
|
524
|
+
* @method onDeselect
|
|
525
|
+
* @param {object} event Event object
|
|
526
|
+
* @param {string} value Value
|
|
527
|
+
* @returns {undefined}
|
|
528
|
+
*/
|
|
529
|
+
onDeselect(event, { value }) {
|
|
530
|
+
this.setState({
|
|
531
|
+
selected: pull(this.state.selected, value),
|
|
532
|
+
});
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
/**
|
|
536
|
+
* On select handler
|
|
537
|
+
* @method onSelect
|
|
538
|
+
* @param {object} event Event object
|
|
539
|
+
* @returns {undefined}
|
|
540
|
+
*/
|
|
541
|
+
onSelect(event, id) {
|
|
542
|
+
if (indexOf(this.state.selected, id) === -1) {
|
|
543
|
+
this.setState({
|
|
544
|
+
selected: concat(this.state.selected, id),
|
|
545
|
+
});
|
|
546
|
+
} else {
|
|
547
|
+
this.setState({
|
|
548
|
+
selected: pull(this.state.selected, id),
|
|
549
|
+
});
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
/**
|
|
554
|
+
* On select all handler
|
|
555
|
+
* @method onSelectAll
|
|
556
|
+
* @returns {undefined}
|
|
557
|
+
*/
|
|
558
|
+
onSelectAll() {
|
|
559
|
+
this.setState({
|
|
560
|
+
selected: map(this.state.items, (item) => item['@id']),
|
|
561
|
+
});
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
/**
|
|
565
|
+
* On select none handler
|
|
566
|
+
* @method onSelectNone
|
|
567
|
+
* @returns {undefined}
|
|
568
|
+
*/
|
|
569
|
+
onSelectNone() {
|
|
570
|
+
this.setState({
|
|
571
|
+
selected: [],
|
|
572
|
+
});
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
/**
|
|
576
|
+
* On select index
|
|
577
|
+
* @method onSelectIndex
|
|
578
|
+
* @param {object} event Event object.
|
|
579
|
+
* @param {string} value Index value.
|
|
580
|
+
* @returns {undefined}
|
|
581
|
+
*/
|
|
582
|
+
onSelectIndex(event, { value }) {
|
|
583
|
+
let newIndex = {
|
|
584
|
+
...this.state.index,
|
|
585
|
+
selectedCount:
|
|
586
|
+
this.state.index.selectedCount +
|
|
587
|
+
(this.state.index.values[value].selected ? -1 : 1),
|
|
588
|
+
values: mapValues(this.state.index.values, (indexValue, indexKey) => ({
|
|
589
|
+
...indexValue,
|
|
590
|
+
selected:
|
|
591
|
+
indexKey === value ? !indexValue.selected : indexValue.selected,
|
|
592
|
+
})),
|
|
593
|
+
};
|
|
594
|
+
this.setState({
|
|
595
|
+
index: newIndex,
|
|
596
|
+
});
|
|
597
|
+
this.props.updateColumnsContent(getBaseUrl(this.props.pathname), newIndex);
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
/**
|
|
601
|
+
* On change filter
|
|
602
|
+
* @method onChangeFilter
|
|
603
|
+
* @param {object} event Event object.
|
|
604
|
+
* @param {string} value Filter value.
|
|
605
|
+
* @returns {undefined}
|
|
606
|
+
*/
|
|
607
|
+
onChangeFilter(event, { value }) {
|
|
608
|
+
const self = this;
|
|
609
|
+
clearTimeout(self.filterTimeout);
|
|
610
|
+
this.setState(
|
|
611
|
+
{
|
|
612
|
+
filter: value,
|
|
613
|
+
},
|
|
614
|
+
() => {
|
|
615
|
+
self.filterTimeout = setTimeout(() => {
|
|
616
|
+
self.fetchContents();
|
|
617
|
+
}, 200);
|
|
618
|
+
},
|
|
619
|
+
);
|
|
620
|
+
}
|
|
621
|
+
|
|
622
|
+
/**
|
|
623
|
+
* On change selected values (Filter)
|
|
624
|
+
* @method onChangeSelected
|
|
625
|
+
* @param {object} event Event object.
|
|
626
|
+
* @param {string} value Filter value.
|
|
627
|
+
* @returns {undefined}
|
|
628
|
+
*/
|
|
629
|
+
onChangeSelected(event, { value }) {
|
|
630
|
+
event.stopPropagation();
|
|
631
|
+
const { items, selected } = this.state;
|
|
632
|
+
|
|
633
|
+
const filteredItems = filter(selected, (selectedItem) =>
|
|
634
|
+
find(items, (item) => item['@id'] === selectedItem)
|
|
635
|
+
.title.toLowerCase()
|
|
636
|
+
.includes(value.toLowerCase()),
|
|
637
|
+
);
|
|
638
|
+
|
|
639
|
+
this.setState({
|
|
640
|
+
filteredItems,
|
|
641
|
+
selectedMenuFilter: value,
|
|
642
|
+
});
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
/**
|
|
646
|
+
* On change page
|
|
647
|
+
* @method onChangePage
|
|
648
|
+
* @param {object} event Event object.
|
|
649
|
+
* @param {string} value Page value.
|
|
650
|
+
* @returns {undefined}
|
|
651
|
+
*/
|
|
652
|
+
onChangePage(event, { value }) {
|
|
653
|
+
this.setState(
|
|
654
|
+
{
|
|
655
|
+
currentPage: value,
|
|
656
|
+
selected: [],
|
|
657
|
+
},
|
|
658
|
+
() => this.fetchContents(),
|
|
659
|
+
);
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
/**
|
|
663
|
+
* On change page size
|
|
664
|
+
* @method onChangePageSize
|
|
665
|
+
* @param {object} event Event object.
|
|
666
|
+
* @param {string} value Page size value.
|
|
667
|
+
* @returns {undefined}
|
|
668
|
+
*/
|
|
669
|
+
onChangePageSize(event, { value }) {
|
|
670
|
+
this.setState(
|
|
671
|
+
{
|
|
672
|
+
pageSize: value,
|
|
673
|
+
currentPage: 0,
|
|
674
|
+
selected: [],
|
|
675
|
+
},
|
|
676
|
+
() => this.fetchContents(),
|
|
677
|
+
);
|
|
678
|
+
}
|
|
679
|
+
|
|
680
|
+
/**
|
|
681
|
+
* On order index
|
|
682
|
+
* @method onOrderIndex
|
|
683
|
+
* @param {number} index Index
|
|
684
|
+
* @param {number} delta Delta
|
|
685
|
+
* @returns {undefined}
|
|
686
|
+
*/
|
|
687
|
+
onOrderIndex(index, delta) {
|
|
688
|
+
this.setState({
|
|
689
|
+
index: {
|
|
690
|
+
...this.state.index,
|
|
691
|
+
order: move(this.state.index.order, index, index + delta),
|
|
692
|
+
},
|
|
693
|
+
});
|
|
694
|
+
this.props.updateColumnsContent(
|
|
695
|
+
getBaseUrl(this.props.pathname),
|
|
696
|
+
this.state.index,
|
|
697
|
+
);
|
|
698
|
+
}
|
|
699
|
+
|
|
700
|
+
/**
|
|
701
|
+
* On order item
|
|
702
|
+
* @method onOrderItem
|
|
703
|
+
* @param {string} id Item id
|
|
704
|
+
* @param {number} itemIndex Item index
|
|
705
|
+
* @param {number} delta Delta
|
|
706
|
+
* @returns {undefined}
|
|
707
|
+
*/
|
|
708
|
+
onOrderItem(id, itemIndex, delta, backend) {
|
|
709
|
+
if (backend) {
|
|
710
|
+
this.props.orderContent(
|
|
711
|
+
getBaseUrl(this.props.pathname),
|
|
712
|
+
id.replace(/^.*\//, ''),
|
|
713
|
+
delta,
|
|
714
|
+
);
|
|
715
|
+
} else {
|
|
716
|
+
this.setState({
|
|
717
|
+
items: move(this.state.items, itemIndex, itemIndex + delta),
|
|
718
|
+
});
|
|
719
|
+
}
|
|
720
|
+
}
|
|
721
|
+
|
|
722
|
+
/**
|
|
723
|
+
* On sort items
|
|
724
|
+
* @method onSortItems
|
|
725
|
+
* @param {object} event Event object
|
|
726
|
+
* @param {string} value Item index
|
|
727
|
+
* @returns {undefined}
|
|
728
|
+
*/
|
|
729
|
+
onSortItems(event, { value }) {
|
|
730
|
+
const values = value.split('|');
|
|
731
|
+
this.setState({
|
|
732
|
+
sort_on: values[0],
|
|
733
|
+
sort_order: values[1],
|
|
734
|
+
selected: [],
|
|
735
|
+
});
|
|
736
|
+
this.props.sortContent(
|
|
737
|
+
getBaseUrl(this.props.pathname),
|
|
738
|
+
values[0],
|
|
739
|
+
values[1],
|
|
740
|
+
);
|
|
741
|
+
}
|
|
742
|
+
|
|
743
|
+
/**
|
|
744
|
+
* On move to top
|
|
745
|
+
* @method onMoveToTop
|
|
746
|
+
* @param {object} event Event object
|
|
747
|
+
* @param {string} value Item index
|
|
748
|
+
* @returns {undefined}
|
|
749
|
+
*/
|
|
750
|
+
onMoveToTop(event, { value }) {
|
|
751
|
+
const id = this.state.items[value]['@id'];
|
|
752
|
+
this.props
|
|
753
|
+
.orderContent(
|
|
754
|
+
getBaseUrl(this.props.pathname),
|
|
755
|
+
id.replace(/^.*\//, ''),
|
|
756
|
+
'top',
|
|
757
|
+
)
|
|
758
|
+
.then(() => {
|
|
759
|
+
this.setState(
|
|
760
|
+
{
|
|
761
|
+
currentPage: 0,
|
|
762
|
+
selected: [],
|
|
763
|
+
},
|
|
764
|
+
() => this.fetchContents(),
|
|
765
|
+
);
|
|
766
|
+
});
|
|
767
|
+
}
|
|
768
|
+
|
|
769
|
+
/**
|
|
770
|
+
* On move to bottom
|
|
771
|
+
* @method onMoveToBottom
|
|
772
|
+
* @param {object} event Event object
|
|
773
|
+
* @param {string} value Item index
|
|
774
|
+
* @returns {undefined}
|
|
775
|
+
*/
|
|
776
|
+
onMoveToBottom(event, { value }) {
|
|
777
|
+
const id = this.state.items[value]['@id'];
|
|
778
|
+
this.props
|
|
779
|
+
.orderContent(
|
|
780
|
+
getBaseUrl(this.props.pathname),
|
|
781
|
+
id.replace(/^.*\//, ''),
|
|
782
|
+
'bottom',
|
|
783
|
+
)
|
|
784
|
+
.then(() => {
|
|
785
|
+
this.setState(
|
|
786
|
+
{
|
|
787
|
+
currentPage: 0,
|
|
788
|
+
selected: [],
|
|
789
|
+
},
|
|
790
|
+
() => this.fetchContents(),
|
|
791
|
+
);
|
|
792
|
+
});
|
|
793
|
+
}
|
|
794
|
+
|
|
795
|
+
/**
|
|
796
|
+
* On delete ok
|
|
797
|
+
* @method onDeleteOk
|
|
798
|
+
* @returns {undefined}
|
|
799
|
+
*/
|
|
800
|
+
onDeleteOk() {
|
|
801
|
+
this.props.deleteContent(this.state.itemsToDelete);
|
|
802
|
+
this.setState({
|
|
803
|
+
showDelete: false,
|
|
804
|
+
itemsToDelete: [],
|
|
805
|
+
selected: [],
|
|
806
|
+
});
|
|
807
|
+
}
|
|
808
|
+
|
|
809
|
+
/**
|
|
810
|
+
* On delete cancel
|
|
811
|
+
* @method onDeleteCancel
|
|
812
|
+
* @returns {undefined}
|
|
813
|
+
*/
|
|
814
|
+
onDeleteCancel() {
|
|
815
|
+
this.setState({
|
|
816
|
+
showDelete: false,
|
|
817
|
+
itemsToDelete: [],
|
|
818
|
+
});
|
|
819
|
+
}
|
|
820
|
+
|
|
821
|
+
/**
|
|
822
|
+
* On upload ok
|
|
823
|
+
* @method onUploadOk
|
|
824
|
+
* @returns {undefined}
|
|
825
|
+
*/
|
|
826
|
+
onUploadOk() {
|
|
827
|
+
this.fetchContents();
|
|
828
|
+
this.setState({
|
|
829
|
+
showUpload: false,
|
|
830
|
+
});
|
|
831
|
+
}
|
|
832
|
+
|
|
833
|
+
/**
|
|
834
|
+
* On upload cancel
|
|
835
|
+
* @method onUploadCancel
|
|
836
|
+
* @returns {undefined}
|
|
837
|
+
*/
|
|
838
|
+
onUploadCancel() {
|
|
839
|
+
this.setState({
|
|
840
|
+
showUpload: false,
|
|
841
|
+
});
|
|
842
|
+
}
|
|
843
|
+
|
|
844
|
+
/**
|
|
845
|
+
* On rename ok
|
|
846
|
+
* @method onRenameOk
|
|
847
|
+
* @returns {undefined}
|
|
848
|
+
*/
|
|
849
|
+
onRenameOk() {
|
|
850
|
+
this.setState({
|
|
851
|
+
showRename: false,
|
|
852
|
+
selected: [],
|
|
853
|
+
});
|
|
854
|
+
}
|
|
855
|
+
|
|
856
|
+
/**
|
|
857
|
+
* On rename cancel
|
|
858
|
+
* @method onRenameCancel
|
|
859
|
+
* @returns {undefined}
|
|
860
|
+
*/
|
|
861
|
+
onRenameCancel() {
|
|
862
|
+
this.setState({
|
|
863
|
+
showRename: false,
|
|
864
|
+
});
|
|
865
|
+
}
|
|
866
|
+
|
|
867
|
+
/**
|
|
868
|
+
* On tags ok
|
|
869
|
+
* @method onTagsOk
|
|
870
|
+
* @returns {undefined}
|
|
871
|
+
*/
|
|
872
|
+
onTagsOk() {
|
|
873
|
+
this.setState({
|
|
874
|
+
showTags: false,
|
|
875
|
+
selected: [],
|
|
876
|
+
});
|
|
877
|
+
}
|
|
878
|
+
|
|
879
|
+
/**
|
|
880
|
+
* On tags cancel
|
|
881
|
+
* @method onTagsCancel
|
|
882
|
+
* @returns {undefined}
|
|
883
|
+
*/
|
|
884
|
+
onTagsCancel() {
|
|
885
|
+
this.setState({
|
|
886
|
+
showTags: false,
|
|
887
|
+
});
|
|
888
|
+
}
|
|
889
|
+
|
|
890
|
+
/**
|
|
891
|
+
* On properties ok
|
|
892
|
+
* @method onPropertiesOk
|
|
893
|
+
* @returns {undefined}
|
|
894
|
+
*/
|
|
895
|
+
onPropertiesOk() {
|
|
896
|
+
this.setState({
|
|
897
|
+
showProperties: false,
|
|
898
|
+
selected: [],
|
|
899
|
+
});
|
|
900
|
+
}
|
|
901
|
+
|
|
902
|
+
/**
|
|
903
|
+
* On properties cancel
|
|
904
|
+
* @method onPropertiesCancel
|
|
905
|
+
* @returns {undefined}
|
|
906
|
+
*/
|
|
907
|
+
onPropertiesCancel() {
|
|
908
|
+
this.setState({
|
|
909
|
+
showProperties: false,
|
|
910
|
+
});
|
|
911
|
+
}
|
|
912
|
+
|
|
913
|
+
/**
|
|
914
|
+
* On workflow ok
|
|
915
|
+
* @method onWorkflowOk
|
|
916
|
+
* @returns {undefined}
|
|
917
|
+
*/
|
|
918
|
+
onWorkflowOk() {
|
|
919
|
+
this.fetchContents();
|
|
920
|
+
this.setState({
|
|
921
|
+
showWorkflow: false,
|
|
922
|
+
selected: [],
|
|
923
|
+
});
|
|
924
|
+
this.props.toastify.toast.success(
|
|
925
|
+
<Toast
|
|
926
|
+
success
|
|
927
|
+
title={this.props.intl.formatMessage(messages.success)}
|
|
928
|
+
content={this.props.intl.formatMessage(messages.messageWorkflowUpdate)}
|
|
929
|
+
/>,
|
|
930
|
+
);
|
|
931
|
+
}
|
|
932
|
+
|
|
933
|
+
/**
|
|
934
|
+
* On workflow cancel
|
|
935
|
+
* @method onWorkflowCancel
|
|
936
|
+
* @returns {undefined}
|
|
937
|
+
*/
|
|
938
|
+
onWorkflowCancel() {
|
|
939
|
+
this.setState({
|
|
940
|
+
showWorkflow: false,
|
|
941
|
+
});
|
|
942
|
+
}
|
|
943
|
+
|
|
944
|
+
/**
|
|
945
|
+
* Get field by id
|
|
946
|
+
* @method getFieldById
|
|
947
|
+
* @param {string} id Id of object
|
|
948
|
+
* @param {string} field Field of object
|
|
949
|
+
* @returns {string} Field of object
|
|
950
|
+
*/
|
|
951
|
+
getFieldById(id, field) {
|
|
952
|
+
const item = find(this.state.items, { '@id': id });
|
|
953
|
+
return item ? item[field] : '';
|
|
954
|
+
}
|
|
955
|
+
|
|
956
|
+
/**
|
|
957
|
+
* Fetch contents handler
|
|
958
|
+
* @method fetchContents
|
|
959
|
+
* @param {string} pathname Pathname to fetch contents.
|
|
960
|
+
* @returns {undefined}
|
|
961
|
+
*/
|
|
962
|
+
fetchContents(pathname) {
|
|
963
|
+
if (this.state.pageSize === this.props.intl.formatMessage(messages.all)) {
|
|
964
|
+
//'All'
|
|
965
|
+
this.props.searchContent(getBaseUrl(pathname || this.props.pathname), {
|
|
966
|
+
'path.depth': 1,
|
|
967
|
+
sort_on: this.state.sort_on,
|
|
968
|
+
sort_order: this.state.sort_order,
|
|
969
|
+
metadata_fields: '_all',
|
|
970
|
+
b_size: 100000000,
|
|
971
|
+
show_inactive: true,
|
|
972
|
+
...(this.state.filter && { SearchableText: `${this.state.filter}*` }),
|
|
973
|
+
});
|
|
974
|
+
} else {
|
|
975
|
+
this.props.searchContent(getBaseUrl(pathname || this.props.pathname), {
|
|
976
|
+
'path.depth': 1,
|
|
977
|
+
sort_on: this.state.sort_on,
|
|
978
|
+
sort_order: this.state.sort_order,
|
|
979
|
+
metadata_fields: '_all',
|
|
980
|
+
...(this.state.filter && { SearchableText: `${this.state.filter}*` }),
|
|
981
|
+
b_size: this.state.pageSize,
|
|
982
|
+
b_start: this.state.currentPage * this.state.pageSize,
|
|
983
|
+
show_inactive: true,
|
|
984
|
+
});
|
|
985
|
+
}
|
|
986
|
+
}
|
|
987
|
+
|
|
988
|
+
/**
|
|
989
|
+
* Cut handler
|
|
990
|
+
* @method cut
|
|
991
|
+
* @param {Object} event Event object.
|
|
992
|
+
* @param {string} value Value of the event.
|
|
993
|
+
* @returns {undefined}
|
|
994
|
+
*/
|
|
995
|
+
cut(event, { value }) {
|
|
996
|
+
this.props.cut(value ? [value] : this.state.selected);
|
|
997
|
+
this.onSelectNone();
|
|
998
|
+
this.props.toastify.toast.success(
|
|
999
|
+
<Toast
|
|
1000
|
+
success
|
|
1001
|
+
title={this.props.intl.formatMessage(messages.success)}
|
|
1002
|
+
content={this.props.intl.formatMessage(messages.messageCut)}
|
|
1003
|
+
/>,
|
|
1004
|
+
);
|
|
1005
|
+
}
|
|
1006
|
+
|
|
1007
|
+
/**
|
|
1008
|
+
* Copy handler
|
|
1009
|
+
* @method copy
|
|
1010
|
+
* @param {Object} event Event object.
|
|
1011
|
+
* @param {string} value Value of the event.
|
|
1012
|
+
* @returns {undefined}
|
|
1013
|
+
*/
|
|
1014
|
+
copy(event, { value }) {
|
|
1015
|
+
this.props.copy(value ? [value] : this.state.selected);
|
|
1016
|
+
this.onSelectNone();
|
|
1017
|
+
this.props.toastify.toast.success(
|
|
1018
|
+
<Toast
|
|
1019
|
+
success
|
|
1020
|
+
title={this.props.intl.formatMessage(messages.success)}
|
|
1021
|
+
content={this.props.intl.formatMessage(messages.messageCopied)}
|
|
1022
|
+
/>,
|
|
1023
|
+
);
|
|
1024
|
+
}
|
|
1025
|
+
|
|
1026
|
+
/**
|
|
1027
|
+
* Delete handler
|
|
1028
|
+
* @method delete
|
|
1029
|
+
* @param {Object} event Event object.
|
|
1030
|
+
* @param {string} value Value of the event.
|
|
1031
|
+
* @returns {undefined}
|
|
1032
|
+
*/
|
|
1033
|
+
delete(event, { value }) {
|
|
1034
|
+
this.setState({
|
|
1035
|
+
showDelete: true,
|
|
1036
|
+
itemsToDelete: value ? [value] : this.state.selected,
|
|
1037
|
+
});
|
|
1038
|
+
}
|
|
1039
|
+
|
|
1040
|
+
/**
|
|
1041
|
+
* Upload handler
|
|
1042
|
+
* @method upload
|
|
1043
|
+
* @returns {undefined}
|
|
1044
|
+
*/
|
|
1045
|
+
upload() {
|
|
1046
|
+
this.setState({
|
|
1047
|
+
showUpload: true,
|
|
1048
|
+
});
|
|
1049
|
+
}
|
|
1050
|
+
|
|
1051
|
+
/**
|
|
1052
|
+
* Rename handler
|
|
1053
|
+
* @method rename
|
|
1054
|
+
* @returns {undefined}
|
|
1055
|
+
*/
|
|
1056
|
+
rename() {
|
|
1057
|
+
this.setState({
|
|
1058
|
+
showRename: true,
|
|
1059
|
+
});
|
|
1060
|
+
}
|
|
1061
|
+
|
|
1062
|
+
/**
|
|
1063
|
+
* Tags handler
|
|
1064
|
+
* @method tags
|
|
1065
|
+
* @returns {undefined}
|
|
1066
|
+
*/
|
|
1067
|
+
tags() {
|
|
1068
|
+
this.setState({
|
|
1069
|
+
showTags: true,
|
|
1070
|
+
});
|
|
1071
|
+
}
|
|
1072
|
+
|
|
1073
|
+
/**
|
|
1074
|
+
* Properties handler
|
|
1075
|
+
* @method properties
|
|
1076
|
+
* @returns {undefined}
|
|
1077
|
+
*/
|
|
1078
|
+
properties() {
|
|
1079
|
+
this.setState({
|
|
1080
|
+
showProperties: true,
|
|
1081
|
+
});
|
|
1082
|
+
}
|
|
1083
|
+
|
|
1084
|
+
/**
|
|
1085
|
+
* Workflow handler
|
|
1086
|
+
* @method workflow
|
|
1087
|
+
* @returns {undefined}
|
|
1088
|
+
*/
|
|
1089
|
+
workflow() {
|
|
1090
|
+
this.setState({
|
|
1091
|
+
showWorkflow: true,
|
|
1092
|
+
});
|
|
1093
|
+
}
|
|
1094
|
+
|
|
1095
|
+
/**
|
|
1096
|
+
* Paste handler
|
|
1097
|
+
* @method paste
|
|
1098
|
+
* @returns {undefined}
|
|
1099
|
+
*/
|
|
1100
|
+
paste() {
|
|
1101
|
+
if (this.props.action === 'copy') {
|
|
1102
|
+
this.props.copyContent(
|
|
1103
|
+
this.props.source,
|
|
1104
|
+
getBaseUrl(this.props.pathname),
|
|
1105
|
+
);
|
|
1106
|
+
}
|
|
1107
|
+
if (this.props.action === 'cut') {
|
|
1108
|
+
this.props.moveContent(
|
|
1109
|
+
this.props.source,
|
|
1110
|
+
getBaseUrl(this.props.pathname),
|
|
1111
|
+
);
|
|
1112
|
+
}
|
|
1113
|
+
}
|
|
1114
|
+
|
|
1115
|
+
/**
|
|
1116
|
+
* Render method.
|
|
1117
|
+
* @method render
|
|
1118
|
+
* @returns {string} Markup for the component.
|
|
1119
|
+
*/
|
|
1120
|
+
render() {
|
|
1121
|
+
const selected = this.state.selected.length > 0;
|
|
1122
|
+
const filteredItems = this.state.filteredItems || this.state.selected;
|
|
1123
|
+
const path = getBaseUrl(this.props.pathname);
|
|
1124
|
+
const folderContentsAction = find(this.props.objectActions, {
|
|
1125
|
+
id: 'folderContents',
|
|
1126
|
+
});
|
|
1127
|
+
const loading =
|
|
1128
|
+
(this.props.clipboardRequest?.loading &&
|
|
1129
|
+
!this.props.clipboardRequest?.error) ||
|
|
1130
|
+
(this.props.deleteRequest?.loading && !this.props.deleteRequest?.error) ||
|
|
1131
|
+
(this.props.updateRequest?.loading && !this.props.updateRequest?.error) ||
|
|
1132
|
+
(this.props.orderRequest?.loading && !this.props.orderRequest?.error) ||
|
|
1133
|
+
(this.props.searchRequest?.loading && !this.props.searchRequest?.error);
|
|
1134
|
+
|
|
1135
|
+
const Container =
|
|
1136
|
+
config.getComponent({ name: 'Container' }).component || SemanticContainer;
|
|
1137
|
+
|
|
1138
|
+
return this.props.token && this.props.objectActions?.length > 0 ? (
|
|
1139
|
+
<>
|
|
1140
|
+
{folderContentsAction ? (
|
|
1141
|
+
<Container
|
|
1142
|
+
id="page-contents"
|
|
1143
|
+
className="folder-contents"
|
|
1144
|
+
aria-live="polite"
|
|
1145
|
+
>
|
|
1146
|
+
<Dimmer.Dimmable as="div" blurring dimmed={loading}>
|
|
1147
|
+
<Dimmer active={loading} inverted>
|
|
1148
|
+
<Loader indeterminate size="massive">
|
|
1149
|
+
{this.props.intl.formatMessage(messages.loading)}
|
|
1150
|
+
</Loader>
|
|
1151
|
+
</Dimmer>
|
|
1152
|
+
<Helmet
|
|
1153
|
+
title={this.props.intl.formatMessage(messages.contents)}
|
|
1154
|
+
/>
|
|
1155
|
+
{/* Start Customization */}
|
|
1156
|
+
<DropzoneContent
|
|
1157
|
+
onOk={this.onUploadOk}
|
|
1158
|
+
onCancel={this.onUploadCancel}
|
|
1159
|
+
pathname={getBaseUrl(this.props.pathname)}
|
|
1160
|
+
>
|
|
1161
|
+
{/* End Customization */}
|
|
1162
|
+
<div className="container">
|
|
1163
|
+
<article id="content">
|
|
1164
|
+
<ContentsDeleteModal
|
|
1165
|
+
open={this.state.showDelete}
|
|
1166
|
+
onCancel={this.onDeleteCancel}
|
|
1167
|
+
onOk={this.onDeleteOk}
|
|
1168
|
+
items={this.state.items}
|
|
1169
|
+
itemsToDelete={this.state.itemsToDelete}
|
|
1170
|
+
hasMultiplePages={
|
|
1171
|
+
Math.ceil(this.props.total / this.state.pageSize) > 1
|
|
1172
|
+
}
|
|
1173
|
+
/>
|
|
1174
|
+
<ContentsUploadModal
|
|
1175
|
+
open={this.state.showUpload}
|
|
1176
|
+
onCancel={this.onUploadCancel}
|
|
1177
|
+
onOk={this.onUploadOk}
|
|
1178
|
+
pathname={getBaseUrl(this.props.pathname)}
|
|
1179
|
+
/>
|
|
1180
|
+
<ContentsRenameModal
|
|
1181
|
+
open={this.state.showRename}
|
|
1182
|
+
onCancel={this.onRenameCancel}
|
|
1183
|
+
onOk={this.onRenameOk}
|
|
1184
|
+
items={map(this.state.selected, (item) => ({
|
|
1185
|
+
url: item,
|
|
1186
|
+
title: this.getFieldById(item, 'title'),
|
|
1187
|
+
id: this.getFieldById(item, 'id'),
|
|
1188
|
+
}))}
|
|
1189
|
+
/>
|
|
1190
|
+
<ContentsTagsModal
|
|
1191
|
+
open={this.state.showTags}
|
|
1192
|
+
onCancel={this.onTagsCancel}
|
|
1193
|
+
onOk={this.onTagsOk}
|
|
1194
|
+
items={map(this.state.selected, (item) => ({
|
|
1195
|
+
url: item,
|
|
1196
|
+
subjects: this.getFieldById(item, 'Subject'),
|
|
1197
|
+
}))}
|
|
1198
|
+
/>
|
|
1199
|
+
<ContentsPropertiesModal
|
|
1200
|
+
open={this.state.showProperties}
|
|
1201
|
+
onCancel={this.onPropertiesCancel}
|
|
1202
|
+
onOk={this.onPropertiesOk}
|
|
1203
|
+
items={this.state.selected}
|
|
1204
|
+
values={map(this.state.selected, (id) =>
|
|
1205
|
+
find(this.state.items, { '@id': id }),
|
|
1206
|
+
).filter((item) => item)}
|
|
1207
|
+
/>
|
|
1208
|
+
{this.state.showWorkflow && (
|
|
1209
|
+
<ContentsWorkflowModal
|
|
1210
|
+
open={this.state.showWorkflow}
|
|
1211
|
+
onCancel={this.onWorkflowCancel}
|
|
1212
|
+
onOk={this.onWorkflowOk}
|
|
1213
|
+
items={this.state.selected}
|
|
1214
|
+
/>
|
|
1215
|
+
)}
|
|
1216
|
+
<section id="content-core">
|
|
1217
|
+
<Segment.Group raised>
|
|
1218
|
+
<Menu secondary attached className="top-menu">
|
|
1219
|
+
<Menu.Menu className="top-menu-menu">
|
|
1220
|
+
<Popup
|
|
1221
|
+
trigger={
|
|
1222
|
+
<Menu.Item
|
|
1223
|
+
icon
|
|
1224
|
+
as={Button}
|
|
1225
|
+
onClick={this.upload}
|
|
1226
|
+
className="upload"
|
|
1227
|
+
aria-controls="contents-table-wrapper"
|
|
1228
|
+
aria-label={this.props.intl.formatMessage(
|
|
1229
|
+
messages.filter,
|
|
1230
|
+
)}
|
|
1231
|
+
>
|
|
1232
|
+
<Icon
|
|
1233
|
+
name={uploadSVG}
|
|
1234
|
+
color="#007eb1"
|
|
1235
|
+
size="24px"
|
|
1236
|
+
className="upload"
|
|
1237
|
+
/>
|
|
1238
|
+
</Menu.Item>
|
|
1239
|
+
}
|
|
1240
|
+
position="top center"
|
|
1241
|
+
content={this.props.intl.formatMessage(
|
|
1242
|
+
messages.upload,
|
|
1243
|
+
)}
|
|
1244
|
+
size="mini"
|
|
1245
|
+
/>
|
|
1246
|
+
</Menu.Menu>
|
|
1247
|
+
<Menu.Menu className="top-menu-menu">
|
|
1248
|
+
<Popup
|
|
1249
|
+
trigger={
|
|
1250
|
+
<Menu.Item
|
|
1251
|
+
icon
|
|
1252
|
+
as={Button}
|
|
1253
|
+
onClick={this.rename}
|
|
1254
|
+
disabled={!selected}
|
|
1255
|
+
aria-label={this.props.intl.formatMessage(
|
|
1256
|
+
messages.rename,
|
|
1257
|
+
)}
|
|
1258
|
+
>
|
|
1259
|
+
<Icon
|
|
1260
|
+
name={renameSVG}
|
|
1261
|
+
color={selected ? '#826a6a' : 'grey'}
|
|
1262
|
+
size="24px"
|
|
1263
|
+
className="rename"
|
|
1264
|
+
/>
|
|
1265
|
+
</Menu.Item>
|
|
1266
|
+
}
|
|
1267
|
+
position="top center"
|
|
1268
|
+
content={this.props.intl.formatMessage(
|
|
1269
|
+
messages.rename,
|
|
1270
|
+
)}
|
|
1271
|
+
size="mini"
|
|
1272
|
+
/>
|
|
1273
|
+
<Popup
|
|
1274
|
+
trigger={
|
|
1275
|
+
<Menu.Item
|
|
1276
|
+
icon
|
|
1277
|
+
as={Button}
|
|
1278
|
+
onClick={this.workflow}
|
|
1279
|
+
disabled={!selected}
|
|
1280
|
+
aria-label={this.props.intl.formatMessage(
|
|
1281
|
+
messages.state,
|
|
1282
|
+
)}
|
|
1283
|
+
>
|
|
1284
|
+
<Icon
|
|
1285
|
+
name={semaphoreSVG}
|
|
1286
|
+
color={selected ? '#826a6a' : 'grey'}
|
|
1287
|
+
size="24px"
|
|
1288
|
+
className="semaphore"
|
|
1289
|
+
/>
|
|
1290
|
+
</Menu.Item>
|
|
1291
|
+
}
|
|
1292
|
+
position="top center"
|
|
1293
|
+
content={this.props.intl.formatMessage(
|
|
1294
|
+
messages.state,
|
|
1295
|
+
)}
|
|
1296
|
+
size="mini"
|
|
1297
|
+
/>
|
|
1298
|
+
<Popup
|
|
1299
|
+
trigger={
|
|
1300
|
+
<Menu.Item
|
|
1301
|
+
icon
|
|
1302
|
+
as={Button}
|
|
1303
|
+
onClick={this.tags}
|
|
1304
|
+
disabled={!selected}
|
|
1305
|
+
aria-label={this.props.intl.formatMessage(
|
|
1306
|
+
messages.tags,
|
|
1307
|
+
)}
|
|
1308
|
+
>
|
|
1309
|
+
<Icon
|
|
1310
|
+
name={tagSVG}
|
|
1311
|
+
color={selected ? '#826a6a' : 'grey'}
|
|
1312
|
+
size="24px"
|
|
1313
|
+
className="tag"
|
|
1314
|
+
/>
|
|
1315
|
+
</Menu.Item>
|
|
1316
|
+
}
|
|
1317
|
+
position="top center"
|
|
1318
|
+
content={this.props.intl.formatMessage(
|
|
1319
|
+
messages.tags,
|
|
1320
|
+
)}
|
|
1321
|
+
size="mini"
|
|
1322
|
+
/>
|
|
1323
|
+
|
|
1324
|
+
<Popup
|
|
1325
|
+
trigger={
|
|
1326
|
+
<Menu.Item
|
|
1327
|
+
icon
|
|
1328
|
+
as={Button}
|
|
1329
|
+
onClick={this.properties}
|
|
1330
|
+
disabled={!selected}
|
|
1331
|
+
aria-label={this.props.intl.formatMessage(
|
|
1332
|
+
messages.properties,
|
|
1333
|
+
)}
|
|
1334
|
+
>
|
|
1335
|
+
<Icon
|
|
1336
|
+
name={propertiesSVG}
|
|
1337
|
+
color={selected ? '#826a6a' : 'grey'}
|
|
1338
|
+
size="24px"
|
|
1339
|
+
className="properties"
|
|
1340
|
+
/>
|
|
1341
|
+
</Menu.Item>
|
|
1342
|
+
}
|
|
1343
|
+
position="top center"
|
|
1344
|
+
content={this.props.intl.formatMessage(
|
|
1345
|
+
messages.properties,
|
|
1346
|
+
)}
|
|
1347
|
+
size="mini"
|
|
1348
|
+
/>
|
|
1349
|
+
</Menu.Menu>
|
|
1350
|
+
<Menu.Menu className="top-menu-menu">
|
|
1351
|
+
<Popup
|
|
1352
|
+
trigger={
|
|
1353
|
+
<Menu.Item
|
|
1354
|
+
icon
|
|
1355
|
+
as={Button}
|
|
1356
|
+
onClick={this.cut}
|
|
1357
|
+
disabled={!selected}
|
|
1358
|
+
aria-label={this.props.intl.formatMessage(
|
|
1359
|
+
messages.cut,
|
|
1360
|
+
)}
|
|
1361
|
+
>
|
|
1362
|
+
<Icon
|
|
1363
|
+
name={cutSVG}
|
|
1364
|
+
color={selected ? '#826a6a' : 'grey'}
|
|
1365
|
+
size="24px"
|
|
1366
|
+
className="cut"
|
|
1367
|
+
/>
|
|
1368
|
+
</Menu.Item>
|
|
1369
|
+
}
|
|
1370
|
+
position="top center"
|
|
1371
|
+
content={this.props.intl.formatMessage(
|
|
1372
|
+
messages.cut,
|
|
1373
|
+
)}
|
|
1374
|
+
size="mini"
|
|
1375
|
+
/>
|
|
1376
|
+
<Popup
|
|
1377
|
+
trigger={
|
|
1378
|
+
<Menu.Item
|
|
1379
|
+
icon
|
|
1380
|
+
as={Button}
|
|
1381
|
+
onClick={this.copy}
|
|
1382
|
+
disabled={!selected}
|
|
1383
|
+
aria-label={this.props.intl.formatMessage(
|
|
1384
|
+
messages.copy,
|
|
1385
|
+
)}
|
|
1386
|
+
>
|
|
1387
|
+
<Icon
|
|
1388
|
+
name={copySVG}
|
|
1389
|
+
color={selected ? '#826a6a' : 'grey'}
|
|
1390
|
+
size="24px"
|
|
1391
|
+
className="copy"
|
|
1392
|
+
/>
|
|
1393
|
+
</Menu.Item>
|
|
1394
|
+
}
|
|
1395
|
+
position="top center"
|
|
1396
|
+
content={this.props.intl.formatMessage(
|
|
1397
|
+
messages.copy,
|
|
1398
|
+
)}
|
|
1399
|
+
size="mini"
|
|
1400
|
+
/>
|
|
1401
|
+
|
|
1402
|
+
<Popup
|
|
1403
|
+
trigger={
|
|
1404
|
+
<Menu.Item
|
|
1405
|
+
icon
|
|
1406
|
+
as={Button}
|
|
1407
|
+
onClick={this.paste}
|
|
1408
|
+
disabled={!this.props.action}
|
|
1409
|
+
aria-label={this.props.intl.formatMessage(
|
|
1410
|
+
messages.paste,
|
|
1411
|
+
)}
|
|
1412
|
+
>
|
|
1413
|
+
<Icon
|
|
1414
|
+
name={pasteSVG}
|
|
1415
|
+
color={selected ? '#826a6a' : 'grey'}
|
|
1416
|
+
size="24px"
|
|
1417
|
+
className="paste"
|
|
1418
|
+
/>
|
|
1419
|
+
</Menu.Item>
|
|
1420
|
+
}
|
|
1421
|
+
position="top center"
|
|
1422
|
+
content={this.props.intl.formatMessage(
|
|
1423
|
+
messages.paste,
|
|
1424
|
+
)}
|
|
1425
|
+
size="mini"
|
|
1426
|
+
/>
|
|
1427
|
+
|
|
1428
|
+
<Popup
|
|
1429
|
+
trigger={
|
|
1430
|
+
<Menu.Item
|
|
1431
|
+
icon
|
|
1432
|
+
as={Button}
|
|
1433
|
+
onClick={this.delete}
|
|
1434
|
+
disabled={!selected}
|
|
1435
|
+
aria-label={this.props.intl.formatMessage(
|
|
1436
|
+
messages.delete,
|
|
1437
|
+
)}
|
|
1438
|
+
>
|
|
1439
|
+
<Icon
|
|
1440
|
+
name={deleteSVG}
|
|
1441
|
+
color={selected ? '#e40166' : 'grey'}
|
|
1442
|
+
size="24px"
|
|
1443
|
+
className="delete"
|
|
1444
|
+
/>
|
|
1445
|
+
</Menu.Item>
|
|
1446
|
+
}
|
|
1447
|
+
position="top center"
|
|
1448
|
+
content={this.props.intl.formatMessage(
|
|
1449
|
+
messages.delete,
|
|
1450
|
+
)}
|
|
1451
|
+
size="mini"
|
|
1452
|
+
/>
|
|
1453
|
+
</Menu.Menu>
|
|
1454
|
+
<Menu.Menu
|
|
1455
|
+
position="right"
|
|
1456
|
+
className="top-menu-searchbox"
|
|
1457
|
+
>
|
|
1458
|
+
<div className="ui right aligned category search item">
|
|
1459
|
+
<Input
|
|
1460
|
+
type="text"
|
|
1461
|
+
transparent
|
|
1462
|
+
placeholder={this.props.intl.formatMessage(
|
|
1463
|
+
messages.filter,
|
|
1464
|
+
)}
|
|
1465
|
+
size="small"
|
|
1466
|
+
value={this.state.filter}
|
|
1467
|
+
onChange={this.onChangeFilter}
|
|
1468
|
+
/>
|
|
1469
|
+
{this.state.filter && (
|
|
1470
|
+
<Button
|
|
1471
|
+
className="icon icon-container"
|
|
1472
|
+
onClick={() => {
|
|
1473
|
+
this.onChangeFilter('', { value: '' });
|
|
1474
|
+
}}
|
|
1475
|
+
>
|
|
1476
|
+
<Icon
|
|
1477
|
+
name={clearSVG}
|
|
1478
|
+
size="30px"
|
|
1479
|
+
color="#e40166"
|
|
1480
|
+
/>
|
|
1481
|
+
</Button>
|
|
1482
|
+
)}
|
|
1483
|
+
<Icon
|
|
1484
|
+
name={zoomSVG}
|
|
1485
|
+
size="30px"
|
|
1486
|
+
color="#007eb1"
|
|
1487
|
+
className="zoom"
|
|
1488
|
+
style={{ flexShrink: '0' }}
|
|
1489
|
+
/>
|
|
1490
|
+
<div className="results" />
|
|
1491
|
+
</div>
|
|
1492
|
+
</Menu.Menu>
|
|
1493
|
+
</Menu>
|
|
1494
|
+
<Segment
|
|
1495
|
+
secondary
|
|
1496
|
+
attached
|
|
1497
|
+
className="contents-breadcrumbs"
|
|
1498
|
+
>
|
|
1499
|
+
<ContentsBreadcrumbs items={this.props.breadcrumbs} />
|
|
1500
|
+
<Dropdown
|
|
1501
|
+
item
|
|
1502
|
+
upward={false}
|
|
1503
|
+
icon={
|
|
1504
|
+
<Icon
|
|
1505
|
+
name={moreSVG}
|
|
1506
|
+
size="24px"
|
|
1507
|
+
color="#826a6a"
|
|
1508
|
+
/>
|
|
1509
|
+
}
|
|
1510
|
+
className="right floating selectIndex"
|
|
1511
|
+
>
|
|
1512
|
+
<Dropdown.Menu className="left">
|
|
1513
|
+
<Dropdown.Header
|
|
1514
|
+
content={this.props.intl.formatMessage(
|
|
1515
|
+
messages.selectColumns,
|
|
1516
|
+
)}
|
|
1517
|
+
/>
|
|
1518
|
+
<Dropdown.Menu scrolling>
|
|
1519
|
+
{map(
|
|
1520
|
+
filter(
|
|
1521
|
+
this.state.index.order,
|
|
1522
|
+
(index) => index !== 'sortable_title',
|
|
1523
|
+
),
|
|
1524
|
+
(index) => (
|
|
1525
|
+
<Dropdown.Item
|
|
1526
|
+
key={index}
|
|
1527
|
+
value={index}
|
|
1528
|
+
onClick={this.onSelectIndex}
|
|
1529
|
+
className="iconAlign"
|
|
1530
|
+
>
|
|
1531
|
+
{this.state.index.values[index]
|
|
1532
|
+
.selected ? (
|
|
1533
|
+
<Icon
|
|
1534
|
+
name={checkboxCheckedSVG}
|
|
1535
|
+
size="24px"
|
|
1536
|
+
color="#007eb1"
|
|
1537
|
+
className={
|
|
1538
|
+
this.state.index.values[index].label
|
|
1539
|
+
}
|
|
1540
|
+
/>
|
|
1541
|
+
) : (
|
|
1542
|
+
<Icon
|
|
1543
|
+
name={checkboxUncheckedSVG}
|
|
1544
|
+
className={
|
|
1545
|
+
this.state.index.values[index].label
|
|
1546
|
+
}
|
|
1547
|
+
size="24px"
|
|
1548
|
+
/>
|
|
1549
|
+
)}
|
|
1550
|
+
<span>
|
|
1551
|
+
{' '}
|
|
1552
|
+
{this.props.intl.formatMessage({
|
|
1553
|
+
id: this.state.index.values[index]
|
|
1554
|
+
.label,
|
|
1555
|
+
defaultMessage:
|
|
1556
|
+
this.state.index.values[index]
|
|
1557
|
+
.label,
|
|
1558
|
+
})}
|
|
1559
|
+
</span>
|
|
1560
|
+
</Dropdown.Item>
|
|
1561
|
+
),
|
|
1562
|
+
)}
|
|
1563
|
+
</Dropdown.Menu>
|
|
1564
|
+
</Dropdown.Menu>
|
|
1565
|
+
</Dropdown>
|
|
1566
|
+
</Segment>
|
|
1567
|
+
<div
|
|
1568
|
+
id="contents-table-wrapper"
|
|
1569
|
+
className="contents-table-wrapper"
|
|
1570
|
+
role="region"
|
|
1571
|
+
>
|
|
1572
|
+
<span
|
|
1573
|
+
aria-live="polite"
|
|
1574
|
+
className="search-feedback"
|
|
1575
|
+
role="status"
|
|
1576
|
+
>
|
|
1577
|
+
{`${this.props.intl.formatMessage(
|
|
1578
|
+
messages.resultCount,
|
|
1579
|
+
)}: ${this.props.total || 0}`}
|
|
1580
|
+
</span>
|
|
1581
|
+
<Table selectable compact singleLine attached>
|
|
1582
|
+
<Table.Header>
|
|
1583
|
+
<Table.Row>
|
|
1584
|
+
<Table.HeaderCell>
|
|
1585
|
+
<Popup
|
|
1586
|
+
menu={true}
|
|
1587
|
+
position="bottom left"
|
|
1588
|
+
flowing={true}
|
|
1589
|
+
basic={true}
|
|
1590
|
+
on="click"
|
|
1591
|
+
popper={{
|
|
1592
|
+
className: 'dropdown-popup',
|
|
1593
|
+
}}
|
|
1594
|
+
trigger={
|
|
1595
|
+
<Icon
|
|
1596
|
+
name={configurationSVG}
|
|
1597
|
+
size="24px"
|
|
1598
|
+
color="#826a6a"
|
|
1599
|
+
className="dropdown-popup-trigger configuration-svg"
|
|
1600
|
+
/>
|
|
1601
|
+
}
|
|
1602
|
+
>
|
|
1603
|
+
<Menu vertical borderless fluid>
|
|
1604
|
+
<Menu.Header
|
|
1605
|
+
content={this.props.intl.formatMessage(
|
|
1606
|
+
messages.rearrangeBy,
|
|
1607
|
+
)}
|
|
1608
|
+
/>
|
|
1609
|
+
{map(
|
|
1610
|
+
[
|
|
1611
|
+
'id',
|
|
1612
|
+
'sortable_title',
|
|
1613
|
+
'EffectiveDate',
|
|
1614
|
+
'CreationDate',
|
|
1615
|
+
'ModificationDate',
|
|
1616
|
+
'portal_type',
|
|
1617
|
+
],
|
|
1618
|
+
(index) => (
|
|
1619
|
+
<Dropdown
|
|
1620
|
+
key={index}
|
|
1621
|
+
item
|
|
1622
|
+
simple
|
|
1623
|
+
className={`sort_${index} icon-align`}
|
|
1624
|
+
icon={
|
|
1625
|
+
<Icon
|
|
1626
|
+
name={downKeySVG}
|
|
1627
|
+
size="24px"
|
|
1628
|
+
className="left"
|
|
1629
|
+
/>
|
|
1630
|
+
}
|
|
1631
|
+
text={this.props.intl.formatMessage(
|
|
1632
|
+
{
|
|
1633
|
+
id: Indexes[index].label,
|
|
1634
|
+
},
|
|
1635
|
+
)}
|
|
1636
|
+
>
|
|
1637
|
+
<Dropdown.Menu>
|
|
1638
|
+
<Dropdown.Item
|
|
1639
|
+
onClick={this.onSortItems}
|
|
1640
|
+
value={`${Indexes[index].sort_on}|ascending`}
|
|
1641
|
+
className={`sort_${Indexes[index].sort_on}_ascending icon-align`}
|
|
1642
|
+
>
|
|
1643
|
+
<Icon
|
|
1644
|
+
name={sortDownSVG}
|
|
1645
|
+
size="24px"
|
|
1646
|
+
/>{' '}
|
|
1647
|
+
<FormattedMessage
|
|
1648
|
+
id="Ascending"
|
|
1649
|
+
defaultMessage="Ascending"
|
|
1650
|
+
/>
|
|
1651
|
+
</Dropdown.Item>
|
|
1652
|
+
<Dropdown.Item
|
|
1653
|
+
onClick={this.onSortItems}
|
|
1654
|
+
value={`${Indexes[index].sort_on}|descending`}
|
|
1655
|
+
className={`sort_${Indexes[index].sort_on}_descending icon-align`}
|
|
1656
|
+
>
|
|
1657
|
+
<Icon
|
|
1658
|
+
name={sortUpSVG}
|
|
1659
|
+
size="24px"
|
|
1660
|
+
/>{' '}
|
|
1661
|
+
<FormattedMessage
|
|
1662
|
+
id="Descending"
|
|
1663
|
+
defaultMessage="Descending"
|
|
1664
|
+
/>
|
|
1665
|
+
</Dropdown.Item>
|
|
1666
|
+
</Dropdown.Menu>
|
|
1667
|
+
</Dropdown>
|
|
1668
|
+
),
|
|
1669
|
+
)}
|
|
1670
|
+
</Menu>
|
|
1671
|
+
</Popup>
|
|
1672
|
+
</Table.HeaderCell>
|
|
1673
|
+
<Table.HeaderCell>
|
|
1674
|
+
<Popup
|
|
1675
|
+
menu={true}
|
|
1676
|
+
position="bottom left"
|
|
1677
|
+
flowing={true}
|
|
1678
|
+
basic={true}
|
|
1679
|
+
on="click"
|
|
1680
|
+
popper={{
|
|
1681
|
+
className: 'dropdown-popup',
|
|
1682
|
+
}}
|
|
1683
|
+
trigger={
|
|
1684
|
+
<Icon
|
|
1685
|
+
name={
|
|
1686
|
+
this.state.selected.length === 0
|
|
1687
|
+
? checkboxUncheckedSVG
|
|
1688
|
+
: this.state.selected.length ===
|
|
1689
|
+
this.state.items.length
|
|
1690
|
+
? checkboxCheckedSVG
|
|
1691
|
+
: checkboxIndeterminateSVG
|
|
1692
|
+
}
|
|
1693
|
+
color={
|
|
1694
|
+
this.state.selected.length > 0
|
|
1695
|
+
? '#007eb1'
|
|
1696
|
+
: '#826a6a'
|
|
1697
|
+
}
|
|
1698
|
+
className="dropdown-popup-trigger"
|
|
1699
|
+
size="24px"
|
|
1700
|
+
/>
|
|
1701
|
+
}
|
|
1702
|
+
>
|
|
1703
|
+
<Menu vertical borderless fluid>
|
|
1704
|
+
<Menu.Header
|
|
1705
|
+
content={this.props.intl.formatMessage(
|
|
1706
|
+
messages.select,
|
|
1707
|
+
)}
|
|
1708
|
+
/>
|
|
1709
|
+
<Menu.Item onClick={this.onSelectAll}>
|
|
1710
|
+
<Icon
|
|
1711
|
+
name={checkboxCheckedSVG}
|
|
1712
|
+
color="#007eb1"
|
|
1713
|
+
size="24px"
|
|
1714
|
+
/>{' '}
|
|
1715
|
+
<FormattedMessage
|
|
1716
|
+
id="All"
|
|
1717
|
+
defaultMessage="All"
|
|
1718
|
+
/>
|
|
1719
|
+
</Menu.Item>
|
|
1720
|
+
<Menu.Item onClick={this.onSelectNone}>
|
|
1721
|
+
<Icon
|
|
1722
|
+
name={checkboxUncheckedSVG}
|
|
1723
|
+
size="24px"
|
|
1724
|
+
/>{' '}
|
|
1725
|
+
<FormattedMessage
|
|
1726
|
+
id="None"
|
|
1727
|
+
defaultMessage="None"
|
|
1728
|
+
/>
|
|
1729
|
+
</Menu.Item>
|
|
1730
|
+
<Divider />
|
|
1731
|
+
<Menu.Header
|
|
1732
|
+
content={this.props.intl.formatMessage(
|
|
1733
|
+
messages.selected,
|
|
1734
|
+
{
|
|
1735
|
+
count: this.state.selected.length,
|
|
1736
|
+
},
|
|
1737
|
+
)}
|
|
1738
|
+
/>
|
|
1739
|
+
<Input
|
|
1740
|
+
icon={
|
|
1741
|
+
<Icon name={zoomSVG} size="24px" />
|
|
1742
|
+
}
|
|
1743
|
+
iconPosition="left"
|
|
1744
|
+
className="item search"
|
|
1745
|
+
placeholder={this.props.intl.formatMessage(
|
|
1746
|
+
messages.filter,
|
|
1747
|
+
)}
|
|
1748
|
+
value={
|
|
1749
|
+
this.state.selectedMenuFilter || ''
|
|
1750
|
+
}
|
|
1751
|
+
onChange={this.onChangeSelected}
|
|
1752
|
+
onClick={(e) => {
|
|
1753
|
+
e.preventDefault();
|
|
1754
|
+
e.stopPropagation();
|
|
1755
|
+
}}
|
|
1756
|
+
/>
|
|
1757
|
+
<Menu.Menu scrolling>
|
|
1758
|
+
{map(filteredItems, (item) => (
|
|
1759
|
+
<Menu.Item
|
|
1760
|
+
key={item}
|
|
1761
|
+
value={item}
|
|
1762
|
+
onClick={this.onDeselect}
|
|
1763
|
+
>
|
|
1764
|
+
<Icon
|
|
1765
|
+
name={deleteSVG}
|
|
1766
|
+
color="#e40166"
|
|
1767
|
+
size="24px"
|
|
1768
|
+
/>{' '}
|
|
1769
|
+
{this.getFieldById(item, 'title')}
|
|
1770
|
+
</Menu.Item>
|
|
1771
|
+
))}
|
|
1772
|
+
</Menu.Menu>
|
|
1773
|
+
</Menu>
|
|
1774
|
+
</Popup>
|
|
1775
|
+
</Table.HeaderCell>
|
|
1776
|
+
<Table.HeaderCell
|
|
1777
|
+
width={Math.ceil(
|
|
1778
|
+
16 / this.state.index.selectedCount,
|
|
1779
|
+
)}
|
|
1780
|
+
>
|
|
1781
|
+
<FormattedMessage
|
|
1782
|
+
id="Title"
|
|
1783
|
+
defaultMessage="Title"
|
|
1784
|
+
/>
|
|
1785
|
+
</Table.HeaderCell>
|
|
1786
|
+
{map(
|
|
1787
|
+
this.state.index.order,
|
|
1788
|
+
(index, order) =>
|
|
1789
|
+
this.state.index.values[index].selected && (
|
|
1790
|
+
<ContentsIndexHeader
|
|
1791
|
+
key={index}
|
|
1792
|
+
width={Math.ceil(
|
|
1793
|
+
16 / this.state.index.selectedCount,
|
|
1794
|
+
)}
|
|
1795
|
+
label={
|
|
1796
|
+
this.state.index.values[index].label
|
|
1797
|
+
}
|
|
1798
|
+
order={order}
|
|
1799
|
+
onOrderIndex={this.onOrderIndex}
|
|
1800
|
+
/>
|
|
1801
|
+
),
|
|
1802
|
+
)}
|
|
1803
|
+
<Table.HeaderCell textAlign="right">
|
|
1804
|
+
<FormattedMessage
|
|
1805
|
+
id="Actions"
|
|
1806
|
+
defaultMessage="Actions"
|
|
1807
|
+
/>
|
|
1808
|
+
</Table.HeaderCell>
|
|
1809
|
+
</Table.Row>
|
|
1810
|
+
</Table.Header>
|
|
1811
|
+
<Table.Body>
|
|
1812
|
+
{this.state.items.map((item, order) => (
|
|
1813
|
+
<ContentsItem
|
|
1814
|
+
key={item['@id']}
|
|
1815
|
+
item={item}
|
|
1816
|
+
order={order}
|
|
1817
|
+
selected={
|
|
1818
|
+
indexOf(
|
|
1819
|
+
this.state.selected,
|
|
1820
|
+
item['@id'],
|
|
1821
|
+
) !== -1
|
|
1822
|
+
}
|
|
1823
|
+
onClick={this.onSelect}
|
|
1824
|
+
indexes={filter(
|
|
1825
|
+
map(this.state.index.order, (index) => ({
|
|
1826
|
+
id: index,
|
|
1827
|
+
type: this.state.index.values[index].type,
|
|
1828
|
+
})),
|
|
1829
|
+
(index) =>
|
|
1830
|
+
this.state.index.values[index.id]
|
|
1831
|
+
.selected,
|
|
1832
|
+
)}
|
|
1833
|
+
onCut={this.cut}
|
|
1834
|
+
onCopy={this.copy}
|
|
1835
|
+
onDelete={this.delete}
|
|
1836
|
+
onOrderItem={this.onOrderItem}
|
|
1837
|
+
onMoveToTop={this.onMoveToTop}
|
|
1838
|
+
onMoveToBottom={this.onMoveToBottom}
|
|
1839
|
+
/>
|
|
1840
|
+
))}
|
|
1841
|
+
</Table.Body>
|
|
1842
|
+
</Table>
|
|
1843
|
+
</div>
|
|
1844
|
+
|
|
1845
|
+
<div className="contents-pagination">
|
|
1846
|
+
<Pagination
|
|
1847
|
+
current={this.state.currentPage}
|
|
1848
|
+
total={Math.ceil(
|
|
1849
|
+
this.props.total / this.state.pageSize,
|
|
1850
|
+
)}
|
|
1851
|
+
pageSize={this.state.pageSize}
|
|
1852
|
+
pageSizes={[
|
|
1853
|
+
50,
|
|
1854
|
+
this.props.intl.formatMessage(messages.all),
|
|
1855
|
+
]}
|
|
1856
|
+
onChangePage={this.onChangePage}
|
|
1857
|
+
onChangePageSize={this.onChangePageSize}
|
|
1858
|
+
/>
|
|
1859
|
+
</div>
|
|
1860
|
+
</Segment.Group>
|
|
1861
|
+
</section>
|
|
1862
|
+
</article>
|
|
1863
|
+
</div>
|
|
1864
|
+
</DropzoneContent>
|
|
1865
|
+
{this.state.isClient &&
|
|
1866
|
+
createPortal(
|
|
1867
|
+
<Toolbar
|
|
1868
|
+
pathname={this.props.pathname}
|
|
1869
|
+
inner={
|
|
1870
|
+
<Link
|
|
1871
|
+
to={`${path}`}
|
|
1872
|
+
aria-label={this.props.intl.formatMessage(
|
|
1873
|
+
messages.back,
|
|
1874
|
+
)}
|
|
1875
|
+
>
|
|
1876
|
+
<Icon
|
|
1877
|
+
name={backSVG}
|
|
1878
|
+
className="contents circled"
|
|
1879
|
+
size="30px"
|
|
1880
|
+
title={this.props.intl.formatMessage(messages.back)}
|
|
1881
|
+
/>
|
|
1882
|
+
</Link>
|
|
1883
|
+
}
|
|
1884
|
+
/>,
|
|
1885
|
+
document.getElementById('toolbar'),
|
|
1886
|
+
)}
|
|
1887
|
+
</Dimmer.Dimmable>
|
|
1888
|
+
</Container>
|
|
1889
|
+
) : (
|
|
1890
|
+
<Unauthorized staticContext={this.props.staticContext} />
|
|
1891
|
+
)}
|
|
1892
|
+
</>
|
|
1893
|
+
) : (
|
|
1894
|
+
<Unauthorized staticContext={this.props.staticContext} />
|
|
1895
|
+
);
|
|
1896
|
+
}
|
|
1897
|
+
}
|
|
1898
|
+
|
|
1899
|
+
let dndContext;
|
|
1900
|
+
|
|
1901
|
+
const DragDropConnector = (props) => {
|
|
1902
|
+
const { DragDropContext } = props.reactDnd;
|
|
1903
|
+
const HTML5Backend = props.reactDndHtml5Backend.default;
|
|
1904
|
+
|
|
1905
|
+
const DndConnectedContents = React.useMemo(() => {
|
|
1906
|
+
if (!dndContext) {
|
|
1907
|
+
dndContext = DragDropContext(HTML5Backend);
|
|
1908
|
+
}
|
|
1909
|
+
return dndContext(Contents);
|
|
1910
|
+
}, [DragDropContext, HTML5Backend]);
|
|
1911
|
+
|
|
1912
|
+
return <DndConnectedContents {...props} />;
|
|
1913
|
+
};
|
|
1914
|
+
|
|
1915
|
+
export const __test__ = compose(
|
|
1916
|
+
injectIntl,
|
|
1917
|
+
injectLazyLibs(['toastify', 'reactDnd']),
|
|
1918
|
+
connect(
|
|
1919
|
+
(store, props) => {
|
|
1920
|
+
return {
|
|
1921
|
+
token: store.userSession.token,
|
|
1922
|
+
items: store.search.items,
|
|
1923
|
+
sort: store.content.update.sort,
|
|
1924
|
+
index: store.content.updatecolumns.idx,
|
|
1925
|
+
breadcrumbs: store.breadcrumbs.items,
|
|
1926
|
+
total: store.search.total,
|
|
1927
|
+
searchRequest: {
|
|
1928
|
+
loading: store.search.loading,
|
|
1929
|
+
loaded: store.search.loaded,
|
|
1930
|
+
},
|
|
1931
|
+
pathname: props.location.pathname,
|
|
1932
|
+
action: store.clipboard.action,
|
|
1933
|
+
source: store.clipboard.source,
|
|
1934
|
+
clipboardRequest: store.clipboard.request,
|
|
1935
|
+
deleteRequest: store.content.delete,
|
|
1936
|
+
updateRequest: store.content.update,
|
|
1937
|
+
objectActions: store.actions.actions.object,
|
|
1938
|
+
orderRequest: store.content.order,
|
|
1939
|
+
};
|
|
1940
|
+
},
|
|
1941
|
+
{
|
|
1942
|
+
searchContent,
|
|
1943
|
+
cut,
|
|
1944
|
+
copy,
|
|
1945
|
+
copyContent,
|
|
1946
|
+
deleteContent,
|
|
1947
|
+
listActions,
|
|
1948
|
+
moveContent,
|
|
1949
|
+
orderContent,
|
|
1950
|
+
sortContent,
|
|
1951
|
+
updateColumnsContent,
|
|
1952
|
+
getContent,
|
|
1953
|
+
},
|
|
1954
|
+
),
|
|
1955
|
+
)(Contents);
|
|
1956
|
+
|
|
1957
|
+
export default compose(
|
|
1958
|
+
injectIntl,
|
|
1959
|
+
connect(
|
|
1960
|
+
(store, props) => {
|
|
1961
|
+
return {
|
|
1962
|
+
token: store.userSession.token,
|
|
1963
|
+
items: store.search.items,
|
|
1964
|
+
sort: store.content.update.sort,
|
|
1965
|
+
index: store.content.updatecolumns.idx,
|
|
1966
|
+
breadcrumbs: store.breadcrumbs.items,
|
|
1967
|
+
total: store.search.total,
|
|
1968
|
+
searchRequest: {
|
|
1969
|
+
loading: store.search.loading,
|
|
1970
|
+
loaded: store.search.loaded,
|
|
1971
|
+
},
|
|
1972
|
+
pathname: props.location.pathname,
|
|
1973
|
+
action: store.clipboard.action,
|
|
1974
|
+
source: store.clipboard.source,
|
|
1975
|
+
clipboardRequest: store.clipboard.request,
|
|
1976
|
+
deleteRequest: store.content.delete,
|
|
1977
|
+
updateRequest: store.content.update,
|
|
1978
|
+
objectActions: store.actions.actions.object,
|
|
1979
|
+
orderRequest: store.content.order,
|
|
1980
|
+
};
|
|
1981
|
+
},
|
|
1982
|
+
{
|
|
1983
|
+
searchContent,
|
|
1984
|
+
cut,
|
|
1985
|
+
copy,
|
|
1986
|
+
copyContent,
|
|
1987
|
+
deleteContent,
|
|
1988
|
+
listActions,
|
|
1989
|
+
moveContent,
|
|
1990
|
+
orderContent,
|
|
1991
|
+
sortContent,
|
|
1992
|
+
updateColumnsContent,
|
|
1993
|
+
getContent,
|
|
1994
|
+
},
|
|
1995
|
+
),
|
|
1996
|
+
asyncConnect([
|
|
1997
|
+
{
|
|
1998
|
+
key: 'actions',
|
|
1999
|
+
// Dispatch async/await to make the operation synchronous, otherwise it returns
|
|
2000
|
+
// before the promise is resolved
|
|
2001
|
+
promise: async ({ location, store: { dispatch } }) =>
|
|
2002
|
+
await dispatch(listActions(getBaseUrl(location.pathname))),
|
|
2003
|
+
},
|
|
2004
|
+
]),
|
|
2005
|
+
injectLazyLibs(['toastify', 'reactDnd', 'reactDndHtml5Backend']),
|
|
2006
|
+
)(DragDropConnector);
|