@muni-sanfer/types-gestor-documental 0.0.1-beta.74 → 0.0.1-beta.76

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.
@@ -1,7 +1,8 @@
1
1
  import { type CommunicationMeans, DocumentAnnulledNumberEntity, DocumentAttachmentEntity, DocumentDeliveryEntity, DocumentEntity, DocumentParticipantEntity, DocumentRecipientEntity, type DocumentStatus, DocumentTrackingEntity, DocumentTypeEntity } from '../../base/entities';
2
2
  import { type RichLetterhead, type RichPage, type RichSpacing, type RichTextStyle } from './richStyle';
3
3
  import { type DocumentDraftingRequestEntity } from '../draftingRequest/draftingRequest.entity';
4
- import { type DocumentStampPlacements } from './stampPlacement';
4
+ import { type DocumentStampPlacements, type StampBox } from './stampPlacement';
5
+ import { type RichDistributionEntry } from './richDistribution';
5
6
  /** Tipo documental de un documento, con lo necesario para citarlo. */
6
7
  export interface DocumentTypeSummaryEntity {
7
8
  id: DocumentTypeEntity['id'];
@@ -606,7 +607,12 @@ export type DocumentComposition = {
606
607
  templateVersion?: number | null;
607
608
  blocks: RichBlock[];
608
609
  fields: RichField[];
609
- distribution: string[];
610
+ /** Destinos de la distribución, en orden: áreas de la municipalidad o texto libre. */
611
+ distribution: RichDistributionEntry[];
612
+ /** El tipo lleva distribución (lo dice su plantilla): el PDF muestra «Distribución:» aunque aún no tenga destinos. */
613
+ hasDistribution?: boolean;
614
+ /** Alto del espacio para firmas y visaciones entre el texto y la distribución, en puntos (sin valor: sin espacio). */
615
+ signatureSpace?: number;
610
616
  /** Página y membrete. En una plantilla propia los pone su versión: lo que mande el navegador no cuenta. */
611
617
  page?: RichPage;
612
618
  letterhead?: RichLetterhead;
@@ -616,6 +622,11 @@ export interface DocumentComposeResponseEntity {
616
622
  fileName: string;
617
623
  fileId?: string;
618
624
  contentBase64?: string;
625
+ /**
626
+ * Dónde quedó el espacio para firmas y visaciones (página y recuadro, en puntos desde la esquina superior izquierda):
627
+ * ahí parten los sellos al ubicarlos. Sin valor: el documento no deja ese espacio.
628
+ */
629
+ signatureArea?: StampBox | null;
619
630
  }
620
631
  /** Copia por correo de un documento, como la ve quien lo consulta en el gestor. */
621
632
  export interface DocumentEmailCopyResponseEntity {
@@ -1,3 +1,4 @@
1
1
  export * from './document.entity';
2
2
  export * from './richStyle';
3
3
  export * from './stampPlacement';
4
+ export * from './richDistribution';
@@ -17,3 +17,4 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./document.entity"), exports);
18
18
  __exportStar(require("./richStyle"), exports);
19
19
  __exportStar(require("./stampPlacement"), exports);
20
+ __exportStar(require("./richDistribution"), exports);
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Un destino de la distribución de un documento redactado con el editor: un área de la municipalidad (con el nombre
3
+ * que tenía al redactar) o un texto libre (por ejemplo, «Archivo» o «Interesado»). Lo redactado antes solo tiene texto.
4
+ */
5
+ export type RichDistributionEntry = string | {
6
+ type: 'Directorate';
7
+ directorateCodeReference: number;
8
+ name: string;
9
+ } | {
10
+ type: 'Department';
11
+ departmentId: string;
12
+ name: string;
13
+ };
14
+ /** Lo que se imprime de un destino: el texto o el nombre del área. */
15
+ export declare const distributionText: (entry: RichDistributionEntry) => string;
16
+ /**
17
+ * Espacio para firmas y visaciones que quien redacta deja entre el término del texto y la distribución, en puntos:
18
+ * hasta 20 cm. Va entero en una página (si no cabe, pasa a la siguiente con lo que sigue).
19
+ */
20
+ export declare const RICH_SIGNATURE_SPACE_LIMITS: {
21
+ readonly max: number;
22
+ };
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RICH_SIGNATURE_SPACE_LIMITS = exports.distributionText = void 0;
4
+ /** Lo que se imprime de un destino: el texto o el nombre del área. */
5
+ const distributionText = (entry) => typeof entry === 'string' ? entry : entry.name;
6
+ exports.distributionText = distributionText;
7
+ /**
8
+ * Espacio para firmas y visaciones que quien redacta deja entre el término del texto y la distribución, en puntos:
9
+ * hasta 20 cm. Va entero en una página (si no cabe, pasa a la siguiente con lo que sigue).
10
+ */
11
+ exports.RICH_SIGNATURE_SPACE_LIMITS = { max: Math.round((20 / 2.54) * 72) };
@@ -87,7 +87,7 @@ export interface RichSpacing {
87
87
  /** Límites del espaciado, en puntos. */
88
88
  export declare const RICH_SPACING_LIMITS: {
89
89
  readonly maxSpace: 72;
90
- readonly maxIndent: 216;
90
+ readonly maxIndent: 360;
91
91
  readonly minLineHeight: 0.8;
92
92
  readonly maxLineHeight: 3;
93
93
  };
@@ -180,6 +180,19 @@ export interface RichLetterhead {
180
180
  text?: RichLetterheadText;
181
181
  /** Línea divisoria bajo el encabezado, de margen a margen. */
182
182
  rule?: boolean;
183
+ /**
184
+ * Dónde estampa el sistema el número y la fecha en la primera página. Sin valor, donde siempre: arriba a la derecha
185
+ * (`RICH_NUMBER_ZONE`).
186
+ */
187
+ numberZone?: RichNumberZone;
188
+ }
189
+ /** Cómo se alinean el número y la fecha dentro de su recuadro. */
190
+ export type RichNumberAlign = 'left' | 'center' | 'right';
191
+ /** El recuadro del número y la fecha: su esquina superior izquierda en la primera página, en puntos, y su alineación. */
192
+ export interface RichNumberZone {
193
+ x: number;
194
+ y: number;
195
+ align: RichNumberAlign;
183
196
  }
184
197
  /** Límites del diseño libre del encabezado. */
185
198
  export declare const RICH_LETTERHEAD_LIMITS: {
@@ -201,6 +214,14 @@ export declare const RICH_NUMBER_ZONE: {
201
214
  readonly height: 30;
202
215
  readonly width: 230;
203
216
  };
217
+ /**
218
+ * El recuadro del número y la fecha en una página del ancho dado: el que ubicó la plantilla o quien redacta, o el de
219
+ * siempre (arriba a la derecha). Lo usan la hoja del editor y el estampado, para que queden en el mismo lugar.
220
+ */
221
+ export declare const richNumberZone: (pageWidth: number, zone?: RichNumberZone | null) => RichNumberZone & {
222
+ width: number;
223
+ height: number;
224
+ };
204
225
  export declare const RICH_DEFAULT_LETTERHEAD: RichLetterhead;
205
226
  /** Límites de una imagen: formatos, peso y tamaño en el texto. */
206
227
  export declare const RICH_IMAGE_LIMITS: {
@@ -4,7 +4,7 @@
4
4
  * márgenes. Todo lo que el PDF muestra sale de aquí, así que el editor y el documento oficial se ven igual.
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.RICH_IMAGE_LIMITS = exports.RICH_DEFAULT_LETTERHEAD = exports.RICH_NUMBER_ZONE = exports.RICH_LETTERHEAD_LIMITS = exports.RICH_DEFAULT_PAGE = exports.RICH_MAX_MARGIN = exports.RICH_MIN_MARGINS = exports.RICH_PAGE_SIZES = exports.RICH_SPACING_LIMITS = exports.RICH_HIGHLIGHTS = exports.RICH_COLORS = exports.RICH_FONT_SIZES = exports.RICH_FONTS = void 0;
7
+ exports.RICH_IMAGE_LIMITS = exports.RICH_DEFAULT_LETTERHEAD = exports.richNumberZone = exports.RICH_NUMBER_ZONE = exports.RICH_LETTERHEAD_LIMITS = exports.RICH_DEFAULT_PAGE = exports.RICH_MAX_MARGIN = exports.RICH_MIN_MARGINS = exports.RICH_PAGE_SIZES = exports.RICH_SPACING_LIMITS = exports.RICH_HIGHLIGHTS = exports.RICH_COLORS = exports.RICH_FONT_SIZES = exports.RICH_FONTS = void 0;
8
8
  /**
9
9
  * Tipografías incrustadas en el PDF (PDF/A exige fuentes incrustadas). Liberation Sans, Liberation Serif y Carlito
10
10
  * miden igual que Arial, Times New Roman y Calibri: lo que se pegó desde Word ocupa lo mismo.
@@ -35,7 +35,8 @@ exports.RICH_HIGHLIGHTS = {
35
35
  gray: { label: 'Gris', hex: '#E5E7EB' },
36
36
  };
37
37
  /** Límites del espaciado, en puntos. */
38
- exports.RICH_SPACING_LIMITS = { maxSpace: 72, maxIndent: 216, minLineHeight: 0.8, maxLineHeight: 3 };
38
+ // la sangría llega a 12,7 cm: en el editor, «Aumentar sangría» (y Tab al comienzo de un párrafo) corre hasta 12,5 cm
39
+ exports.RICH_SPACING_LIMITS = { maxSpace: 72, maxIndent: 360, minLineHeight: 0.8, maxLineHeight: 3 };
39
40
  /** Tamaños de hoja, en puntos. Oficio es el chileno: 216 x 330 mm. */
40
41
  exports.RICH_PAGE_SIZES = {
41
42
  letter: { label: 'Carta (216 x 279 mm)', width: 612, height: 792 },
@@ -71,6 +72,18 @@ exports.RICH_LETTERHEAD_LIMITS = {
71
72
  * debe taparlo. En puntos; `right` es la distancia al borde derecho.
72
73
  */
73
74
  exports.RICH_NUMBER_ZONE = { right: 36, top: 18, height: 30, width: 230 };
75
+ /**
76
+ * El recuadro del número y la fecha en una página del ancho dado: el que ubicó la plantilla o quien redacta, o el de
77
+ * siempre (arriba a la derecha). Lo usan la hoja del editor y el estampado, para que queden en el mismo lugar.
78
+ */
79
+ const richNumberZone = (pageWidth, zone) => ({
80
+ x: zone?.x ?? pageWidth - exports.RICH_NUMBER_ZONE.right - exports.RICH_NUMBER_ZONE.width,
81
+ y: zone?.y ?? exports.RICH_NUMBER_ZONE.top,
82
+ align: zone?.align ?? 'right',
83
+ width: exports.RICH_NUMBER_ZONE.width,
84
+ height: exports.RICH_NUMBER_ZONE.height,
85
+ });
86
+ exports.richNumberZone = richNumberZone;
74
87
  exports.RICH_DEFAULT_LETTERHEAD = { imageId: null, showOrganName: true, showUnitName: true };
75
88
  /** Límites de una imagen: formatos, peso y tamaño en el texto. */
76
89
  exports.RICH_IMAGE_LIMITS = {
@@ -12,6 +12,8 @@ export interface DocumentTemplateContent {
12
12
  page?: RichPage;
13
13
  /** Membrete con logo. Sin valor, el nombre de la municipalidad y de la unidad. */
14
14
  letterhead?: RichLetterhead;
15
+ /** Los documentos del tipo llevan distribución: quien redacta la arma (con áreas o texto libre). */
16
+ hasDistribution?: boolean;
15
17
  }
16
18
  /** La plantilla de un tipo documental, que se aplica al redactar uno de sus documentos: lista para usar. */
17
19
  export interface DocumentTemplateAvailableResponseEntity {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@muni-sanfer/types-gestor-documental",
3
- "version": "0.0.1-beta.74",
3
+ "version": "0.0.1-beta.76",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "scripts": {
@@ -12,7 +12,8 @@ import {
12
12
  } from '../../base/entities';
13
13
  import { type RichLetterhead, type RichPage, type RichSpacing, type RichTextStyle } from './richStyle';
14
14
  import { type DocumentDraftingRequestEntity } from '../draftingRequest/draftingRequest.entity';
15
- import { type DocumentStampPlacements } from './stampPlacement';
15
+ import { type DocumentStampPlacements, type StampBox } from './stampPlacement';
16
+ import { type RichDistributionEntry } from './richDistribution';
16
17
 
17
18
  /** Tipo documental de un documento, con lo necesario para citarlo. */
18
19
  export interface DocumentTypeSummaryEntity {
@@ -636,7 +637,12 @@ export type DocumentComposition =
636
637
  templateVersion?: number | null;
637
638
  blocks: RichBlock[];
638
639
  fields: RichField[];
639
- distribution: string[];
640
+ /** Destinos de la distribución, en orden: áreas de la municipalidad o texto libre. */
641
+ distribution: RichDistributionEntry[];
642
+ /** El tipo lleva distribución (lo dice su plantilla): el PDF muestra «Distribución:» aunque aún no tenga destinos. */
643
+ hasDistribution?: boolean;
644
+ /** Alto del espacio para firmas y visaciones entre el texto y la distribución, en puntos (sin valor: sin espacio). */
645
+ signatureSpace?: number;
640
646
  /** Página y membrete. En una plantilla propia los pone su versión: lo que mande el navegador no cuenta. */
641
647
  page?: RichPage;
642
648
  letterhead?: RichLetterhead;
@@ -647,6 +653,11 @@ export interface DocumentComposeResponseEntity {
647
653
  fileName: string;
648
654
  fileId?: string;
649
655
  contentBase64?: string;
656
+ /**
657
+ * Dónde quedó el espacio para firmas y visaciones (página y recuadro, en puntos desde la esquina superior izquierda):
658
+ * ahí parten los sellos al ubicarlos. Sin valor: el documento no deja ese espacio.
659
+ */
660
+ signatureArea?: StampBox | null;
650
661
  }
651
662
 
652
663
  /** Copia por correo de un documento, como la ve quien lo consulta en el gestor. */
@@ -1,3 +1,4 @@
1
1
  export * from './document.entity';
2
2
  export * from './richStyle';
3
3
  export * from './stampPlacement';
4
+ export * from './richDistribution';
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Un destino de la distribución de un documento redactado con el editor: un área de la municipalidad (con el nombre
3
+ * que tenía al redactar) o un texto libre (por ejemplo, «Archivo» o «Interesado»). Lo redactado antes solo tiene texto.
4
+ */
5
+ export type RichDistributionEntry =
6
+ | string
7
+ | { type: 'Directorate'; directorateCodeReference: number; name: string }
8
+ | { type: 'Department'; departmentId: string; name: string };
9
+
10
+ /** Lo que se imprime de un destino: el texto o el nombre del área. */
11
+ export const distributionText = (entry: RichDistributionEntry): string =>
12
+ typeof entry === 'string' ? entry : entry.name;
13
+
14
+ /**
15
+ * Espacio para firmas y visaciones que quien redacta deja entre el término del texto y la distribución, en puntos:
16
+ * hasta 20 cm. Va entero en una página (si no cabe, pasa a la siguiente con lo que sigue).
17
+ */
18
+ export const RICH_SIGNATURE_SPACE_LIMITS = { max: Math.round((20 / 2.54) * 72) } as const;
@@ -62,7 +62,8 @@ export interface RichSpacing {
62
62
  }
63
63
 
64
64
  /** Límites del espaciado, en puntos. */
65
- export const RICH_SPACING_LIMITS = { maxSpace: 72, maxIndent: 216, minLineHeight: 0.8, maxLineHeight: 3 } as const;
65
+ // la sangría llega a 12,7 cm: en el editor, «Aumentar sangría» (y Tab al comienzo de un párrafo) corre hasta 12,5 cm
66
+ export const RICH_SPACING_LIMITS = { maxSpace: 72, maxIndent: 360, minLineHeight: 0.8, maxLineHeight: 3 } as const;
66
67
 
67
68
  /** Tamaños de hoja, en puntos. Oficio es el chileno: 216 x 330 mm. */
68
69
  export const RICH_PAGE_SIZES = {
@@ -161,6 +162,21 @@ export interface RichLetterhead {
161
162
  text?: RichLetterheadText;
162
163
  /** Línea divisoria bajo el encabezado, de margen a margen. */
163
164
  rule?: boolean;
165
+ /**
166
+ * Dónde estampa el sistema el número y la fecha en la primera página. Sin valor, donde siempre: arriba a la derecha
167
+ * (`RICH_NUMBER_ZONE`).
168
+ */
169
+ numberZone?: RichNumberZone;
170
+ }
171
+
172
+ /** Cómo se alinean el número y la fecha dentro de su recuadro. */
173
+ export type RichNumberAlign = 'left' | 'center' | 'right';
174
+
175
+ /** El recuadro del número y la fecha: su esquina superior izquierda en la primera página, en puntos, y su alineación. */
176
+ export interface RichNumberZone {
177
+ x: number;
178
+ y: number;
179
+ align: RichNumberAlign;
164
180
  }
165
181
 
166
182
  /** Límites del diseño libre del encabezado. */
@@ -180,6 +196,21 @@ export const RICH_LETTERHEAD_LIMITS = {
180
196
  */
181
197
  export const RICH_NUMBER_ZONE = { right: 36, top: 18, height: 30, width: 230 } as const;
182
198
 
199
+ /**
200
+ * El recuadro del número y la fecha en una página del ancho dado: el que ubicó la plantilla o quien redacta, o el de
201
+ * siempre (arriba a la derecha). Lo usan la hoja del editor y el estampado, para que queden en el mismo lugar.
202
+ */
203
+ export const richNumberZone = (
204
+ pageWidth: number,
205
+ zone?: RichNumberZone | null,
206
+ ): RichNumberZone & { width: number; height: number } => ({
207
+ x: zone?.x ?? pageWidth - RICH_NUMBER_ZONE.right - RICH_NUMBER_ZONE.width,
208
+ y: zone?.y ?? RICH_NUMBER_ZONE.top,
209
+ align: zone?.align ?? 'right',
210
+ width: RICH_NUMBER_ZONE.width,
211
+ height: RICH_NUMBER_ZONE.height,
212
+ });
213
+
183
214
  export const RICH_DEFAULT_LETTERHEAD: RichLetterhead = { imageId: null, showOrganName: true, showUnitName: true };
184
215
 
185
216
  /** Límites de una imagen: formatos, peso y tamaño en el texto. */
@@ -13,6 +13,8 @@ export interface DocumentTemplateContent {
13
13
  page?: RichPage;
14
14
  /** Membrete con logo. Sin valor, el nombre de la municipalidad y de la unidad. */
15
15
  letterhead?: RichLetterhead;
16
+ /** Los documentos del tipo llevan distribución: quien redacta la arma (con áreas o texto libre). */
17
+ hasDistribution?: boolean;
16
18
  }
17
19
 
18
20
  /** La plantilla de un tipo documental, que se aplica al redactar uno de sus documentos: lista para usar. */