@tekkare/auriga 0.1.136 → 0.1.138
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/module.json +1 -1
- package/dist/runtime/components/argExportXLSX.vue +290 -409
- package/dist/runtime/components/argExportXLSX.vue.d.ts +84 -63
- package/dist/runtime/components/argToolbarSources.vue +5 -1
- package/dist/runtime/components/argToolbarSources.vue.d.ts +9 -0
- package/dist/runtime/typings/index.d.ts +0 -1
- package/package.json +2 -2
package/dist/module.json
CHANGED
|
@@ -10,12 +10,70 @@
|
|
|
10
10
|
>
|
|
11
11
|
{{ name }}
|
|
12
12
|
</argBtn>
|
|
13
|
+
<div v-if="showModal === true" class="modal">
|
|
14
|
+
<div class="modal-content">
|
|
15
|
+
<div class="oip_row v-center space-between">
|
|
16
|
+
<p class="modal_title" v-if="lang === 'en'">Download limit reached</p>
|
|
17
|
+
<p class="modal_title" v-else>Limite de telechargement atteinte</p>
|
|
18
|
+
</div>
|
|
19
|
+
<p v-if="lang === 'en'">
|
|
20
|
+
Your selection contains
|
|
21
|
+
{{
|
|
22
|
+
actualAmount !== null
|
|
23
|
+
? actualAmount
|
|
24
|
+
: tabs.reduce((prevTab, currentTab) => {
|
|
25
|
+
return prevTab.data.length > currentTab.data.length
|
|
26
|
+
? prevTab.data.length
|
|
27
|
+
: currentTab.data.length;
|
|
28
|
+
})
|
|
29
|
+
}}
|
|
30
|
+
elements. For optimization reasons, only
|
|
31
|
+
<b> the first {{ limit }} elements </b> will be downloaded.
|
|
32
|
+
</p>
|
|
33
|
+
<p v-else>
|
|
34
|
+
Votre sélection contient
|
|
35
|
+
{{
|
|
36
|
+
actualAmount !== null
|
|
37
|
+
? actualAmount
|
|
38
|
+
: tabs.reduce((prevTab, currentTab) => {
|
|
39
|
+
return prevTab.data.length > currentTab.data.length
|
|
40
|
+
? prevTab
|
|
41
|
+
: currentTab;
|
|
42
|
+
})
|
|
43
|
+
}}
|
|
44
|
+
éléments. Pour des raisons d'optimisation, seuls les
|
|
45
|
+
<b> {{ limit }} premiers éléments</b> seront téléchargés.
|
|
46
|
+
</p>
|
|
47
|
+
<div class="oip_row v-center gap-8">
|
|
48
|
+
<div class="oip_row v-center">
|
|
49
|
+
<argBtn
|
|
50
|
+
btn-style="secondary-stroke"
|
|
51
|
+
:full-width="true"
|
|
52
|
+
@click="closeModal(false)"
|
|
53
|
+
>
|
|
54
|
+
{{ lang === "en" ? "Cancel" : "Annuler" }}
|
|
55
|
+
</argBtn>
|
|
56
|
+
</div>
|
|
57
|
+
<argBtn
|
|
58
|
+
btn-style="primary-fill"
|
|
59
|
+
@click="closeModal(true)"
|
|
60
|
+
:full-width="true"
|
|
61
|
+
>
|
|
62
|
+
{{
|
|
63
|
+
lang === "en"
|
|
64
|
+
? "Continue to download"
|
|
65
|
+
: "Continuer le téléchargement"
|
|
66
|
+
}}
|
|
67
|
+
</argBtn>
|
|
68
|
+
</div>
|
|
69
|
+
</div>
|
|
70
|
+
</div>
|
|
13
71
|
</div>
|
|
14
72
|
</template>
|
|
15
73
|
|
|
16
74
|
<script>
|
|
17
75
|
import argBtn from "./argBtn.vue";
|
|
18
|
-
import
|
|
76
|
+
import writeXlsxFile from "write-excel-file";
|
|
19
77
|
import { ref, defineComponent } from "vue";
|
|
20
78
|
export default defineComponent({
|
|
21
79
|
name: "ArgExportXLSX",
|
|
@@ -23,43 +81,47 @@ export default defineComponent({
|
|
|
23
81
|
props: {
|
|
24
82
|
name: {
|
|
25
83
|
type: String,
|
|
26
|
-
|
|
84
|
+
required: true
|
|
27
85
|
},
|
|
28
|
-
|
|
86
|
+
tabs: {
|
|
87
|
+
type: Array,
|
|
88
|
+
required: true
|
|
89
|
+
},
|
|
90
|
+
beforeExport: {
|
|
91
|
+
type: Function,
|
|
92
|
+
default: () => null
|
|
93
|
+
},
|
|
94
|
+
style: {
|
|
29
95
|
type: String,
|
|
30
|
-
|
|
31
|
-
default: "export-tekkare"
|
|
96
|
+
default: "primary-fill"
|
|
32
97
|
},
|
|
33
98
|
kpi: {
|
|
34
99
|
type: Array,
|
|
35
|
-
default:
|
|
36
|
-
},
|
|
37
|
-
subtitle: {
|
|
38
|
-
type: String,
|
|
39
|
-
require: false,
|
|
40
|
-
default: null
|
|
100
|
+
default: () => []
|
|
41
101
|
},
|
|
42
102
|
sources: {
|
|
43
103
|
type: Array,
|
|
44
|
-
|
|
45
|
-
default: () => [
|
|
104
|
+
required: true,
|
|
105
|
+
default: () => []
|
|
46
106
|
},
|
|
47
|
-
|
|
48
|
-
type:
|
|
49
|
-
|
|
50
|
-
default: null
|
|
107
|
+
subtitle: {
|
|
108
|
+
type: String,
|
|
109
|
+
default: ""
|
|
51
110
|
},
|
|
52
|
-
|
|
53
|
-
type:
|
|
54
|
-
|
|
111
|
+
exportName: {
|
|
112
|
+
type: String,
|
|
113
|
+
required: true,
|
|
114
|
+
default: "export-tekkare"
|
|
55
115
|
},
|
|
56
|
-
|
|
57
|
-
type:
|
|
58
|
-
|
|
116
|
+
limit: {
|
|
117
|
+
type: Number,
|
|
118
|
+
required: true,
|
|
119
|
+
default: 1e3
|
|
59
120
|
},
|
|
60
|
-
|
|
61
|
-
type:
|
|
62
|
-
|
|
121
|
+
actualAmount: {
|
|
122
|
+
type: Number,
|
|
123
|
+
required: false,
|
|
124
|
+
default: null
|
|
63
125
|
},
|
|
64
126
|
lang: {
|
|
65
127
|
type: String,
|
|
@@ -73,407 +135,226 @@ export default defineComponent({
|
|
|
73
135
|
const isLoading = ref(false);
|
|
74
136
|
const launchDownload = async () => {
|
|
75
137
|
isLoading.value = true;
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
if (!props.isCustom) {
|
|
83
|
-
formattedWorksheets = (props.worksheets || []).map((worksheet) => {
|
|
84
|
-
return {
|
|
85
|
-
name: worksheet.name,
|
|
86
|
-
value: XLSX.utils.json_to_sheet(worksheet.value),
|
|
87
|
-
sizes: worksheet.sizes,
|
|
88
|
-
formatToNumber: worksheet.formatToNumber,
|
|
89
|
-
formatToPourcent: worksheet.formatToPourcent
|
|
90
|
-
};
|
|
91
|
-
});
|
|
92
|
-
} else {
|
|
93
|
-
formattedWorksheets = props.worksheets;
|
|
94
|
-
}
|
|
95
|
-
if (formattedWorksheets) {
|
|
96
|
-
formattedWorksheets.forEach((worksheet) => {
|
|
97
|
-
XLSX.utils.book_append_sheet(
|
|
98
|
-
workbook,
|
|
99
|
-
worksheet.value,
|
|
100
|
-
worksheet.name
|
|
101
|
-
);
|
|
102
|
-
if (worksheet.sizes && worksheet.sizes.length > 0) {
|
|
103
|
-
const columnSizes = worksheet.sizes.map((column) => ({
|
|
104
|
-
wch: column
|
|
105
|
-
}));
|
|
106
|
-
worksheet.value["!cols"] = columnSizes;
|
|
107
|
-
}
|
|
108
|
-
applyColumnHeaderStyle(worksheet);
|
|
109
|
-
formatCells(worksheet);
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
XLSX.writeFile(
|
|
113
|
-
workbook,
|
|
114
|
-
`${props.title}-from_${(/* @__PURE__ */ new Date()).toLocaleString([], {
|
|
115
|
-
dateStyle: "short"
|
|
116
|
-
})}.xlsx`
|
|
117
|
-
);
|
|
118
|
-
isLoading.value = false;
|
|
119
|
-
};
|
|
120
|
-
const applyColumnHeaderStyle = (worksheet) => {
|
|
121
|
-
for (let lettre = 65; lettre <= 90; lettre++) {
|
|
122
|
-
const cellule = String.fromCharCode(lettre) + 1;
|
|
123
|
-
if (worksheet.value[cellule]) {
|
|
124
|
-
worksheet.value[cellule].s = { font: { bold: true, sz: 12 } };
|
|
125
|
-
}
|
|
138
|
+
const currentDate = (/* @__PURE__ */ new Date()).toLocaleString([], {
|
|
139
|
+
dateStyle: "short"
|
|
140
|
+
});
|
|
141
|
+
await props.beforeExport();
|
|
142
|
+
if ((props.actualAmount !== null && props.actualAmount > props.limit || props.actualAmount === null && props.tabs.some((tab) => tab.data.length > props.limit)) && canLaunchDownload.value === false) {
|
|
143
|
+
openModal();
|
|
126
144
|
}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
145
|
+
if (canLaunchDownload.value === true || props.actualAmount === null && props.tabs.some((tab) => tab.data.length > props.limit) === false || props.actualAmount !== null && props.actualAmount <= props.limit) {
|
|
146
|
+
const emptyStyledCell = {
|
|
147
|
+
value: "",
|
|
148
|
+
borderColor: "#FFFFFF",
|
|
149
|
+
width: 20,
|
|
150
|
+
height: 30
|
|
151
|
+
};
|
|
152
|
+
const emptyCell = {
|
|
153
|
+
value: "",
|
|
154
|
+
borderColor: "#FFFFFF"
|
|
155
|
+
};
|
|
156
|
+
const generalStyle = {
|
|
157
|
+
borderColor: "#FFFFFF",
|
|
158
|
+
align: "center",
|
|
159
|
+
alignVertical: "center",
|
|
160
|
+
fontFamily: "Figtree"
|
|
161
|
+
};
|
|
162
|
+
const kpiValueStyle = {
|
|
163
|
+
...generalStyle,
|
|
164
|
+
fontSize: 18,
|
|
165
|
+
fontWeight: "bold"
|
|
166
|
+
};
|
|
167
|
+
const kpiLabelStyle = {
|
|
168
|
+
...generalStyle,
|
|
169
|
+
fontSize: 18,
|
|
170
|
+
color: "#b2b2b2",
|
|
171
|
+
fontStyle: "italic"
|
|
172
|
+
};
|
|
173
|
+
const emptyRow = [];
|
|
174
|
+
const generatedByRow = [];
|
|
175
|
+
const tekkareRow = [];
|
|
176
|
+
const kpiRow1 = [];
|
|
177
|
+
const kpiRow2 = [];
|
|
178
|
+
const kpiRow3 = [];
|
|
179
|
+
const kpiRow4 = [];
|
|
180
|
+
const kpiDescriptionRow = [];
|
|
181
|
+
const subtitleRow = [];
|
|
182
|
+
for (let i = 0; i < 40; i++) {
|
|
183
|
+
emptyRow.push(emptyStyledCell);
|
|
184
|
+
if (i === 7) {
|
|
185
|
+
tekkareRow.push({
|
|
186
|
+
...generalStyle,
|
|
187
|
+
value: "Tekkare \u{1F49C}",
|
|
188
|
+
fontWeight: "bold",
|
|
189
|
+
fontSize: 72,
|
|
190
|
+
width: 60
|
|
191
|
+
});
|
|
192
|
+
generatedByRow.push({
|
|
193
|
+
...generalStyle,
|
|
194
|
+
value: props.lang === "en" ? `This document was generated on ${(/* @__PURE__ */ new Date()).toLocaleDateString(
|
|
195
|
+
"en-US",
|
|
196
|
+
{ year: "numeric", month: "long", day: "numeric" }
|
|
197
|
+
)} by` : `Ce document a \xE9t\xE9 g\xE9n\xE9r\xE9 le ${(/* @__PURE__ */ new Date()).toLocaleDateString(
|
|
198
|
+
"fr-FR",
|
|
199
|
+
{ year: "numeric", month: "long", day: "numeric" }
|
|
200
|
+
)} par`,
|
|
201
|
+
fontSize: 16
|
|
202
|
+
});
|
|
203
|
+
if (props.subtitle !== null) {
|
|
204
|
+
subtitleRow.push({
|
|
205
|
+
...generalStyle,
|
|
206
|
+
value: props.subtitle,
|
|
207
|
+
fontSize: 16
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
} else {
|
|
211
|
+
tekkareRow.push(emptyCell);
|
|
212
|
+
generatedByRow.push(emptyCell);
|
|
213
|
+
if (props.subtitle !== null) {
|
|
214
|
+
subtitleRow.push(emptyCell);
|
|
135
215
|
}
|
|
136
216
|
}
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
217
|
+
if (props.kpi.length > 0 && props.kpi !== null && props.kpi !== void 0) {
|
|
218
|
+
if (i === 8) {
|
|
219
|
+
kpiDescriptionRow.push({
|
|
220
|
+
...generalStyle,
|
|
221
|
+
value: props.lang === "fr" ? "Votre export contient :" : "Your export currently contains :",
|
|
222
|
+
fontSize: 18
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
if (i === 6) {
|
|
226
|
+
if (props.kpi[0] !== void 0) {
|
|
227
|
+
kpiRow1.push({
|
|
228
|
+
...kpiValueStyle,
|
|
229
|
+
value: props.kpi[0].value.toString()
|
|
230
|
+
});
|
|
231
|
+
kpiRow2.push({
|
|
232
|
+
...kpiLabelStyle,
|
|
233
|
+
value: props.kpi[0].label.toString()
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
if (props.kpi[2] !== void 0) {
|
|
237
|
+
kpiRow3.push({
|
|
238
|
+
...kpiValueStyle,
|
|
239
|
+
value: props.kpi[2].value.toString()
|
|
240
|
+
});
|
|
241
|
+
kpiRow4.push({
|
|
242
|
+
...kpiLabelStyle,
|
|
243
|
+
value: props.kpi[2].label.toString()
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
} else if (i === 8) {
|
|
247
|
+
if (props.kpi[1] !== void 0) {
|
|
248
|
+
kpiRow1.push({
|
|
249
|
+
...kpiValueStyle,
|
|
250
|
+
value: props.kpi[1].value.toString()
|
|
251
|
+
});
|
|
252
|
+
kpiRow2.push({
|
|
253
|
+
...kpiLabelStyle,
|
|
254
|
+
value: props.kpi[1].label.toString()
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
if (props.kpi[3] !== void 0) {
|
|
258
|
+
kpiRow3.push({
|
|
259
|
+
...kpiValueStyle,
|
|
260
|
+
value: props.kpi[3].value.toString()
|
|
261
|
+
});
|
|
262
|
+
kpiRow4.push({
|
|
263
|
+
...kpiLabelStyle,
|
|
264
|
+
value: props.kpi[3].label.toString()
|
|
265
|
+
});
|
|
266
|
+
}
|
|
267
|
+
} else {
|
|
268
|
+
kpiDescriptionRow.push(emptyCell);
|
|
269
|
+
kpiRow1.push(emptyCell);
|
|
270
|
+
kpiRow2.push(emptyCell);
|
|
271
|
+
kpiRow3.push(emptyCell);
|
|
272
|
+
kpiRow4.push(emptyCell);
|
|
145
273
|
}
|
|
146
274
|
}
|
|
147
|
-
});
|
|
148
|
-
}
|
|
149
|
-
};
|
|
150
|
-
const setUpCoverPage = (workbook) => {
|
|
151
|
-
const pageData = [];
|
|
152
|
-
const emptyObject = {};
|
|
153
|
-
const style = {
|
|
154
|
-
border: {
|
|
155
|
-
top: { style: "dotted", color: { rgb: "FFFFFF" } },
|
|
156
|
-
left: { style: "dotted", color: { rgb: "FFFFFF" } },
|
|
157
|
-
right: { style: "dotted", color: { rgb: "FFFFFF" } },
|
|
158
|
-
bottom: { style: "dotted", color: { rgb: "FFFFFF" } }
|
|
159
|
-
}
|
|
160
|
-
};
|
|
161
|
-
const firstRowStyle = {
|
|
162
|
-
font: {
|
|
163
|
-
bold: true,
|
|
164
|
-
sz: 14
|
|
165
|
-
},
|
|
166
|
-
border: {
|
|
167
|
-
top: { style: "dotted", color: { rgb: "FFFFFF" } },
|
|
168
|
-
left: { style: "dotted", color: { rgb: "FFFFFF" } },
|
|
169
|
-
right: { style: "dotted", color: { rgb: "FFFFFF" } },
|
|
170
|
-
bottom: { style: "dotted", color: { rgb: "FFFFFF" } }
|
|
171
|
-
}
|
|
172
|
-
};
|
|
173
|
-
const kpiStyle = {
|
|
174
|
-
font: {
|
|
175
|
-
color: { rgb: "525670" },
|
|
176
|
-
name: "Figtree",
|
|
177
|
-
sz: 16,
|
|
178
|
-
italic: true
|
|
179
|
-
},
|
|
180
|
-
border: {
|
|
181
|
-
top: { color: { rgb: "FFFFFF" } },
|
|
182
|
-
left: { color: { rgb: "FFFFFF" } },
|
|
183
|
-
right: { color: { rgb: "FFFFFF" } },
|
|
184
|
-
bottom: { color: { rgb: "FFFFFF" } }
|
|
185
|
-
},
|
|
186
|
-
alignment: {
|
|
187
|
-
vertical: "center",
|
|
188
|
-
horizontal: "center"
|
|
189
|
-
}
|
|
190
|
-
};
|
|
191
|
-
const kpiBoldStyle = {
|
|
192
|
-
font: {
|
|
193
|
-
name: "Figtree",
|
|
194
|
-
sz: 18,
|
|
195
|
-
bold: true
|
|
196
|
-
},
|
|
197
|
-
border: {
|
|
198
|
-
top: { color: { rgb: "FFFFFF" } },
|
|
199
|
-
left: { color: { rgb: "FFFFFF" } },
|
|
200
|
-
right: { color: { rgb: "FFFFFF" } },
|
|
201
|
-
bottom: { color: { rgb: "FFFFFF" } }
|
|
202
|
-
},
|
|
203
|
-
alignment: {
|
|
204
|
-
vertical: "center",
|
|
205
|
-
horizontal: "center"
|
|
206
|
-
}
|
|
207
|
-
};
|
|
208
|
-
for (let i = 0; i < 26; i++) {
|
|
209
|
-
emptyObject[i] = " ";
|
|
210
|
-
}
|
|
211
|
-
for (let i = 0; i < 60; i++) {
|
|
212
|
-
pageData.push({ ...emptyObject });
|
|
213
|
-
}
|
|
214
|
-
const pageDeGarde = XLSX.utils.json_to_sheet(pageData);
|
|
215
|
-
XLSX.utils.book_append_sheet(workbook, pageDeGarde, `Tekkare`);
|
|
216
|
-
pageDeGarde["!cols"] = [
|
|
217
|
-
{ wch: 10 },
|
|
218
|
-
{ wch: 10 },
|
|
219
|
-
{ wch: 10 },
|
|
220
|
-
{ wch: 10 },
|
|
221
|
-
{ wch: 50 },
|
|
222
|
-
{ wch: 50 }
|
|
223
|
-
];
|
|
224
|
-
XLSX.utils.sheet_add_aoa(
|
|
225
|
-
pageDeGarde,
|
|
226
|
-
[
|
|
227
|
-
[
|
|
228
|
-
`This document was generated on ${(/* @__PURE__ */ new Date()).toLocaleString([], {
|
|
229
|
-
dateStyle: "short"
|
|
230
|
-
})} by`
|
|
231
|
-
]
|
|
232
|
-
],
|
|
233
|
-
{
|
|
234
|
-
origin: "E5"
|
|
235
|
-
}
|
|
236
|
-
);
|
|
237
|
-
XLSX.utils.sheet_add_aoa(pageDeGarde, [["Tekkare \u{1F49C}"]], {
|
|
238
|
-
origin: "E7"
|
|
239
|
-
});
|
|
240
|
-
XLSX.utils.sheet_add_aoa(
|
|
241
|
-
pageDeGarde,
|
|
242
|
-
[[`Your export currently contains :`]],
|
|
243
|
-
{
|
|
244
|
-
origin: "E11"
|
|
245
275
|
}
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
pageDeGarde[`E${currentRow}`].s = {
|
|
253
|
-
font: {
|
|
254
|
-
name: "Figtree",
|
|
255
|
-
sz: 18
|
|
256
|
-
},
|
|
257
|
-
border: {
|
|
258
|
-
top: { style: "dotted", color: { rgb: "FFFFFF" } },
|
|
259
|
-
left: { style: "dotted", color: { rgb: "FFFFFF" } },
|
|
260
|
-
right: { style: "dotted", color: { rgb: "FFFFFF" } },
|
|
261
|
-
bottom: { style: "dotted", color: { rgb: "FFFFFF" } }
|
|
262
|
-
},
|
|
263
|
-
alignment: {
|
|
264
|
-
vertical: "center",
|
|
265
|
-
horizontal: "center"
|
|
276
|
+
const data = [];
|
|
277
|
+
for (let i = 0; i < 16; i++) {
|
|
278
|
+
if (props.kpi !== null && props.kpi !== void 0 && props.kpi.length > 0) {
|
|
279
|
+
i === 3 ? data.push(generatedByRow) : i === 4 ? data.push(tekkareRow) : i === 6 ? data.push(kpiDescriptionRow) : i === 8 ? data.push(kpiRow1) : i === 9 ? data.push(kpiRow2) : i === 11 ? data.push(kpiRow3) : i === 12 ? data.push(kpiRow4) : i === 14 ? data.push(subtitleRow) : data.push(emptyRow);
|
|
280
|
+
} else {
|
|
281
|
+
i === 3 ? data.push(generatedByRow) : i === 4 ? data.push(tekkareRow) : i === 6 ? data.push(subtitleRow) : data.push(emptyRow);
|
|
266
282
|
}
|
|
267
|
-
};
|
|
268
|
-
currentRow++;
|
|
269
|
-
});
|
|
270
|
-
XLSX.utils.sheet_add_aoa(
|
|
271
|
-
pageDeGarde,
|
|
272
|
-
[
|
|
273
|
-
[
|
|
274
|
-
"",
|
|
275
|
-
"",
|
|
276
|
-
"",
|
|
277
|
-
"",
|
|
278
|
-
"",
|
|
279
|
-
"",
|
|
280
|
-
"",
|
|
281
|
-
"",
|
|
282
|
-
"",
|
|
283
|
-
"",
|
|
284
|
-
"",
|
|
285
|
-
"",
|
|
286
|
-
"",
|
|
287
|
-
"",
|
|
288
|
-
"",
|
|
289
|
-
"",
|
|
290
|
-
"",
|
|
291
|
-
"",
|
|
292
|
-
"",
|
|
293
|
-
"",
|
|
294
|
-
"",
|
|
295
|
-
"",
|
|
296
|
-
"",
|
|
297
|
-
"",
|
|
298
|
-
"",
|
|
299
|
-
"",
|
|
300
|
-
"",
|
|
301
|
-
"",
|
|
302
|
-
"",
|
|
303
|
-
""
|
|
304
|
-
]
|
|
305
|
-
],
|
|
306
|
-
{
|
|
307
|
-
origin: "A1"
|
|
308
283
|
}
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
);
|
|
329
|
-
}
|
|
330
|
-
if (props.kpi !== null && props.kpi !== void 0 && props.kpi.length > 2) {
|
|
331
|
-
XLSX.utils.sheet_add_aoa(
|
|
332
|
-
pageDeGarde,
|
|
333
|
-
[
|
|
334
|
-
props.kpi[3] !== null && props.kpi[3] !== void 0 ? [`${props.kpi[2].value}`, `${props.kpi[3].value}`] : [`${props.kpi[2].value}`]
|
|
335
|
-
],
|
|
336
|
-
{
|
|
337
|
-
origin: "E18"
|
|
338
|
-
}
|
|
339
|
-
);
|
|
340
|
-
XLSX.utils.sheet_add_aoa(
|
|
341
|
-
pageDeGarde,
|
|
342
|
-
[
|
|
343
|
-
props.kpi[3] !== null && props.kpi[3] !== void 0 ? [`${props.kpi[2].label}`, `${props.kpi[3].label}`] : [`${props.kpi[2].label}`]
|
|
344
|
-
],
|
|
345
|
-
{
|
|
346
|
-
origin: "E19"
|
|
284
|
+
props.sources.forEach((source) => {
|
|
285
|
+
const sourceRow = [];
|
|
286
|
+
for (let i = 0; i < 40; i++) {
|
|
287
|
+
if (i === 7) {
|
|
288
|
+
sourceRow.push({
|
|
289
|
+
...generalStyle,
|
|
290
|
+
value: `${source.emoji !== void 0 && source.emoji !== null ? source.emoji : ""} Source : ${source.name} - ${props.lang === "en" ? "Last update" : "Derni\xE8re mise \xE0 jour"} : ${new Date(source.date).toLocaleDateString(
|
|
291
|
+
props.lang === "en" ? "en-US" : "fr-FR",
|
|
292
|
+
{
|
|
293
|
+
year: "numeric",
|
|
294
|
+
month: "long",
|
|
295
|
+
day: "numeric"
|
|
296
|
+
}
|
|
297
|
+
)}`,
|
|
298
|
+
fontSize: 18
|
|
299
|
+
});
|
|
300
|
+
} else {
|
|
301
|
+
sourceRow.push(emptyCell);
|
|
302
|
+
}
|
|
347
303
|
}
|
|
348
|
-
|
|
349
|
-
}
|
|
350
|
-
if (props.subtitle !== null && props.subtitle !== void 0) {
|
|
351
|
-
XLSX.utils.sheet_add_aoa(pageDeGarde, [[props.subtitle]], {
|
|
352
|
-
origin: "E23"
|
|
304
|
+
data.push(sourceRow);
|
|
353
305
|
});
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
for (let chiffre = 1; chiffre < 60; chiffre++) {
|
|
357
|
-
const cellule = String.fromCharCode(lettre) + chiffre;
|
|
358
|
-
if (String.fromCharCode(lettre) === "1") {
|
|
359
|
-
pageDeGarde[cellule].s = firstRowStyle;
|
|
360
|
-
} else {
|
|
361
|
-
pageDeGarde[cellule].s = style;
|
|
362
|
-
}
|
|
363
|
-
}
|
|
364
|
-
}
|
|
365
|
-
pageDeGarde["E7"].s = {
|
|
366
|
-
font: {
|
|
367
|
-
name: "Figtree",
|
|
368
|
-
sz: 72,
|
|
369
|
-
bold: true
|
|
370
|
-
},
|
|
371
|
-
alignment: {
|
|
372
|
-
vertical: "center",
|
|
373
|
-
horizontal: "center"
|
|
374
|
-
},
|
|
375
|
-
border: {
|
|
376
|
-
top: { color: { rgb: "FFFFFF" } },
|
|
377
|
-
left: { color: { rgb: "FFFFFF" } },
|
|
378
|
-
right: { color: { rgb: "FFFFFF" } },
|
|
379
|
-
bottom: { color: { rgb: "FFFFFF" } }
|
|
380
|
-
}
|
|
381
|
-
};
|
|
382
|
-
const smallStyle = {
|
|
383
|
-
font: {
|
|
384
|
-
name: "Figtree",
|
|
385
|
-
sz: 18
|
|
386
|
-
},
|
|
387
|
-
border: {
|
|
388
|
-
top: { color: { rgb: "FFFFFF" } },
|
|
389
|
-
left: { color: { rgb: "FFFFFF" } },
|
|
390
|
-
right: { color: { rgb: "FFFFFF" } },
|
|
391
|
-
bottom: { color: { rgb: "FFFFFF" } }
|
|
392
|
-
}
|
|
393
|
-
};
|
|
394
|
-
pageDeGarde["E5"].s = {
|
|
395
|
-
font: {
|
|
396
|
-
name: "Figtree",
|
|
397
|
-
sz: 14
|
|
398
|
-
},
|
|
399
|
-
border: {
|
|
400
|
-
top: { color: { rgb: "FFFFFF" } },
|
|
401
|
-
left: { color: { rgb: "FFFFFF" } },
|
|
402
|
-
right: { color: { rgb: "FFFFFF" } },
|
|
403
|
-
bottom: { color: { rgb: "FFFFFF" } }
|
|
404
|
-
},
|
|
405
|
-
alignment: {
|
|
406
|
-
vertical: "center",
|
|
407
|
-
horizontal: "center"
|
|
408
|
-
}
|
|
409
|
-
};
|
|
410
|
-
pageDeGarde["E11"].s = {
|
|
411
|
-
...smallStyle,
|
|
412
|
-
alignment: {
|
|
413
|
-
horizontal: "center"
|
|
414
|
-
}
|
|
415
|
-
};
|
|
416
|
-
pageDeGarde["E23"].s = {
|
|
417
|
-
font: {
|
|
418
|
-
name: "Figtree",
|
|
419
|
-
sz: 16
|
|
420
|
-
},
|
|
421
|
-
border: {
|
|
422
|
-
top: { style: "dotted", color: { rgb: "FFFFFF" } },
|
|
423
|
-
left: { style: "dotted", color: { rgb: "FFFFFF" } },
|
|
424
|
-
right: { style: "dotted", color: { rgb: "FFFFFF" } },
|
|
425
|
-
bottom: { style: "dotted", color: { rgb: "FFFFFF" } }
|
|
426
|
-
},
|
|
427
|
-
alignment: {
|
|
428
|
-
vertical: "center",
|
|
429
|
-
horizontal: "center"
|
|
306
|
+
for (let i = 0; i < 15; i++) {
|
|
307
|
+
data.push(emptyRow);
|
|
430
308
|
}
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
pageDeGarde[`E${row}`].s = {
|
|
442
|
-
font: {
|
|
443
|
-
name: "Figtree",
|
|
444
|
-
sz: 16
|
|
445
|
-
},
|
|
446
|
-
border: {
|
|
447
|
-
top: { style: "dotted", color: { rgb: "FFFFFF" } },
|
|
448
|
-
left: { style: "dotted", color: { rgb: "FFFFFF" } },
|
|
449
|
-
right: { style: "dotted", color: { rgb: "FFFFFF" } },
|
|
450
|
-
bottom: { style: "dotted", color: { rgb: "FFFFFF" } }
|
|
451
|
-
},
|
|
452
|
-
alignment: {
|
|
453
|
-
vertical: "center",
|
|
454
|
-
horizontal: "center"
|
|
309
|
+
const coverSchema = null;
|
|
310
|
+
const globalData = props.tabs.map((tab) => {
|
|
311
|
+
if (tab.data.length > props.limit) {
|
|
312
|
+
if (props.actualAmount !== void 0 && props.actualAmount !== null) {
|
|
313
|
+
return props.actualAmount > tab.data.length ? tab.data.slice(0, props.limit) : tab.data;
|
|
314
|
+
} else {
|
|
315
|
+
return tab.data.slice(0, props.limit);
|
|
316
|
+
}
|
|
317
|
+
} else {
|
|
318
|
+
return tab.data;
|
|
455
319
|
}
|
|
456
|
-
};
|
|
457
|
-
}
|
|
458
|
-
pageDeGarde["!merges"] = [
|
|
459
|
-
{ s: { r: 6, c: 4 }, e: { r: 6, c: 5 } },
|
|
460
|
-
{ s: { r: 10, c: 4 }, e: { r: 10, c: 5 } },
|
|
461
|
-
{ s: { r: 22, c: 4 }, e: { r: 22, c: 5 } },
|
|
462
|
-
{ s: { r: 4, c: 4 }, e: { r: 4, c: 5 } }
|
|
463
|
-
];
|
|
464
|
-
props.sources.forEach((source, index) => {
|
|
465
|
-
pageDeGarde["!merges"].push({
|
|
466
|
-
s: { r: 25 + index, c: 4 },
|
|
467
|
-
e: { r: 25 + index, c: 5 }
|
|
468
320
|
});
|
|
469
|
-
|
|
321
|
+
globalData.unshift(data);
|
|
322
|
+
const globalSchema = props.tabs.map((tab) => tab.schema);
|
|
323
|
+
globalSchema.unshift(coverSchema);
|
|
324
|
+
const globalSheets = props.tabs.map((tab) => tab.name);
|
|
325
|
+
globalSheets.unshift("Tekkare");
|
|
326
|
+
await writeXlsxFile(globalData, {
|
|
327
|
+
schema: globalSchema,
|
|
328
|
+
sheets: globalSheets,
|
|
329
|
+
fileName: `${props.exportName}-from_${currentDate}.xlsx`,
|
|
330
|
+
stickyRowsCount: 1
|
|
331
|
+
});
|
|
332
|
+
}
|
|
333
|
+
canLaunchDownload.value = false;
|
|
334
|
+
isLoading.value = false;
|
|
470
335
|
};
|
|
336
|
+
const showModal = ref(false);
|
|
337
|
+
const canLaunchDownload = ref(false);
|
|
338
|
+
function openModal() {
|
|
339
|
+
showModal.value = true;
|
|
340
|
+
}
|
|
341
|
+
function closeModal(value) {
|
|
342
|
+
showModal.value = false;
|
|
343
|
+
canLaunchDownload.value = value;
|
|
344
|
+
if (value === true) {
|
|
345
|
+
launchDownload();
|
|
346
|
+
}
|
|
347
|
+
}
|
|
471
348
|
return {
|
|
472
349
|
launchDownload,
|
|
473
|
-
isLoading
|
|
350
|
+
isLoading,
|
|
351
|
+
showModal,
|
|
352
|
+
closeModal
|
|
474
353
|
};
|
|
475
354
|
}
|
|
476
355
|
});
|
|
477
356
|
</script>
|
|
478
357
|
|
|
479
|
-
<style scoped
|
|
358
|
+
<style scoped>
|
|
359
|
+
.modal{align-items:center;background-color:rgba(0,0,0,.2);display:flex;height:100vh;justify-content:center;left:0;overflow:auto;position:fixed;top:0;width:100%;z-index:100}.modal-content{background-color:#fff;border-radius:8px;display:flex;flex-direction:column;font-size:16px;font-weight:400;gap:24px;line-height:160%;padding:24px;width:420px}.modal-content,.modal_title{color:var(--Base-Darkest,#1e293b);font-family:Figtree;font-style:normal}.modal_title{font-size:20px;font-weight:900;line-height:normal}
|
|
360
|
+
</style>
|
|
@@ -3,54 +3,70 @@ interface KPIContent {
|
|
|
3
3
|
label: string;
|
|
4
4
|
value: any;
|
|
5
5
|
}
|
|
6
|
-
|
|
6
|
+
type KPI = KPIContent[];
|
|
7
|
+
interface columnSchem {
|
|
8
|
+
column: string;
|
|
9
|
+
type: any;
|
|
10
|
+
format?: any;
|
|
11
|
+
value: (any: any) => any;
|
|
12
|
+
}
|
|
13
|
+
interface Tab {
|
|
7
14
|
name: string;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
15
|
+
data: any;
|
|
16
|
+
schema: columnSchem[];
|
|
17
|
+
}
|
|
18
|
+
type Tabs = Tab[];
|
|
19
|
+
interface Source {
|
|
20
|
+
name: string;
|
|
21
|
+
date: string | Date;
|
|
22
|
+
emoji?: any;
|
|
12
23
|
}
|
|
24
|
+
type Sources = Source[];
|
|
13
25
|
declare const _default: import("vue").DefineComponent<{
|
|
14
26
|
name: {
|
|
15
27
|
type: StringConstructor;
|
|
16
|
-
|
|
28
|
+
required: true;
|
|
29
|
+
};
|
|
30
|
+
tabs: {
|
|
31
|
+
type: PropType<Tabs>;
|
|
32
|
+
required: true;
|
|
33
|
+
};
|
|
34
|
+
beforeExport: {
|
|
35
|
+
type: FunctionConstructor;
|
|
36
|
+
default: () => null;
|
|
17
37
|
};
|
|
18
|
-
|
|
38
|
+
style: {
|
|
19
39
|
type: StringConstructor;
|
|
20
|
-
require: boolean;
|
|
21
40
|
default: string;
|
|
22
41
|
};
|
|
23
42
|
kpi: {
|
|
24
|
-
type: PropType<
|
|
25
|
-
default:
|
|
26
|
-
};
|
|
27
|
-
subtitle: {
|
|
28
|
-
type: StringConstructor;
|
|
29
|
-
require: boolean;
|
|
30
|
-
default: null;
|
|
43
|
+
type: PropType<KPI>;
|
|
44
|
+
default: () => never[];
|
|
31
45
|
};
|
|
32
46
|
sources: {
|
|
33
|
-
type: PropType<
|
|
34
|
-
|
|
35
|
-
default: () =>
|
|
36
|
-
};
|
|
37
|
-
worksheets: {
|
|
38
|
-
type: PropType<WorksheetContent[] | null>;
|
|
39
|
-
require: boolean;
|
|
40
|
-
default: null;
|
|
47
|
+
type: PropType<Sources>;
|
|
48
|
+
required: true;
|
|
49
|
+
default: () => never[];
|
|
41
50
|
};
|
|
42
|
-
|
|
43
|
-
type:
|
|
44
|
-
default:
|
|
45
|
-
};
|
|
46
|
-
beforeExport: {
|
|
47
|
-
type: FunctionConstructor;
|
|
48
|
-
default: () => null;
|
|
51
|
+
subtitle: {
|
|
52
|
+
type: StringConstructor;
|
|
53
|
+
default: string;
|
|
49
54
|
};
|
|
50
|
-
|
|
55
|
+
exportName: {
|
|
51
56
|
type: StringConstructor;
|
|
57
|
+
required: true;
|
|
52
58
|
default: string;
|
|
53
59
|
};
|
|
60
|
+
limit: {
|
|
61
|
+
type: NumberConstructor;
|
|
62
|
+
required: true;
|
|
63
|
+
default: number;
|
|
64
|
+
};
|
|
65
|
+
actualAmount: {
|
|
66
|
+
type: NumberConstructor;
|
|
67
|
+
required: false;
|
|
68
|
+
default: null;
|
|
69
|
+
};
|
|
54
70
|
lang: {
|
|
55
71
|
type: StringConstructor;
|
|
56
72
|
default: string;
|
|
@@ -59,62 +75,67 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
59
75
|
}, {
|
|
60
76
|
launchDownload: () => Promise<void>;
|
|
61
77
|
isLoading: import("vue").Ref<boolean>;
|
|
78
|
+
showModal: import("vue").Ref<boolean>;
|
|
79
|
+
closeModal: (value: boolean) => void;
|
|
62
80
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
63
81
|
name: {
|
|
64
82
|
type: StringConstructor;
|
|
65
|
-
|
|
83
|
+
required: true;
|
|
84
|
+
};
|
|
85
|
+
tabs: {
|
|
86
|
+
type: PropType<Tabs>;
|
|
87
|
+
required: true;
|
|
88
|
+
};
|
|
89
|
+
beforeExport: {
|
|
90
|
+
type: FunctionConstructor;
|
|
91
|
+
default: () => null;
|
|
66
92
|
};
|
|
67
|
-
|
|
93
|
+
style: {
|
|
68
94
|
type: StringConstructor;
|
|
69
|
-
require: boolean;
|
|
70
95
|
default: string;
|
|
71
96
|
};
|
|
72
97
|
kpi: {
|
|
73
|
-
type: PropType<
|
|
74
|
-
default:
|
|
75
|
-
};
|
|
76
|
-
subtitle: {
|
|
77
|
-
type: StringConstructor;
|
|
78
|
-
require: boolean;
|
|
79
|
-
default: null;
|
|
98
|
+
type: PropType<KPI>;
|
|
99
|
+
default: () => never[];
|
|
80
100
|
};
|
|
81
101
|
sources: {
|
|
82
|
-
type: PropType<
|
|
83
|
-
|
|
84
|
-
default: () =>
|
|
102
|
+
type: PropType<Sources>;
|
|
103
|
+
required: true;
|
|
104
|
+
default: () => never[];
|
|
85
105
|
};
|
|
86
|
-
|
|
87
|
-
type:
|
|
88
|
-
|
|
89
|
-
default: null;
|
|
90
|
-
};
|
|
91
|
-
isCustom: {
|
|
92
|
-
type: BooleanConstructor;
|
|
93
|
-
default: boolean;
|
|
94
|
-
};
|
|
95
|
-
beforeExport: {
|
|
96
|
-
type: FunctionConstructor;
|
|
97
|
-
default: () => null;
|
|
106
|
+
subtitle: {
|
|
107
|
+
type: StringConstructor;
|
|
108
|
+
default: string;
|
|
98
109
|
};
|
|
99
|
-
|
|
110
|
+
exportName: {
|
|
100
111
|
type: StringConstructor;
|
|
112
|
+
required: true;
|
|
101
113
|
default: string;
|
|
102
114
|
};
|
|
115
|
+
limit: {
|
|
116
|
+
type: NumberConstructor;
|
|
117
|
+
required: true;
|
|
118
|
+
default: number;
|
|
119
|
+
};
|
|
120
|
+
actualAmount: {
|
|
121
|
+
type: NumberConstructor;
|
|
122
|
+
required: false;
|
|
123
|
+
default: null;
|
|
124
|
+
};
|
|
103
125
|
lang: {
|
|
104
126
|
type: StringConstructor;
|
|
105
127
|
default: string;
|
|
106
128
|
validator: (value: string) => boolean;
|
|
107
129
|
};
|
|
108
130
|
}>>, {
|
|
109
|
-
name: string;
|
|
110
131
|
lang: string;
|
|
111
|
-
title: string;
|
|
112
132
|
subtitle: string;
|
|
113
|
-
kpi: KPIContent[];
|
|
114
|
-
sources: String[];
|
|
115
|
-
worksheets: WorksheetContent[] | null;
|
|
116
|
-
isCustom: boolean;
|
|
117
133
|
beforeExport: Function;
|
|
118
134
|
style: string;
|
|
135
|
+
kpi: KPI;
|
|
136
|
+
sources: Sources;
|
|
137
|
+
exportName: string;
|
|
138
|
+
limit: number;
|
|
139
|
+
actualAmount: number;
|
|
119
140
|
}, {}>;
|
|
120
141
|
export default _default;
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
: "you must list in your reports the sources used."
|
|
31
31
|
}}
|
|
32
32
|
</p>
|
|
33
|
-
<p>
|
|
33
|
+
<p v-if="showCopy">
|
|
34
34
|
{{
|
|
35
35
|
lang === "fr"
|
|
36
36
|
? "Le bouton “Copier” est prévu pour faciliter cette démarche."
|
|
@@ -59,6 +59,10 @@ export default defineComponent({
|
|
|
59
59
|
validator: (value) => {
|
|
60
60
|
return ["en", "fr", "es"].includes(value);
|
|
61
61
|
}
|
|
62
|
+
},
|
|
63
|
+
showCopy: {
|
|
64
|
+
type: Boolean,
|
|
65
|
+
default: true
|
|
62
66
|
}
|
|
63
67
|
}
|
|
64
68
|
});
|
|
@@ -4,13 +4,22 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
4
4
|
default: string;
|
|
5
5
|
validator: (value: string) => boolean;
|
|
6
6
|
};
|
|
7
|
+
showCopy: {
|
|
8
|
+
type: BooleanConstructor;
|
|
9
|
+
default: boolean;
|
|
10
|
+
};
|
|
7
11
|
}, unknown, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
8
12
|
lang: {
|
|
9
13
|
type: StringConstructor;
|
|
10
14
|
default: string;
|
|
11
15
|
validator: (value: string) => boolean;
|
|
12
16
|
};
|
|
17
|
+
showCopy: {
|
|
18
|
+
type: BooleanConstructor;
|
|
19
|
+
default: boolean;
|
|
20
|
+
};
|
|
13
21
|
}>>, {
|
|
14
22
|
lang: string;
|
|
23
|
+
showCopy: boolean;
|
|
15
24
|
}, {}>;
|
|
16
25
|
export default _default;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tekkare/auriga",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.138",
|
|
4
4
|
"description": "Aurgia is a UI kit developped by Tekkare",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"vue-apexcharts": "^1.6.2",
|
|
42
42
|
"vue-svg-map": "^1.2.0",
|
|
43
43
|
"vue3-apexcharts": "^1.4.4",
|
|
44
|
-
"
|
|
44
|
+
"write-excel-file": "^1.4.30"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@nuxt/devtools": "latest",
|