@osfarm/itineraire-technique 1.1.18 → 1.1.20
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/.github/workflows/publish.yml +7 -5
- package/css/styles-editor.css +1 -1
- package/css/styles-editor.css.map +1 -1
- package/editor.html +17 -10
- package/js/chart-render.js +6 -1
- package/js/editor-attributes.js +4 -1
- package/js/editor-crops.js +3 -0
- package/js/editor-interventions.js +44 -4
- package/package.json +22 -2
- package/scss/styles-editor.scss +17 -7
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
name: Publish to npmjs
|
|
2
2
|
|
|
3
|
+
permissions:
|
|
4
|
+
contents: read
|
|
5
|
+
id-token: write
|
|
6
|
+
|
|
3
7
|
on:
|
|
4
8
|
push:
|
|
5
9
|
branches:
|
|
@@ -8,7 +12,6 @@ on:
|
|
|
8
12
|
jobs:
|
|
9
13
|
publish:
|
|
10
14
|
runs-on: ubuntu-latest
|
|
11
|
-
|
|
12
15
|
steps:
|
|
13
16
|
- name: Checkout code
|
|
14
17
|
uses: actions/checkout@v4
|
|
@@ -16,7 +19,7 @@ jobs:
|
|
|
16
19
|
- name: Set up Node.js
|
|
17
20
|
uses: actions/setup-node@v4
|
|
18
21
|
with:
|
|
19
|
-
node-version: '
|
|
22
|
+
node-version: '24'
|
|
20
23
|
registry-url: 'https://registry.npmjs.org/'
|
|
21
24
|
|
|
22
25
|
- name: Install dependencies
|
|
@@ -27,6 +30,5 @@ jobs:
|
|
|
27
30
|
continue-on-error: true
|
|
28
31
|
|
|
29
32
|
- name: Publish to npmjs
|
|
30
|
-
run: npm publish --access public
|
|
31
|
-
|
|
32
|
-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
33
|
+
run: npm publish --provenance --access public
|
|
34
|
+
|
package/css/styles-editor.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.main-header{background-color:#6fa76f;color:#fff;height:3rem;display:flex;align-items:center}.main-header .btn.show,.main-header .btn:first-child:active,.main-header :not(.btn-check)+.btn:active{background-color:#026602}.editor-view{overflow-y:auto;height:calc(100vh - 4rem)}.rotation_item .step-edit{color:#878787;cursor:pointer;display:none;margin-left:10px;font-size:70%;vertical-align:super}.rotation_item:hover .step-edit{display:inline !important}.welcome-view{background-color:#6fa76f;color:#fff;padding:1rem;margin-top:1rem;border-radius:1rem}.welcome-view #cropsContainer{color:green}.card-white{background-color:#fff;padding:1rem;border-radius:1rem}.card-holder{background-color:#f5f5f5;padding:1rem;border-radius:1rem;margin:auto}.editable-row{background-color:#f7f7f7;min-height:3rem;display:flex;align-items:center;border-radius:.5rem}.editable-row .edit-buttons{visibility:hidden}.editable-row:hover>.edit-buttons{visibility:visible}.intervention-row{background:#e0e0e0}.primary-button{color:#fff;background-color:green;border:green}.primary-button:hover{background-color:#026602}.close-step-times{background:none;border:none;color:#878787;font-size:120%}.close-step-times:hover{color:#494949}#cropsContainer .drag-handle{color:#ccc;font-weight:normal;font-size:86%;margin-right:10px;vertical-align:middle;cursor:grab}.form-control.text-right{text-align:right}.modal .form-label{font-weight:600}#code-snippet{font-family:monospace;font-size:13px;text-align:left;border:1px inset;background-color:#f1f1f1}/*# sourceMappingURL=styles-editor.css.map */
|
|
1
|
+
.main-header{background-color:#6fa76f;color:#fff;height:3rem;display:flex;align-items:center}.main-header .btn.show,.main-header .btn:first-child:active,.main-header :not(.btn-check)+.btn:active{background-color:#026602}.editor-view{overflow-y:auto;height:calc(100vh - 4rem)}.rotation_item .step-edit{color:#878787;cursor:pointer;display:none;margin-left:10px;font-size:70%;vertical-align:super}.rotation_item:hover .step-edit{display:inline !important}.welcome-view{background-color:#6fa76f;color:#fff;padding:1rem;margin-top:1rem;border-radius:1rem}.welcome-view #cropsContainer{color:green}.card-white{background-color:#fff;padding:1rem;border-radius:1rem}.card-holder{background-color:#f5f5f5;padding:1rem;border-radius:1rem;margin:auto}.editable-row{background-color:#f7f7f7;min-height:3rem;display:flex;align-items:center;border-radius:.5rem}.editable-row .edit-buttons{visibility:hidden}.editable-row:hover>.edit-buttons{visibility:visible}.intervention-row{background:#e0e0e0}.primary-button{color:#fff;background-color:green;border:green}.primary-button:hover{background-color:#026602}.close-step-times{background:none;border:none;color:#878787;font-size:120%}.close-step-times:hover{color:#494949}#cropsContainer .drag-handle{color:#ccc;font-weight:normal;font-size:86%;margin-right:10px;vertical-align:middle;cursor:grab}#cropsContainer div.col{cursor:pointer}.form-control.text-right{text-align:right}.modal .form-label{font-weight:600}#code-snippet{font-family:monospace;font-size:13px;text-align:left;border:1px inset;background-color:#f1f1f1}#attributeName,#interventionName{font-weight:bold}/*# sourceMappingURL=styles-editor.css.map */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sourceRoot":"","sources":["../scss/styles-editor.scss"],"names":[],"mappings":"AAKA,aACI,yBACA,WACA,OALiB,KAOjB,aACA,mBAEA,sGAGI,yBAIR,aACI,gBAGA,0BAKA,0BACI,cACA,eACA,aACA,iBACA,cACA,qBAGJ,gCACI,0BAIR,cACI,yBACA,WACA,aACA,gBACA,mBAEA,8BACI,YAIR,YACI,sBACA,aACA,mBAGJ,aACI,yBACA,aACA,mBACA,YAGJ,cACI,yBACA,gBAEA,aACA,mBAEA,oBAEA,4BACI,kBAGJ,kCACI,mBAIR,kBACI,mBAGJ,gBACI,MAzFiB,KA0FjB,iBA5FiB,MA6FjB,OA7FiB,MA+FjB,sBACI,iBA/Fa,QAmGrB,kBACI,gBACA,YACA,cACA,eAEA,wBACI,
|
|
1
|
+
{"version":3,"sourceRoot":"","sources":["../scss/styles-editor.scss"],"names":[],"mappings":"AAKA,aACI,yBACA,WACA,OALiB,KAOjB,aACA,mBAEA,sGAGI,yBAIR,aACI,gBAGA,0BAKA,0BACI,cACA,eACA,aACA,iBACA,cACA,qBAGJ,gCACI,0BAIR,cACI,yBACA,WACA,aACA,gBACA,mBAEA,8BACI,YAIR,YACI,sBACA,aACA,mBAGJ,aACI,yBACA,aACA,mBACA,YAGJ,cACI,yBACA,gBAEA,aACA,mBAEA,oBAEA,4BACI,kBAGJ,kCACI,mBAIR,kBACI,mBAGJ,gBACI,MAzFiB,KA0FjB,iBA5FiB,MA6FjB,OA7FiB,MA+FjB,sBACI,iBA/Fa,QAmGrB,kBACI,gBACA,YACA,cACA,eAEA,wBACI,cAKJ,6BACI,WACA,mBACA,cACA,kBACA,sBACA,YAGJ,wBACI,eAKJ,yBACI,iBAKJ,mBACI,gBAIR,cACI,sBACA,eACA,gBACA,iBACA,yBAGJ,iCACI","file":"styles-editor.css"}
|
package/editor.html
CHANGED
|
@@ -946,27 +946,34 @@
|
|
|
946
946
|
return latestEndDate;
|
|
947
947
|
}
|
|
948
948
|
|
|
949
|
-
function addEditAndRemoveButtons(rowDiv, deleteId, editFunction, deleteFunction, duplicateFunction) {
|
|
949
|
+
function addEditAndRemoveButtons(rowDiv, deleteId, editFunction, deleteFunction, duplicateFunction, style="btn-group") {
|
|
950
950
|
rowDiv = $(rowDiv);
|
|
951
951
|
|
|
952
|
-
let actionContainer = $(
|
|
952
|
+
let actionContainer = $(`<div class="col-auto edit-buttons m-1 ${style}" role="group"></div>`);
|
|
953
953
|
|
|
954
|
-
|
|
954
|
+
rowDiv.append(actionContainer);
|
|
955
|
+
|
|
956
|
+
actionContainer.append($('<button class="edit-button btn btn-outline-primary p-2"><i class="fa fa-pencil"></i></button>').click(function(event) {
|
|
955
957
|
event.stopPropagation(); // Prevent other onclick events from triggering
|
|
956
|
-
|
|
958
|
+
editFunction();
|
|
957
959
|
}));
|
|
958
960
|
|
|
959
|
-
|
|
961
|
+
rowDiv.find('.col').click(function(event) {
|
|
960
962
|
event.stopPropagation(); // Prevent other onclick events from triggering
|
|
961
963
|
editFunction();
|
|
962
|
-
})
|
|
964
|
+
});
|
|
963
965
|
|
|
964
|
-
|
|
966
|
+
if (duplicateFunction != null) {
|
|
967
|
+
actionContainer.append($('<button class="btn btn-outline-secondary p-2"><i class="fa fa-copy"></i></button>').click(function (event) {
|
|
968
|
+
event.stopPropagation(); // Prevent other onclick events from triggering
|
|
969
|
+
duplicateFunction(deleteId);
|
|
970
|
+
}));
|
|
971
|
+
}
|
|
972
|
+
|
|
973
|
+
actionContainer.append($('<button class="btn btn-outline-danger p-2"><i class="fa fa-trash"></i></button>').click(function (event) {
|
|
965
974
|
event.stopPropagation(); // Prevent other onclick events from triggering
|
|
966
|
-
|
|
975
|
+
deleteFunction(deleteId);
|
|
967
976
|
}));
|
|
968
|
-
|
|
969
|
-
rowDiv.append(actionContainer);
|
|
970
977
|
}
|
|
971
978
|
|
|
972
979
|
function getAndCleanElement(elementId) {
|
package/js/chart-render.js
CHANGED
|
@@ -117,6 +117,10 @@ class RotationRenderer {
|
|
|
117
117
|
}
|
|
118
118
|
}
|
|
119
119
|
|
|
120
|
+
resize() {
|
|
121
|
+
this.chart.resize();
|
|
122
|
+
}
|
|
123
|
+
|
|
120
124
|
getElementID(element) {
|
|
121
125
|
return element.classList.values().find(item => item.match(/Intervention_[0-9]+_[0-9]+|Step_[0-9]+/));
|
|
122
126
|
}
|
|
@@ -220,7 +224,8 @@ class RotationRenderer {
|
|
|
220
224
|
|
|
221
225
|
grid: {
|
|
222
226
|
height: self.barHeight * 3,
|
|
223
|
-
right: 6
|
|
227
|
+
right: 6,
|
|
228
|
+
left: 6
|
|
224
229
|
},
|
|
225
230
|
|
|
226
231
|
xAxis: {
|
package/js/editor-attributes.js
CHANGED
package/js/editor-crops.js
CHANGED
|
@@ -21,6 +21,9 @@ function refreshInterventionsTable() {
|
|
|
21
21
|
let interventionsBottomContainer = getAndCleanElement("interventionsBottomContainer");
|
|
22
22
|
|
|
23
23
|
if (selectedStep && selectedStep.getStep().interventions) {
|
|
24
|
+
// Sort all interventions by day
|
|
25
|
+
selectedStep.getStep().interventions = selectedStep.getStep().interventions.sort((a, b) => a.day - b.day);
|
|
26
|
+
|
|
24
27
|
selectedStep.getStep().interventions.forEach((intervention) => {
|
|
25
28
|
const rowDiv = createInterventionRow(intervention);
|
|
26
29
|
|
|
@@ -29,7 +32,6 @@ function refreshInterventionsTable() {
|
|
|
29
32
|
} else {
|
|
30
33
|
interventionsBottomContainer.appendChild(rowDiv);
|
|
31
34
|
}
|
|
32
|
-
|
|
33
35
|
});
|
|
34
36
|
}
|
|
35
37
|
}
|
|
@@ -49,17 +51,35 @@ function createInterventionRow(intervention) {
|
|
|
49
51
|
},
|
|
50
52
|
function(id) {
|
|
51
53
|
selectedStep.removeIntervention(id);
|
|
52
|
-
|
|
53
|
-
|
|
54
|
+
refreshInterventionsTable();
|
|
55
|
+
renderChart();
|
|
56
|
+
},
|
|
57
|
+
function(id) {
|
|
58
|
+
duplicateIntervention(id);
|
|
59
|
+
refreshInterventionsTable();
|
|
60
|
+
renderChart();
|
|
61
|
+
},
|
|
62
|
+
'btn-group-vertical'
|
|
54
63
|
);
|
|
55
64
|
|
|
56
65
|
return rowDiv;
|
|
57
66
|
}
|
|
58
67
|
|
|
59
68
|
function createInterventionNameAndValueColumn(intervention) {
|
|
69
|
+
let absoluteDate = "";
|
|
70
|
+
if (selectedStep && selectedStep.getStep().startDate) {
|
|
71
|
+
const stepStartDate = new Date(selectedStep.getStep().startDate);
|
|
72
|
+
const interventionDate = new Date(stepStartDate);
|
|
73
|
+
interventionDate.setDate(stepStartDate.getDate() + parseInt(intervention.day));
|
|
74
|
+
absoluteDate = interventionDate.toLocaleDateString('fr-FR', {
|
|
75
|
+
month: "short",
|
|
76
|
+
day: "numeric",
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
|
|
60
80
|
let nameValueDiv = document.createElement("div");
|
|
61
81
|
nameValueDiv.className = "col";
|
|
62
|
-
nameValueDiv.innerHTML = `<strong>${intervention.name}</strong
|
|
82
|
+
nameValueDiv.innerHTML = `<strong>${intervention.name}</strong> (${absoluteDate})</br> ${intervention.description}`;
|
|
63
83
|
|
|
64
84
|
return nameValueDiv;
|
|
65
85
|
}
|
|
@@ -174,4 +194,24 @@ function updateRelativeDayFromAbsolute() {
|
|
|
174
194
|
|
|
175
195
|
$("#interventionDay").val(dayDiff);
|
|
176
196
|
}
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
function duplicateIntervention(interventionId) {
|
|
200
|
+
if (!selectedStep) return;
|
|
201
|
+
|
|
202
|
+
// Find the intervention to duplicate
|
|
203
|
+
let originalIntervention = selectedStep.getStep().interventions.find(interv => interv.id === interventionId);
|
|
204
|
+
if (!originalIntervention) return;
|
|
205
|
+
|
|
206
|
+
// Create a copy of the intervention
|
|
207
|
+
let newIntervention = {
|
|
208
|
+
id: crypto.randomUUID(),
|
|
209
|
+
day: Number(originalIntervention.day) + 15, // Offset by 15 days to avoid overlap
|
|
210
|
+
name: originalIntervention.name,
|
|
211
|
+
type: originalIntervention.type,
|
|
212
|
+
description: originalIntervention.description
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
// Add the duplicated intervention to the selected step
|
|
216
|
+
selectedStep.getStep().interventions.push(newIntervention);
|
|
177
217
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@osfarm/itineraire-technique",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.20",
|
|
4
4
|
"description": "A visualisation tool to show agricultural technical itineraries based on Echarts",
|
|
5
5
|
"main": "editor.html",
|
|
6
6
|
"scripts": {
|
|
@@ -12,5 +12,25 @@
|
|
|
12
12
|
},
|
|
13
13
|
"devDependencies": {
|
|
14
14
|
"sass": "^1.85.1"
|
|
15
|
-
}
|
|
15
|
+
},
|
|
16
|
+
"publishConfig": {
|
|
17
|
+
"access": "public"
|
|
18
|
+
},
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "https://github.com/osfarm/itineraire-technique"
|
|
22
|
+
},
|
|
23
|
+
"homepage": "https://www.osfarm.org/itineraire-technique/",
|
|
24
|
+
"bugs": {
|
|
25
|
+
"url": "https://github.com/osfarm/itineraire-technique/issues"
|
|
26
|
+
},
|
|
27
|
+
"license": "MIT",
|
|
28
|
+
"keywords": [
|
|
29
|
+
"agriculture",
|
|
30
|
+
"echarts",
|
|
31
|
+
"visualization",
|
|
32
|
+
"farming",
|
|
33
|
+
"itineraire-technique",
|
|
34
|
+
"TIKA"
|
|
35
|
+
]
|
|
16
36
|
}
|
package/scss/styles-editor.scss
CHANGED
|
@@ -109,13 +109,19 @@ $header-height : 3rem;
|
|
|
109
109
|
}
|
|
110
110
|
}
|
|
111
111
|
|
|
112
|
-
#cropsContainer
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
112
|
+
#cropsContainer{
|
|
113
|
+
.drag-handle {
|
|
114
|
+
color : #CCC;
|
|
115
|
+
font-weight : normal;
|
|
116
|
+
font-size : 86%;
|
|
117
|
+
margin-right : 10px;
|
|
118
|
+
vertical-align: middle;
|
|
119
|
+
cursor : grab;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
div.col {
|
|
123
|
+
cursor: pointer;
|
|
124
|
+
}
|
|
119
125
|
}
|
|
120
126
|
|
|
121
127
|
.form-control {
|
|
@@ -136,4 +142,8 @@ $header-height : 3rem;
|
|
|
136
142
|
text-align : left;
|
|
137
143
|
border : 1px inset;
|
|
138
144
|
background-color: #f1f1f1;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
#attributeName, #interventionName {
|
|
148
|
+
font-weight: bold;
|
|
139
149
|
}
|