@osfarm/itineraire-technique 1.1.0 → 1.1.1

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
@@ -293,6 +293,9 @@
293
293
  enableTitleEditing();
294
294
 
295
295
  $('.close-step-button').click(function() {
296
+ // Set the current step to be fully edited now:
297
+ selectedStep.setAsEdited();
298
+
296
299
  displayCropListView();
297
300
  });
298
301
 
@@ -402,6 +405,12 @@
402
405
  this.step.useDefaultEndDate = step.useDefaultEndDate ?? true;
403
406
  }
404
407
 
408
+ setAsEdited() {
409
+ this.step.useDefaultColor = false;
410
+ this.step.useDefaultStartDate = false;
411
+ this.step.useDefaultEndDate = false;
412
+ }
413
+
405
414
  getStep() {
406
415
  return this.step;
407
416
  }
@@ -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.1",
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
  }