@tekkare/auriga 0.1.131 → 0.1.133

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 CHANGED
@@ -4,5 +4,5 @@
4
4
  "compatibility": {
5
5
  "nuxt": "^3.0.0"
6
6
  },
7
- "version": "0.1.131"
7
+ "version": "0.1.133"
8
8
  }
@@ -110,17 +110,27 @@ export default defineComponent({
110
110
  if (!element)
111
111
  return false;
112
112
  const rect = element.getBoundingClientRect();
113
- return rect.top <= getElementPosition("chapter_menu") + headerHeight.value;
113
+ return rect.top <= getElementPosition("chapter_menu") + 10;
114
114
  }
115
- function selectChapter(index, anchorId) {
116
- document.removeEventListener("scroll", scrollChapters, true);
117
- activeChapter.value = index;
118
- setBarPosition();
119
- const targetElement = document.getElementById(anchorId);
120
- if (targetElement) {
121
- const targetPosition = targetElement.offsetTop - headerHeight.value;
122
- window.scrollTo({ top: targetPosition, behavior: "smooth" });
123
- }
115
+ function removeEvent(index, anchor, callback) {
116
+ return new Promise((resolve) => {
117
+ document.removeEventListener("scroll", scrollChapters);
118
+ activeChapter.value = index;
119
+ setBarPosition();
120
+ const targetElement = document.getElementById(anchor);
121
+ if (targetElement) {
122
+ const targetPosition = targetElement.offsetTop - headerHeight.value;
123
+ window.scrollTo({ top: targetPosition, behavior: "smooth" });
124
+ }
125
+ resolve();
126
+ });
127
+ }
128
+ async function selectChapter(index, anchorId) {
129
+ await removeEvent(index, anchorId).then(() => {
130
+ setTimeout(() => {
131
+ document.addEventListener("scroll", scrollChapters);
132
+ }, 1200);
133
+ });
124
134
  }
125
135
  function setBarPosition() {
126
136
  const selector = document?.getElementById(`chapters_nav_bar`);
@@ -17,7 +17,7 @@ declare const _default: import("vue").DefineComponent<{
17
17
  value: null;
18
18
  };
19
19
  }, {
20
- selectChapter: (index: number, anchorId: string) => void;
20
+ selectChapter: (index: number, anchorId: string) => Promise<void>;
21
21
  activeChapter: import("vue").Ref<any>;
22
22
  headerHeight: import("vue").Ref<number>;
23
23
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "onClose"[], "onClose", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
@@ -2,7 +2,12 @@
2
2
  <!-- eslint-disable vue/max-attributes-per-line -->
3
3
  <template>
4
4
  <div>
5
- <argBtn prefixIcon="FileXls" :loading="isLoading" @click="launchDownload">
5
+ <argBtn
6
+ prefixIcon="FileXls"
7
+ :btn-style="style"
8
+ :loading="isLoading"
9
+ @click="launchDownload"
10
+ >
6
11
  {{ name }}
7
12
  </argBtn>
8
13
  </div>
@@ -51,6 +56,17 @@ export default defineComponent({
51
56
  beforeExport: {
52
57
  type: Function,
53
58
  default: () => null
59
+ },
60
+ style: {
61
+ type: String,
62
+ default: "primary-fill"
63
+ },
64
+ lang: {
65
+ type: String,
66
+ default: "en",
67
+ validator: (value) => {
68
+ return ["en", "fr"].includes(value);
69
+ }
54
70
  }
55
71
  },
56
72
  setup(props) {
@@ -60,19 +76,11 @@ export default defineComponent({
60
76
  if (props.beforeExport !== null) {
61
77
  await props.beforeExport();
62
78
  }
63
- const pageData = [];
64
- const emptyObject = {};
65
- for (let i = 0; i < 26; i++) {
66
- emptyObject[i] = " ";
67
- }
68
- for (let i = 0; i < 60; i++) {
69
- pageData.push({ ...emptyObject });
70
- }
71
79
  const workbook = XLSX.utils.book_new();
72
- const pageDeGarde = XLSX.utils.json_to_sheet(pageData);
80
+ setUpCoverPage(workbook);
73
81
  let formattedWorksheets = null;
74
82
  if (!props.isCustom) {
75
- formattedWorksheets = props.worksheets?.map((worksheet) => {
83
+ formattedWorksheets = (props.worksheets || []).map((worksheet) => {
76
84
  return {
77
85
  name: worksheet.name,
78
86
  value: XLSX.utils.json_to_sheet(worksheet.value),
@@ -84,45 +92,127 @@ export default defineComponent({
84
92
  } else {
85
93
  formattedWorksheets = props.worksheets;
86
94
  }
87
- XLSX.utils.book_append_sheet(workbook, pageDeGarde, `Tekkare`);
88
- if (formattedWorksheets !== null && formattedWorksheets !== void 0) {
95
+ if (formattedWorksheets) {
89
96
  formattedWorksheets.forEach((worksheet) => {
90
97
  XLSX.utils.book_append_sheet(
91
98
  workbook,
92
99
  worksheet.value,
93
100
  worksheet.name
94
101
  );
95
- if (worksheet.sizes !== null && worksheet.sizes !== void 0 && worksheet.sizes.length > 0) {
96
- const columnSizes = [];
97
- worksheet.sizes.forEach(
98
- (column) => columnSizes.push({ wch: column })
99
- );
102
+ if (worksheet.sizes && worksheet.sizes.length > 0) {
103
+ const columnSizes = worksheet.sizes.map((column) => ({
104
+ wch: column
105
+ }));
100
106
  worksheet.value["!cols"] = columnSizes;
101
107
  }
102
- for (let lettre = 65; lettre <= 90; lettre++) {
103
- for (let chiffre = 1; chiffre < Object.keys(worksheet.value).length; chiffre++) {
104
- const cellule = String.fromCharCode(lettre) + chiffre;
105
- if (chiffre === 1 && worksheet.value[cellule] !== void 0) {
106
- worksheet.value[cellule].s = { font: { bold: true, sz: 12 } };
107
- }
108
- if (worksheet.formatToNumber !== void 0 && worksheet.formatToNumber !== null && worksheet.formatToNumber.length > 0) {
109
- worksheet.formatToNumber.forEach((columnToFormat) => {
110
- if (String.fromCharCode(lettre) === columnToFormat && chiffre !== 1 && worksheet.value[`${columnToFormat}${chiffre}`] !== void 0) {
111
- worksheet.value[`${columnToFormat}${chiffre}`].v > 1e3 ? worksheet.value[`${columnToFormat}${chiffre}`].z = "#,##0" : worksheet.value[`${columnToFormat}${chiffre}`].z = "#,##0.00";
112
- }
113
- });
114
- }
115
- if (worksheet.formatToPourcent !== void 0 && worksheet.formatToPourcent !== null && worksheet.formatToPourcent.length > 0) {
116
- worksheet.formatToPourcent.forEach((columnToFormat) => {
117
- if (String.fromCharCode(lettre) === columnToFormat && chiffre !== 1 && worksheet.value[`${columnToFormat}${chiffre}`] !== void 0) {
118
- worksheet.value[`${columnToFormat}${chiffre}`].z = "0.00%";
119
- }
120
- });
121
- }
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
+ }
126
+ }
127
+ };
128
+ const formatCells = (worksheet) => {
129
+ if (worksheet.formatToNumber && worksheet.formatToNumber.length > 0) {
130
+ worksheet.formatToNumber.forEach((column) => {
131
+ for (let chiffre = 1; chiffre < Object.keys(worksheet.value).length; chiffre++) {
132
+ const cellule = `${column}${chiffre}`;
133
+ if (worksheet.value[cellule]) {
134
+ worksheet.value[cellule].z = worksheet.value[cellule].v > 1e3 ? "#,##0" : "#,##0.00";
135
+ }
136
+ }
137
+ });
138
+ }
139
+ if (worksheet.formatToPourcent && worksheet.formatToPourcent.length > 0) {
140
+ worksheet.formatToPourcent.forEach((column) => {
141
+ for (let chiffre = 1; chiffre < Object.keys(worksheet.value).length; chiffre++) {
142
+ const cellule = `${column}${chiffre}`;
143
+ if (worksheet.value[cellule]) {
144
+ worksheet.value[cellule].z = "0.00%";
122
145
  }
123
146
  }
124
147
  });
125
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`);
126
216
  pageDeGarde["!cols"] = [
127
217
  { wch: 10 },
128
218
  { wch: 10 },
@@ -262,26 +352,6 @@ export default defineComponent({
262
352
  origin: "E23"
263
353
  });
264
354
  }
265
- const style = {
266
- border: {
267
- top: { style: "dotted", color: { rgb: "FFFFFF" } },
268
- left: { style: "dotted", color: { rgb: "FFFFFF" } },
269
- right: { style: "dotted", color: { rgb: "FFFFFF" } },
270
- bottom: { style: "dotted", color: { rgb: "FFFFFF" } }
271
- }
272
- };
273
- const firstRowStyle = {
274
- font: {
275
- bold: true,
276
- sz: 14
277
- },
278
- border: {
279
- top: { style: "dotted", color: { rgb: "FFFFFF" } },
280
- left: { style: "dotted", color: { rgb: "FFFFFF" } },
281
- right: { style: "dotted", color: { rgb: "FFFFFF" } },
282
- bottom: { style: "dotted", color: { rgb: "FFFFFF" } }
283
- }
284
- };
285
355
  for (let lettre = 65; lettre <= 90; lettre++) {
286
356
  for (let chiffre = 1; chiffre < 60; chiffre++) {
287
357
  const cellule = String.fromCharCode(lettre) + chiffre;
@@ -321,41 +391,6 @@ export default defineComponent({
321
391
  bottom: { color: { rgb: "FFFFFF" } }
322
392
  }
323
393
  };
324
- const kpiStyle = {
325
- font: {
326
- color: { rgb: "525670" },
327
- name: "Figtree",
328
- sz: 16,
329
- italic: true
330
- },
331
- border: {
332
- top: { color: { rgb: "FFFFFF" } },
333
- left: { color: { rgb: "FFFFFF" } },
334
- right: { color: { rgb: "FFFFFF" } },
335
- bottom: { color: { rgb: "FFFFFF" } }
336
- },
337
- alignment: {
338
- vertical: "center",
339
- horizontal: "center"
340
- }
341
- };
342
- const kpiBoldStyle = {
343
- font: {
344
- name: "Figtree",
345
- sz: 18,
346
- bold: true
347
- },
348
- border: {
349
- top: { color: { rgb: "FFFFFF" } },
350
- left: { color: { rgb: "FFFFFF" } },
351
- right: { color: { rgb: "FFFFFF" } },
352
- bottom: { color: { rgb: "FFFFFF" } }
353
- },
354
- alignment: {
355
- vertical: "center",
356
- horizontal: "center"
357
- }
358
- };
359
394
  pageDeGarde["E5"].s = {
360
395
  font: {
361
396
  name: "Figtree",
@@ -432,13 +467,6 @@ export default defineComponent({
432
467
  e: { r: 25 + index, c: 5 }
433
468
  });
434
469
  });
435
- XLSX.writeFile(
436
- workbook,
437
- `${props.title}-from_${(/* @__PURE__ */ new Date()).toLocaleString([], {
438
- dateStyle: "short"
439
- })}.xlsx`
440
- );
441
- isLoading.value = false;
442
470
  };
443
471
  return {
444
472
  launchDownload,
@@ -47,6 +47,15 @@ declare const _default: import("vue").DefineComponent<{
47
47
  type: FunctionConstructor;
48
48
  default: () => null;
49
49
  };
50
+ style: {
51
+ type: StringConstructor;
52
+ default: string;
53
+ };
54
+ lang: {
55
+ type: StringConstructor;
56
+ default: string;
57
+ validator: (value: string) => boolean;
58
+ };
50
59
  }, {
51
60
  launchDownload: () => Promise<void>;
52
61
  isLoading: import("vue").Ref<boolean>;
@@ -87,8 +96,18 @@ declare const _default: import("vue").DefineComponent<{
87
96
  type: FunctionConstructor;
88
97
  default: () => null;
89
98
  };
99
+ style: {
100
+ type: StringConstructor;
101
+ default: string;
102
+ };
103
+ lang: {
104
+ type: StringConstructor;
105
+ default: string;
106
+ validator: (value: string) => boolean;
107
+ };
90
108
  }>>, {
91
109
  name: string;
110
+ lang: string;
92
111
  title: string;
93
112
  subtitle: string;
94
113
  kpi: KPIContent[];
@@ -96,5 +115,6 @@ declare const _default: import("vue").DefineComponent<{
96
115
  worksheets: WorksheetContent[] | null;
97
116
  isCustom: boolean;
98
117
  beforeExport: Function;
118
+ style: string;
99
119
  }, {}>;
100
120
  export default _default;
@@ -2,7 +2,7 @@
2
2
  <div
3
3
  v-show="displayTip"
4
4
  class="arg_tips_box"
5
- :class="showMore ? 'arg_tips_open' : 'arg_tips_collapse'"
5
+ :class="showMore ? 'arg_tips_open' : haveMore ? 'arg_tips_collapse' : ''"
6
6
  >
7
7
  <div class="tips_visible_content">
8
8
  <div class="oip_row v-center gap-8">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tekkare/auriga",
3
- "version": "0.1.131",
3
+ "version": "0.1.133",
4
4
  "description": "Aurgia is a UI kit developped by Tekkare",
5
5
  "license": "MIT",
6
6
  "type": "module",