@eeacms/volto-marine-policy 1.0.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 (154) hide show
  1. package/.coverage.babel.config.js +9 -0
  2. package/.eslintrc.js +65 -0
  3. package/.husky/pre-commit +2 -0
  4. package/.release-it.json +17 -0
  5. package/CHANGELOG.md +5 -0
  6. package/DEVELOP.md +53 -0
  7. package/DEVELOP.md.tpl +106 -0
  8. package/Jenkinsfile.tpl +416 -0
  9. package/LICENSE.md +9 -0
  10. package/Makefile.tpl +165 -0
  11. package/README.md +172 -0
  12. package/README.md.tpl +93 -0
  13. package/RELEASE.md +74 -0
  14. package/babel.config.js +17 -0
  15. package/bootstrap +41 -0
  16. package/cypress.config.js +24 -0
  17. package/docker-compose.yml +32 -0
  18. package/jest-addon.config.js +35 -0
  19. package/jest-addon.config.js.tpl +51 -0
  20. package/jest.setup.js +65 -0
  21. package/locales/de/LC_MESSAGES/volto.po +14 -0
  22. package/locales/en/LC_MESSAGES/volto.po +14 -0
  23. package/locales/it/LC_MESSAGES/volto.po +14 -0
  24. package/locales/ro/LC_MESSAGES/volto.po +14 -0
  25. package/locales/volto.pot +16 -0
  26. package/package.json +68 -0
  27. package/package.json.tpl +70 -0
  28. package/razzle.extend.js +29 -0
  29. package/src/components/Blocks/CustomBlockTemplates/customBlockTemplates.js +25 -0
  30. package/src/components/Blocks/MsfdDataExplorerBlock/Edit.jsx +29 -0
  31. package/src/components/Blocks/MsfdDataExplorerBlock/View.jsx +105 -0
  32. package/src/components/Blocks/MsfdDataExplorerBlock/index.js +23 -0
  33. package/src/components/Blocks/MsfdDataExplorerBlock/schema.jsx +30 -0
  34. package/src/components/Result/MarineMeasureItem.jsx +83 -0
  35. package/src/components/Widgets/MeasureViewWidget.jsx +233 -0
  36. package/src/components/Widgets/String.jsx +15 -0
  37. package/src/components/Widgets/TextAlign.jsx +41 -0
  38. package/src/components/Widgets/measure.css +101 -0
  39. package/src/components/index.js +15 -0
  40. package/src/components/theme/AppExtras/PrintPage/PrintPage.jsx +61 -0
  41. package/src/components/theme/AppExtras/PrintPage/css/printpage.less +29 -0
  42. package/src/components/theme/AppExtras/PrintPage/index.js +3 -0
  43. package/src/components/theme/AppExtras/ScrollToTop/ScrollToTop.jsx +61 -0
  44. package/src/components/theme/AppExtras/ScrollToTop/css/scrolltop.less +19 -0
  45. package/src/components/theme/AppExtras/ScrollToTop/index.js +3 -0
  46. package/src/components/theme/AppExtras/index.js +18 -0
  47. package/src/components/theme/DatabaseItemView/DatabaseItemView.jsx +39 -0
  48. package/src/components/theme/DatabaseItemView/style.less +87 -0
  49. package/src/components/theme/Header/HeroSection.jsx +45 -0
  50. package/src/components/theme/Header/StickyHeader.jsx +51 -0
  51. package/src/components/theme/Header/less/globals.less +18 -0
  52. package/src/components/theme/Header/less/herosection.less +64 -0
  53. package/src/components/theme/Header/less/herosection.variables +18 -0
  54. package/src/components/theme/ItemMetadata/ItemMetadata.jsx +217 -0
  55. package/src/components/theme/ItemMetadata/ItemMetadataSnippet.jsx +69 -0
  56. package/src/components/theme/ItemMetadata/ItemTitle.jsx +29 -0
  57. package/src/components/theme/MetadataListingView/MapPreview.jsx +105 -0
  58. package/src/components/theme/MetadataListingView/MetadataHeader.jsx +66 -0
  59. package/src/components/theme/MetadataListingView/MetadataListingView.jsx +36 -0
  60. package/src/components/theme/MetadataListingView/style.less +219 -0
  61. package/src/components/theme/SimpleListingView/SimpleListingView.jsx +97 -0
  62. package/src/components/theme/SimpleListingView/style.less +33 -0
  63. package/src/components/theme/Tableau/TableauDownload.jsx +86 -0
  64. package/src/components/theme/Tableau/TableauFullscreen.jsx +78 -0
  65. package/src/components/theme/Tableau/TableauShare.jsx +128 -0
  66. package/src/components/theme/View/FullwidthView.jsx +102 -0
  67. package/src/components/theme/View/HeroSectionView.jsx +125 -0
  68. package/src/constants/ActionTypes.js +12 -0
  69. package/src/constants/measureFields.js +56 -0
  70. package/src/customizations/@eeacms/volto-block-style/StyleWrapper/schema.js +217 -0
  71. package/src/customizations/@eeacms/volto-eea-design-system/ui/Header/Header.jsx +358 -0
  72. package/src/customizations/@eeacms/volto-eea-design-system/ui/Header/HeaderMenuPopUp.js +403 -0
  73. package/src/customizations/@eeacms/volto-eea-design-system/ui/Header/HeaderSearchPopUp.js +131 -0
  74. package/src/customizations/@eeacms/volto-eea-design-system/ui/Logo/Logo.jsx +32 -0
  75. package/src/customizations/@eeacms/volto-eea-design-system/ui/Logo/marine_logo.svg +63 -0
  76. package/src/customizations/volto/components/manage/Contents/ContentsBreadcrumbs.jsx +81 -0
  77. package/src/customizations/volto/components/manage/Contents/README.md +1 -0
  78. package/src/customizations/volto/components/manage/Toolbar/PersonalTools.jsx +205 -0
  79. package/src/customizations/volto/components/manage/Toolbar/Toolbar.jsx +624 -0
  80. package/src/customizations/volto/components/theme/Breadcrumbs/Breadcrumbs.jsx +49 -0
  81. package/src/customizations/volto/components/theme/Breadcrumbs/README.md +1 -0
  82. package/src/customizations/volto/components/theme/Header/Header.jsx +272 -0
  83. package/src/helpers/index.js +2 -0
  84. package/src/helpers/useCopyToClipboard.js +25 -0
  85. package/src/helpers/useOutsideClick.js +20 -0
  86. package/src/icons/arrow.svg +3 -0
  87. package/src/icons/basket.svg +3 -0
  88. package/src/icons/newspaper.svg +3 -0
  89. package/src/icons/popup.svg +3 -0
  90. package/src/icons/search.svg +3 -0
  91. package/src/icons/star-full.svg +3 -0
  92. package/src/icons/user.svg +3 -0
  93. package/src/index.js +466 -0
  94. package/src/reducers/breadcrumb/breadcrumb.js +59 -0
  95. package/src/reducers/index.js +2 -0
  96. package/src/reducers/localnavigation/localnavigation.js +69 -0
  97. package/src/search/config.js +98 -0
  98. package/src/search/facets.js +85 -0
  99. package/src/search/index.js +48 -0
  100. package/src/search/views.js +15 -0
  101. package/src/slate-styles.less +43 -0
  102. package/src/static/bise_logo.svg +1 -0
  103. package/src/static/cca_logo.svg +20 -0
  104. package/src/static/ec_logo.svg +343 -0
  105. package/src/static/ec_logo_white.svg +10 -0
  106. package/src/static/eea_logo.svg +14 -0
  107. package/src/static/footer-fishes.svg +21 -0
  108. package/src/static/forest_logo.svg +30 -0
  109. package/src/static/freshwater_logo.svg +12 -0
  110. package/src/static/marine_logo.svg +63 -0
  111. package/src/static/marine_logo_white.svg +44 -0
  112. package/src/utils.js +38 -0
  113. package/theme/assets/fonts/Poppins/Poppins-Bold.ttf +0 -0
  114. package/theme/assets/fonts/Poppins/Poppins-Bold.woff +0 -0
  115. package/theme/assets/fonts/Poppins/Poppins-Bold.woff2 +0 -0
  116. package/theme/assets/fonts/Poppins/Poppins-ExtraBold.ttf +0 -0
  117. package/theme/assets/fonts/Poppins/Poppins-Light.ttf +0 -0
  118. package/theme/assets/fonts/Poppins/Poppins-Light.woff +0 -0
  119. package/theme/assets/fonts/Poppins/Poppins-Light.woff2 +0 -0
  120. package/theme/assets/fonts/Poppins/Poppins-Regular.ttf +0 -0
  121. package/theme/assets/fonts/Poppins/Poppins-Regular.woff +0 -0
  122. package/theme/assets/fonts/Poppins/Poppins-Regular.woff2 +0 -0
  123. package/theme/assets/fonts/Poppins/Poppins-SemiBold.ttf +0 -0
  124. package/theme/assets/fonts/Poppins/Poppins-SemiBold.woff +0 -0
  125. package/theme/assets/fonts/Poppins/Poppins-SemiBold.woff2 +0 -0
  126. package/theme/assets/fonts/Roboto/Roboto-Light.ttf +0 -0
  127. package/theme/assets/fonts/Roboto/Roboto-Light.woff +0 -0
  128. package/theme/assets/fonts/Roboto/Roboto-Light.woff2 +0 -0
  129. package/theme/assets/fonts/Roboto/Roboto-Medium.ttf +0 -0
  130. package/theme/assets/fonts/Roboto/Roboto-Medium.woff +0 -0
  131. package/theme/assets/fonts/Roboto/Roboto-Medium.woff2 +0 -0
  132. package/theme/assets/fonts/Roboto/Roboto-Regular.ttf +0 -0
  133. package/theme/assets/fonts/Roboto/Roboto-Regular.woff +0 -0
  134. package/theme/assets/fonts/Roboto/Roboto-Regular.woff2 +0 -0
  135. package/theme/assets/images/Footer/ec_logo.svg +10 -0
  136. package/theme/assets/images/Header/climate-adapt-logo-1.svg +20 -0
  137. package/theme/assets/images/Header/climate-adapt-logo.svg +22 -0
  138. package/theme/assets/images/spinner.svg +1 -0
  139. package/theme/collections/table.variables +17 -0
  140. package/theme/elements/button.overrides +22 -0
  141. package/theme/extras/banner.variables +5 -0
  142. package/theme/extras/contextNavigation.overrides +60 -0
  143. package/theme/extras/contextNavigation.variables +32 -0
  144. package/theme/extras/footer.variables +6 -0
  145. package/theme/extras/header.overrides +20 -0
  146. package/theme/extras/header.variables +7 -0
  147. package/theme/extras/hero.overrides +4 -0
  148. package/theme/extras/inpageNavigation.variables +5 -0
  149. package/theme/extras/mixins.less +8 -0
  150. package/theme/globals/site.overrides +349 -0
  151. package/theme/globals/site.variables +997 -0
  152. package/theme/theme.config +136 -0
  153. package/theme/tokens/colors.less +9 -0
  154. package/theme/tokens/tokens.less +1 -0
