@luomus/laji-form 15.1.9 → 15.1.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/laji-form.js +1 -1
- package/dist/styles.css +8 -9
- package/lib/components/fields/ImageArrayField.d.ts +2 -0
- package/lib/components/fields/ImageArrayField.js +6 -3
- package/lib/components/fields/PdfArrayField.d.ts +1 -2
- package/lib/components/fields/PdfArrayField.js +4 -5
- package/package.json +1 -1
package/dist/styles.css
CHANGED
|
@@ -2420,7 +2420,7 @@ min-height: 20px;
|
|
|
2420
2420
|
height: 120px;
|
|
2421
2421
|
float: left;
|
|
2422
2422
|
}
|
|
2423
|
-
.laji-form .laji-form-medias
|
|
2423
|
+
.laji-form .laji-form-medias .media-container-link > img, .laji-form .audios-container .media-container-link {
|
|
2424
2424
|
cursor: pointer;
|
|
2425
2425
|
}
|
|
2426
2426
|
.laji-form .laji-form-medias img, .laji-form .media-loading {
|
|
@@ -2463,10 +2463,6 @@ min-height: 20px;
|
|
|
2463
2463
|
background-color: #d8fbc6;
|
|
2464
2464
|
border-color: #a7d490;
|
|
2465
2465
|
}
|
|
2466
|
-
.laji-form .laji-form-medias a:hover, .laji-form .laji-form-medias a:active {
|
|
2467
|
-
text-decoration: none;
|
|
2468
|
-
color: #337ab7;
|
|
2469
|
-
}
|
|
2470
2466
|
.laji-form .laji-form-drop-zone:hover:not(.disabled) span, .laji-form .laji-form-drop-zone.dragging:not(.disabled) span {
|
|
2471
2467
|
color: #a7d490;
|
|
2472
2468
|
}
|
|
@@ -2474,13 +2470,16 @@ min-height: 20px;
|
|
|
2474
2470
|
cursor: not-allowed;
|
|
2475
2471
|
}
|
|
2476
2472
|
|
|
2477
|
-
.laji-form .laji-form-medias a {
|
|
2473
|
+
.laji-form .laji-form-medias .media-container-link, .laji-form .laji-form-medias .media-container-link a {
|
|
2478
2474
|
text-align: center;
|
|
2479
2475
|
vertical-align: middle;
|
|
2480
2476
|
width: 100%;
|
|
2481
2477
|
height: 100%;
|
|
2482
2478
|
}
|
|
2483
|
-
.laji-form .laji-form-medias .media-container
|
|
2479
|
+
.laji-form .laji-form-medias .media-container-link a:focus {
|
|
2480
|
+
outline: none;
|
|
2481
|
+
}
|
|
2482
|
+
.laji-form .laji-form-medias .media-container > .media-container-link > div > .glyphicon, .laji-form .laji-form-medias .laji-form-drop-zone .glyphicon {
|
|
2484
2483
|
font-size: 78px;
|
|
2485
2484
|
color: #dedede;
|
|
2486
2485
|
display: table-cell;
|
|
@@ -2494,12 +2493,12 @@ min-height: 20px;
|
|
|
2494
2493
|
padding-left: 12px;
|
|
2495
2494
|
padding-top: 19px;
|
|
2496
2495
|
}
|
|
2497
|
-
.laji-form .audios-container .media-container >
|
|
2496
|
+
.laji-form .audios-container .media-container > .media-container-link > div > .glyphicon {
|
|
2498
2497
|
padding-left: 2px;
|
|
2499
2498
|
padding-top: 0px;
|
|
2500
2499
|
color: #868686;
|
|
2501
2500
|
}
|
|
2502
|
-
.laji-form .audios-container .media-container >
|
|
2501
|
+
.laji-form .audios-container .media-container > .media-container-link > div > .glyphicon-pause {
|
|
2503
2502
|
padding-left: 6px;
|
|
2504
2503
|
}
|
|
2505
2504
|
.laji-form .audio-container {
|
|
@@ -156,9 +156,11 @@ interface ThumbnailProps {
|
|
|
156
156
|
apiEndpoint?: string;
|
|
157
157
|
dataURL?: string;
|
|
158
158
|
loading?: boolean;
|
|
159
|
+
downloadLink?: boolean;
|
|
159
160
|
}
|
|
160
161
|
interface ThumbnailState {
|
|
161
162
|
url?: string;
|
|
163
|
+
linkUrl?: string;
|
|
162
164
|
}
|
|
163
165
|
export declare class Thumbnail extends React.PureComponent<ThumbnailProps, ThumbnailState> {
|
|
164
166
|
mounted: boolean;
|
|
@@ -108,7 +108,7 @@ function MediaArrayField(ComposedComponent) {
|
|
|
108
108
|
const { disabled, readonly } = this.props;
|
|
109
109
|
const { deleteConfirmPlacement = "top" } = utils_1.getUiOptions(this.props.uiSchema);
|
|
110
110
|
return (this.props.formData || []).map((item, i) => (React.createElement("div", { key: i, className: "media-container" },
|
|
111
|
-
React.createElement("
|
|
111
|
+
React.createElement("div", { className: "media-container-link", onClick: this.onMediaClick(i) }, this.renderMedia(item, i)),
|
|
112
112
|
React.createElement(components_1.DeleteButton, { corner: true, confirm: true, confirmPlacement: deleteConfirmPlacement, translations: this.props.formContext.translations, onClick: this.onMediaRmClick(i), disabled: disabled || readonly, id: `${this.props.idSchema.$id}_${i}` }))));
|
|
113
113
|
};
|
|
114
114
|
this.renderLoadingMedias = () => {
|
|
@@ -671,7 +671,7 @@ class Thumbnail extends React.PureComponent {
|
|
|
671
671
|
apiClient.fetchCached(`/${apiEndpoint}/${id}`, undefined, { failSilently: true }).then((response) => {
|
|
672
672
|
if (!this.mounted)
|
|
673
673
|
return;
|
|
674
|
-
this.setState({ url: response.squareThumbnailURL });
|
|
674
|
+
this.setState({ url: response.squareThumbnailURL, linkUrl: response.originalURL });
|
|
675
675
|
});
|
|
676
676
|
};
|
|
677
677
|
this.state = {};
|
|
@@ -688,7 +688,10 @@ class Thumbnail extends React.PureComponent {
|
|
|
688
688
|
}
|
|
689
689
|
render() {
|
|
690
690
|
const url = this.state.url || this.props.dataURL;
|
|
691
|
-
const
|
|
691
|
+
const linkUrl = this.state.linkUrl;
|
|
692
|
+
const addLink = this.props.downloadLink && linkUrl;
|
|
693
|
+
let img = url ? React.createElement("img", { src: url }) : null;
|
|
694
|
+
img = addLink ? React.createElement("a", { href: linkUrl, target: "_blank", rel: "noopener noreferrer", download: true }, img) : img;
|
|
692
695
|
return (!url || this.props.loading)
|
|
693
696
|
? React.createElement("div", { className: "media-loading" },
|
|
694
697
|
img,
|
|
@@ -15,7 +15,6 @@ export default class PdfArrayField extends React.Component<FieldProps, MediaArra
|
|
|
15
15
|
METADATA_FORM_ID: string;
|
|
16
16
|
renderMedia: (id: string) => JSX.Element;
|
|
17
17
|
renderLoadingMedia: (id: string) => JSX.Element;
|
|
18
|
-
onMediaClick: (
|
|
19
|
-
renderModalMedia: () => JSX.Element;
|
|
18
|
+
onMediaClick: () => null;
|
|
20
19
|
formatValue(value: string[], options: any, props: FieldProps): string | null;
|
|
21
20
|
}
|
|
@@ -21,11 +21,10 @@ let PdfArrayField = class PdfArrayField extends React.Component {
|
|
|
21
21
|
this.TRANSLATION_SELECT_FILE = "";
|
|
22
22
|
this.TRANSLATION_NO_MEDIA = "";
|
|
23
23
|
this.CONTAINER_CLASS = "pdf-container";
|
|
24
|
-
this.METADATA_FORM_ID = "
|
|
25
|
-
this.renderMedia = (id) => React.createElement(ImageArrayField_1.Thumbnail, { id: id, apiClient: this.props.formContext.apiClient, apiEndpoint: this.ENDPOINT });
|
|
26
|
-
this.renderLoadingMedia = (id) => React.createElement(ImageArrayField_1.Thumbnail, { dataURL: id, loading: true, apiClient: this.props.formContext.apiClient, apiEndpoint: this.ENDPOINT });
|
|
27
|
-
this.onMediaClick = (
|
|
28
|
-
this.renderModalMedia = () => React.createElement("img", { src: this.state.modalMediaSrc });
|
|
24
|
+
this.METADATA_FORM_ID = "";
|
|
25
|
+
this.renderMedia = (id) => React.createElement(ImageArrayField_1.Thumbnail, { id: id, apiClient: this.props.formContext.apiClient, apiEndpoint: this.ENDPOINT, downloadLink: true });
|
|
26
|
+
this.renderLoadingMedia = (id) => React.createElement(ImageArrayField_1.Thumbnail, { dataURL: id, loading: true, apiClient: this.props.formContext.apiClient, apiEndpoint: this.ENDPOINT, downloadLink: true });
|
|
27
|
+
this.onMediaClick = () => null;
|
|
29
28
|
}
|
|
30
29
|
formatValue(value, options, props) {
|
|
31
30
|
const { translations } = props.formContext;
|