@tekkare/romulus 0.1.110 → 0.1.112

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,7 +4,7 @@
4
4
  "compatibility": {
5
5
  "nuxt": ">=3.16.0"
6
6
  },
7
- "version": "0.1.109",
7
+ "version": "0.1.111",
8
8
  "builder": {
9
9
  "@nuxt/module-builder": "0.8.4",
10
10
  "unbuild": "2.0.0"
@@ -78,6 +78,10 @@ const FR = {
78
78
  refusal: {
79
79
  too_broad: (n: string, max: string) =>
80
80
  `Cette vue est trop large pour être surveillée : ${n} documents, alors qu’une alerte en suit ${max} au maximum. Resserrez le périmètre de la vue, sur une marque ou une molécule par exemple.`,
81
+ too_many_brands: (n: string, max: string) =>
82
+ `Cette vue couvre ${n} marques, alors qu'une alerte en suit ${max} au maximum. Une veille se fait sur un portefeuille ou sur des concurrents : resserrez la vue sur les marques qui vous intéressent.`,
83
+ too_heavy: (n: string) =>
84
+ `Ce périmètre demande trop de mémoire pour être suivi champ par champ (${n} Mo). Réduisez la vue, ou choisissez les champs à suivre plutôt que « n'importe quel changement ».`,
81
85
  collapse: (n: string) =>
82
86
  `Les résultats se sont effondrés (${n} documents restants) : c’est un incident sur les données, pas une nouvelle. Rien n’a été signalé, l’alerte reprendra au prochain passage sain.`,
83
87
  growth: (n: string) =>
@@ -131,6 +135,10 @@ const EN = {
131
135
  refusal: {
132
136
  too_broad: (n: string, max: string) =>
133
137
  `This view is too wide to watch: ${n} documents, where an alert tracks at most ${max}. Narrow the view, to one brand or molecule for instance.`,
138
+ too_many_brands: (n: string, max: string) =>
139
+ `This view covers ${n} brands, where an alert tracks at most ${max}. Monitoring is done on a portfolio or on competitors: narrow the view to the brands you care about.`,
140
+ too_heavy: (n: string) =>
141
+ `This scope needs too much memory to be tracked field by field (${n} MB). Narrow the view, or pick the fields to watch instead of "any change".`,
134
142
  collapse: (n: string) =>
135
143
  `Results collapsed (${n} documents left): that is a data incident, not news. Nothing was reported; the alert resumes on the next healthy run.`,
136
144
  growth: (n: string) =>
@@ -169,9 +177,11 @@ const refusal = computed<string | null>(() => {
169
177
  if (typeof sentence === 'string') return sentence
170
178
 
171
179
  const count = number(props.alert.lastErrorCount ?? 0)
172
- return kind === 'too_broad'
173
- ? sentence(count, number(props.alert.maxTracked ?? 10000))
174
- : sentence(count)
180
+ // Deux plafonds se disent avec leur valeur : le nombre de documents et le
181
+ // nombre de marques.
182
+ if (kind === 'too_broad') return sentence(count, number(props.alert.maxTracked ?? 10000))
183
+ if (kind === 'too_many_brands') return sentence(count, number(props.alert.maxBrands ?? 20))
184
+ return sentence(count)
175
185
  })
176
186
 
177
187
  /** Les etats qui demandent une explication, pas seulement une pastille. */
@@ -41,9 +41,10 @@ const props = withDefaults(defineProps<{
41
41
  * d'une carte se presente comme l'export global de la page.
42
42
  *
43
43
  * Une fonction est preferable des qu'une liste monte la meme carte vingt
44
- * fois : elle n'est appelee qu'a l'export.
44
+ * fois : elle n'est appelee qu'a l'export. Elle peut etre asynchrone, le
45
+ * menu affichant « Preparation... » le temps de la requete.
45
46
  */
46
- payload?: Partial<RmExportPayload> | (() => Partial<RmExportPayload> | null | undefined)
47
+ payload?: Partial<RmExportPayload> | (() => Partial<RmExportPayload> | null | undefined | Promise<Partial<RmExportPayload> | null | undefined>)
47
48
  /**
48
49
  * Force les items visuels. Non renseigne : ils suivent la presence d'un
49
50
  * graphe dans la carte, ce qui est le bon defaut dans les deux sens.
@@ -31,9 +31,11 @@ export interface RmCardActionContext {
31
31
  *
32
32
  * Une fonction est preferable des qu'une liste monte la meme carte vingt
33
33
  * fois : elle n'est appelee qu'a l'export, alors qu'un objet lie en prop est
34
- * recalcule a chaque rendu de chaque carte.
34
+ * recalcule a chaque rendu de chaque carte. Elle peut etre asynchrone : la
35
+ * donnee complete d'une carte demande parfois une requete, que seul
36
+ * l'export justifie de lancer.
35
37
  */
36
- payload?: RmCardPayload | (() => RmCardPayload | null | undefined);
38
+ payload?: RmCardPayload | (() => RmCardPayload | null | undefined | Promise<RmCardPayload | null | undefined>);
37
39
  }
38
40
  export declare function useRmCardActions(): {
39
41
  runCardAction: (action: RmCardAction, context: RmCardActionContext) => Promise<import("./useRmExport").RmExportResult>;
@@ -41,7 +41,7 @@ export function useRmCardActions() {
41
41
  const { run } = useRmExport();
42
42
  async function runCardAction(action, context) {
43
43
  const { card, lang = "fr" } = context;
44
- const provided = (typeof context.payload === "function" ? context.payload() : context.payload) ?? {};
44
+ const provided = await (typeof context.payload === "function" ? context.payload() : context.payload) ?? {};
45
45
  const title = context.name || provided.title || rmCardTitle(card) || "Export";
46
46
  const format = action === "link" ? "link" : action;
47
47
  const sheets = action === "png" || action === "svg" ? [] : provided.sheets?.length ? provided.sheets : await rmCardSheets(card, title, lang);
@@ -54,6 +54,8 @@ export interface RmAlert {
54
54
  lastErrorCount?: number | null;
55
55
  /** Plafond de documents qu'une alerte peut suivre. */
56
56
  maxTracked?: number | null;
57
+ /** Plafond de marques distinctes qu'une alerte peut suivre. */
58
+ maxBrands?: number | null;
57
59
  lastRunAt?: string | null;
58
60
  /** Date de la derniere remise a zero de la reference, s'il y en a eu une. */
59
61
  reseededAt?: string | null;
@@ -1,4 +1,4 @@
1
- const CARD_SELECTOR = ".chart-card, .rm-table-card, .rm-rcard";
1
+ const CARD_SELECTOR = ".chart-card, .rm-table-card, .rm-rcard, .rm-card";
2
2
  const CHART_SELECTOR = ".rm-chart .echart";
3
3
  const WORDS = {
4
4
  fr: { label: "Libell\xE9", value: "Valeur", series: "S\xE9rie", table: "Tableau", field: "Champ", chart: "Graphique", title: "Intitul\xE9", subtitle: "Compl\xE9ment", source: "Provenance" },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tekkare/romulus",
3
- "version": "0.1.110",
3
+ "version": "0.1.112",
4
4
  "description": "Romulus Design System - Nuxt module by Tekkare",
5
5
  "license": "MIT",
6
6
  "type": "module",