@@ -0,0 +1,105 @@
1
+ import React from 'react';
2
+ import { Modal, Button } from 'semantic-ui-react';
3
+ import { Icon } from '@plone/volto/components';
4
+ import config from '@plone/volto/registry';
5
+ import fullscreenSVG from '@plone/volto/icons/slider.svg';
6
+ import { useHistory, useLocation } from 'react-router-dom';
7
+ import {
8
+ TableauDownload,
9
+ TableauShare,
10
+ } from '@eeacms/volto-marine-policy/components';
11
+
12
+ const MapPreview = (props) => {
13
+ const { item, map_url, tableau_url, item_view } = props;
14
+ const itemID = item?.source?.[0].getId || item?.id;
15
+ const modalHash = itemID + '_preview';
16
+ const [open, setOpen] = React.useState(false);
17
+ const {
18
+ blocks: { blocksConfig },
19
+ } = config;
20
+ const TableauBlockView = blocksConfig.tableau_block.view;
21
+ const MapBlockView = blocksConfig.maps.view;
22
+ const history = useHistory();
23
+ const location = useLocation();
24
+
25
+ React.useEffect(() => {
26
+ if (location.hash.includes(modalHash)) {
27
+ setOpen(true);
28
+ } else {
29
+ setOpen(false);
30
+ }
31
+ }, [location, modalHash]);
32
+
33
+ const closeModal = () => {
34
+ history.push({
35
+ hash: item_view ? '' : itemID,
36
+ });
37
+ setOpen(false);
38
+ };
39
+
40
+ return (
41
+ <>
42
+ <div className="toolbar-button-wrapper">
43
+ <Button
44
+ size="mini"
45
+ className="viz-btn toolbar-button"
46
+ title="Preview"
47
+ onClick={() => {
48
+ setOpen(true);
49
+ if (item) {
50
+ history.push({
51
+ hash: itemID + '_preview',
52
+ });
53
+ }
54
+ }}
55
+ >
56
+ <Icon name={fullscreenSVG} size="28px" />
57
+ </Button>
58
+ <span className="btn-text">Preview</span>
59
+ </div>
60
+
61
+ <Modal
62
+ className="metadata-tableau"
63
+ onClose={closeModal}
64
+ onOpen={() => setOpen(true)}
65
+ open={open}
66
+ >
67
+ <Modal.Content>
68
+ {tableau_url && (
69
+ <TableauBlockView
70
+ {...props}
71
+ data={{ url: props.tableau_url, hideToolbar: true }}
72
+ >
73
+ {(viz) => {
74
+ return (
75
+ <div className="tableau-icons">
76
+ <TableauDownload {...props} viz={viz} />
77
+ <TableauShare
78
+ {...props}
79
+ viz={viz}
80
+ data={{ url: props.tableau_url }}
81
+ />
82
+ </div>
83
+ );
84
+ }}
85
+ </TableauBlockView>
86
+ )}
87
+
88
+ {map_url && (
89
+ <div style={{ margin: '1em 0' }}>
90
+ <MapBlockView {...props} data={{ url: map_url }} />
91
+ </div>
92
+ )}
93
+ </Modal.Content>
94
+
95
+ <Modal.Actions>
96
+ <Button primary onClick={closeModal}>
97
+ Close
98
+ </Button>
99
+ </Modal.Actions>
100
+ </Modal>
101
+ </>
102
+ );
103
+ };
104
+
105
+ export default MapPreview;
@@ -0,0 +1,66 @@
1
+ import React, { useState } from 'react';
2
+ import { Modal } from 'semantic-ui-react';
3
+ import {
4
+ ItemMetadata,
5
+ ItemTitle,
6
+ ItemMetadataSnippet,
7
+ } from '@eeacms/volto-marine-policy/components';
8
+ import './style.less';
9
+ import { useLocation, useHistory } from 'react-router-dom';
10
+
11
+ const MetadataHeader = (props) => {
12
+ const { item } = props;
13
+ const [isOpenModal, setOpenModal] = useState(false);
14
+ const history = useHistory();
15
+ const location = useLocation();
16
+
17
+ React.useEffect(() => {
18
+ if (!location.hash.includes(item.id)) {
19
+ setOpenModal(false);
20
+ }
21
+ }, [location, item.id]);
22
+
23
+ const closeModal = (item) => {
24
+ history.replace({}, document.title, window.location.pathname);
25
+ setOpenModal(false);
26
+ };
27
+
28
+ return (
29
+ <>
30
+ <div
31
+ className="listing-title"
32
+ onClick={() => {
33
+ setOpenModal(true);
34
+ history.push({
35
+ hash: item?.id,
36
+ });
37
+ }}
38
+ onKeyDown={() => setOpenModal(true)}
39
+ role="button"
40
+ tabIndex="0"
41
+ >
42
+ <h3>{item.title ? item.title : item.id}</h3>
43
+ </div>
44
+
45
+ <Modal
46
+ className="item-metadata-modal"
47
+ open={isOpenModal}
48
+ onClose={closeModal}
49
+ size="large"
50
+ closeIcon
51
+ centered
52
+ >
53
+ <Modal.Header>
54
+ <ItemMetadataSnippet item={item} />
55
+ <ItemTitle item={item} />
56
+ </Modal.Header>
57
+
58
+ <Modal.Content>
59
+ <ItemMetadata item={item} map_preview={true} shareItem={true} />
60
+ </Modal.Content>
61
+ </Modal>
62
+ </>
63
+ );
64
+ };
65
+
66
+ export default MetadataHeader;
@@ -0,0 +1,36 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import { connect } from 'react-redux';
4
+ import { compose } from 'redux';
5
+ import {
6
+ ItemMetadataSnippet,
7
+ MetadataHeader,
8
+ } from '@eeacms/volto-marine-policy/components';
9
+ import './style.less';
10
+
11
+ const MetadataListingView = ({ items, isEditMode, token }) => {
12
+ return (
13
+ <div className="items">
14
+ {items.map((item, index) => (
15
+ <div className="listing-item" key={item['@id']}>
16
+ <div className="listing-body">
17
+ <MetadataHeader item={item} />
18
+ <ItemMetadataSnippet item={item} />
19
+ <p>{item.description}</p>
20
+ </div>
21
+ </div>
22
+ ))}
23
+ </div>
24
+ );
25
+ };
26
+
27
+ MetadataListingView.propTypes = {
28
+ items: PropTypes.arrayOf(PropTypes.any).isRequired,
29
+ isEditMode: PropTypes.bool,
30
+ };
31
+
32
+ export default compose(
33
+ connect((state) => ({
34
+ token: state.userSession.token,
35
+ })),
36
+ )(MetadataListingView);
@@ -0,0 +1,219 @@
1
+ @type: 'extra';
2
+ @element: 'custom';
3
+
4
+ @import (multiple, reference, optional) '../../theme.config';
5
+
6
+ .item-metadata-table {
7
+ .ui.definition.table tr td:first-child:not(.ignored),
8
+ .ui.definition.table tr td.definition {
9
+ width: 220px;
10
+ background: transparent !important;
11
+ color: @textColor !important;
12
+ font-family: @headerFont;
13
+ vertical-align: top;
14
+ }
15
+
16
+ .ui.definition.table tr td a {
17
+ word-break: break-word;
18
+ }
19
+
20
+ .ui.definition.table tr:last-child {
21
+ border-bottom: none;
22
+ }
23
+
24
+ .ui.definition.table td {
25
+ border: none !important;
26
+ }
27
+
28
+ .tag-types {
29
+ div {
30
+ display: inline-block;
31
+ padding: 0 10px;
32
+ margin: 2px;
33
+ background-color: #ddd;
34
+ font-size: 12px;
35
+ }
36
+ }
37
+ }
38
+
39
+ @media only screen and (max-width: 767px) {
40
+ .item-metadata-table .ui.definition.table tr {
41
+ box-shadow: none !important;
42
+ }
43
+ }
44
+
45
+ .item-metadata-modal {
46
+ margin: 3.5rem auto !important;
47
+
48
+ .header {
49
+ border-bottom: 1px solid @lightGrey !important;
50
+
51
+ h3 {
52
+ margin-top: 0;
53
+ }
54
+ }
55
+
56
+ .copy-box {
57
+ right: 15px;
58
+ bottom: 15px;
59
+ }
60
+
61
+ .content {
62
+ overflow: auto;
63
+ max-height: 600px;
64
+ padding-top: 0 !important;
65
+ }
66
+
67
+ @media only screen and (max-width: @largeMobileBreakpoint) {
68
+ top: 0;
69
+ bottom: 0;
70
+ width: 100% !important;
71
+ height: 100% !important;
72
+ margin: 0 !important;
73
+ }
74
+ }
75
+
76
+ .item-modal-metadata {
77
+ margin-bottom: 0.5em;
78
+ font-family: @pageFont;
79
+ font-weight: normal;
80
+ line-height: 18px;
81
+ }
82
+
83
+ .item-metadata-modal {
84
+ .header a {
85
+ color: @secondaryColor;
86
+
87
+ &:hover {
88
+ color: @primaryColorHover;
89
+ }
90
+ }
91
+ }
92
+
93
+ .listing-body {
94
+ position: relative;
95
+ margin-top: 1.7em;
96
+
97
+ .ui.basic.button.add-fav-btn {
98
+ position: absolute;
99
+ top: 4px;
100
+ left: -23px;
101
+ margin: 0;
102
+ box-shadow: none !important;
103
+
104
+ &:hover {
105
+ background-color: transparent !important;
106
+ }
107
+
108
+ svg {
109
+ margin: 0 !important;
110
+ }
111
+
112
+ @media only screen and (max-width: @largeMobileBreakpoint) {
113
+ left: -19px;
114
+
115
+ svg {
116
+ height: 17px !important;
117
+ }
118
+ }
119
+ }
120
+ }
121
+
122
+ svg.selected {
123
+ fill: @primaryColor !important;
124
+ }
125
+
126
+ .listing-title h3 {
127
+ display: inline-block;
128
+ margin-top: 0 !important;
129
+ margin-bottom: 0 !important;
130
+ }
131
+
132
+ .tableau-download-dialog,
133
+ .tableau-share-dialog {
134
+ z-index: 9999 !important;
135
+ }
136
+
137
+ .item-metadata {
138
+ display: flex;
139
+ margin-bottom: 0.5rem;
140
+ font-size: 13px;
141
+
142
+ p {
143
+ display: -webkit-box;
144
+ overflow: hidden;
145
+ width: 100%;
146
+ -webkit-box-orient: vertical;
147
+ -webkit-line-clamp: 2;
148
+ }
149
+ }
150
+
151
+ .metadata-tab-title {
152
+ margin-right: 1px;
153
+ color: @primaryColor;
154
+ font-weight: 500;
155
+ }
156
+
157
+ .metadata-icons {
158
+ display: flex;
159
+ align-items: center;
160
+ justify-content: flex-end;
161
+ margin-top: 10px;
162
+ margin-bottom: 10px;
163
+
164
+ .ui.button.toolbar-button {
165
+ margin: 0 7px !important;
166
+ }
167
+ }
168
+
169
+ .metadata-tab-section {
170
+ display: inline-block;
171
+ margin-right: 10px;
172
+ font-size: 13px;
173
+ }
174
+
175
+ .metadata-tableau {
176
+ top: 0 !important;
177
+ width: 100% !important;
178
+ height: 100% !important;
179
+ margin: 0 !important;
180
+
181
+ .tableau-block {
182
+ position: relative;
183
+ }
184
+
185
+ .toolbar-button-wrapper .ui.button.toolbar-button {
186
+ margin: 0 7px !important;
187
+ }
188
+
189
+ .tableau-icons {
190
+ position: absolute;
191
+ top: -10px;
192
+ right: -18px !important;
193
+ display: flex;
194
+ flex-direction: row;
195
+ }
196
+ }
197
+
198
+ .toolbar-button {
199
+ position: relative;
200
+ width: 32px;
201
+ height: 32px;
202
+ padding: 2px !important;
203
+ background-color: @orange !important;
204
+ border-radius: 3px !important;
205
+ color: @white !important;
206
+
207
+ &:hover {
208
+ opacity: 0.6;
209
+ }
210
+ }
211
+
212
+ .toolbar-button svg {
213
+ position: absolute;
214
+ top: 50%;
215
+ left: 50%;
216
+ margin: 0 !important;
217
+ fill: #fff !important;
218
+ transform: translate(-50%, -50%);
219
+ }
@@ -0,0 +1,97 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import { Modal } from 'semantic-ui-react';
4
+ import {
5
+ ItemMetadata,
6
+ ItemTitle,
7
+ ItemMetadataSnippet,
8
+ } from '@eeacms/volto-marine-policy/components';
9
+ import { formatItemType } from '@eeacms/volto-marine-policy/utils';
10
+ import { useLocation, useHistory } from 'react-router-dom';
11
+ import './style.less';
12
+
13
+ const SimpleListingView = ({ items, isEditMode }) => {
14
+ const [isOpenModal, setOpenModal] = React.useState(false);
15
+ const [selectedItem, setSelectedItem] = React.useState(null);
16
+ const modalHash = selectedItem?.getId;
17
+ const history = useHistory();
18
+ const location = useLocation();
19
+
20
+ React.useEffect(() => {
21
+ if (location.hash.includes(modalHash)) {
22
+ setOpenModal(true);
23
+ } else {
24
+ setOpenModal(false);
25
+ }
26
+ }, [location, modalHash]);
27
+
28
+ const closeModal = (item) => {
29
+ setOpenModal(false);
30
+ setSelectedItem(null);
31
+ history.push({
32
+ hash: '',
33
+ });
34
+ };
35
+
36
+ return (
37
+ <>
38
+ <ul className="items">
39
+ {items.map((item) => (
40
+ <li className="simple-listing-item" key={item['@id']}>
41
+ <div
42
+ className="simple-listing"
43
+ onClick={() => {
44
+ setOpenModal(true);
45
+ setSelectedItem(item);
46
+ history.push({
47
+ hash: item?.getId,
48
+ });
49
+ }}
50
+ onKeyDown={() => setSelectedItem(item)}
51
+ role="button"
52
+ tabIndex="0"
53
+ >
54
+ <div className="simple-listing-title">
55
+ {item.title ? item.title : item.id}
56
+ </div>
57
+ {item['@type'] && (
58
+ <div className="metadata-tab-section">
59
+ <span>{formatItemType(item['@type'])}</span>
60
+ </div>
61
+ )}
62
+ </div>
63
+ </li>
64
+ ))}
65
+ </ul>
66
+
67
+ <Modal
68
+ className="item-metadata-modal"
69
+ open={isOpenModal}
70
+ onClose={closeModal}
71
+ size="large"
72
+ closeIcon
73
+ centered
74
+ >
75
+ <Modal.Header>
76
+ <ItemMetadataSnippet item={selectedItem} />
77
+ <ItemTitle item={selectedItem} />
78
+ </Modal.Header>
79
+
80
+ <Modal.Content>
81
+ <ItemMetadata
82
+ item={selectedItem}
83
+ map_preview={true}
84
+ shareItem={true}
85
+ />
86
+ </Modal.Content>
87
+ </Modal>
88
+ </>
89
+ );
90
+ };
91
+
92
+ SimpleListingView.propTypes = {
93
+ items: PropTypes.arrayOf(PropTypes.any).isRequired,
94
+ isEditMode: PropTypes.bool,
95
+ };
96
+
97
+ export default SimpleListingView;
@@ -0,0 +1,33 @@
1
+ @type: 'extra';
2
+ @element: 'custom';
3
+
4
+ @import (multiple, reference, optional) '../../theme.config';
5
+
6
+ .block.listing.simple {
7
+ font-size: 15px;
8
+
9
+ .items {
10
+ padding-left: 25px;
11
+ margin: 0;
12
+ }
13
+
14
+ .simple-listing-item {
15
+ padding-bottom: 10px;
16
+ }
17
+ }
18
+
19
+ .simple-listing-title {
20
+ cursor: pointer;
21
+ font-size: inherit;
22
+ font-weight: 500;
23
+ line-height: 22px;
24
+
25
+ &:hover {
26
+ color: @primaryColorHover;
27
+ }
28
+ }
29
+
30
+ .simple-listing {
31
+ display: inline-block;
32
+ vertical-align: text-top;
33
+ }
@@ -0,0 +1,86 @@
1
+ import React from 'react';
2
+ import { Popup, Button, Modal } from 'semantic-ui-react';
3
+ import { Icon } from '@plone/volto/components';
4
+ import downloadSVG from '@plone/volto/icons/download.svg';
5
+
6
+ const TableauDownload = (props) => {
7
+ const [open, setOpen] = React.useState(false);
8
+ const viz = props.viz.viz || {};
9
+
10
+ const exportImage = () => {
11
+ viz.showExportImageDialog();
12
+ };
13
+
14
+ const exportData = () => {
15
+ viz.showExportDataDialog();
16
+ };
17
+
18
+ const exportToCSV = () => {
19
+ viz.showExportCrossTabDialog();
20
+ };
21
+
22
+ const exportToExcel = () => {
23
+ viz.exportCrossTabToExcel();
24
+ };
25
+
26
+ const exportToPDF = () => {
27
+ viz.showExportPDFDialog();
28
+ };
29
+
30
+ const exportPowerPoint = () => {
31
+ viz.showExportPowerPointDialog();
32
+ };
33
+
34
+ const exportWorkbook = () => {
35
+ try {
36
+ viz.showDownloadWorkbookDialog();
37
+ } catch (err) {
38
+ setOpen(true);
39
+ }
40
+ };
41
+
42
+ return (
43
+ <>
44
+ <Popup
45
+ basic
46
+ className="tableau-download-dialog"
47
+ position="top center"
48
+ on="click"
49
+ trigger={
50
+ <div className="toolbar-button-wrapper">
51
+ <Button className="toolbar-button" title="Download">
52
+ <Icon name={downloadSVG} size="26px" />
53
+ </Button>
54
+ <span className="btn-text">Save</span>
55
+ </div>
56
+ }
57
+ >
58
+ <Popup.Header>Download</Popup.Header>
59
+ <Popup.Content>
60
+ <p>Select your file format.</p>
61
+ <Button onClick={exportImage}>Image</Button>
62
+ <Button onClick={exportData}>Data</Button>
63
+ <Button onClick={exportToCSV}>CSV</Button>
64
+ <Button onClick={exportToExcel}>Excel</Button>
65
+ <Button onClick={exportToPDF}>PDF</Button>
66
+ <Button onClick={exportPowerPoint}>PowerPoint</Button>
67
+ <Button onClick={exportWorkbook}>Tableau Workbook</Button>
68
+ </Popup.Content>
69
+ </Popup>
70
+
71
+ <Modal onClose={() => setOpen(false)} open={open}>
72
+ <Modal.Content>
73
+ Permissions are required to download the workbook.
74
+ </Modal.Content>
75
+
76
+ <Modal.Actions>
77
+ <Button primary onClick={() => setOpen(false)}>
78
+ OK
79
+ </Button>
80
+ </Modal.Actions>
81
+ </Modal>
82
+ </>
83
+ );
84
+ };
85
+
86
+ export default TableauDownload;