@osfarm/itineraire-technique 1.1.0 → 1.1.2

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.
@@ -1 +1 @@
1
- div.mainITKContainer{container-type:inline-size;container-name:myparent;line-height:1rem}div.mainITKContainer .left-transcript{display:none;width:50%;font-family:Segoe UI}div.mainITKContainer .chart-div{width:100%}div.mainITKContainer .bottom-transcript{display:block;font-family:Segoe UI}@container myparent (min-width: 800px){div.mainITKContainer .left-transcript{display:block}div.mainITKContainer .chart-div{width:50%}div.mainITKContainer .bottom-transcript{display:none}}@container myparent (min-width: 1200px){div.mainITKContainer .left-transcript{display:block;width:40%}div.mainITKContainer .chart-div{width:60%}div.mainITKContainer .bottom-transcript{display:none}}div.mainITKContainer div.rotation_item{background-color:#f8fafc;border-left:#fff 14px solid;border-radius:7px;padding:8px 3px 5px 9px;margin:12px 0;overflow-x:hidden}div.mainITKContainer div.rotation_item.highlighted{box-shadow:0px 4px 4px 0px var(--UI-Shadow, rgba(17, 36, 69, 0.16)),0px 1px 16px 0px var(--UI-Shadow, rgba(17, 36, 69, 0.16));background-color:#f0f3f5}div.mainITKContainer div.rotation_item div.step-header h4{margin-bottom:0;margin-top:0}div.mainITKContainer div.rotation_item div.step-header div.step_dates{font-size:11px;background-color:#cdcccc;color:#fff;margin:5px;padding:2px 5px;border-radius:5px;height:20px;float:right}div.mainITKContainer div.rotation_item div.step-header div.collapse-button{border-radius:50%;width:30px;height:30px;text-align:center;padding:5px 0px;margin:0 5px 3px 0;cursor:pointer;background:#dfe6f7;color:#7a8bad;float:right;transition:transform .3s ease-in-out}div.mainITKContainer div.rotation_item .step_description{clear:both}div.mainITKContainer div.rotation_item.show-all div.collapse-button{transform:rotate(180deg)}div.mainITKContainer div.rotation_item.show-all div.details{max-height:10000px}div.mainITKContainer div.rotation_item div.details{max-height:0px;overflow:hidden;transition:max-height .3s ease-in-out}div.mainITKContainer div.rotation_item div.details div.intervention{background-color:#fff;border-radius:5px;margin-bottom:11px;padding:13px;cursor:pointer}div.mainITKContainer div.rotation_item div.details div.intervention span.intervention_title{font-weight:bold}div.mainITKContainer div.rotation_item div.details div.intervention span.intervention_date{color:#707070;background-color:#f0f3f5;float:right}div.mainITKContainer div.rotation_item div.details div.intervention div.intervention_description{margin-top:5px}div.mainITKContainer div.rotation_item .step-edit{display:none}div.mainITKContainer .charts{width:100%;height:500px;display:inline-block}div.mainITKContainer .transcript{font-size:80%;width:100%;max-height:450px;overflow-y:scroll;scroll-behavior:smooth;padding:3px}/*# sourceMappingURL=styles-rendering.css.map */
1
+ div.mainITKContainer{container-type:inline-size;container-name:myparent;line-height:1rem}div.mainITKContainer .left-transcript{display:none;width:50%;font-family:Segoe UI}div.mainITKContainer .chart-div{width:100%}div.mainITKContainer .bottom-transcript{display:block;font-family:Segoe UI}@container myparent (min-width: 800px){div.mainITKContainer .left-transcript{display:block}div.mainITKContainer .chart-div{width:50%}div.mainITKContainer .bottom-transcript{display:none}}@container myparent (min-width: 1200px){div.mainITKContainer .left-transcript{display:block;width:40%}div.mainITKContainer .chart-div{width:60%}div.mainITKContainer .bottom-transcript{display:none}}div.mainITKContainer div.rotation_item{background-color:#f8fafc;border-left:#fff 14px solid;border-radius:7px;padding:8px 3px 5px 9px;margin:12px 0;overflow-x:hidden}div.mainITKContainer div.rotation_item.highlighted{box-shadow:0px 4px 4px 0px var(--UI-Shadow, rgba(17, 36, 69, 0.16)),0px 1px 16px 0px var(--UI-Shadow, rgba(17, 36, 69, 0.16));background-color:#f0f3f5}div.mainITKContainer div.rotation_item div.step-header h4{margin-bottom:0;margin-top:0}div.mainITKContainer div.rotation_item div.step-header div.step_dates{font-size:11px;background-color:#cdcccc;color:#fff;margin:5px;padding:2px 5px;border-radius:5px;height:20px;float:right}div.mainITKContainer div.rotation_item div.step-header div.collapse-button{border-radius:50%;width:30px;height:30px;text-align:center;padding:5px 0px;margin:0 5px 3px 0;cursor:pointer;background:#dfe6f7;color:#7a8bad;float:right;transition:transform .3s ease-in-out}div.mainITKContainer div.rotation_item .step_description{clear:both}div.mainITKContainer div.rotation_item.show-all div.collapse-button{transform:rotate(180deg)}div.mainITKContainer div.rotation_item.show-all div.details{max-height:10000px}div.mainITKContainer div.rotation_item div.details{max-height:0px;overflow:hidden;transition:max-height .3s ease-in-out}div.mainITKContainer div.rotation_item div.details div.intervention{background-color:#fff;border-radius:5px;margin-bottom:11px;padding:13px;cursor:pointer}div.mainITKContainer div.rotation_item div.details div.intervention span.intervention_title{font-weight:bold}div.mainITKContainer div.rotation_item div.details div.intervention span.intervention_date{color:#707070;background-color:#f0f3f5;float:right}div.mainITKContainer div.rotation_item div.details div.intervention div.intervention_description{margin-top:5px}div.mainITKContainer div.rotation_item .step-edit{display:none}div.mainITKContainer .charts{width:100%;height:500px;display:inline-block}div.mainITKContainer .transcript{font-size:80%;width:100%;max-height:450px;overflow-y:scroll;scroll-behavior:smooth;padding:3px}.rotation-tooltip{width:400px}/*# sourceMappingURL=styles-rendering.css.map */
@@ -1 +1 @@
1
- {"version":3,"sourceRoot":"","sources":["../scss/styles-rendering.scss"],"names":[],"mappings":"AAAA,qBACI,2BACA,wBACA,iBAEA,sCACI,aACA,UACA,qBAGJ,gCACI,WAGJ,wCACI,cACA,qBAGJ,uCACI,sCACI,cAGJ,gCACI,UAGJ,wCACI,cAIR,wCACI,sCACI,cACA,UAGJ,gCACI,UAGJ,wCACI,cAIR,uCACI,yBACA,4BACA,kBACA,wBACA,cACA,kBAEA,mDACI,8HAEA,yBAIA,0DACI,gBACA,aAGJ,sEACI,eACA,yBACA,WACA,WACA,gBACA,kBACA,YACA,YAGJ,2EACI,kBACA,WACA,YACA,kBACA,gBACA,mBACA,eACA,mBACA,cACA,YACA,qCAIR,yDACI,WAIA,oEACI,yBAGJ,4DACI,mBAKR,mDACI,eACA,gBACA,sCAEA,oEACI,sBACA,kBACA,mBACA,aACA,eAEA,4FACI,iBAGJ,2FACI,cACA,yBACA,YAGJ,iGACI,eAKZ,kDACI,aAIR,6BACI,WACA,aACA,qBAGJ,iCACI,cACA,WACA,iBACA,kBACA,uBACA","file":"styles-rendering.css"}
1
+ {"version":3,"sourceRoot":"","sources":["../scss/styles-rendering.scss"],"names":[],"mappings":"AAAA,qBACI,2BACA,wBACA,iBAEA,sCACI,aACA,UACA,qBAGJ,gCACI,WAGJ,wCACI,cACA,qBAGJ,uCACI,sCACI,cAGJ,gCACI,UAGJ,wCACI,cAIR,wCACI,sCACI,cACA,UAGJ,gCACI,UAGJ,wCACI,cAIR,uCACI,yBACA,4BACA,kBACA,wBACA,cACA,kBAEA,mDACI,8HAEA,yBAIA,0DACI,gBACA,aAGJ,sEACI,eACA,yBACA,WACA,WACA,gBACA,kBACA,YACA,YAGJ,2EACI,kBACA,WACA,YACA,kBACA,gBACA,mBACA,eACA,mBACA,cACA,YACA,qCAIR,yDACI,WAIA,oEACI,yBAGJ,4DACI,mBAKR,mDACI,eACA,gBACA,sCAEA,oEACI,sBACA,kBACA,mBACA,aACA,eAEA,4FACI,iBAGJ,2FACI,cACA,yBACA,YAGJ,iGACI,eAKZ,kDACI,aAIR,6BACI,WACA,aACA,qBAGJ,iCACI,cACA,WACA,iBACA,kBACA,uBACA,YAIR,kBACI","file":"styles-rendering.css"}
package/editor.html CHANGED
@@ -13,7 +13,8 @@
13
13
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/jquery-ui@1.14.1/themes/base/jquery-ui.css">
14
14
 
15
15
  <script src="https://cdn.jsdelivr.net/npm/underscore@1.13.7/underscore-umd-min.js"></script>
16
- <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"></script>
16
+ <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.8/dist/js/bootstrap.bundle.min.js"
17
+ integrity="sha384-FKyoEForCGlyvwx9Hj09JcYn3nv7wiPVlz7YYwJrWVcXK/BmnVDxM+D2scQbITxI" crossorigin="anonymous"></script>
17
18
 
18
19
  <script src="./js/chart-render.js"></script>
19
20
  <script src="./js/editor-attributes.js"></script>
@@ -22,8 +23,9 @@
22
23
  <script src="./js/editor-export.js"></script>
23
24
  <script src="./js/editor-wiki-editor.js"></script>
24
25
 
25
- <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet"
26
- integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
26
+ <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.8/dist/css/bootstrap.min.css" rel="stylesheet"
27
+ integrity="sha384-sRIl4kxILFvY47J16cr9ZwB07vP4J8+LH7qKQnuqkuIAvNWLzeN8tE5YBujZqJLB" crossorigin="anonymous">
28
+
27
29
  <link href="https://cdn.jsdelivr.net/npm/font-awesome@4.7.0/css/font-awesome.min.css" rel="stylesheet">
28
30
  <link href="./css/styles-editor.css" rel="stylesheet">
29
31
  <link href="./css/styles-rendering.css" rel="stylesheet">
@@ -293,6 +295,9 @@
293
295
  enableTitleEditing();
294
296
 
295
297
  $('.close-step-button').click(function() {
298
+ // Set the current step to be fully edited now:
299
+ selectedStep.setAsEdited();
300
+
296
301
  displayCropListView();
297
302
  });
298
303
 
@@ -355,7 +360,7 @@
355
360
  });
