@panoramax/web-viewer 4.1.0-develop-55fdf56c → 4.1.0-develop-22cdb9e7
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.md +8 -0
- package/build/index.js +140 -77
- package/build/index.js.map +1 -1
- package/build/widgets.html +1 -1
- package/docs/reference/components/menus/SemanticsMetadata.md +15 -0
- package/docs/reference/components/ui/SemanticsEditor.md +12 -0
- package/docs/reference/utils/API.md +14 -0
- package/docs/reference.md +2 -0
- package/mkdocs.yml +2 -0
- package/package.json +1 -1
- package/public/widgets.html +1 -1
- package/src/components/core/Basic.js +5 -1
- package/src/components/menus/PictureMetadata.js +8 -86
- package/src/components/menus/SemanticsMetadata.js +186 -0
- package/src/components/menus/index.js +1 -0
- package/src/components/styles.js +22 -0
- package/src/components/ui/SemanticsEditor.js +14 -2
- package/src/components/ui/SemanticsTable.js +1 -0
- package/src/translations/en.json +7 -0
- package/src/translations/fr.json +7 -0
- package/src/utils/API.js +40 -0
package/src/translations/fr.json
CHANGED
|
@@ -200,6 +200,13 @@
|
|
|
200
200
|
"P361": "partie de"
|
|
201
201
|
},
|
|
202
202
|
"semantics_editor_error": "La syntaxe est invalide. Vos attributs doivent avoir cette forme:\nclé=valeur\npréfixe|clé=valeur\npréfixe|clé[qualif_clé=qualif_val]=valeur\n\nLongueur max des clés : 256 caractères, max des valeurs 2048 caractères.",
|
|
203
|
+
"semantics_editor_example": "clé=valeur\npréfixe|clé=valeur",
|
|
204
|
+
"semantics_edit": "Modifier les attributs",
|
|
205
|
+
"semantics_save": "Enregistrer vos modifications",
|
|
206
|
+
"semantics_undo": "Annuler vos modifications",
|
|
207
|
+
"semantics_cantsave_invalid": "Impossible de sauvegarder les modifications, les attributs ne sont pas valides",
|
|
208
|
+
"semantics_send_fail": "Nous n'avons pas pu enregistrer vos modifications, merci de réessayer plus tard",
|
|
209
|
+
"semantics_send_ok": "Vos modifications ont bien été enregistrées",
|
|
203
210
|
"report": "Signaler",
|
|
204
211
|
"report_auth": "Ce signalement sera envoyé en utilisant votre compte \"{a}\"",
|
|
205
212
|
"report_nature_label": "Nature du problème",
|
package/src/utils/API.js
CHANGED
|
@@ -789,6 +789,46 @@ export default class API extends EventTarget {
|
|
|
789
789
|
});
|
|
790
790
|
}
|
|
791
791
|
|
|
792
|
+
/**
|
|
793
|
+
* Send picture semantics change to origin API.
|
|
794
|
+
* @memberOf Panoramax.utils.API#
|
|
795
|
+
* @param {object} picMeta The picture metadata
|
|
796
|
+
* @param {object} semanticsDiff The difference in semantics compared to original data
|
|
797
|
+
* @returns {Promise}
|
|
798
|
+
* @fulfil {object} The JSON API response
|
|
799
|
+
*/
|
|
800
|
+
sendPictureSemantics(picMeta, semanticsDiff) {
|
|
801
|
+
/* eslint-disable */
|
|
802
|
+
if(!this.isReady()) { throw new Error("API is not ready to use"); }
|
|
803
|
+
if(!picMeta?.sequence?.id || !picMeta?.id) { throw new Error("Missing IDs from picture"); }
|
|
804
|
+
|
|
805
|
+
// Check if it's from metacatalog
|
|
806
|
+
let picLink = this.getPictureMetadataUrl(picMeta.id, picMeta.sequence.id);
|
|
807
|
+
if(picMeta?.origInstance) {
|
|
808
|
+
picLink = `${picMeta.origInstance.href}/api/collections/${picMeta.sequence.id}/items/${picMeta.id}`;
|
|
809
|
+
}
|
|
810
|
+
|
|
811
|
+
const opts = {
|
|
812
|
+
...this._getFetchOptions(),
|
|
813
|
+
method: "PATCH",
|
|
814
|
+
body: JSON.stringify({ semantics: semanticsDiff }),
|
|
815
|
+
headers: { "Content-Type": "application/json" },
|
|
816
|
+
};
|
|
817
|
+
|
|
818
|
+
return fetch(picLink, opts)
|
|
819
|
+
.then(async res => {
|
|
820
|
+
if(res.status >= 400) {
|
|
821
|
+
let txt = await res.text();
|
|
822
|
+
try {
|
|
823
|
+
txt = JSON.parse(txt)["message"];
|
|
824
|
+
}
|
|
825
|
+
catch(e) {} // eslint-disable-line no-empty
|
|
826
|
+
return Promise.reject(txt);
|
|
827
|
+
}
|
|
828
|
+
return res.json();
|
|
829
|
+
});
|
|
830
|
+
}
|
|
831
|
+
|
|
792
832
|
/**
|
|
793
833
|
* Checks URL string validity
|
|
794
834
|
* @memberOf Panoramax.utils.API
|