@tekkare/romulus 0.1.133 → 0.1.134
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
|
@@ -110,7 +110,7 @@ const FR = {
|
|
|
110
110
|
kindView: 'Une vue',
|
|
111
111
|
kindViewHint: 'Un écran filtré, aussi fin que vous voulez, mais limité à cette page.',
|
|
112
112
|
kindProduct: 'Une marque',
|
|
113
|
-
kindProductHint: 'Une à {max} marques, suivies partout : prix, avis HAS, indications, ANSM, PUT, MITM, Journal officiel.',
|
|
113
|
+
kindProductHint: 'Une à {max} marques, suivies partout : prix, avis HAS, indications, ANSM, PUT, MITM, Journal officiel, ventes ville et hospitalières.',
|
|
114
114
|
brands: 'Marques surveillées',
|
|
115
115
|
brandsSearch: 'Rechercher',
|
|
116
116
|
brandsHint: 'Cherchez par marque, molécule, classe ATC ou laboratoire. L’alerte couvre tout le hub pour chaque marque retenue.',
|
|
@@ -163,7 +163,7 @@ const EN = {
|
|
|
163
163
|
kindView: 'A view',
|
|
164
164
|
kindViewHint: 'A filtered screen, as precise as you like, but tied to that page.',
|
|
165
165
|
kindProduct: 'A brand',
|
|
166
|
-
kindProductHint: 'One to {max} brands, watched everywhere: prices, HAS opinions, indications, ANSM, PUT, MITM, official journal.',
|
|
166
|
+
kindProductHint: 'One to {max} brands, watched everywhere: prices, HAS opinions, indications, ANSM, PUT, MITM, official journal, retail and hospital sales.',
|
|
167
167
|
brands: 'Watched brands',
|
|
168
168
|
brandsSearch: 'Search',
|
|
169
169
|
brandsHint: 'Search by brand, molecule, ATC class or company. The alert covers the whole hub for each brand kept.',
|
|
@@ -2,6 +2,8 @@ import { RM_EXPORT_EXTENSIONS } from "../utils/export.js";
|
|
|
2
2
|
const BRAND_TITLE = "OIP Healthcare";
|
|
3
3
|
const BRAND_LINE = "By Tekkare \u{1F49C}";
|
|
4
4
|
const COVER_SHEET = "Tekkare";
|
|
5
|
+
const CARD_PAGES_MAX = 10;
|
|
6
|
+
const CARD_COUNT_MAX = 2e3;
|
|
5
7
|
function longDate(lang) {
|
|
6
8
|
return (/* @__PURE__ */ new Date()).toLocaleDateString(lang === "en" ? "en-US" : "fr-FR", {
|
|
7
9
|
year: "numeric",
|
|
@@ -105,7 +107,7 @@ function printable(text) {
|
|
|
105
107
|
return substituted.replace(/[^\u0000-\u00ff]/g, "").replace(/\s{2,}/g, " ").trim();
|
|
106
108
|
}
|
|
107
109
|
function cardsOf(payload, config, lang) {
|
|
108
|
-
if (payload.cards?.length) return payload.cards.slice(0, payload.cardLimit ??
|
|
110
|
+
if (payload.cards?.length) return payload.cards.slice(0, payload.cardLimit ?? CARD_COUNT_MAX);
|
|
109
111
|
const sheet = payload.sheets[0];
|
|
110
112
|
if (!sheet) return [];
|
|
111
113
|
const pick = (name) => name ? sheet.schema.find((column) => column.column === name) : void 0;
|
|
@@ -115,7 +117,7 @@ function cardsOf(payload, config, lang) {
|
|
|
115
117
|
const head = title ?? columns[0];
|
|
116
118
|
if (!head) return [];
|
|
117
119
|
const fields = columns.filter((column) => column !== head && column !== subtitle);
|
|
118
|
-
return rowsOf(sheet, payload.cardLimit ??
|
|
120
|
+
return rowsOf(sheet, payload.cardLimit ?? CARD_COUNT_MAX).map((row) => ({
|
|
119
121
|
title: cellText(head.value(row), lang) || "\u2014",
|
|
120
122
|
subtitle: subtitle ? cellText(subtitle.value(row), lang) : void 0,
|
|
121
123
|
fields: fields.map((column) => ({ label: column.column, value: cellText(column.value(row), lang) })).filter((field) => field.value !== "")
|
|
@@ -405,13 +407,14 @@ export function useRmExport() {
|
|
|
405
407
|
let rowCount = 0;
|
|
406
408
|
if (config.sections.includes("cards")) {
|
|
407
409
|
const cards = cardsOf(payload, config, lang);
|
|
408
|
-
rowCount = cards.length;
|
|
409
410
|
const pageHeight = doc.internal.pageSize.getHeight();
|
|
410
411
|
const PAD = 6;
|
|
411
412
|
const COUNT_WIDTH = 32;
|
|
412
413
|
const COUNT_GAP = 6;
|
|
413
414
|
const LABEL_WIDTH = 26;
|
|
414
|
-
|
|
415
|
+
const firstCardPage = doc.getNumberOfPages();
|
|
416
|
+
let drawn = 0;
|
|
417
|
+
for (const card of cards) {
|
|
415
418
|
const hasCount = !!card.count?.value;
|
|
416
419
|
const bodyX = margin + PAD + (hasCount ? COUNT_WIDTH + COUNT_GAP : 0);
|
|
417
420
|
const bodyWidth = inner - PAD * 2 - (hasCount ? COUNT_WIDTH + COUNT_GAP : 0);
|
|
@@ -476,6 +479,7 @@ export function useRmExport() {
|
|
|
476
479
|
const countHeight = hasCount ? 9 + (card.count?.label ? 4 : 0) + (card.count?.extra ? 4.5 : 0) : 0;
|
|
477
480
|
const height = PAD + headHeight + 3 + Math.max(bodyHeight, countHeight) + PAD;
|
|
478
481
|
if (y + height > pageHeight - margin) {
|
|
482
|
+
if (doc.getNumberOfPages() - firstCardPage + 1 >= CARD_PAGES_MAX) break;
|
|
479
483
|
doc.addPage();
|
|
480
484
|
y = margin;
|
|
481
485
|
}
|
|
@@ -583,15 +587,17 @@ export function useRmExport() {
|
|
|
583
587
|
cursor += Math.max(field.label.length, field.value.length) * 4.4;
|
|
584
588
|
});
|
|
585
589
|
y += height + 4;
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
590
|
+
drawn += 1;
|
|
591
|
+
}
|
|
592
|
+
rowCount = drawn;
|
|
593
|
+
const total = payload.cards?.length || (payload.sheets[0]?.data.length ?? 0);
|
|
594
|
+
if (total > drawn) {
|
|
589
595
|
doc.setTextColor(...grey);
|
|
590
596
|
doc.setFont("helvetica", "italic");
|
|
591
597
|
doc.setFontSize(8);
|
|
592
598
|
doc.text(
|
|
593
599
|
printable(
|
|
594
|
-
lang === "en" ? `${
|
|
600
|
+
lang === "en" ? `${drawn} of ${total} records shown. Export to Excel for the full set.` : `${drawn} fiches sur ${total}. Passez par l'export Excel pour la totalit\xE9.`
|
|
595
601
|
),
|
|
596
602
|
margin,
|
|
597
603
|
y + 2
|