356
361
 
357
362
 
358
- $('#paramsModal').on('show.bs.modal', function (event) {
363
+ $('#modalParams').on('show.bs.modal', function (event) {
359
364
 
360
365
  // Set the modal form inputs values from crops.options
361
366
  $("#viewSelect").val(crops.options.view);
@@ -363,7 +368,7 @@
363
368
  $("#topInterventionsTitle").val(crops.options.title_top_interventions);
364
369
  $("#bottomInterventionsTitle").val(crops.options.title_bottom_interventions);
365
370
  $("#stepsTitle").val(crops.options.title_steps);
366
- $("#regionInput").val(crops.options.region);
371
+ $("#regionInput").val(crops.options.region ?? "France");
367
372
  });
368
373
 
369
374
  $("#paramsModalSaveButton").click(function () {
@@ -402,6 +407,12 @@
402
407
  this.step.useDefaultEndDate = step.useDefaultEndDate ?? true;
403
408
  }
404
409
 
410
+ setAsEdited() {
411
+ this.step.useDefaultColor = false;
412
+ this.step.useDefaultStartDate = false;
413
+ this.step.useDefaultEndDate = false;
414
+ }
415
+
405
416
  getStep() {
406
417
  return this.step;
407
418
  }
@@ -289,7 +289,7 @@ class RotationRenderer {
289
289
  startDate: new Date(item.startDate.valueOf()), // Date de début
290
290
  endDate: new Date(item.endDate.valueOf()), // Date de fin
291
291
  duration: item.duration,
292
- description: (item.description ?? ''),
292
+ description: self.getHTMLFormatedDescription(item.description),
293
293
  value: [
294
294
  1, // Parcelle (index de la série)
295
295
  item.startDate.valueOf(), // Date de début
@@ -690,7 +690,7 @@ class RotationRenderer {
690
690
  'startDate': new Date(item.startDate.valueOf()), // Date de début
691
691
  'endDate': new Date(item.endDate.valueOf()), // Date de fin
692
692
  'duration': item.duration,
693
- 'description': (item.description ?? '')// + (item.attributes ? item.attributes.map((attribute) => { return '<p><dt>' + attribute.name + '</dt><dd>' + attribute.value + '</dd></p>' }).join('') : '')
693
+ 'description': self.getHTMLFormatedDescription(item.description)
694
694
  };
695
695
 
696
696
  if (pieItem.color != '#ffffff')
@@ -822,6 +822,8 @@ class RotationRenderer {
822
822
  }
823
823
 
824
824
  option.tooltip = {
825
+ extraCssText: "text-wrap: wrap;",
826
+ className: "rotation-tooltip",
825
827
  formatter: function (params) {
826
828
  if (params.data.type == 'rotation_item') {
827
829
  let start = params.data.startDate.toLocaleDateString('fr-FR', { day: 'numeric', month: 'short', year: '2-digit' });
@@ -877,4 +879,18 @@ class RotationRenderer {
877
879
 
878
880
  return option;
879
881
  }
882
+
883
+ getHTMLFormatedDescription(description) {
884
+
885
+ if (description == undefined)
886
+ return '';
887
+
888
+ // If a line has a column in it, split the line in two and add bold to the first part:
889
+ description = description.replace(/^([^:\n]+):/gm, "<b>$1:</b>");
890
+ description = description.replace(/\n([^:\n]+):/gm, "\n<b>$1:</b>");
891
+
892
+ description = description.replace(/\n/g, '<br/>');
893
+
894
+ return description;
895
+ }
880
896
  }
@@ -28,24 +28,28 @@ function importFromTestJson() {
28
28
  });
29
29
  } else {
30
30
  importTestJSON();
31
- }
31
+ }
32
32
  }
33
33
 
34
34
  function importTestJSON() {
35
- fetch('test/test.json')
36
- .then(response => {
37
- if (!response.ok) {
38
- throw new Error("Erreur HTTP " + response.status);
39
- }
40
- return response.json();
41
- })
42
- .then(data => {
43
- console.log("Données JSON :", data);
44
- reloadCropsFromJson(data);
45
- })
46
- .catch(error => {
47
- console.error("Impossible de charger le JSON :", error);
48
- });
35
+ fetch('test/test.json')
36
+ .then(response => {
37
+ if (!response.ok) {
38
+ throw new Error("Erreur HTTP " + response.status);
39
+ }
40
+ return response.json();
41
+ })
42
+ .then(data => {
43
+ console.log("Données JSON :", data);
44
+ data.steps.forEach(step => {
45
+ let sm = new StepModel(step)
46
+ sm.setAsEdited();
47
+ });
48
+ reloadCropsFromJson(data);
49
+ })
50
+ .catch(error => {
51
+ console.error("Impossible de charger le JSON :", error);
52
+ });
49
53
  }
50
54
 
51
55
  function wipe() {
@@ -67,7 +71,7 @@ function wipe() {
67
71
  });
68
72
  } else {
69
73
  reloadCropsFromJson(crops);
70
- }
74
+ }
71
75
  }
