@valtimo-plugins/freemarker 8.1.0 → 8.1.1
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.
|
@@ -625,12 +625,19 @@ class DocumentTemplateEditorComponent {
|
|
|
625
625
|
setTimeout(() => {
|
|
626
626
|
const preview = document.getElementById('preview-iframe');
|
|
627
627
|
if (preview) {
|
|
628
|
+
preview.src = window.URL.createObjectURL(new Blob([""], { type: "text/plain" }));
|
|
628
629
|
combineLatest([this.updatedModelValue$, this.template$]).pipe(take(1), switchMap(([updatedModelValue, template]) => combineLatest([this.templateService.previewTemplate({
|
|
629
630
|
fileName: `${template.key}.${template.type}`,
|
|
630
631
|
content: updatedModelValue,
|
|
631
|
-
}), of(`${template.key}.${template.type}`)]))).subscribe(
|
|
632
|
-
|
|
633
|
-
|
|
632
|
+
}), of(`${template.key}.${template.type}`)]))).subscribe({
|
|
633
|
+
next: ([blob, filename]) => {
|
|
634
|
+
preview.src = URL.createObjectURL(blob);
|
|
635
|
+
},
|
|
636
|
+
error: (err) => {
|
|
637
|
+
console.error("Preview failed:", err);
|
|
638
|
+
const errorBlob = new Blob([`<html><body><h2>Error loading preview</h2><p>See logs for more information</p></body></html>`], { type: 'text/html' });
|
|
639
|
+
preview.src = URL.createObjectURL(errorBlob);
|
|
640
|
+
}
|
|
634
641
|
});
|
|
635
642
|
}
|
|
636
643
|
}, 100);
|
|
@@ -661,7 +668,7 @@ class DocumentTemplateEditorComponent {
|
|
|
661
668
|
});
|
|
662
669
|
}
|
|
663
670
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: DocumentTemplateEditorComponent, deps: [{ token: FreemarkerTemplateManagementService }, { token: i2$2.ActivatedRoute }, { token: i3.PageTitleService }, { token: i2$2.Router }, { token: i4.NotificationService }, { token: i5$1.TranslateService }, { token: i3.BreadcrumbService }, { token: i3$1.EnvironmentService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
664
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.15", type: DocumentTemplateEditorComponent, isStandalone: true, selector: "ng-component", providers: [NotificationService], ngImport: i0, template: "<!--\n ~ Copyright 2015-2023 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<ng-container\n *ngIf=\"{\n model: model$ | async,\n updatedModelValue: updatedModelValue$ | async,\n template: template$ | async,\n } as obs\">\n\n <div class=\"template-explanation\">\n @if (obs
|
|
671
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.15", type: DocumentTemplateEditorComponent, isStandalone: true, selector: "ng-component", providers: [NotificationService], ngImport: i0, template: "<!--\n ~ Copyright 2015-2023 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<ng-container\n *ngIf=\"{\n model: model$ | async,\n updatedModelValue: updatedModelValue$ | async,\n template: template$ | async,\n } as obs\">\n\n <div class=\"template-explanation\">\n @if (obs?.template?.type === 'pdf') {\n <p>\n <strong>PDF Templates</strong> use HTML in combination with\n <a href=\"https://freemarker.apache.org/docs/dgui_quickstart_basics.html\" target=\"_blank\"\n rel=\"noopener noreferrer\">\n FreeMarker\n </a>\n to define placeholders within the HTML structure. The FreeMarker data model is based on nested\n <a href=\"https://docs.valtimo.nl/features/value-resolvers\" target=\"_blank\" rel=\"noopener noreferrer\">\n Valtimo value resolvers\n </a>,\n but uses a slightly different syntax.\n </p>\n <p>\n For example, <code>${doc.firstName}</code> retrieves the\n <code>firstName</code> value from the case.\n </p>\n <p>\n The notation <code><#list docs as doc>...</#list></code> streams all documents in the\n current case.\n </p>\n } @else {\n <p>\n <strong>CSV Templates</strong> use a semicolon (<code>;</code>) as a separator.\n <a href=\"https://freemarker.apache.org/docs/dgui_quickstart_basics.html\" target=\"_blank\"\n rel=\"noopener noreferrer\">\n FreeMarker\n </a>\n is used to define placeholders within the CSV content. The FreeMarker data model is based on nested\n <a href=\"https://docs.valtimo.nl/features/value-resolvers\" target=\"_blank\" rel=\"noopener noreferrer\">\n Valtimo value resolvers\n </a>,\n but uses a slightly different syntax.\n </p>\n <p>\n For example, <code>${doc.firstName}</code> retrieves the\n <code>firstName</code> value from the case.\n </p>\n <p>\n The notation <code><#list docs as doc>...</#list></code> streams all documents in the\n current case.\n </p>\n }\n </div>\n\n <cds-tabs type=\"contained\">\n <cds-tab [active]=\"true\" [heading]=\"'Editor'\">\n <valtimo-editor\n [model]=\"obs.model\"\n [disabled]=\"(editorDisabled$ | async) || (readOnly$ | async)\"\n (validEvent)=\"onValid($event)\"\n (valueChangeEvent)=\"onValueChange($event)\"\n [fitPage]=\"true\"\n [fitPageExtraSpace]=\"80\"\n ></valtimo-editor>\n </cds-tab>\n <cds-tab [heading]=\"'Preview'\" (selected)=\"onSelectedTabPreview()\">\n <iframe title=\"Preview\" id=\"preview-iframe\">\n </iframe>\n </cds-tab>\n </cds-tabs>\n\n</ng-container>\n\n<ng-container renderInPageHeader>\n <ng-template>\n <div *ngIf=\"{\n model: model$ | async,\n moreDisabled: moreDisabled$ | async,\n template: template$ | async,\n } as obs\"\n class=\"buttons-container\"\n >\n <cds-overflow-menu class=\"overflow-button\">\n <cds-overflow-menu-option\n [disabled]=\"obs.moreDisabled || (readOnly$ | async)\"\n type=\"danger\"\n (selected)=\"showDeleteModal()\"\n >{{ 'interface.delete' | translate }}\n </cds-overflow-menu-option\n >\n </cds-overflow-menu>\n\n <button\n [disabled]=\"(saveDisabled$ | async) || (readOnly$ | async)\"\n cdsButton=\"primary\"\n size=\"md\"\n (click)=\"updateTemplate()\"\n >\n {{ 'interface.save' | translate }}\n\n <svg class=\"cds--btn__icon\" cdsIcon=\"save\" size=\"16\"></svg>\n </button>\n </div>\n </ng-template>\n</ng-container>\n\n<ng-container *ngIf=\"{templateKey: templateKey$ | async, templateType: templateType$ | async} as obs\">\n <valtimo-document-template-delete-modal\n [deleteRowKeys]=\"[{key: obs.templateKey, type: obs.templateType}]\"\n [showDeleteModal$]=\"showDeleteModal$\"\n (deleteEvent)=\"onDelete($event)\"\n >\n </valtimo-document-template-delete-modal>\n</ng-container>\n", styles: ["::ng-deep .cds--tab-content{background:var(--cds-layer)!important}::ng-deep #preview-iframe{width:100%;height:calc(100vh - 219px)}.loading-container{display:flex;width:100%;justify-content:center}.overflow-button{margin-right:16px}.buttons-container{display:flex;flex-direction:row}.template-explanation{margin-top:16px;margin-bottom:24px}\n/*!\n * Copyright 2015-2023 Ritense BV, the Netherlands.\n *\n * Licensed under EUPL, Version 1.2 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" basis,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "pipe", type: i2.AsyncPipe, name: "async" }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i5$1.TranslatePipe, name: "translate" }, { kind: "ngmodule", type: TabsModule }, { kind: "component", type: i4.Tabs, selector: "cds-tabs, ibm-tabs", inputs: ["position", "cacheActive", "followFocus", "isNavigation", "ariaLabel", "ariaLabelledby", "type", "theme", "skeleton"] }, { kind: "component", type: i4.Tab, selector: "cds-tab, ibm-tab", inputs: ["heading", "title", "context", "active", "disabled", "tabIndex", "id", "cacheActive", "tabContent", "templateContext"], outputs: ["selected"] }, { kind: "ngmodule", type: DialogModule }, { kind: "component", type: i4.OverflowMenu, selector: "cds-overflow-menu, ibm-overflow-menu", inputs: ["buttonLabel", "description", "flip", "placement", "open", "customTrigger", "offset", "wrapperClass", "triggerClass"], outputs: ["openChange"] }, { kind: "component", type: i4.OverflowMenuOption, selector: "cds-overflow-menu-option, ibm-overflow-menu-option", inputs: ["divider", "type", "disabled", "href", "target", "innerClass"], outputs: ["selected"] }, { kind: "component", type: DocumentTemplateDeleteModalComponent, selector: "valtimo-document-template-delete-modal", inputs: ["deleteRowKeys", "showDeleteModal$"], outputs: ["deleteEvent"] }, { kind: "ngmodule", type: CarbonListModule }, { kind: "ngmodule", type: ButtonModule }, { kind: "directive", type: i4.Button, selector: "[cdsButton], [ibmButton]", inputs: ["ibmButton", "cdsButton", "size", "skeleton", "iconOnly", "isExpressive"] }, { kind: "ngmodule", type: EditorModule }, { kind: "component", type: i3.EditorComponent, selector: "valtimo-editor", inputs: ["editorOptions", "model", "disabled", "formatOnLoad", "widthPx", "heightPx", "heightStyle", "jsonSchema", "fitPage", "fitPageExtraSpace"], outputs: ["validEvent", "valueChangeEvent"] }, { kind: "directive", type: RenderInPageHeaderDirective, selector: "[renderInPageHeader]", inputs: ["fullWidth"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
665
672
|
}
|
|
666
673
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: DocumentTemplateEditorComponent, decorators: [{
|
|
667
674
|
type: Component,
|
|
@@ -675,7 +682,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImpo
|
|
|
675
682
|
ButtonModule,
|
|
676
683
|
EditorModule,
|
|
677
684
|
RenderInPageHeaderDirective,
|
|
678
|
-
], template: "<!--\n ~ Copyright 2015-2023 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<ng-container\n *ngIf=\"{\n model: model$ | async,\n updatedModelValue: updatedModelValue$ | async,\n template: template$ | async,\n } as obs\">\n\n <div class=\"template-explanation\">\n @if (obs
|
|
685
|
+
], template: "<!--\n ~ Copyright 2015-2023 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<ng-container\n *ngIf=\"{\n model: model$ | async,\n updatedModelValue: updatedModelValue$ | async,\n template: template$ | async,\n } as obs\">\n\n <div class=\"template-explanation\">\n @if (obs?.template?.type === 'pdf') {\n <p>\n <strong>PDF Templates</strong> use HTML in combination with\n <a href=\"https://freemarker.apache.org/docs/dgui_quickstart_basics.html\" target=\"_blank\"\n rel=\"noopener noreferrer\">\n FreeMarker\n </a>\n to define placeholders within the HTML structure. The FreeMarker data model is based on nested\n <a href=\"https://docs.valtimo.nl/features/value-resolvers\" target=\"_blank\" rel=\"noopener noreferrer\">\n Valtimo value resolvers\n </a>,\n but uses a slightly different syntax.\n </p>\n <p>\n For example, <code>${doc.firstName}</code> retrieves the\n <code>firstName</code> value from the case.\n </p>\n <p>\n The notation <code><#list docs as doc>...</#list></code> streams all documents in the\n current case.\n </p>\n } @else {\n <p>\n <strong>CSV Templates</strong> use a semicolon (<code>;</code>) as a separator.\n <a href=\"https://freemarker.apache.org/docs/dgui_quickstart_basics.html\" target=\"_blank\"\n rel=\"noopener noreferrer\">\n FreeMarker\n </a>\n is used to define placeholders within the CSV content. The FreeMarker data model is based on nested\n <a href=\"https://docs.valtimo.nl/features/value-resolvers\" target=\"_blank\" rel=\"noopener noreferrer\">\n Valtimo value resolvers\n </a>,\n but uses a slightly different syntax.\n </p>\n <p>\n For example, <code>${doc.firstName}</code> retrieves the\n <code>firstName</code> value from the case.\n </p>\n <p>\n The notation <code><#list docs as doc>...</#list></code> streams all documents in the\n current case.\n </p>\n }\n </div>\n\n <cds-tabs type=\"contained\">\n <cds-tab [active]=\"true\" [heading]=\"'Editor'\">\n <valtimo-editor\n [model]=\"obs.model\"\n [disabled]=\"(editorDisabled$ | async) || (readOnly$ | async)\"\n (validEvent)=\"onValid($event)\"\n (valueChangeEvent)=\"onValueChange($event)\"\n [fitPage]=\"true\"\n [fitPageExtraSpace]=\"80\"\n ></valtimo-editor>\n </cds-tab>\n <cds-tab [heading]=\"'Preview'\" (selected)=\"onSelectedTabPreview()\">\n <iframe title=\"Preview\" id=\"preview-iframe\">\n </iframe>\n </cds-tab>\n </cds-tabs>\n\n</ng-container>\n\n<ng-container renderInPageHeader>\n <ng-template>\n <div *ngIf=\"{\n model: model$ | async,\n moreDisabled: moreDisabled$ | async,\n template: template$ | async,\n } as obs\"\n class=\"buttons-container\"\n >\n <cds-overflow-menu class=\"overflow-button\">\n <cds-overflow-menu-option\n [disabled]=\"obs.moreDisabled || (readOnly$ | async)\"\n type=\"danger\"\n (selected)=\"showDeleteModal()\"\n >{{ 'interface.delete' | translate }}\n </cds-overflow-menu-option\n >\n </cds-overflow-menu>\n\n <button\n [disabled]=\"(saveDisabled$ | async) || (readOnly$ | async)\"\n cdsButton=\"primary\"\n size=\"md\"\n (click)=\"updateTemplate()\"\n >\n {{ 'interface.save' | translate }}\n\n <svg class=\"cds--btn__icon\" cdsIcon=\"save\" size=\"16\"></svg>\n </button>\n </div>\n </ng-template>\n</ng-container>\n\n<ng-container *ngIf=\"{templateKey: templateKey$ | async, templateType: templateType$ | async} as obs\">\n <valtimo-document-template-delete-modal\n [deleteRowKeys]=\"[{key: obs.templateKey, type: obs.templateType}]\"\n [showDeleteModal$]=\"showDeleteModal$\"\n (deleteEvent)=\"onDelete($event)\"\n >\n </valtimo-document-template-delete-modal>\n</ng-container>\n", styles: ["::ng-deep .cds--tab-content{background:var(--cds-layer)!important}::ng-deep #preview-iframe{width:100%;height:calc(100vh - 219px)}.loading-container{display:flex;width:100%;justify-content:center}.overflow-button{margin-right:16px}.buttons-container{display:flex;flex-direction:row}.template-explanation{margin-top:16px;margin-bottom:24px}\n/*!\n * Copyright 2015-2023 Ritense BV, the Netherlands.\n *\n * Licensed under EUPL, Version 1.2 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" basis,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n"] }]
|
|
679
686
|
}], ctorParameters: () => [{ type: FreemarkerTemplateManagementService }, { type: i2$2.ActivatedRoute }, { type: i3.PageTitleService }, { type: i2$2.Router }, { type: i4.NotificationService }, { type: i5$1.TranslateService }, { type: i3.BreadcrumbService }, { type: i3$1.EnvironmentService }] });
|
|
680
687
|
|
|
681
688
|
/*
|