@muni-sanfer/types-gestor-documental 0.0.1-beta.90 → 0.0.1-beta.92
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/contracts/document.contract.d.ts +2 -1
- package/dist/contracts/index.d.ts +2 -0
- package/dist/contracts/partsOffice.contract.d.ts +24 -2
- package/dist/contracts/partsOffice.contract.js +2 -0
- package/dist/entities/document/folio.d.ts +54 -4
- package/dist/entities/document/folio.js +67 -7
- package/dist/entities/document/richStyle.d.ts +6 -0
- package/dist/entities/document/richStyle.js +2 -2
- package/dist/entities/partsOffice/partsOffice.entity.d.ts +26 -1
- package/package.json +1 -1
- package/src/contracts/document.contract.ts +2 -0
- package/src/contracts/partsOffice.contract.ts +27 -2
- package/src/entities/document/folio.ts +99 -9
- package/src/entities/document/richStyle.ts +6 -0
- package/src/entities/partsOffice/partsOffice.entity.ts +29 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type DocumentAccessAction, type DocumentAccessLevel, type DocumentAttachmentEntity, type DocumentDeliveryEntity, type DocumentEntity, type DocumentInstruction, type DocumentParticipantEntity, type DocumentStatus } from '../base/entities';
|
|
2
|
-
import { type StampBox, type DocumentFolioFormat, type DocumentFolioResponseEntity, type DocumentAnnulResponseEntity, type DocumentCloseDeliveryResponseEntity, type DocumentCreateResponseEntity, type DocumentAddRecipientsResponseEntity, type DocumentDeriveResponseEntity, type DocumentDiscardResponseEntity, type DocumentEmailCopyIssuedEntity, type DocumentEmailCopyViewEntity, type DocumentReminderEntity, type DocumentSlaReminderEntity, type DocumentGetAllResponseEntity, type DocumentGetByIdResponseEntity, type DocumentGetSummaryResponseEntity, type DocumentReviewAreaEntity, type DocumentInboxItemEntity, type DocumentPublicFileResponseEntity, type DocumentReassignResponseEntity, type DocumentReviewResponseEntity, type DocumentSignManyResponseEntity, type DocumentAgendaResponseEntity, type DocumentComposeResponseEntity, type DocumentComposition, type DocumentTrailExportEntity, type DocumentUpdateResponseEntity, type DocumentVerifyResponseEntity, type DocumentCommentResponseEntity, type DocumentCommentsResponseEntity, type DocumentVersionResponseEntity, type DocumentDraftCorrectionResponseEntity, type DocumentStampPlacements, type DocumentDraftReviewResponseEntity } from '../entities';
|
|
2
|
+
import { type StampBox, type DocumentFolioFormat, type FolioLayout, type DocumentFolioResponseEntity, type DocumentAnnulResponseEntity, type DocumentCloseDeliveryResponseEntity, type DocumentCreateResponseEntity, type DocumentAddRecipientsResponseEntity, type DocumentDeriveResponseEntity, type DocumentDiscardResponseEntity, type DocumentEmailCopyIssuedEntity, type DocumentEmailCopyViewEntity, type DocumentReminderEntity, type DocumentSlaReminderEntity, type DocumentGetAllResponseEntity, type DocumentGetByIdResponseEntity, type DocumentGetSummaryResponseEntity, type DocumentReviewAreaEntity, type DocumentInboxItemEntity, type DocumentPublicFileResponseEntity, type DocumentReassignResponseEntity, type DocumentReviewResponseEntity, type DocumentSignManyResponseEntity, type DocumentAgendaResponseEntity, type DocumentComposeResponseEntity, type DocumentComposition, type DocumentTrailExportEntity, type DocumentUpdateResponseEntity, type DocumentVerifyResponseEntity, type DocumentCommentResponseEntity, type DocumentCommentsResponseEntity, type DocumentVersionResponseEntity, type DocumentDraftCorrectionResponseEntity, type DocumentStampPlacements, type DocumentDraftReviewResponseEntity } from '../entities';
|
|
3
3
|
import { type RpcPage } from './contract';
|
|
4
4
|
/** Patrones NATS de `document`: `<servicio>.<recurso>.<acción>`. */
|
|
5
5
|
export declare const DocumentPatterns: {
|
|
@@ -281,6 +281,7 @@ export interface DocumentContract {
|
|
|
281
281
|
partsOffice?: boolean;
|
|
282
282
|
box?: StampBox;
|
|
283
283
|
format?: DocumentFolioFormat;
|
|
284
|
+
layout?: FolioLayout;
|
|
284
285
|
actor: DocumentActor;
|
|
285
286
|
};
|
|
286
287
|
response: DocumentFolioResponseEntity;
|
|
@@ -156,6 +156,8 @@ export declare const GestorDocumentalPatterns: {
|
|
|
156
156
|
readonly getDispatches: "gestorDocumental.partsOffice.getDispatches";
|
|
157
157
|
readonly dispatch: "gestorDocumental.partsOffice.dispatch";
|
|
158
158
|
readonly dispatchInGestor: "gestorDocumental.partsOffice.dispatchInGestor";
|
|
159
|
+
readonly matchInternalUsers: "gestorDocumental.partsOffice.matchInternalUsers";
|
|
160
|
+
readonly getInternalRecipients: "gestorDocumental.partsOffice.getInternalRecipients";
|
|
159
161
|
readonly returnDispatch: "gestorDocumental.partsOffice.returnDispatch";
|
|
160
162
|
readonly resendDispatch: "gestorDocumental.partsOffice.resendDispatch";
|
|
161
163
|
readonly getDispatchFile: "gestorDocumental.partsOffice.getDispatchFile";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type CommunicationMeans, type DocumentAccessLevel, type DocumentInstruction } from '../base/entities';
|
|
2
|
-
import { type CaseFileAddEntryResponseEntity, type DocDigitalDocumentTypeEntity, type DocDigitalEntityEntity, type PartsOfficeInboundEntity, type DocDigitalUserEntity, type EnablementPersonInput, type PartsOfficeEnablementEntity, type PartsOfficeDispatchEntity, type PartsOfficeFileEntity, type PartsOfficeOkResponseEntity, type PartsOfficeRegisterResponseEntity, type PartsOfficeStatusEntity, type PartsOfficeSummaryEntity, type PartsOfficeSyncResponseEntity } from '../entities';
|
|
2
|
+
import { type CaseFileAddEntryResponseEntity, type DocDigitalDocumentTypeEntity, type DocDigitalEntityEntity, type PartsOfficeInboundEntity, type DocDigitalUserEntity, type EnablementPersonInput, type PartsOfficeEnablementEntity, type PartsOfficeDispatchEntity, type DocDigitalInternalPersonInput, type PartsOfficeInternalRecipientEntity, type DocDigitalInternalMatchEntity, type PartsOfficeFileEntity, type PartsOfficeOkResponseEntity, type PartsOfficeRegisterResponseEntity, type PartsOfficeStatusEntity, type PartsOfficeSummaryEntity, type PartsOfficeSyncResponseEntity } from '../entities';
|
|
3
3
|
import { type RpcPage } from './contract';
|
|
4
4
|
import { type DocumentActor, type DocumentExternalRecipientInput } from './document.contract';
|
|
5
5
|
/** Patrones NATS de `partsOffice` (Oficina de Partes y DocDigital): `<servicio>.<recurso>.<acción>`. */
|
|
@@ -13,6 +13,8 @@ export declare const PartsOfficePatterns: {
|
|
|
13
13
|
readonly getDispatches: "gestorDocumental.partsOffice.getDispatches";
|
|
14
14
|
readonly dispatch: "gestorDocumental.partsOffice.dispatch";
|
|
15
15
|
readonly dispatchInGestor: "gestorDocumental.partsOffice.dispatchInGestor";
|
|
16
|
+
readonly matchInternalUsers: "gestorDocumental.partsOffice.matchInternalUsers";
|
|
17
|
+
readonly getInternalRecipients: "gestorDocumental.partsOffice.getInternalRecipients";
|
|
16
18
|
readonly returnDispatch: "gestorDocumental.partsOffice.returnDispatch";
|
|
17
19
|
readonly resendDispatch: "gestorDocumental.partsOffice.resendDispatch";
|
|
18
20
|
readonly getDispatchFile: "gestorDocumental.partsOffice.getDispatchFile";
|
|
@@ -121,18 +123,38 @@ export interface PartsOfficeContract {
|
|
|
121
123
|
};
|
|
122
124
|
response: RpcPage<PartsOfficeDispatchEntity[]>;
|
|
123
125
|
};
|
|
124
|
-
/**
|
|
126
|
+
/**
|
|
127
|
+
* Despacha por DocDigital, con el número del documento como folio. `operatorRun`: RUN de quien despacha.
|
|
128
|
+
* `internalPeople`: si también va a sus destinatarios del gestor por DocDigital, a quién (lo arma el gateway); si
|
|
129
|
+
* alguno no tiene usuario en DocDigital, no se despacha.
|
|
130
|
+
*/
|
|
125
131
|
[PartsOfficePatterns.dispatch]: {
|
|
126
132
|
payload: {
|
|
127
133
|
id: string;
|
|
128
134
|
docDigitalTypeId: number;
|
|
129
135
|
operatorRun?: string | null;
|
|
136
|
+
internalPeople?: DocDigitalInternalPersonInput[];
|
|
130
137
|
actor: DocumentActor;
|
|
131
138
|
};
|
|
132
139
|
response: PartsOfficeOkResponseEntity & {
|
|
133
140
|
docDigitalDocumentId: string;
|
|
134
141
|
};
|
|
135
142
|
};
|
|
143
|
+
/** Los destinatarios del gestor de un despacho (personas y áreas), para resolver a quién van en DocDigital. */
|
|
144
|
+
[PartsOfficePatterns.getInternalRecipients]: {
|
|
145
|
+
payload: {
|
|
146
|
+
id: string;
|
|
147
|
+
};
|
|
148
|
+
response: PartsOfficeInternalRecipientEntity[];
|
|
149
|
+
};
|
|
150
|
+
/** Cruza los destinatarios del gestor de un despacho con los usuarios de DocDigital de quien lo emite, por RUN. */
|
|
151
|
+
[PartsOfficePatterns.matchInternalUsers]: {
|
|
152
|
+
payload: {
|
|
153
|
+
id: string;
|
|
154
|
+
people: DocDigitalInternalPersonInput[];
|
|
155
|
+
};
|
|
156
|
+
response: DocDigitalInternalMatchEntity[];
|
|
157
|
+
};
|
|
136
158
|
/**
|
|
137
159
|
* Despacha en el gestor, sin DocDigital: el documento queda finalizado y llega a los buzones de sus destinatarios.
|
|
138
160
|
* No si tiene destinatarios de otras instituciones (van por DocDigital o por contingencia).
|
|
@@ -12,6 +12,8 @@ exports.PartsOfficePatterns = {
|
|
|
12
12
|
getDispatches: 'gestorDocumental.partsOffice.getDispatches',
|
|
13
13
|
dispatch: 'gestorDocumental.partsOffice.dispatch',
|
|
14
14
|
dispatchInGestor: 'gestorDocumental.partsOffice.dispatchInGestor',
|
|
15
|
+
matchInternalUsers: 'gestorDocumental.partsOffice.matchInternalUsers',
|
|
16
|
+
getInternalRecipients: 'gestorDocumental.partsOffice.getInternalRecipients',
|
|
15
17
|
returnDispatch: 'gestorDocumental.partsOffice.returnDispatch',
|
|
16
18
|
resendDispatch: 'gestorDocumental.partsOffice.resendDispatch',
|
|
17
19
|
getDispatchFile: 'gestorDocumental.partsOffice.getDispatchFile',
|
|
@@ -14,18 +14,66 @@ export interface DocumentFolioFormat {
|
|
|
14
14
|
label: FolioLabel;
|
|
15
15
|
number: FolioNumberStyle;
|
|
16
16
|
date: FolioDateStyle;
|
|
17
|
-
/** Un texto fijo
|
|
17
|
+
/** Un texto fijo, aparte (por ejemplo, «Oficina de Partes»). */
|
|
18
18
|
text?: string | null;
|
|
19
|
-
|
|
19
|
+
/** Ya no se usa: cada pieza se alinea en el bloque (`FolioLayout`). Se conserva en lo guardado antes. */
|
|
20
|
+
align?: 'left' | 'center' | 'right';
|
|
20
21
|
}
|
|
21
|
-
/** La de siempre: el nombre del tipo con su número, y la fecha larga
|
|
22
|
+
/** La de siempre: el nombre del tipo con su número, y la fecha larga. */
|
|
22
23
|
export declare const DEFAULT_FOLIO_FORMAT: DocumentFolioFormat;
|
|
24
|
+
/** Las piezas de la estampa del folio: el número (con el tipo o su sigla), la fecha y el texto fijo. */
|
|
25
|
+
export type FolioItemKey = 'number' | 'date' | 'text';
|
|
26
|
+
export declare const FOLIO_ITEM_KEYS: FolioItemKey[];
|
|
27
|
+
export type FolioAlign = 'left' | 'center' | 'right';
|
|
28
|
+
/**
|
|
29
|
+
* Dónde va una pieza dentro del bloque de la estampa, en puntos desde su esquina superior izquierda: `y` es el borde de
|
|
30
|
+
* arriba de su línea y `x` su ancla, que según `align` es su borde izquierdo, su centro o su borde derecho.
|
|
31
|
+
*/
|
|
32
|
+
export interface FolioItemPlacement {
|
|
33
|
+
x: number;
|
|
34
|
+
y: number;
|
|
35
|
+
align: FolioAlign;
|
|
36
|
+
}
|
|
37
|
+
/** Cómo van las piezas dentro del bloque; la que falta se ubica sola. */
|
|
38
|
+
export type FolioLayout = Partial<Record<FolioItemKey, FolioItemPlacement>>;
|
|
39
|
+
/** Tamaño de letra de cada pieza, en puntos (el número en negrita). */
|
|
40
|
+
export declare const FOLIO_FONT_SIZE: Record<FolioItemKey, number>;
|
|
41
|
+
/** Alto de una línea, por punto de letra. */
|
|
42
|
+
export declare const FOLIO_LINE_HEIGHT = 1.25;
|
|
43
|
+
/**
|
|
44
|
+
* Las piezas una bajo otra, centradas en el alto del bloque y alineadas como se pida (por omisión, a la derecha): el
|
|
45
|
+
* número arriba, la fecha y el texto debajo.
|
|
46
|
+
*/
|
|
47
|
+
export declare const defaultFolioLayout: (box: {
|
|
48
|
+
width: number;
|
|
49
|
+
height: number;
|
|
50
|
+
}, keys: FolioItemKey[], align?: FolioAlign) => FolioLayout;
|
|
51
|
+
/** Cada pieza dentro del bloque: su ancla entre los bordes y su línea sin salirse por abajo. */
|
|
52
|
+
export declare const clampFolioLayout: (layout: FolioLayout, box: {
|
|
53
|
+
width: number;
|
|
54
|
+
height: number;
|
|
55
|
+
}) => FolioLayout;
|
|
56
|
+
/**
|
|
57
|
+
* Las piezas que lleva la estampa con su texto, y dónde va cada una: la que el bloque ya ubicó, o la que se ubica sola
|
|
58
|
+
* (una bajo otra, con la alineación pedida).
|
|
59
|
+
*/
|
|
60
|
+
export declare const folioStampItems: (parts: Partial<Record<FolioItemKey, string>>, layout: FolioLayout | null | undefined, box: {
|
|
61
|
+
width: number;
|
|
62
|
+
height: number;
|
|
63
|
+
}, align?: FolioAlign) => {
|
|
64
|
+
key: FolioItemKey;
|
|
65
|
+
text: string;
|
|
66
|
+
size: number;
|
|
67
|
+
bold: boolean;
|
|
68
|
+
placement: FolioItemPlacement;
|
|
69
|
+
}[];
|
|
23
70
|
/** Largo máximo del texto fijo de la estampa. */
|
|
24
71
|
export declare const FOLIO_TEXT_MAX = 80;
|
|
25
|
-
/** La estampa del folio que se firmó en un documento: dónde
|
|
72
|
+
/** La estampa del folio que se firmó en un documento: dónde quedó, con qué formato y cómo iban sus piezas. */
|
|
26
73
|
export interface DocumentFolioStamp {
|
|
27
74
|
box: StampBox;
|
|
28
75
|
format: DocumentFolioFormat;
|
|
76
|
+
layout?: FolioLayout;
|
|
29
77
|
}
|
|
30
78
|
/**
|
|
31
79
|
* Lo necesario para proponer la estampa del folio de un documento por foliar, sobre su vista previa: el formato del tipo
|
|
@@ -52,4 +100,6 @@ export interface FolioStampData {
|
|
|
52
100
|
* Las líneas de la estampa del folio, de arriba abajo: el tipo (o su sigla) con el número, la fecha y el texto fijo. Lo
|
|
53
101
|
* usan el ms al firmar la estampa y la vista previa de las pantallas, para que se vean igual.
|
|
54
102
|
*/
|
|
103
|
+
/** Las piezas de la estampa con su texto: el número (con el tipo o su sigla), la fecha y el texto fijo. */
|
|
104
|
+
export declare const folioStampParts: (format: DocumentFolioFormat, data: FolioStampData) => Partial<Record<FolioItemKey, string>>;
|
|
55
105
|
export declare const folioStampLines: (format: DocumentFolioFormat, data: FolioStampData) => string[];
|
|
@@ -1,19 +1,79 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.folioStampLines = exports.FOLIO_TEXT_MAX = exports.DEFAULT_FOLIO_FORMAT = void 0;
|
|
4
|
-
/** La de siempre: el nombre del tipo con su número, y la fecha larga
|
|
5
|
-
exports.DEFAULT_FOLIO_FORMAT = {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
3
|
+
exports.folioStampLines = exports.folioStampParts = exports.FOLIO_TEXT_MAX = exports.folioStampItems = exports.clampFolioLayout = exports.defaultFolioLayout = exports.FOLIO_LINE_HEIGHT = exports.FOLIO_FONT_SIZE = exports.FOLIO_ITEM_KEYS = exports.DEFAULT_FOLIO_FORMAT = void 0;
|
|
4
|
+
/** La de siempre: el nombre del tipo con su número, y la fecha larga. */
|
|
5
|
+
exports.DEFAULT_FOLIO_FORMAT = { label: 'name', number: 'number', date: 'long' };
|
|
6
|
+
exports.FOLIO_ITEM_KEYS = ['number', 'date', 'text'];
|
|
7
|
+
/** Tamaño de letra de cada pieza, en puntos (el número en negrita). */
|
|
8
|
+
exports.FOLIO_FONT_SIZE = { number: 10, date: 9, text: 8 };
|
|
9
|
+
/** Alto de una línea, por punto de letra. */
|
|
10
|
+
exports.FOLIO_LINE_HEIGHT = 1.25;
|
|
11
|
+
/**
|
|
12
|
+
* Las piezas una bajo otra, centradas en el alto del bloque y alineadas como se pida (por omisión, a la derecha): el
|
|
13
|
+
* número arriba, la fecha y el texto debajo.
|
|
14
|
+
*/
|
|
15
|
+
const defaultFolioLayout = (box, keys, align = 'right') => {
|
|
16
|
+
const total = keys.reduce((sum, key) => sum + exports.FOLIO_FONT_SIZE[key] * exports.FOLIO_LINE_HEIGHT, 0);
|
|
17
|
+
const x = align === 'left' ? 2 : align === 'center' ? box.width / 2 : box.width - 2;
|
|
18
|
+
let y = Math.max(0, (box.height - total) / 2);
|
|
19
|
+
const layout = {};
|
|
20
|
+
for (const key of exports.FOLIO_ITEM_KEYS) {
|
|
21
|
+
if (!keys.includes(key))
|
|
22
|
+
continue;
|
|
23
|
+
layout[key] = { x: Math.round(x * 10) / 10, y: Math.round(y * 10) / 10, align };
|
|
24
|
+
y += exports.FOLIO_FONT_SIZE[key] * exports.FOLIO_LINE_HEIGHT;
|
|
25
|
+
}
|
|
26
|
+
return layout;
|
|
10
27
|
};
|
|
28
|
+
exports.defaultFolioLayout = defaultFolioLayout;
|
|
29
|
+
/** Cada pieza dentro del bloque: su ancla entre los bordes y su línea sin salirse por abajo. */
|
|
30
|
+
const clampFolioLayout = (layout, box) => {
|
|
31
|
+
const clamped = {};
|
|
32
|
+
for (const key of exports.FOLIO_ITEM_KEYS) {
|
|
33
|
+
const item = layout[key];
|
|
34
|
+
if (!item)
|
|
35
|
+
continue;
|
|
36
|
+
const lineHeight = exports.FOLIO_FONT_SIZE[key] * exports.FOLIO_LINE_HEIGHT;
|
|
37
|
+
clamped[key] = {
|
|
38
|
+
align: item.align,
|
|
39
|
+
x: Math.round(Math.min(Math.max(item.x, 0), box.width) * 10) / 10,
|
|
40
|
+
y: Math.round(Math.min(Math.max(item.y, 0), Math.max(0, box.height - lineHeight)) * 10) / 10,
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
return clamped;
|
|
44
|
+
};
|
|
45
|
+
exports.clampFolioLayout = clampFolioLayout;
|
|
46
|
+
/**
|
|
47
|
+
* Las piezas que lleva la estampa con su texto, y dónde va cada una: la que el bloque ya ubicó, o la que se ubica sola
|
|
48
|
+
* (una bajo otra, con la alineación pedida).
|
|
49
|
+
*/
|
|
50
|
+
const folioStampItems = (parts, layout, box, align = 'right') => {
|
|
51
|
+
const keys = exports.FOLIO_ITEM_KEYS.filter(key => parts[key]);
|
|
52
|
+
const fallback = (0, exports.defaultFolioLayout)(box, keys, align);
|
|
53
|
+
const placed = (0, exports.clampFolioLayout)({ ...fallback, ...(layout ?? {}) }, box);
|
|
54
|
+
return keys.map(key => ({
|
|
55
|
+
key,
|
|
56
|
+
text: parts[key],
|
|
57
|
+
size: exports.FOLIO_FONT_SIZE[key],
|
|
58
|
+
bold: key === 'number',
|
|
59
|
+
placement: placed[key],
|
|
60
|
+
}));
|
|
61
|
+
};
|
|
62
|
+
exports.folioStampItems = folioStampItems;
|
|
11
63
|
/** Largo máximo del texto fijo de la estampa. */
|
|
12
64
|
exports.FOLIO_TEXT_MAX = 80;
|
|
13
65
|
/**
|
|
14
66
|
* Las líneas de la estampa del folio, de arriba abajo: el tipo (o su sigla) con el número, la fecha y el texto fijo. Lo
|
|
15
67
|
* usan el ms al firmar la estampa y la vista previa de las pantallas, para que se vean igual.
|
|
16
68
|
*/
|
|
69
|
+
/** Las piezas de la estampa con su texto: el número (con el tipo o su sigla), la fecha y el texto fijo. */
|
|
70
|
+
const folioStampParts = (format, data) => {
|
|
71
|
+
const [number, ...rest] = (0, exports.folioStampLines)(format, data);
|
|
72
|
+
const date = format.date === 'none' ? undefined : rest[0];
|
|
73
|
+
const text = format.text?.trim() || undefined;
|
|
74
|
+
return { number, ...(date ? { date } : {}), ...(text ? { text } : {}) };
|
|
75
|
+
};
|
|
76
|
+
exports.folioStampParts = folioStampParts;
|
|
17
77
|
const folioStampLines = (format, data) => {
|
|
18
78
|
const number = `N° ${data.correlative}${format.number === 'numberYear' ? `/${data.correlativeYear}` : ''}`;
|
|
19
79
|
const label = format.label === 'name'
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type FolioLayout } from './folio';
|
|
1
2
|
/**
|
|
2
3
|
* Formato del editor del gestor que comparten el navegador y el microservicio: tipografías, colores, tamaños de hoja y
|
|
3
4
|
* márgenes. Todo lo que el PDF muestra sale de aquí, así que el editor y el documento oficial se ven igual.
|
|
@@ -198,6 +199,11 @@ export interface RichNumberZone {
|
|
|
198
199
|
align: RichNumberAlign;
|
|
199
200
|
width?: number;
|
|
200
201
|
height?: number;
|
|
202
|
+
/**
|
|
203
|
+
* Dónde va cada pieza de la estampa del folio (el número, la fecha, el texto) dentro del recuadro, si se movieron en
|
|
204
|
+
* el editor. Sin valor, una bajo otra con la alineación del recuadro.
|
|
205
|
+
*/
|
|
206
|
+
layout?: FolioLayout;
|
|
201
207
|
}
|
|
202
208
|
/** Límites del diseño libre del encabezado. */
|
|
203
209
|
export declare const RICH_LETTERHEAD_LIMITS: {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RICH_IMAGE_LIMITS = exports.RICH_DEFAULT_LETTERHEAD = exports.richFitLetterhead = exports.richNumberZone = exports.RICH_NUMBER_ZONE_LIMITS = 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;
|
|
2
4
|
/**
|
|
3
5
|
* Formato del editor del gestor que comparten el navegador y el microservicio: tipografías, colores, tamaños de hoja y
|
|
4
6
|
* márgenes. Todo lo que el PDF muestra sale de aquí, así que el editor y el documento oficial se ven igual.
|
|
5
7
|
*/
|
|
6
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.RICH_IMAGE_LIMITS = exports.RICH_DEFAULT_LETTERHEAD = exports.richFitLetterhead = exports.richNumberZone = exports.RICH_NUMBER_ZONE_LIMITS = 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.
|
|
@@ -28,12 +28,37 @@ export interface PartsOfficeSummaryEntity {
|
|
|
28
28
|
toDispatch: number;
|
|
29
29
|
received: number;
|
|
30
30
|
}
|
|
31
|
-
/**
|
|
31
|
+
/** Destinatario del gestor (una persona o un área) de un documento por despachar. */
|
|
32
|
+
export interface PartsOfficeInternalRecipientEntity {
|
|
33
|
+
type: 'Employee' | 'Directorate' | 'Department';
|
|
34
|
+
employeeId: string | null;
|
|
35
|
+
directorateCodeReference: number | null;
|
|
36
|
+
departmentId: string | null;
|
|
37
|
+
name: string;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* A quién de DocDigital va un destinatario del gestor: la persona, o la jefatura del área (director o encargado). Lo
|
|
41
|
+
* arma el gateway con su RUN; `key` lo identifica y `label` dice de qué destinatario viene.
|
|
42
|
+
*/
|
|
43
|
+
export interface DocDigitalInternalPersonInput {
|
|
44
|
+
key: string;
|
|
45
|
+
label: string;
|
|
46
|
+
fullName: string;
|
|
47
|
+
run: string;
|
|
48
|
+
}
|
|
49
|
+
/** El cruce de un destinatario del gestor con su usuario de DocDigital (por RUN); sin usuario, `userId` es `null`. */
|
|
50
|
+
export interface DocDigitalInternalMatchEntity extends DocDigitalInternalPersonInput {
|
|
51
|
+
userId: number | null;
|
|
52
|
+
userName: string | null;
|
|
53
|
+
}
|
|
54
|
+
/** Documento que despacha Oficina de Partes: en el gestor y, si corresponde, por DocDigital. */
|
|
32
55
|
export interface PartsOfficeDispatchEntity extends DocumentDispatchResponseEntity {
|
|
33
56
|
document: DocumentLinkEntity & {
|
|
34
57
|
accessLevel: string;
|
|
35
58
|
};
|
|
36
59
|
externalRecipients: DocumentExternalRecipientResponseEntity[];
|
|
60
|
+
/** Sus destinatarios del gestor: se le despachan en el gestor y, si Partes lo elige, también por DocDigital. */
|
|
61
|
+
internalRecipients: PartsOfficeInternalRecipientEntity[];
|
|
37
62
|
/** A nombre de quién sale: la entidad emisora del tipo documental o la municipalidad. */
|
|
38
63
|
issuerName: string;
|
|
39
64
|
/** Si está por foliar: lo necesario para proponer la estampa del folio sobre su vista previa. */
|
package/package.json
CHANGED
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
import {
|
|
12
12
|
type StampBox,
|
|
13
13
|
type DocumentFolioFormat,
|
|
14
|
+
type FolioLayout,
|
|
14
15
|
type DocumentFolioResponseEntity,
|
|
15
16
|
type DocumentAnnulResponseEntity,
|
|
16
17
|
type DocumentCloseDeliveryResponseEntity,
|
|
@@ -338,6 +339,7 @@ export interface DocumentContract {
|
|
|
338
339
|
// Solo para este documento: dónde va la estampa y cómo se ve (sin ellos, los del tipo y su plantilla)
|
|
339
340
|
box?: StampBox;
|
|
340
341
|
format?: DocumentFolioFormat;
|
|
342
|
+
layout?: FolioLayout;
|
|
341
343
|
actor: DocumentActor;
|
|
342
344
|
};
|
|
343
345
|
response: DocumentFolioResponseEntity;
|
|
@@ -8,6 +8,9 @@ import {
|
|
|
8
8
|
type EnablementPersonInput,
|
|
9
9
|
type PartsOfficeEnablementEntity,
|
|
10
10
|
type PartsOfficeDispatchEntity,
|
|
11
|
+
type DocDigitalInternalPersonInput,
|
|
12
|
+
type PartsOfficeInternalRecipientEntity,
|
|
13
|
+
type DocDigitalInternalMatchEntity,
|
|
11
14
|
type PartsOfficeFileEntity,
|
|
12
15
|
type PartsOfficeOkResponseEntity,
|
|
13
16
|
type PartsOfficeRegisterResponseEntity,
|
|
@@ -29,6 +32,8 @@ export const PartsOfficePatterns = {
|
|
|
29
32
|
getDispatches: 'gestorDocumental.partsOffice.getDispatches',
|
|
30
33
|
dispatch: 'gestorDocumental.partsOffice.dispatch',
|
|
31
34
|
dispatchInGestor: 'gestorDocumental.partsOffice.dispatchInGestor',
|
|
35
|
+
matchInternalUsers: 'gestorDocumental.partsOffice.matchInternalUsers',
|
|
36
|
+
getInternalRecipients: 'gestorDocumental.partsOffice.getInternalRecipients',
|
|
32
37
|
returnDispatch: 'gestorDocumental.partsOffice.returnDispatch',
|
|
33
38
|
resendDispatch: 'gestorDocumental.partsOffice.resendDispatch',
|
|
34
39
|
getDispatchFile: 'gestorDocumental.partsOffice.getDispatchFile',
|
|
@@ -98,11 +103,31 @@ export interface PartsOfficeContract {
|
|
|
98
103
|
};
|
|
99
104
|
response: RpcPage<PartsOfficeDispatchEntity[]>;
|
|
100
105
|
};
|
|
101
|
-
/**
|
|
106
|
+
/**
|
|
107
|
+
* Despacha por DocDigital, con el número del documento como folio. `operatorRun`: RUN de quien despacha.
|
|
108
|
+
* `internalPeople`: si también va a sus destinatarios del gestor por DocDigital, a quién (lo arma el gateway); si
|
|
109
|
+
* alguno no tiene usuario en DocDigital, no se despacha.
|
|
110
|
+
*/
|
|
102
111
|
[PartsOfficePatterns.dispatch]: {
|
|
103
|
-
payload: {
|
|
112
|
+
payload: {
|
|
113
|
+
id: string;
|
|
114
|
+
docDigitalTypeId: number;
|
|
115
|
+
operatorRun?: string | null;
|
|
116
|
+
internalPeople?: DocDigitalInternalPersonInput[];
|
|
117
|
+
actor: DocumentActor;
|
|
118
|
+
};
|
|
104
119
|
response: PartsOfficeOkResponseEntity & { docDigitalDocumentId: string };
|
|
105
120
|
};
|
|
121
|
+
/** Los destinatarios del gestor de un despacho (personas y áreas), para resolver a quién van en DocDigital. */
|
|
122
|
+
[PartsOfficePatterns.getInternalRecipients]: {
|
|
123
|
+
payload: { id: string };
|
|
124
|
+
response: PartsOfficeInternalRecipientEntity[];
|
|
125
|
+
};
|
|
126
|
+
/** Cruza los destinatarios del gestor de un despacho con los usuarios de DocDigital de quien lo emite, por RUN. */
|
|
127
|
+
[PartsOfficePatterns.matchInternalUsers]: {
|
|
128
|
+
payload: { id: string; people: DocDigitalInternalPersonInput[] };
|
|
129
|
+
response: DocDigitalInternalMatchEntity[];
|
|
130
|
+
};
|
|
106
131
|
/**
|
|
107
132
|
* Despacha en el gestor, sin DocDigital: el documento queda finalizado y llega a los buzones de sus destinatarios.
|
|
108
133
|
* No si tiene destinatarios de otras instituciones (van por DocDigital o por contingencia).
|
|
@@ -16,26 +16,105 @@ export interface DocumentFolioFormat {
|
|
|
16
16
|
label: FolioLabel;
|
|
17
17
|
number: FolioNumberStyle;
|
|
18
18
|
date: FolioDateStyle;
|
|
19
|
-
/** Un texto fijo
|
|
19
|
+
/** Un texto fijo, aparte (por ejemplo, «Oficina de Partes»). */
|
|
20
20
|
text?: string | null;
|
|
21
|
-
|
|
21
|
+
/** Ya no se usa: cada pieza se alinea en el bloque (`FolioLayout`). Se conserva en lo guardado antes. */
|
|
22
|
+
align?: 'left' | 'center' | 'right';
|
|
22
23
|
}
|
|
23
24
|
|
|
24
|
-
/** La de siempre: el nombre del tipo con su número, y la fecha larga
|
|
25
|
-
export const DEFAULT_FOLIO_FORMAT: DocumentFolioFormat = {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
25
|
+
/** La de siempre: el nombre del tipo con su número, y la fecha larga. */
|
|
26
|
+
export const DEFAULT_FOLIO_FORMAT: DocumentFolioFormat = { label: 'name', number: 'number', date: 'long' };
|
|
27
|
+
|
|
28
|
+
/** Las piezas de la estampa del folio: el número (con el tipo o su sigla), la fecha y el texto fijo. */
|
|
29
|
+
export type FolioItemKey = 'number' | 'date' | 'text';
|
|
30
|
+
export const FOLIO_ITEM_KEYS: FolioItemKey[] = ['number', 'date', 'text'];
|
|
31
|
+
export type FolioAlign = 'left' | 'center' | 'right';
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Dónde va una pieza dentro del bloque de la estampa, en puntos desde su esquina superior izquierda: `y` es el borde de
|
|
35
|
+
* arriba de su línea y `x` su ancla, que según `align` es su borde izquierdo, su centro o su borde derecho.
|
|
36
|
+
*/
|
|
37
|
+
export interface FolioItemPlacement {
|
|
38
|
+
x: number;
|
|
39
|
+
y: number;
|
|
40
|
+
align: FolioAlign;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** Cómo van las piezas dentro del bloque; la que falta se ubica sola. */
|
|
44
|
+
export type FolioLayout = Partial<Record<FolioItemKey, FolioItemPlacement>>;
|
|
45
|
+
|
|
46
|
+
/** Tamaño de letra de cada pieza, en puntos (el número en negrita). */
|
|
47
|
+
export const FOLIO_FONT_SIZE: Record<FolioItemKey, number> = { number: 10, date: 9, text: 8 };
|
|
48
|
+
/** Alto de una línea, por punto de letra. */
|
|
49
|
+
export const FOLIO_LINE_HEIGHT = 1.25;
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Las piezas una bajo otra, centradas en el alto del bloque y alineadas como se pida (por omisión, a la derecha): el
|
|
53
|
+
* número arriba, la fecha y el texto debajo.
|
|
54
|
+
*/
|
|
55
|
+
export const defaultFolioLayout = (
|
|
56
|
+
box: { width: number; height: number },
|
|
57
|
+
keys: FolioItemKey[],
|
|
58
|
+
align: FolioAlign = 'right',
|
|
59
|
+
): FolioLayout => {
|
|
60
|
+
const total = keys.reduce((sum, key) => sum + FOLIO_FONT_SIZE[key] * FOLIO_LINE_HEIGHT, 0);
|
|
61
|
+
const x = align === 'left' ? 2 : align === 'center' ? box.width / 2 : box.width - 2;
|
|
62
|
+
let y = Math.max(0, (box.height - total) / 2);
|
|
63
|
+
const layout: FolioLayout = {};
|
|
64
|
+
for (const key of FOLIO_ITEM_KEYS) {
|
|
65
|
+
if (!keys.includes(key)) continue;
|
|
66
|
+
layout[key] = { x: Math.round(x * 10) / 10, y: Math.round(y * 10) / 10, align };
|
|
67
|
+
y += FOLIO_FONT_SIZE[key] * FOLIO_LINE_HEIGHT;
|
|
68
|
+
}
|
|
69
|
+
return layout;
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
/** Cada pieza dentro del bloque: su ancla entre los bordes y su línea sin salirse por abajo. */
|
|
73
|
+
export const clampFolioLayout = (layout: FolioLayout, box: { width: number; height: number }): FolioLayout => {
|
|
74
|
+
const clamped: FolioLayout = {};
|
|
75
|
+
for (const key of FOLIO_ITEM_KEYS) {
|
|
76
|
+
const item = layout[key];
|
|
77
|
+
if (!item) continue;
|
|
78
|
+
const lineHeight = FOLIO_FONT_SIZE[key] * FOLIO_LINE_HEIGHT;
|
|
79
|
+
clamped[key] = {
|
|
80
|
+
align: item.align,
|
|
81
|
+
x: Math.round(Math.min(Math.max(item.x, 0), box.width) * 10) / 10,
|
|
82
|
+
y: Math.round(Math.min(Math.max(item.y, 0), Math.max(0, box.height - lineHeight)) * 10) / 10,
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
return clamped;
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Las piezas que lleva la estampa con su texto, y dónde va cada una: la que el bloque ya ubicó, o la que se ubica sola
|
|
90
|
+
* (una bajo otra, con la alineación pedida).
|
|
91
|
+
*/
|
|
92
|
+
export const folioStampItems = (
|
|
93
|
+
parts: Partial<Record<FolioItemKey, string>>,
|
|
94
|
+
layout: FolioLayout | null | undefined,
|
|
95
|
+
box: { width: number; height: number },
|
|
96
|
+
align: FolioAlign = 'right',
|
|
97
|
+
): { key: FolioItemKey; text: string; size: number; bold: boolean; placement: FolioItemPlacement }[] => {
|
|
98
|
+
const keys = FOLIO_ITEM_KEYS.filter(key => parts[key]);
|
|
99
|
+
const fallback = defaultFolioLayout(box, keys, align);
|
|
100
|
+
const placed = clampFolioLayout({ ...fallback, ...(layout ?? {}) }, box);
|
|
101
|
+
return keys.map(key => ({
|
|
102
|
+
key,
|
|
103
|
+
text: parts[key]!,
|
|
104
|
+
size: FOLIO_FONT_SIZE[key],
|
|
105
|
+
bold: key === 'number',
|
|
106
|
+
placement: placed[key]!,
|
|
107
|
+
}));
|
|
30
108
|
};
|
|
31
109
|
|
|
32
110
|
/** Largo máximo del texto fijo de la estampa. */
|
|
33
111
|
export const FOLIO_TEXT_MAX = 80;
|
|
34
112
|
|
|
35
|
-
/** La estampa del folio que se firmó en un documento: dónde
|
|
113
|
+
/** La estampa del folio que se firmó en un documento: dónde quedó, con qué formato y cómo iban sus piezas. */
|
|
36
114
|
export interface DocumentFolioStamp {
|
|
37
115
|
box: StampBox;
|
|
38
116
|
format: DocumentFolioFormat;
|
|
117
|
+
layout?: FolioLayout;
|
|
39
118
|
}
|
|
40
119
|
|
|
41
120
|
/**
|
|
@@ -65,6 +144,17 @@ export interface FolioStampData {
|
|
|
65
144
|
* Las líneas de la estampa del folio, de arriba abajo: el tipo (o su sigla) con el número, la fecha y el texto fijo. Lo
|
|
66
145
|
* usan el ms al firmar la estampa y la vista previa de las pantallas, para que se vean igual.
|
|
67
146
|
*/
|
|
147
|
+
/** Las piezas de la estampa con su texto: el número (con el tipo o su sigla), la fecha y el texto fijo. */
|
|
148
|
+
export const folioStampParts = (
|
|
149
|
+
format: DocumentFolioFormat,
|
|
150
|
+
data: FolioStampData,
|
|
151
|
+
): Partial<Record<FolioItemKey, string>> => {
|
|
152
|
+
const [number, ...rest] = folioStampLines(format, data);
|
|
153
|
+
const date = format.date === 'none' ? undefined : rest[0];
|
|
154
|
+
const text = format.text?.trim() || undefined;
|
|
155
|
+
return { number, ...(date ? { date } : {}), ...(text ? { text } : {}) };
|
|
156
|
+
};
|
|
157
|
+
|
|
68
158
|
export const folioStampLines = (format: DocumentFolioFormat, data: FolioStampData): string[] => {
|
|
69
159
|
const number = `N° ${data.correlative}${format.number === 'numberYear' ? `/${data.correlativeYear}` : ''}`;
|
|
70
160
|
const label =
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type FolioLayout } from './folio';
|
|
1
2
|
/**
|
|
2
3
|
* Formato del editor del gestor que comparten el navegador y el microservicio: tipografías, colores, tamaños de hoja y
|
|
3
4
|
* márgenes. Todo lo que el PDF muestra sale de aquí, así que el editor y el documento oficial se ven igual.
|
|
@@ -182,6 +183,11 @@ export interface RichNumberZone {
|
|
|
182
183
|
align: RichNumberAlign;
|
|
183
184
|
width?: number;
|
|
184
185
|
height?: number;
|
|
186
|
+
/**
|
|
187
|
+
* Dónde va cada pieza de la estampa del folio (el número, la fecha, el texto) dentro del recuadro, si se movieron en
|
|
188
|
+
* el editor. Sin valor, una bajo otra con la alineación del recuadro.
|
|
189
|
+
*/
|
|
190
|
+
layout?: FolioLayout;
|
|
185
191
|
}
|
|
186
192
|
|
|
187
193
|
/** Límites del diseño libre del encabezado. */
|
|
@@ -38,10 +38,38 @@ export interface PartsOfficeSummaryEntity {
|
|
|
38
38
|
received: number;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
/**
|
|
41
|
+
/** Destinatario del gestor (una persona o un área) de un documento por despachar. */
|
|
42
|
+
export interface PartsOfficeInternalRecipientEntity {
|
|
43
|
+
type: 'Employee' | 'Directorate' | 'Department';
|
|
44
|
+
employeeId: string | null;
|
|
45
|
+
directorateCodeReference: number | null;
|
|
46
|
+
departmentId: string | null;
|
|
47
|
+
name: string;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* A quién de DocDigital va un destinatario del gestor: la persona, o la jefatura del área (director o encargado). Lo
|
|
52
|
+
* arma el gateway con su RUN; `key` lo identifica y `label` dice de qué destinatario viene.
|
|
53
|
+
*/
|
|
54
|
+
export interface DocDigitalInternalPersonInput {
|
|
55
|
+
key: string;
|
|
56
|
+
label: string;
|
|
57
|
+
fullName: string;
|
|
58
|
+
run: string;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/** El cruce de un destinatario del gestor con su usuario de DocDigital (por RUN); sin usuario, `userId` es `null`. */
|
|
62
|
+
export interface DocDigitalInternalMatchEntity extends DocDigitalInternalPersonInput {
|
|
63
|
+
userId: number | null;
|
|
64
|
+
userName: string | null;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/** Documento que despacha Oficina de Partes: en el gestor y, si corresponde, por DocDigital. */
|
|
42
68
|
export interface PartsOfficeDispatchEntity extends DocumentDispatchResponseEntity {
|
|
43
69
|
document: DocumentLinkEntity & { accessLevel: string };
|
|
44
70
|
externalRecipients: DocumentExternalRecipientResponseEntity[];
|
|
71
|
+
/** Sus destinatarios del gestor: se le despachan en el gestor y, si Partes lo elige, también por DocDigital. */
|
|
72
|
+
internalRecipients: PartsOfficeInternalRecipientEntity[];
|
|
45
73
|
/** A nombre de quién sale: la entidad emisora del tipo documental o la municipalidad. */
|
|
46
74
|
issuerName: string;
|
|
47
75
|
/** Si está por foliar: lo necesario para proponer la estampa del folio sobre su vista previa. */
|