72
76
 
73
77
  function openFileInput() {
@@ -82,6 +86,10 @@ function openFileInput() {
82
86
  reader.onload = () => {
83
87
  try {
84
88
  const jsonData = JSON.parse(reader.result);
89
+ jsonData.steps.forEach(step => {
90
+ let sm = new StepModel(step)
91
+ sm.setAsEdited();
92
+ });
85
93
  reloadCropsFromJson(jsonData);
86
94
  } catch (error) {
87
95
  console.error("Error parsing JSON file:", error);
@@ -25,6 +25,10 @@ class WikiEditor {
25
25
  if (data.parse && data.parse.wikitext) {
26
26
  try {
27
27
  const content = JSON.parse(data.parse.wikitext['*']);
28
+ content.steps.forEach(step => {
29
+ let sm = new StepModel(step)
30
+ sm.setAsEdited();
31
+ });
28
32
  reloadCropsFromJson(content);
29
33
  } catch (e) {
30
34
  console.error("Erreur lors de l'analyse du JSON de la page :", e);
@@ -43,7 +47,7 @@ class WikiEditor {
43
47
  const jsonErrorModal = new bootstrap.Modal(document.getElementById('jsonErrorModal'));
44
48
  jsonErrorModal.show();
45
49
  }
46
-
50
+
47
51
  }
48
52
  });
49
53
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@osfarm/itineraire-technique",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "description": "A visualisation tool to show agricultural technical itineraries based on Echarts",
5
5
  "main": "editor.html",
6
6
  "scripts": {
@@ -155,4 +155,8 @@ div.mainITKContainer {
155
155
  scroll-behavior: smooth;
156
156
  padding : 3px;
157
157
  }
158
+ }
159
+
160
+ .rotation-tooltip {
161
+ width: 400px;
158
162
  }