@minvws/mgo-hcim-pdf 0.0.0-stage → 0.1.2
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/CHANGELOG.md +34 -0
- package/LICENSE.md +7 -0
- package/README.md +87 -2
- package/dist/api/createCategoryPdf/createCategoryPdf.d.ts +12 -0
- package/dist/api/createCategoryPdf/createCategoryPdf.d.ts.map +1 -0
- package/dist/api/createCategoryPdf/createCategoryPdf.js +19 -0
- package/dist/api/createPdf/createPdf.d.ts +10 -0
- package/dist/api/createPdf/createPdf.d.ts.map +1 -0
- package/dist/api/createPdf/createPdf.js +26 -0
- package/dist/api/createUiSchemaPdf/createUiSchemaPdf.d.ts +7 -0
- package/dist/api/createUiSchemaPdf/createUiSchemaPdf.d.ts.map +1 -0
- package/dist/api/createUiSchemaPdf/createUiSchemaPdf.js +17 -0
- package/dist/directives/index.d.ts +2 -0
- package/dist/directives/index.d.ts.map +1 -0
- package/dist/directives/index.js +1 -0
- package/dist/directives/pageBreak/pageBreak.d.ts +3 -0
- package/dist/directives/pageBreak/pageBreak.d.ts.map +1 -0
- package/dist/directives/pageBreak/pageBreak.js +3 -0
- package/dist/elements/card/card.d.ts +7 -0
- package/dist/elements/card/card.d.ts.map +1 -0
- package/dist/elements/card/card.js +25 -0
- package/dist/elements/heading/heading.d.ts +8 -0
- package/dist/elements/heading/heading.d.ts.map +1 -0
- package/dist/elements/heading/heading.js +25 -0
- package/dist/elements/icon/icon.d.ts +8 -0
- package/dist/elements/icon/icon.d.ts.map +1 -0
- package/dist/elements/icon/icon.js +11 -0
- package/dist/elements/icon/icons.d.ts +6 -0
- package/dist/elements/icon/icons.d.ts.map +1 -0
- package/dist/elements/icon/icons.js +4 -0
- package/dist/elements/iconText/iconText.d.ts +7 -0
- package/dist/elements/iconText/iconText.d.ts.map +1 -0
- package/dist/elements/iconText/iconText.js +18 -0
- package/dist/elements/image/image.d.ts +9 -0
- package/dist/elements/image/image.d.ts.map +1 -0
- package/dist/elements/image/image.js +19 -0
- package/dist/elements/index.d.ts +11 -0
- package/dist/elements/index.d.ts.map +1 -0
- package/dist/elements/index.js +10 -0
- package/dist/elements/pageFooter/pageFooter.d.ts +15 -0
- package/dist/elements/pageFooter/pageFooter.d.ts.map +1 -0
- package/dist/elements/pageFooter/pageFooter.js +44 -0
- package/dist/elements/pageHeader/pageHeader.d.ts +8 -0
- package/dist/elements/pageHeader/pageHeader.d.ts.map +1 -0
- package/dist/elements/pageHeader/pageHeader.js +18 -0
- package/dist/elements/row/row.d.ts +8 -0
- package/dist/elements/row/row.d.ts.map +1 -0
- package/dist/elements/row/row.js +12 -0
- package/dist/elements/stack/stack.d.ts +7 -0
- package/dist/elements/stack/stack.d.ts.map +1 -0
- package/dist/elements/stack/stack.js +11 -0
- package/dist/elements/text/text.d.ts +12 -0
- package/dist/elements/text/text.d.ts.map +1 -0
- package/dist/elements/text/text.js +23 -0
- package/dist/fonts/helvetica-bold.base64.d.ts +2 -0
- package/dist/fonts/helvetica-bold.base64.d.ts.map +1 -0
- package/dist/fonts/helvetica-bold.base64.js +3 -0
- package/dist/fonts/helvetica.base64.d.ts +2 -0
- package/dist/fonts/helvetica.base64.d.ts.map +1 -0
- package/dist/fonts/helvetica.base64.js +3 -0
- package/dist/fonts/index.d.ts +11 -0
- package/dist/fonts/index.d.ts.map +1 -0
- package/dist/fonts/index.js +8 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/layout/bounds/pdfContentBounds/pdfContentBounds.d.ts +4 -0
- package/dist/layout/bounds/pdfContentBounds/pdfContentBounds.d.ts.map +1 -0
- package/dist/layout/bounds/pdfContentBounds/pdfContentBounds.js +9 -0
- package/dist/layout/measure/measureElement/measureElement.d.ts +5 -0
- package/dist/layout/measure/measureElement/measureElement.d.ts.map +1 -0
- package/dist/layout/measure/measureElement/measureElement.js +31 -0
- package/dist/layout/measure/measureGroupHeight/measureGroupHeight.d.ts +3 -0
- package/dist/layout/measure/measureGroupHeight/measureGroupHeight.d.ts.map +1 -0
- package/dist/layout/measure/measureGroupHeight/measureGroupHeight.js +25 -0
- package/dist/layout/measure/measureLeafHeight/measureLeafHeight.d.ts +3 -0
- package/dist/layout/measure/measureLeafHeight/measureLeafHeight.d.ts.map +1 -0
- package/dist/layout/measure/measureLeafHeight/measureLeafHeight.js +14 -0
- package/dist/layout/measure/measureTextHeight/measureTextHeight.d.ts +3 -0
- package/dist/layout/measure/measureTextHeight/measureTextHeight.d.ts.map +1 -0
- package/dist/layout/measure/measureTextHeight/measureTextHeight.js +79 -0
- package/dist/layout/pagination/clampElementHeight/clampElementHeight.d.ts +3 -0
- package/dist/layout/pagination/clampElementHeight/clampElementHeight.d.ts.map +1 -0
- package/dist/layout/pagination/clampElementHeight/clampElementHeight.js +14 -0
- package/dist/layout/pagination/paginateElements/paginateElements.d.ts +3 -0
- package/dist/layout/pagination/paginateElements/paginateElements.d.ts.map +1 -0
- package/dist/layout/pagination/paginateElements/paginateElements.js +50 -0
- package/dist/layout/pagination/splitCardIntoFragments/splitCardIntoFragments.d.ts +3 -0
- package/dist/layout/pagination/splitCardIntoFragments/splitCardIntoFragments.d.ts.map +1 -0
- package/dist/layout/pagination/splitCardIntoFragments/splitCardIntoFragments.js +49 -0
- package/dist/layout/pagination/splitElementsByPageBreak/splitElementsByPageBreak.d.ts +3 -0
- package/dist/layout/pagination/splitElementsByPageBreak/splitElementsByPageBreak.d.ts.map +1 -0
- package/dist/layout/pagination/splitElementsByPageBreak/splitElementsByPageBreak.js +14 -0
- package/dist/layout/position/getChildBounds/getChildBounds.d.ts +3 -0
- package/dist/layout/position/getChildBounds/getChildBounds.d.ts.map +1 -0
- package/dist/layout/position/getChildBounds/getChildBounds.js +8 -0
- package/dist/layout/position/getRowChildWidths/getRowChildWidths.d.ts +3 -0
- package/dist/layout/position/getRowChildWidths/getRowChildWidths.d.ts.map +1 -0
- package/dist/layout/position/getRowChildWidths/getRowChildWidths.js +21 -0
- package/dist/layout/position/positionElements/positionElements.d.ts +3 -0
- package/dist/layout/position/positionElements/positionElements.d.ts.map +1 -0
- package/dist/layout/position/positionElements/positionElements.js +13 -0
- package/dist/layout/position/positionMeasuredElement/positionMeasuredElement.d.ts +3 -0
- package/dist/layout/position/positionMeasuredElement/positionMeasuredElement.d.ts.map +1 -0
- package/dist/layout/position/positionMeasuredElement/positionMeasuredElement.js +25 -0
- package/dist/layout/position/positionRowChildren/positionRowChildren.d.ts +3 -0
- package/dist/layout/position/positionRowChildren/positionRowChildren.d.ts.map +1 -0
- package/dist/layout/position/positionRowChildren/positionRowChildren.js +21 -0
- package/dist/layout/position/positionStackedChildren/positionStackedChildren.d.ts +3 -0
- package/dist/layout/position/positionStackedChildren/positionStackedChildren.d.ts.map +1 -0
- package/dist/layout/position/positionStackedChildren/positionStackedChildren.js +11 -0
- package/dist/layout/position/shiftElementY/shiftElementY.d.ts +3 -0
- package/dist/layout/position/shiftElementY/shiftElementY.d.ts.map +1 -0
- package/dist/layout/position/shiftElementY/shiftElementY.js +14 -0
- package/dist/layout/schema/collectSchemas/collectSchemas.d.ts +4 -0
- package/dist/layout/schema/collectSchemas/collectSchemas.d.ts.map +1 -0
- package/dist/layout/schema/collectSchemas/collectSchemas.js +29 -0
- package/dist/template/createA4BlankPdf/createA4BlankPdf.d.ts +3 -0
- package/dist/template/createA4BlankPdf/createA4BlankPdf.d.ts.map +1 -0
- package/dist/template/createA4BlankPdf/createA4BlankPdf.js +8 -0
- package/dist/template/createBasePdfWithFooter/createBasePdfWithFooter.d.ts +7 -0
- package/dist/template/createBasePdfWithFooter/createBasePdfWithFooter.d.ts.map +1 -0
- package/dist/template/createBasePdfWithFooter/createBasePdfWithFooter.js +32 -0
- package/dist/toElements/index.d.ts +3 -0
- package/dist/toElements/index.d.ts.map +1 -0
- package/dist/toElements/index.js +2 -0
- package/dist/toElements/subCategory/subCategory.d.ts +8 -0
- package/dist/toElements/subCategory/subCategory.d.ts.map +1 -0
- package/dist/toElements/subCategory/subCategory.js +17 -0
- package/dist/toElements/subCategory/uiSchema.d.ts +4 -0
- package/dist/toElements/subCategory/uiSchema.d.ts.map +1 -0
- package/dist/toElements/subCategory/uiSchema.js +31 -0
- package/dist/toElements/subCategory/uiSchemaGroup.d.ts +4 -0
- package/dist/toElements/subCategory/uiSchemaGroup.d.ts.map +1 -0
- package/dist/toElements/subCategory/uiSchemaGroup.js +20 -0
- package/dist/toElements/uiElement/getElementValue/getElementValue.d.ts +6 -0
- package/dist/toElements/uiElement/getElementValue/getElementValue.d.ts.map +1 -0
- package/dist/toElements/uiElement/getElementValue/getElementValue.js +21 -0
- package/dist/toElements/uiElement/uiElement.d.ts +4 -0
- package/dist/toElements/uiElement/uiElement.d.ts.map +1 -0
- package/dist/toElements/uiElement/uiElement.js +32 -0
- package/dist/toElements/uiSchemaGroup/uiSchemaGroup.d.ts +5 -0
- package/dist/toElements/uiSchemaGroup/uiSchemaGroup.d.ts.map +1 -0
- package/dist/toElements/uiSchemaGroup/uiSchemaGroup.js +36 -0
- package/dist/toElements/uiSchemaSubGroup/uiSchemaSubGroup.d.ts +4 -0
- package/dist/toElements/uiSchemaSubGroup/uiSchemaSubGroup.d.ts.map +1 -0
- package/dist/toElements/uiSchemaSubGroup/uiSchemaSubGroup.js +20 -0
- package/dist/transforms/index.d.ts +4 -0
- package/dist/transforms/index.d.ts.map +1 -0
- package/dist/transforms/index.js +3 -0
- package/dist/transforms/normalizeBaseElementProps/normalizeBaseElementProps.d.ts +4 -0
- package/dist/transforms/normalizeBaseElementProps/normalizeBaseElementProps.d.ts.map +1 -0
- package/dist/transforms/normalizeBaseElementProps/normalizeBaseElementProps.js +12 -0
- package/dist/transforms/pxToMm/pxToMm.d.ts +2 -0
- package/dist/transforms/pxToMm/pxToMm.d.ts.map +1 -0
- package/dist/transforms/pxToMm/pxToMm.js +5 -0
- package/dist/transforms/pxToPt/pxToPt.d.ts +2 -0
- package/dist/transforms/pxToPt/pxToPt.d.ts.map +1 -0
- package/dist/transforms/pxToPt/pxToPt.js +5 -0
- package/dist/types/bounds.d.ts +7 -0
- package/dist/types/bounds.d.ts.map +1 -0
- package/dist/types/bounds.js +1 -0
- package/dist/types/elements.d.ts +36 -0
- package/dist/types/elements.d.ts.map +1 -0
- package/dist/types/elements.js +1 -0
- package/dist/types/geometry.d.ts +15 -0
- package/dist/types/geometry.d.ts.map +1 -0
- package/dist/types/geometry.js +1 -0
- package/dist/types/index.d.ts +6 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +1 -0
- package/dist/types/schema.d.ts +44 -0
- package/dist/types/schema.d.ts.map +1 -0
- package/dist/types/schema.js +1 -0
- package/dist/types/typeguards.d.ts +13 -0
- package/dist/types/typeguards.d.ts.map +1 -0
- package/dist/types/typeguards.js +18 -0
- package/package.json +42 -3
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
## 0.1.2 (2026-11-03)
|
|
2
|
+
|
|
3
|
+
### 🧱 Updated Dependencies
|
|
4
|
+
|
|
5
|
+
- Updated @minvws/mgo-utils to 0.1.4
|
|
6
|
+
- Updated @minvws/mgo-hcim-ui to 0.1.3
|
|
7
|
+
|
|
8
|
+
## 0.1.1 (2026-10-22)
|
|
9
|
+
|
|
10
|
+
### 🚀 Features
|
|
11
|
+
|
|
12
|
+
- **hcim-pdf:** add readme for hcim-pdf ([3fc24d80](https://github.com/minvws/nl-mgo-app-web-private/commit/3fc24d80))
|
|
13
|
+
- type discriminators update ([d6628926](https://github.com/minvws/nl-mgo-app-web-private/commit/d6628926))
|
|
14
|
+
- **hcim-pdf:** ignore dicom_viewer for pdf's ([91bd3135](https://github.com/minvws/nl-mgo-app-web-private/commit/91bd3135))
|
|
15
|
+
- remove MultipleGroupedValues type from HealthUiSchema ([55ffa396](https://github.com/minvws/nl-mgo-app-web-private/commit/55ffa396))
|
|
16
|
+
- add DICOM_VIEWER type ([6cdacdea](https://github.com/minvws/nl-mgo-app-web-private/commit/6cdacdea))
|
|
17
|
+
- add empty_value type ([ea7a60e3](https://github.com/minvws/nl-mgo-app-web-private/commit/ea7a60e3))
|
|
18
|
+
- **hcim-pdf:** refactor to elements/layout setup, add schema pdf ([f84f760b](https://github.com/minvws/nl-mgo-app-web-private/commit/f84f760b))
|
|
19
|
+
- **hcim-pdf:** add hcim-pdf ([b7e3c51d](https://github.com/minvws/nl-mgo-app-web-private/commit/b7e3c51d))
|
|
20
|
+
|
|
21
|
+
### 🩹 Fixes
|
|
22
|
+
|
|
23
|
+
- npm audit patches ([0386911d](https://github.com/minvws/nl-mgo-app-web-private/commit/0386911d))
|
|
24
|
+
- **hcim-pdf:** update pdf snapshots only when called for ([910e1674](https://github.com/minvws/nl-mgo-app-web-private/commit/910e1674))
|
|
25
|
+
|
|
26
|
+
### 🧱 Updated Dependencies
|
|
27
|
+
|
|
28
|
+
- Updated @minvws/mgo-utils to 0.1.3
|
|
29
|
+
- Updated @minvws/mgo-hcim-ui to 0.1.2
|
|
30
|
+
|
|
31
|
+
### ❤️ Thank You
|
|
32
|
+
|
|
33
|
+
- Geert Fokke
|
|
34
|
+
- Otto Boekesteijn
|
package/LICENSE.md
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
The source code is released under the [EUPL license](./LICENSES/EUPL-1.2.txt).
|
|
2
|
+
The documentation is released under the [CC0 license](./LICENSES/CC0-1.0.txt).
|
|
3
|
+
The EUPL 1.2 and the CC0 do not apply to photos, videos, infographics, fonts or other forms of media.
|
|
4
|
+
Specifically the rijkslogo and rijkshuisstijl have specific [terms of use](./LICENSES/LicenseRef-Rijkshuisstijl.txt).
|
|
5
|
+
|
|
6
|
+
This repository follows the [REUSE Specfication v3.3](https://reuse.software/spec/).
|
|
7
|
+
Please see [REUSE.toml](./REUSE.toml) and the individual `*.license` files for copyright and license information.
|
package/README.md
CHANGED
|
@@ -1,3 +1,88 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @minvws/mgo-hcim-pdf
|
|
2
2
|
|
|
3
|
-
This
|
|
3
|
+
This package renders [Health UI Schemas][packages-hcim-ui] to paginated, printable PDF documents. It is used to let users export their health data (a single category, or a whole overview) as a PDF.
|
|
4
|
+
|
|
5
|
+
For more context on why / how this is used please [visit the about documentation][about-hcim-ui].
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```shell
|
|
10
|
+
npm i --save @minvws/mgo-hcim-pdf
|
|
11
|
+
|
|
12
|
+
# or
|
|
13
|
+
|
|
14
|
+
pnpm add @minvws/mgo-hcim-pdf
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Use
|
|
18
|
+
|
|
19
|
+
```typescript
|
|
20
|
+
import { createCategoryPdf, createUiSchemaPdf } from '@minvws/mgo-hcim-pdf';
|
|
21
|
+
import { type HealthUiSchema } from '@minvws/mgo-hcim-ui';
|
|
22
|
+
|
|
23
|
+
// Render a single Health UI Schema, e.g. the details of one health record
|
|
24
|
+
const uiSchemaPdfBytes = await createUiSchemaPdf({
|
|
25
|
+
schema: healthUiSchema as HealthUiSchema,
|
|
26
|
+
generatedAtLabel: 'Generated on 18 August 2026, 12:00',
|
|
27
|
+
footer: 'This export was generated via MGO',
|
|
28
|
+
footerPaginationTemplate: 'Page {currentPage} of {totalPages}',
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
// Render a full category, grouping the summaries of multiple sub categories
|
|
32
|
+
const categoryPdfBytes = await createCategoryPdf({
|
|
33
|
+
heading: 'Medication',
|
|
34
|
+
generatedAtLabel: 'Generated on 18 August 2026, 12:00',
|
|
35
|
+
noDataMessage: 'No data available',
|
|
36
|
+
subCategories: [{ heading: 'Medication use', schemas: [healthUiSchema as HealthUiSchema] }],
|
|
37
|
+
footer: 'This export was generated via MGO',
|
|
38
|
+
footerPaginationTemplate: 'Page {currentPage} of {totalPages}',
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
const blob = new Blob([uiSchemaPdfBytes], { type: 'application/pdf' });
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## API
|
|
45
|
+
|
|
46
|
+
### createUiSchemaPdf( options )
|
|
47
|
+
|
|
48
|
+
The `createUiSchemaPdf()` function renders a single `HealthUiSchema` (its groups of fields, excluding any marked `excludeFromPrint`) to a PDF.
|
|
49
|
+
|
|
50
|
+
- **@param** `{HealthUiSchema} options.schema`
|
|
51
|
+
The Health UI Schema to render.
|
|
52
|
+
- **@param** `{string} options.generatedAtLabel`
|
|
53
|
+
Label shown under the heading, e.g. the date/time the export was generated.
|
|
54
|
+
- **@param** `{string} options.footer`
|
|
55
|
+
Disclaimer text shown in the page footer.
|
|
56
|
+
- **@param** `{string} options.footerPaginationTemplate`
|
|
57
|
+
Template for the pagination text in the footer. Supports the `{currentPage}` and `{totalPages}` placeholders.
|
|
58
|
+
- **@returns** `{Promise<Uint8Array>}`
|
|
59
|
+
Resolves with the generated PDF as bytes.
|
|
60
|
+
|
|
61
|
+
### createCategoryPdf( options )
|
|
62
|
+
|
|
63
|
+
The `createCategoryPdf()` function renders one or more sub categories, each a heading with a list of `HealthUiSchema` summaries, to a single PDF. Sub categories are separated by a page break.
|
|
64
|
+
|
|
65
|
+
- **@param** `{string} options.heading`
|
|
66
|
+
Heading of the PDF.
|
|
67
|
+
- **@param** `{string} options.generatedAtLabel`
|
|
68
|
+
Label shown under the heading, e.g. the date/time the export was generated.
|
|
69
|
+
- **@param** `{string} options.noDataMessage`
|
|
70
|
+
Message shown for a sub category that has no schemas.
|
|
71
|
+
- **@param** `{Array.<{heading: string, schemas: HealthUiSchema[]}>} options.subCategories`
|
|
72
|
+
The sub categories to render, each with its own heading and list of Health UI Schema summaries.
|
|
73
|
+
- **@param** `{string} options.footer`
|
|
74
|
+
Disclaimer text shown in the page footer.
|
|
75
|
+
- **@param** `{string} options.footerPaginationTemplate`
|
|
76
|
+
Template for the pagination text in the footer. Supports the `{currentPage}` and `{totalPages}` placeholders.
|
|
77
|
+
- **@returns** `{Promise<Uint8Array>}`
|
|
78
|
+
Resolves with the generated PDF as bytes.
|
|
79
|
+
|
|
80
|
+
<hr />
|
|
81
|
+
|
|
82
|
+
See the **[package source][source]** for more details
|
|
83
|
+
|
|
84
|
+
_This package and its documentation are still under development._
|
|
85
|
+
|
|
86
|
+
[packages-hcim-ui]: https://github.com/minvws/nl-mgo-app-web/tree/main/packages/hcim-ui
|
|
87
|
+
[about-hcim-ui]: https://github.com/minvws/nl-mgo-app-web/blob/main/docs/about.md#from-hcim-to-ui
|
|
88
|
+
[source]: https://github.com/minvws/nl-mgo-app-web/tree/main/packages/hcim-pdf
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { HealthUiSchema } from '@minvws/mgo-hcim-ui';
|
|
2
|
+
import { CreatePdfOptions } from '../createPdf/createPdf.js';
|
|
3
|
+
export type SubCategory = {
|
|
4
|
+
readonly heading: string;
|
|
5
|
+
readonly schemas: HealthUiSchema[];
|
|
6
|
+
};
|
|
7
|
+
export interface CreateCategoryPdfOptions extends Pick<CreatePdfOptions, 'heading' | 'generatedAtLabel' | 'footer' | 'footerPaginationTemplate'> {
|
|
8
|
+
readonly noDataMessage: string;
|
|
9
|
+
readonly subCategories: SubCategory[];
|
|
10
|
+
}
|
|
11
|
+
export declare function createCategoryPdf({ noDataMessage, subCategories, heading, generatedAtLabel, footer, footerPaginationTemplate, }: CreateCategoryPdfOptions): Promise<import("@pdfme/common").PdfBytes>;
|
|
12
|
+
//# sourceMappingURL=createCategoryPdf.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createCategoryPdf.d.ts","sourceRoot":"","sources":["../../../src/api/createCategoryPdf/createCategoryPdf.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAGrD,OAAO,EAAa,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAExE,MAAM,MAAM,WAAW,GAAG;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,OAAO,EAAE,cAAc,EAAE,CAAC;CACtC,CAAC;AAEF,MAAM,WAAW,wBAAyB,SAAQ,IAAI,CAClD,gBAAgB,EAChB,SAAS,GAAG,kBAAkB,GAAG,QAAQ,GAAG,0BAA0B,CACzE;IACG,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,aAAa,EAAE,WAAW,EAAE,CAAC;CACzC;AAED,wBAAsB,iBAAiB,CAAC,EACpC,aAAa,EACb,aAAa,EACb,OAAO,EACP,gBAAgB,EAChB,MAAM,EACN,wBAAwB,GAC3B,EAAE,wBAAwB,6CAgB1B"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { pageBreak } from '../../directives/index.js';
|
|
2
|
+
import { subCategoryToElements } from '../../toElements/index.js';
|
|
3
|
+
import { createPdf } from '../createPdf/createPdf.js';
|
|
4
|
+
export async function createCategoryPdf({ noDataMessage, subCategories, heading, generatedAtLabel, footer, footerPaginationTemplate, }) {
|
|
5
|
+
const subCategoryElements = subCategories.flatMap((subCategory, index) => {
|
|
6
|
+
const isNotLast = index < subCategories.length - 1;
|
|
7
|
+
return [
|
|
8
|
+
...subCategoryToElements(subCategory, noDataMessage),
|
|
9
|
+
...(isNotLast ? [pageBreak()] : []),
|
|
10
|
+
];
|
|
11
|
+
});
|
|
12
|
+
return createPdf({
|
|
13
|
+
heading,
|
|
14
|
+
generatedAtLabel,
|
|
15
|
+
footer,
|
|
16
|
+
footerPaginationTemplate,
|
|
17
|
+
elements: subCategoryElements,
|
|
18
|
+
});
|
|
19
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Directive, Element } from '../../types/index.js';
|
|
2
|
+
export type CreatePdfOptions = {
|
|
3
|
+
readonly heading: string;
|
|
4
|
+
readonly generatedAtLabel: string;
|
|
5
|
+
readonly footer: string;
|
|
6
|
+
readonly footerPaginationTemplate: string;
|
|
7
|
+
elements: (Element | Directive)[];
|
|
8
|
+
};
|
|
9
|
+
export declare function createPdf({ heading, generatedAtLabel, footer, footerPaginationTemplate, elements, }: CreatePdfOptions): Promise<import("@pdfme/generator").PdfBytes>;
|
|
10
|
+
//# sourceMappingURL=createPdf.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createPdf.d.ts","sourceRoot":"","sources":["../../../src/api/createPdf/createPdf.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAE1D,MAAM,MAAM,gBAAgB,GAAG;IAC3B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,wBAAwB,EAAE,MAAM,CAAC;IAC1C,QAAQ,EAAE,CAAC,OAAO,GAAG,SAAS,CAAC,EAAE,CAAC;CACrC,CAAC;AAEF,wBAAsB,SAAS,CAAC,EAC5B,OAAO,EACP,gBAAgB,EAChB,MAAM,EACN,wBAAwB,EACxB,QAAQ,GACX,EAAE,gBAAgB,gDAkBlB"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { generate } from '@pdfme/generator';
|
|
2
|
+
import { image as imagePlugin, rectangle, text as textPlugin } from '@pdfme/schemas';
|
|
3
|
+
import { pageHeader } from '../../elements/index.js';
|
|
4
|
+
import { fonts } from '../../fonts/index.js';
|
|
5
|
+
import { pdfContentBounds } from '../../layout/bounds/pdfContentBounds/pdfContentBounds.js';
|
|
6
|
+
import { paginateElements } from '../../layout/pagination/paginateElements/paginateElements.js';
|
|
7
|
+
import { collectSchemas } from '../../layout/schema/collectSchemas/collectSchemas.js';
|
|
8
|
+
import { createBasePdfWithFooter } from '../../template/createBasePdfWithFooter/createBasePdfWithFooter.js';
|
|
9
|
+
import { pxToMm } from '../../transforms/index.js';
|
|
10
|
+
export async function createPdf({ heading, generatedAtLabel, footer, footerPaginationTemplate, elements, }) {
|
|
11
|
+
const basePdf = createBasePdfWithFooter({ footer, footerPaginationTemplate });
|
|
12
|
+
const bounds = pdfContentBounds(basePdf);
|
|
13
|
+
const header = pageHeader({
|
|
14
|
+
heading,
|
|
15
|
+
generatedAt: generatedAtLabel,
|
|
16
|
+
margin: { bottom: pxToMm(16) },
|
|
17
|
+
});
|
|
18
|
+
const paginatedPositionedElements = paginateElements([header, ...elements], bounds);
|
|
19
|
+
const schemas = paginatedPositionedElements.map((page) => collectSchemas(page));
|
|
20
|
+
return generate({
|
|
21
|
+
template: { basePdf, schemas },
|
|
22
|
+
plugins: { text: textPlugin, rectangle, image: imagePlugin },
|
|
23
|
+
options: { font: fonts },
|
|
24
|
+
inputs: [{}],
|
|
25
|
+
});
|
|
26
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { HealthUiSchema } from '@minvws/mgo-hcim-ui';
|
|
2
|
+
import { CreatePdfOptions } from '../createPdf/createPdf.js';
|
|
3
|
+
export interface CreateUiSchemaPdfOptions extends Pick<CreatePdfOptions, 'generatedAtLabel' | 'footer' | 'footerPaginationTemplate'> {
|
|
4
|
+
readonly schema: HealthUiSchema;
|
|
5
|
+
}
|
|
6
|
+
export declare function createUiSchemaPdf({ schema, generatedAtLabel, footer, footerPaginationTemplate, }: CreateUiSchemaPdfOptions): Promise<import("@pdfme/common").PdfBytes>;
|
|
7
|
+
//# sourceMappingURL=createUiSchemaPdf.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createUiSchemaPdf.d.ts","sourceRoot":"","sources":["../../../src/api/createUiSchemaPdf/createUiSchemaPdf.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAe,MAAM,qBAAqB,CAAC;AAElE,OAAO,EAAa,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAExE,MAAM,WAAW,wBAAyB,SAAQ,IAAI,CAClD,gBAAgB,EAChB,kBAAkB,GAAG,QAAQ,GAAG,0BAA0B,CAC7D;IACG,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC;CACnC;AAED,wBAAsB,iBAAiB,CAAC,EACpC,MAAM,EACN,gBAAgB,EAChB,MAAM,EACN,wBAAwB,GAC3B,EAAE,wBAAwB,6CAa1B"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { isGroupNode } from '@minvws/mgo-hcim-ui';
|
|
2
|
+
import { uiSchemaGroupToElements } from '../../toElements/index.js';
|
|
3
|
+
import { createPdf } from '../createPdf/createPdf.js';
|
|
4
|
+
export async function createUiSchemaPdf({ schema, generatedAtLabel, footer, footerPaginationTemplate, }) {
|
|
5
|
+
return createPdf({
|
|
6
|
+
heading: schema.label,
|
|
7
|
+
generatedAtLabel,
|
|
8
|
+
footer,
|
|
9
|
+
footerPaginationTemplate,
|
|
10
|
+
elements: [
|
|
11
|
+
...schema.children
|
|
12
|
+
.filter((child) => isGroupNode(child))
|
|
13
|
+
.filter((child) => !child.excludeFromPrint)
|
|
14
|
+
.flatMap((child) => uiSchemaGroupToElements(child)),
|
|
15
|
+
],
|
|
16
|
+
});
|
|
17
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/directives/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './pageBreak/pageBreak.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pageBreak.d.ts","sourceRoot":"","sources":["../../../src/directives/pageBreak/pageBreak.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,wBAAgB,SAAS,IAAI,kBAAkB,CAE9C"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { PartialDeep } from 'type-fest';
|
|
2
|
+
import { BaseElementProps, Element, GroupElement } from '../../types/index.js';
|
|
3
|
+
export interface CardProps extends PartialDeep<BaseElementProps> {
|
|
4
|
+
children: Element[];
|
|
5
|
+
}
|
|
6
|
+
export declare function card(props: CardProps): GroupElement<'card'>;
|
|
7
|
+
//# sourceMappingURL=card.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"card.d.ts","sourceRoot":"","sources":["../../../src/elements/card/card.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAE7C,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAE/E,MAAM,WAAW,SAAU,SAAQ,WAAW,CAAC,gBAAgB,CAAC;IAC5D,QAAQ,EAAE,OAAO,EAAE,CAAC;CACvB;AAED,wBAAgB,IAAI,CAAC,KAAK,EAAE,SAAS,GAAG,YAAY,CAAC,MAAM,CAAC,CAuB3D"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { uniqueId } from 'lodash-es';
|
|
2
|
+
import { normalizeBaseElementProps, pxToMm } from '../../transforms/index.js';
|
|
3
|
+
export function card(props) {
|
|
4
|
+
const baseProps = normalizeBaseElementProps(props, {
|
|
5
|
+
padding: {
|
|
6
|
+
top: pxToMm(12),
|
|
7
|
+
bottom: pxToMm(12),
|
|
8
|
+
left: pxToMm(12),
|
|
9
|
+
right: pxToMm(12),
|
|
10
|
+
},
|
|
11
|
+
});
|
|
12
|
+
return {
|
|
13
|
+
kind: 'element',
|
|
14
|
+
type: 'card',
|
|
15
|
+
layout: 'stack',
|
|
16
|
+
...baseProps,
|
|
17
|
+
children: props.children,
|
|
18
|
+
backgroundSchema: {
|
|
19
|
+
name: uniqueId('card'),
|
|
20
|
+
type: 'rectangle',
|
|
21
|
+
borderWidth: pxToMm(1),
|
|
22
|
+
borderColor: '#E7E7E7',
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { PartialDeep } from 'type-fest';
|
|
2
|
+
import { BaseElementProps, LeafElement } from '../../types/index.js';
|
|
3
|
+
export interface HeadingProps extends PartialDeep<BaseElementProps> {
|
|
4
|
+
text: string;
|
|
5
|
+
size: 'xs' | 'sm' | 'md' | 'lg';
|
|
6
|
+
}
|
|
7
|
+
export declare function heading({ text, size, ...rest }: HeadingProps): LeafElement<'heading'>;
|
|
8
|
+
//# sourceMappingURL=heading.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"heading.d.ts","sourceRoot":"","sources":["../../../src/elements/heading/heading.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAE7C,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAErE,MAAM,WAAW,YAAa,SAAQ,WAAW,CAAC,gBAAgB,CAAC;IAC/D,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;CACnC;AASD,wBAAgB,OAAO,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,IAAI,EAAE,EAAE,YAAY,GAAG,WAAW,CAAC,SAAS,CAAC,CAiBrF"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { uniqueId } from 'lodash-es';
|
|
2
|
+
import { normalizeBaseElementProps, pxToPt } from '../../transforms/index.js';
|
|
3
|
+
const HeadingStyle = {
|
|
4
|
+
xs: pxToPt(12),
|
|
5
|
+
sm: pxToPt(14),
|
|
6
|
+
md: pxToPt(16),
|
|
7
|
+
lg: pxToPt(24),
|
|
8
|
+
};
|
|
9
|
+
export function heading({ text, size, ...rest }) {
|
|
10
|
+
const baseProps = normalizeBaseElementProps(rest);
|
|
11
|
+
return {
|
|
12
|
+
kind: 'element',
|
|
13
|
+
type: 'heading',
|
|
14
|
+
...baseProps,
|
|
15
|
+
schema: {
|
|
16
|
+
name: uniqueId('groupHeading'),
|
|
17
|
+
type: 'text',
|
|
18
|
+
content: text,
|
|
19
|
+
readOnly: true,
|
|
20
|
+
fontName: 'Helvetica-Bold',
|
|
21
|
+
fontSize: HeadingStyle[size],
|
|
22
|
+
lineHeight: 1.2,
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { PartialDeep } from 'type-fest';
|
|
2
|
+
import type { BaseElementProps, LeafElement } from '../../types/index.js';
|
|
3
|
+
import type { IconName } from './icons.js';
|
|
4
|
+
export interface IconProps extends PartialDeep<BaseElementProps> {
|
|
5
|
+
iconName: IconName;
|
|
6
|
+
}
|
|
7
|
+
export declare function icon({ iconName, ...rest }: IconProps): LeafElement<'image', 'image'>;
|
|
8
|
+
//# sourceMappingURL=icon.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"icon.d.ts","sourceRoot":"","sources":["../../../src/elements/icon/icon.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAE7C,OAAO,KAAK,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAE1E,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAG3C,MAAM,WAAW,SAAU,SAAQ,WAAW,CAAC,gBAAgB,CAAC;IAC5D,QAAQ,EAAE,QAAQ,CAAC;CACtB;AAED,wBAAgB,IAAI,CAAC,EAAE,QAAQ,EAAE,GAAG,IAAI,EAAE,EAAE,SAAS,GAAG,WAAW,CAAC,OAAO,EAAE,OAAO,CAAC,CAOpF"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { pxToMm } from '../../transforms/index.js';
|
|
2
|
+
import { image } from '../image/image.js';
|
|
3
|
+
import { icons } from './icons.js';
|
|
4
|
+
export function icon({ iconName, ...rest }) {
|
|
5
|
+
return image({
|
|
6
|
+
dataUrl: icons[iconName],
|
|
7
|
+
width: pxToMm(11),
|
|
8
|
+
height: pxToMm(11),
|
|
9
|
+
...rest,
|
|
10
|
+
});
|
|
11
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** Base64 data URLs keyed by logical icon name. */
|
|
2
|
+
export declare const icons: {
|
|
3
|
+
readonly attachment: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACEAAAAhCAYAAABX5MJvAAAACXBIWXMAACE4AAAhOAFFljFgAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAOdEVYdFNvZnR3YXJlAEZpZ21hnrGWYwAAAk9JREFUeAHtls1u00AQx2c3gQNpq0gkqDcceIFypReTgMSN8ARJ3oCSIHFruCER0vQJyhuQIxJt6l7gSI6cqC9Ipc0hNIVKcXeHmXyAHeImdtubf1Ki9Xjs/e/szKwBIiIiIs5HzHJYflgxlcYCCLEiEJMQEBSiS//t61Jufv/4pg1BRKQfvVgBrTcAwYRLQgBWD1v1V//b/QQovUtDXnkXQWyiwLYYrCrE5AqLNFOBxxJw7Uer3jhXxPLjl4bqO19YAAI0F7Qq2VYj1ORu0tnnRZpui4bdxNJixm5W/74zPumsHGedBVAOWJ2d2tOOW6D5zIB43IB5icftgw+vbR4eterv0rlKARDN0+OTIpkaU0WMosAOEFNnJY/dcbYU54dGmJu+w8IzB1bD5kuBsEdPmzjc5n9a3Req3zcHOyTAGj84tDucHwb9unR37q2hyrA91zC9ujwiBEiDHEmx2BvbRklqsICYVvfc4kLwZDgRtn1FzCKsACNfTf7u9TYQwaBI2oc7b5u+IjRoCrfgsN0e2xzHsa/JGG9BMpUr70pXlOaB3/XruJeHUR5oKUqTPp4STVF3FBp5/z1ldDNXzkuE93ABOAIsoLNds6bc83IrW95HTkIpGkfbtbWxncvzTMq8BBm4dWsJ1rTJfUW4V+3XZi+b2KThdP/z1xuZVUHqTJJhJu7cN5burv48+fbJhivC9wBLZStVisT6hLMNAeATNLG48MDdogOJYDgPlIhVyYvrO3AuMNRbMrNKe+b3xJgknxsh6F6suUVEREQM+API9u5i/hPquAAAAABJRU5ErkJggg==";
|
|
4
|
+
};
|
|
5
|
+
export type IconName = keyof typeof icons;
|
|
6
|
+
//# sourceMappingURL=icons.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"icons.d.ts","sourceRoot":"","sources":["../../../src/elements/icon/icons.ts"],"names":[],"mappings":"AAAA,mDAAmD;AACnD,eAAO,MAAM,KAAK;;CAGmC,CAAC;AAEtD,MAAM,MAAM,QAAQ,GAAG,MAAM,OAAO,KAAK,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/** Base64 data URLs keyed by logical icon name. */
|
|
2
|
+
export const icons = {
|
|
3
|
+
attachment: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACEAAAAhCAYAAABX5MJvAAAACXBIWXMAACE4AAAhOAFFljFgAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAOdEVYdFNvZnR3YXJlAEZpZ21hnrGWYwAAAk9JREFUeAHtls1u00AQx2c3gQNpq0gkqDcceIFypReTgMSN8ARJ3oCSIHFruCER0vQJyhuQIxJt6l7gSI6cqC9Ipc0hNIVKcXeHmXyAHeImdtubf1Ki9Xjs/e/szKwBIiIiIs5HzHJYflgxlcYCCLEiEJMQEBSiS//t61Jufv/4pg1BRKQfvVgBrTcAwYRLQgBWD1v1V//b/QQovUtDXnkXQWyiwLYYrCrE5AqLNFOBxxJw7Uer3jhXxPLjl4bqO19YAAI0F7Qq2VYj1ORu0tnnRZpui4bdxNJixm5W/74zPumsHGedBVAOWJ2d2tOOW6D5zIB43IB5icftgw+vbR4eterv0rlKARDN0+OTIpkaU0WMosAOEFNnJY/dcbYU54dGmJu+w8IzB1bD5kuBsEdPmzjc5n9a3Req3zcHOyTAGj84tDucHwb9unR37q2hyrA91zC9ujwiBEiDHEmx2BvbRklqsICYVvfc4kLwZDgRtn1FzCKsACNfTf7u9TYQwaBI2oc7b5u+IjRoCrfgsN0e2xzHsa/JGG9BMpUr70pXlOaB3/XruJeHUR5oKUqTPp4STVF3FBp5/z1ldDNXzkuE93ABOAIsoLNds6bc83IrW95HTkIpGkfbtbWxncvzTMq8BBm4dWsJ1rTJfUW4V+3XZi+b2KThdP/z1xuZVUHqTJJhJu7cN5burv48+fbJhivC9wBLZStVisT6hLMNAeATNLG48MDdogOJYDgPlIhVyYvrO3AuMNRbMrNKe+b3xJgknxsh6F6suUVEREQM+API9u5i/hPquAAAAABJRU5ErkJggg==',
|
|
4
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { IconProps } from '../icon/icon.js';
|
|
2
|
+
import { TextProps } from '../text/text.js';
|
|
3
|
+
export interface IconTextProps extends TextProps {
|
|
4
|
+
iconName: IconProps['iconName'];
|
|
5
|
+
}
|
|
6
|
+
export declare function iconText({ iconName, margin, padding, ...rest }: IconTextProps): import("../../types/elements.js").GroupElement<"row", import("../../types/elements.js").Element>;
|
|
7
|
+
//# sourceMappingURL=iconText.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"iconText.d.ts","sourceRoot":"","sources":["../../../src/elements/iconText/iconText.ts"],"names":[],"mappings":"AACA,OAAO,EAAQ,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAElD,OAAO,EAAQ,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAElD,MAAM,WAAW,aAAc,SAAQ,SAAS;IAC5C,QAAQ,EAAE,SAAS,CAAC,UAAU,CAAC,CAAC;CACnC;AAED,wBAAgB,QAAQ,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,EAAE,EAAE,aAAa,oGAa7E"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { pxToMm } from '../../transforms/index.js';
|
|
2
|
+
import { icon } from '../icon/icon.js';
|
|
3
|
+
import { row } from '../row/row.js';
|
|
4
|
+
import { text } from '../text/text.js';
|
|
5
|
+
export function iconText({ iconName, margin, padding, ...rest }) {
|
|
6
|
+
return row({
|
|
7
|
+
margin,
|
|
8
|
+
padding,
|
|
9
|
+
columnWidths: [pxToMm(11), 'fill'],
|
|
10
|
+
children: [
|
|
11
|
+
icon({ iconName }),
|
|
12
|
+
text({
|
|
13
|
+
margin: { left: pxToMm(4) },
|
|
14
|
+
...rest,
|
|
15
|
+
}),
|
|
16
|
+
],
|
|
17
|
+
});
|
|
18
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { PartialDeep } from 'type-fest';
|
|
2
|
+
import { BaseElementProps, LeafElement } from '../../types/index.js';
|
|
3
|
+
export interface ImageProps extends PartialDeep<BaseElementProps> {
|
|
4
|
+
dataUrl: string;
|
|
5
|
+
width: number;
|
|
6
|
+
height: number;
|
|
7
|
+
}
|
|
8
|
+
export declare function image({ dataUrl, width, height, ...rest }: ImageProps): LeafElement<'image', 'image'>;
|
|
9
|
+
//# sourceMappingURL=image.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"image.d.ts","sourceRoot":"","sources":["../../../src/elements/image/image.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAE7C,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAErE,MAAM,WAAW,UAAW,SAAQ,WAAW,CAAC,gBAAgB,CAAC;IAC7D,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAClB;AAED,wBAAgB,KAAK,CAAC,EAClB,OAAO,EACP,KAAK,EACL,MAAM,EACN,GAAG,IAAI,EACV,EAAE,UAAU,GAAG,WAAW,CAAC,OAAO,EAAE,OAAO,CAAC,CAiB5C"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { uniqueId } from 'lodash-es';
|
|
2
|
+
import { normalizeBaseElementProps } from '../../transforms/index.js';
|
|
3
|
+
export function image({ dataUrl, width, height, ...rest }) {
|
|
4
|
+
const baseProps = normalizeBaseElementProps(rest);
|
|
5
|
+
return {
|
|
6
|
+
kind: 'element',
|
|
7
|
+
type: 'image',
|
|
8
|
+
...baseProps,
|
|
9
|
+
schema: {
|
|
10
|
+
name: uniqueId('image'),
|
|
11
|
+
type: 'image',
|
|
12
|
+
src: dataUrl,
|
|
13
|
+
content: dataUrl,
|
|
14
|
+
readOnly: true,
|
|
15
|
+
width,
|
|
16
|
+
height,
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from './card/card.js';
|
|
2
|
+
export * from './heading/heading.js';
|
|
3
|
+
export * from './icon/icon.js';
|
|
4
|
+
export * from './iconText/iconText.js';
|
|
5
|
+
export * from './image/image.js';
|
|
6
|
+
export * from './pageFooter/pageFooter.js';
|
|
7
|
+
export * from './pageHeader/pageHeader.js';
|
|
8
|
+
export * from './row/row.js';
|
|
9
|
+
export * from './stack/stack.js';
|
|
10
|
+
export * from './text/text.js';
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/elements/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC;AACrC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,wBAAwB,CAAC;AACvC,cAAc,kBAAkB,CAAC;AACjC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export * from './card/card.js';
|
|
2
|
+
export * from './heading/heading.js';
|
|
3
|
+
export * from './icon/icon.js';
|
|
4
|
+
export * from './iconText/iconText.js';
|
|
5
|
+
export * from './image/image.js';
|
|
6
|
+
export * from './pageFooter/pageFooter.js';
|
|
7
|
+
export * from './pageHeader/pageHeader.js';
|
|
8
|
+
export * from './row/row.js';
|
|
9
|
+
export * from './stack/stack.js';
|
|
10
|
+
export * from './text/text.js';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { PartialDeep } from 'type-fest';
|
|
2
|
+
import { BaseElementProps, GroupElement, LeafElement } from '../../types/index.js';
|
|
3
|
+
type FooterDisclaimerElement = LeafElement<'footer-disclaimer'>;
|
|
4
|
+
type FooterPaginationElement = LeafElement<'footer-pagination'>;
|
|
5
|
+
type FooterChildElement = FooterDisclaimerElement | FooterPaginationElement;
|
|
6
|
+
export type PageFooterElement = GroupElement<'page-footer', FooterChildElement> & {
|
|
7
|
+
children: [FooterDisclaimerElement, FooterPaginationElement];
|
|
8
|
+
};
|
|
9
|
+
export interface PageFooterProps extends PartialDeep<BaseElementProps> {
|
|
10
|
+
text: string;
|
|
11
|
+
paginationTemplate: string;
|
|
12
|
+
}
|
|
13
|
+
export declare function pageFooter({ text, paginationTemplate, ...basePropsInput }: PageFooterProps): PageFooterElement;
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=pageFooter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pageFooter.d.ts","sourceRoot":"","sources":["../../../src/elements/pageFooter/pageFooter.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAE7C,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnF,KAAK,uBAAuB,GAAG,WAAW,CAAC,mBAAmB,CAAC,CAAC;AAChE,KAAK,uBAAuB,GAAG,WAAW,CAAC,mBAAmB,CAAC,CAAC;AAChE,KAAK,kBAAkB,GAAG,uBAAuB,GAAG,uBAAuB,CAAC;AAE5E,MAAM,MAAM,iBAAiB,GAAG,YAAY,CAAC,aAAa,EAAE,kBAAkB,CAAC,GAAG;IAC9E,QAAQ,EAAE,CAAC,uBAAuB,EAAE,uBAAuB,CAAC,CAAC;CAChE,CAAC;AAEF,MAAM,WAAW,eAAgB,SAAQ,WAAW,CAAC,gBAAgB,CAAC;IAClE,IAAI,EAAE,MAAM,CAAC;IACb,kBAAkB,EAAE,MAAM,CAAC;CAC9B;AAED,wBAAgB,UAAU,CAAC,EACvB,IAAI,EACJ,kBAAkB,EAClB,GAAG,cAAc,EACpB,EAAE,eAAe,GAAG,iBAAiB,CA0CrC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { uniqueId } from 'lodash-es';
|
|
2
|
+
import { normalizeBaseElementProps } from '../../transforms/index.js';
|
|
3
|
+
export function pageFooter({ text, paginationTemplate, ...basePropsInput }) {
|
|
4
|
+
const baseProps = normalizeBaseElementProps(basePropsInput);
|
|
5
|
+
return {
|
|
6
|
+
kind: 'element',
|
|
7
|
+
type: 'page-footer',
|
|
8
|
+
layout: 'row',
|
|
9
|
+
alignItems: 'bottom',
|
|
10
|
+
columnWidths: ['fill', 26],
|
|
11
|
+
...baseProps,
|
|
12
|
+
children: [
|
|
13
|
+
{
|
|
14
|
+
kind: 'element',
|
|
15
|
+
type: 'footer-disclaimer',
|
|
16
|
+
...normalizeBaseElementProps({}),
|
|
17
|
+
schema: {
|
|
18
|
+
name: uniqueId('footer-disclaimer'),
|
|
19
|
+
type: 'text',
|
|
20
|
+
content: text,
|
|
21
|
+
readOnly: true,
|
|
22
|
+
fontSize: 10,
|
|
23
|
+
lineHeight: 1.2,
|
|
24
|
+
fontColor: '#6D6D6D',
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
kind: 'element',
|
|
29
|
+
type: 'footer-pagination',
|
|
30
|
+
...normalizeBaseElementProps({}),
|
|
31
|
+
schema: {
|
|
32
|
+
name: uniqueId('footer-pagination'),
|
|
33
|
+
type: 'text',
|
|
34
|
+
content: paginationTemplate,
|
|
35
|
+
readOnly: true,
|
|
36
|
+
alignment: 'right',
|
|
37
|
+
fontSize: 10,
|
|
38
|
+
lineHeight: 1.2,
|
|
39
|
+
fontColor: '#6D6D6D',
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
],
|
|
43
|
+
};
|
|
44
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { PartialDeep } from 'type-fest';
|
|
2
|
+
import type { BaseElementProps, GroupElement } from '../../types/index.js';
|
|
3
|
+
export interface PageHeaderProps extends PartialDeep<BaseElementProps> {
|
|
4
|
+
heading: string;
|
|
5
|
+
generatedAt: string;
|
|
6
|
+
}
|
|
7
|
+
export declare function pageHeader({ heading, generatedAt, ...basePropsInput }: PageHeaderProps): GroupElement<'row'>;
|
|
8
|
+
//# sourceMappingURL=pageHeader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pageHeader.d.ts","sourceRoot":"","sources":["../../../src/elements/pageHeader/pageHeader.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,KAAK,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAK3E,MAAM,WAAW,eAAgB,SAAQ,WAAW,CAAC,gBAAgB,CAAC;IAClE,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;CACvB;AAED,wBAAgB,UAAU,CAAC,EACvB,OAAO,EACP,WAAW,EACX,GAAG,cAAc,EACpB,EAAE,eAAe,GAAG,YAAY,CAAC,KAAK,CAAC,CAavC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { pxToMm } from '../../transforms/index.js';
|
|
2
|
+
import { heading as headingElement } from '../heading/heading.js';
|
|
3
|
+
import { row } from '../row/row.js';
|
|
4
|
+
import { text } from '../text/text.js';
|
|
5
|
+
export function pageHeader({ heading, generatedAt, ...basePropsInput }) {
|
|
6
|
+
return row({
|
|
7
|
+
columnWidths: ['fill', pxToMm(180)],
|
|
8
|
+
...basePropsInput,
|
|
9
|
+
children: [
|
|
10
|
+
headingElement({ text: heading, size: 'lg' }),
|
|
11
|
+
text({
|
|
12
|
+
margin: { left: pxToMm(4) },
|
|
13
|
+
text: generatedAt,
|
|
14
|
+
style: { fontColor: '#5D5D5D' },
|
|
15
|
+
}),
|
|
16
|
+
],
|
|
17
|
+
});
|
|
18
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { PartialDeep } from 'type-fest';
|
|
2
|
+
import type { BaseElementProps, Element, GroupColumnWidth, GroupElement } from '../../types/index.js';
|
|
3
|
+
export interface RowProps extends PartialDeep<BaseElementProps> {
|
|
4
|
+
children: Element[];
|
|
5
|
+
columnWidths?: GroupColumnWidth[];
|
|
6
|
+
}
|
|
7
|
+
export declare function row({ children, columnWidths, ...basePropsInput }: RowProps): GroupElement<'row'>;
|
|
8
|
+
//# sourceMappingURL=row.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"row.d.ts","sourceRoot":"","sources":["../../../src/elements/row/row.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAE7C,OAAO,KAAK,EACR,gBAAgB,EAChB,OAAO,EACP,gBAAgB,EAChB,YAAY,EACf,MAAM,sBAAsB,CAAC;AAE9B,MAAM,WAAW,QAAS,SAAQ,WAAW,CAAC,gBAAgB,CAAC;IAC3D,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,YAAY,CAAC,EAAE,gBAAgB,EAAE,CAAC;CACrC;AAED,wBAAgB,GAAG,CAAC,EAAE,QAAQ,EAAE,YAAY,EAAE,GAAG,cAAc,EAAE,EAAE,QAAQ,GAAG,YAAY,CAAC,KAAK,CAAC,CAWhG"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { normalizeBaseElementProps } from '../../transforms/index.js';
|
|
2
|
+
export function row({ children, columnWidths, ...basePropsInput }) {
|
|
3
|
+
const baseProps = normalizeBaseElementProps(basePropsInput);
|
|
4
|
+
return {
|
|
5
|
+
kind: 'element',
|
|
6
|
+
type: 'row',
|
|
7
|
+
layout: 'row',
|
|
8
|
+
columnWidths,
|
|
9
|
+
...baseProps,
|
|
10
|
+
children,
|
|
11
|
+
};
|
|
12
|
+
}
|