@valtimo/decision 10.8.0 → 11.0.0

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.
Files changed (33) hide show
  1. package/{esm2020 → esm2022}/lib/decision-deploy/decision-deploy.component.mjs +4 -4
  2. package/{esm2020 → esm2022}/lib/decision-display/decision-display.component.mjs +4 -4
  3. package/{esm2020 → esm2022}/lib/decision-list/decision-list.component.mjs +4 -4
  4. package/esm2022/lib/decision-modeler/decision-modeler.component.mjs +213 -0
  5. package/{esm2020 → esm2022}/lib/decision-routing.module.mjs +5 -5
  6. package/{esm2020 → esm2022}/lib/decision.component.mjs +4 -4
  7. package/esm2022/lib/decision.module.mjs +77 -0
  8. package/esm2022/lib/decision.service.mjs +54 -0
  9. package/{esm2020 → esm2022}/lib/services/decision-state.service.mjs +4 -4
  10. package/{fesm2020 → fesm2022}/valtimo-decision.mjs +53 -52
  11. package/fesm2022/valtimo-decision.mjs.map +1 -0
  12. package/lib/decision-deploy/decision-deploy.component.d.ts +1 -1
  13. package/lib/decision-display/decision-display.component.d.ts +1 -1
  14. package/lib/decision-list/decision-list.component.d.ts +1 -1
  15. package/lib/decision-modeler/decision-modeler.component.d.ts +2 -3
  16. package/lib/decision-modeler/decision-modeler.component.d.ts.map +1 -1
  17. package/lib/decision.component.d.ts +1 -1
  18. package/lib/decision.module.d.ts +1 -2
  19. package/lib/decision.module.d.ts.map +1 -1
  20. package/lib/decision.service.d.ts.map +1 -1
  21. package/package.json +10 -16
  22. package/esm2020/lib/decision-modeler/decision-modeler.component.mjs +0 -214
  23. package/esm2020/lib/decision.module.mjs +0 -78
  24. package/esm2020/lib/decision.service.mjs +0 -54
  25. package/fesm2015/valtimo-decision.mjs +0 -719
  26. package/fesm2015/valtimo-decision.mjs.map +0 -1
  27. package/fesm2020/valtimo-decision.mjs.map +0 -1
  28. /package/{esm2020 → esm2022}/lib/decision-modeler/empty-decision.mjs +0 -0
  29. /package/{esm2020 → esm2022}/lib/models/decision.model.mjs +0 -0
  30. /package/{esm2020 → esm2022}/lib/models/index.mjs +0 -0
  31. /package/{esm2020 → esm2022}/lib/services/index.mjs +0 -0
  32. /package/{esm2020 → esm2022}/public-api.mjs +0 -0
  33. /package/{esm2020 → esm2022}/valtimo-decision.mjs +0 -0
@@ -1,719 +0,0 @@
1
- import * as i0 from '@angular/core';
2
- import { Injectable, EventEmitter, Component, Output, ViewChild, ViewEncapsulation, NgModule } from '@angular/core';
3
- import * as i1 from '@valtimo/config';
4
- import { ROLE_ADMIN } from '@valtimo/config';
5
- import * as i2 from '@angular/common/http';
6
- import { Subject, startWith, BehaviorSubject, switchMap, map, tap, filter, combineLatest, from, take, catchError, of } from 'rxjs';
7
- import * as i3 from '@valtimo/components';
8
- import { WidgetModule, ListModule, ModalModule, SpinnerModule } from '@valtimo/components';
9
- import * as i4 from '@ngx-translate/core';
10
- import { TranslateModule } from '@ngx-translate/core';
11
- import * as i2$1 from '@angular/router';
12
- import { RouterModule } from '@angular/router';
13
- import * as i6 from '@angular/common';
14
- import { CommonModule } from '@angular/common';
15
- import { AuthGuardService } from '@valtimo/security';
16
- import { __awaiter } from 'tslib';
17
- import DmnJS from 'dmn-js/dist/dmn-modeler.development.js';
18
- import { migrateDiagram } from '@bpmn-io/dmn-migrate';
19
- import * as i5 from '@valtimo/layout';
20
- import * as i7 from '@valtimo/user-interface';
21
- import { SelectModule } from '@valtimo/user-interface';
22
- import DmnViewer from 'dmn-js';
23
- import * as i3$1 from 'ngx-toastr';
24
- import { FormsModule } from '@angular/forms';
25
-
26
- /*
27
- * Copyright 2015-2023 Ritense BV, the Netherlands.
28
- *
29
- * Licensed under EUPL, Version 1.2 (the "License");
30
- * you may not use this file except in compliance with the License.
31
- * You may obtain a copy of the License at
32
- *
33
- * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
34
- *
35
- * Unless required by applicable law or agreed to in writing, software
36
- * distributed under the License is distributed on an "AS IS" basis,
37
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
38
- * See the License for the specific language governing permissions and
39
- * limitations under the License.
40
- */
41
-
42
- /*
43
- * Copyright 2015-2023 Ritense BV, the Netherlands.
44
- *
45
- * Licensed under EUPL, Version 1.2 (the "License");
46
- * you may not use this file except in compliance with the License.
47
- * You may obtain a copy of the License at
48
- *
49
- * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
50
- *
51
- * Unless required by applicable law or agreed to in writing, software
52
- * distributed under the License is distributed on an "AS IS" basis,
53
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
54
- * See the License for the specific language governing permissions and
55
- * limitations under the License.
56
- */
57
- class DecisionService {
58
- constructor(configService, http) {
59
- this.configService = configService;
60
- this.http = http;
61
- this.valtimoApiConfig = configService.config.valtimoApi;
62
- }
63
- deployDmn(dmn) {
64
- const formData = new FormData();
65
- formData.append('file', dmn);
66
- formData.append('deployment-name', 'dmnTableDeploy');
67
- formData.append('deployment-source', 'process application');
68
- return this.http.post(`${this.valtimoApiConfig.endpointUri}v1/process/definition/deployment`, formData);
69
- }
70
- getDecisions() {
71
- return this.http.get(`${this.valtimoApiConfig.endpointUri}camunda-rest/engine/default/decision-definition`);
72
- }
73
- getDecisionById(decisionId) {
74
- return this.http.get(`${this.valtimoApiConfig.endpointUri}camunda-rest/engine/default/decision-definition/${decisionId}`);
75
- }
76
- getLatestDecisionByKey(decisionKey) {
77
- return this.http.get(`${this.valtimoApiConfig.endpointUri}camunda-rest/engine/default/decision-definition/key/${decisionKey}`);
78
- }
79
- getDecisionXml(decisionId) {
80
- return this.http.get(`${this.valtimoApiConfig.endpointUri}camunda-rest/engine/default/decision-definition/${decisionId}/xml`);
81
- }
82
- }
83
- DecisionService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: DecisionService, deps: [{ token: i1.ConfigService }, { token: i2.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
84
- DecisionService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: DecisionService, providedIn: 'root' });
85
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: DecisionService, decorators: [{
86
- type: Injectable,
87
- args: [{
88
- providedIn: 'root',
89
- }]
90
- }], ctorParameters: function () { return [{ type: i1.ConfigService }, { type: i2.HttpClient }]; } });
91
-
92
- /*
93
- * Copyright 2015-2023 Ritense BV, the Netherlands.
94
- *
95
- * Licensed under EUPL, Version 1.2 (the "License");
96
- * you may not use this file except in compliance with the License.
97
- * You may obtain a copy of the License at
98
- *
99
- * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
100
- *
101
- * Unless required by applicable law or agreed to in writing, software
102
- * distributed under the License is distributed on an "AS IS" basis,
103
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
104
- * See the License for the specific language governing permissions and
105
- * limitations under the License.
106
- */
107
- class DecisionStateService {
108
- constructor() {
109
- this._refreshDecisions$ = new Subject();
110
- }
111
- get refreshDecisions$() {
112
- return this._refreshDecisions$.asObservable().pipe(startWith(null));
113
- }
114
- refreshDecisions() {
115
- this._refreshDecisions$.next(null);
116
- }
117
- }
118
- DecisionStateService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: DecisionStateService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
119
- DecisionStateService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: DecisionStateService, providedIn: 'root' });
120
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: DecisionStateService, decorators: [{
121
- type: Injectable,
122
- args: [{
123
- providedIn: 'root',
124
- }]
125
- }] });
126
-
127
- /*
128
- * Copyright 2015-2023 Ritense BV, the Netherlands.
129
- *
130
- * Licensed under EUPL, Version 1.2 (the "License");
131
- * you may not use this file except in compliance with the License.
132
- * You may obtain a copy of the License at
133
- *
134
- * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
135
- *
136
- * Unless required by applicable law or agreed to in writing, software
137
- * distributed under the License is distributed on an "AS IS" basis,
138
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
139
- * See the License for the specific language governing permissions and
140
- * limitations under the License.
141
- */
142
-
143
- /*
144
- * Copyright 2015-2023 Ritense BV, the Netherlands.
145
- *
146
- * Licensed under EUPL, Version 1.2 (the "License");
147
- * you may not use this file except in compliance with the License.
148
- * You may obtain a copy of the License at
149
- *
150
- * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
151
- *
152
- * Unless required by applicable law or agreed to in writing, software
153
- * distributed under the License is distributed on an "AS IS" basis,
154
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
155
- * See the License for the specific language governing permissions and
156
- * limitations under the License.
157
- */
158
- class DecisionDeployComponent {
159
- constructor(decisionService, stateService) {
160
- this.decisionService = decisionService;
161
- this.stateService = stateService;
162
- this.dmn = null;
163
- this.deploySuccessful = new EventEmitter();
164
- }
165
- ngOnInit() { }
166
- onChange(files) {
167
- this.dmn = files.item(0);
168
- }
169
- deployDmn() {
170
- this.decisionService.deployDmn(this.dmn).subscribe(() => {
171
- this.modal.hide();
172
- this.deploySuccessful.emit();
173
- this.stateService.refreshDecisions();
174
- });
175
- }
176
- openModal() {
177
- this.modal.show();
178
- }
179
- }
180
- DecisionDeployComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: DecisionDeployComponent, deps: [{ token: DecisionService }, { token: DecisionStateService }], target: i0.ɵɵFactoryTarget.Component });
181
- DecisionDeployComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: DecisionDeployComponent, selector: "valtimo-decision-deploy", outputs: { deploySuccessful: "deploySuccessful" }, viewQueries: [{ propertyName: "modal", first: true, predicate: ["decisionDeployModal"], descendants: true }], 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<valtimo-modal\n #decisionDeployModal\n elementId=\"decisionDeployModal\"\n title=\"Upload Decision table\"\n [showFooter]=\"true\"\n>\n <div body>\n <div class=\"mt-3\">{{ 'decisions.upload.description' | translate }}</div>\n <div class=\"form-group mt-3 mb-3\">\n <input type=\"file\" id=\"file\" accept=\".dmn\" (change)=\"onChange($event.target.files)\" />\n </div>\n </div>\n <div footer>\n <div class=\"mb-0 p-3 text-right\">\n <button\n [disabled]=\"!dmn\"\n class=\"btn btn-primary btn-space\"\n type=\"button\"\n (click)=\"deployDmn()\"\n >\n <i class=\"icon mdi mdi-upload mr-1\"></i>\n {{ 'Upload' | translate }}\n </button>\n </div>\n </div>\n</valtimo-modal>\n", styles: ["/*!\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: "component", type: i3.ModalComponent, selector: "valtimo-modal", inputs: ["elementId", "title", "subtitle", "templateBelowSubtitle", "showFooter"] }, { kind: "pipe", type: i4.TranslatePipe, name: "translate" }] });
182
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: DecisionDeployComponent, decorators: [{
183
- type: Component,
184
- args: [{ selector: 'valtimo-decision-deploy', 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<valtimo-modal\n #decisionDeployModal\n elementId=\"decisionDeployModal\"\n title=\"Upload Decision table\"\n [showFooter]=\"true\"\n>\n <div body>\n <div class=\"mt-3\">{{ 'decisions.upload.description' | translate }}</div>\n <div class=\"form-group mt-3 mb-3\">\n <input type=\"file\" id=\"file\" accept=\".dmn\" (change)=\"onChange($event.target.files)\" />\n </div>\n </div>\n <div footer>\n <div class=\"mb-0 p-3 text-right\">\n <button\n [disabled]=\"!dmn\"\n class=\"btn btn-primary btn-space\"\n type=\"button\"\n (click)=\"deployDmn()\"\n >\n <i class=\"icon mdi mdi-upload mr-1\"></i>\n {{ 'Upload' | translate }}\n </button>\n </div>\n </div>\n</valtimo-modal>\n", styles: ["/*!\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"] }]
185
- }], ctorParameters: function () { return [{ type: DecisionService }, { type: DecisionStateService }]; }, propDecorators: { deploySuccessful: [{
186
- type: Output
187
- }], modal: [{
188
- type: ViewChild,
189
- args: ['decisionDeployModal']
190
- }] } });
191
-
192
- /*
193
- * Copyright 2015-2023 Ritense BV, the Netherlands.
194
- *
195
- * Licensed under EUPL, Version 1.2 (the "License");
196
- * you may not use this file except in compliance with the License.
197
- * You may obtain a copy of the License at
198
- *
199
- * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
200
- *
201
- * Unless required by applicable law or agreed to in writing, software
202
- * distributed under the License is distributed on an "AS IS" basis,
203
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
204
- * See the License for the specific language governing permissions and
205
- * limitations under the License.
206
- */
207
- class DecisionListComponent {
208
- constructor(decisionService, router, configService, stateService) {
209
- this.decisionService = decisionService;
210
- this.router = router;
211
- this.configService = configService;
212
- this.stateService = stateService;
213
- this.fields = [
214
- { key: 'key', label: 'Key' },
215
- { key: 'name', label: 'Name' },
216
- { key: 'version', label: 'Version' },
217
- ];
218
- this.loading$ = new BehaviorSubject(true);
219
- this.decisionsLatestVersions$ = this.stateService.refreshDecisions$.pipe(switchMap(() => this.decisionService.getDecisions()), map(decisions => decisions.reduce((acc, curr) => {
220
- const findInAcc = acc.find(decision => decision.key === curr.key);
221
- if (findInAcc && findInAcc.version > curr.version) {
222
- return acc;
223
- }
224
- else if (findInAcc && findInAcc.version < curr.version) {
225
- const newAcc = acc.filter(decision => decision.key !== curr.key);
226
- return [...newAcc, curr];
227
- }
228
- return [...acc, curr];
229
- }, [])), tap(() => this.loading$.next(false)));
230
- this.experimentalEditing = this.configService.config.featureToggles.experimentalDmnEditing;
231
- }
232
- viewDecisionTable(decision) {
233
- if (this.experimentalEditing) {
234
- this.router.navigate(['/decision-tables/edit', decision.id]);
235
- }
236
- else {
237
- this.router.navigate(['/decision-tables', decision.id]);
238
- }
239
- }
240
- }
241
- DecisionListComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: DecisionListComponent, deps: [{ token: DecisionService }, { token: i2$1.Router }, { token: i1.ConfigService }, { token: DecisionStateService }], target: i0.ɵɵFactoryTarget.Component });
242
- DecisionListComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: DecisionListComponent, selector: "valtimo-decision-list", 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 *ngIf=\"decisionsLatestVersions$ | async as decisions\">\n <ng-container *ngIf=\"(loading$ | async) === false\">\n <valtimo-widget>\n <valtimo-list\n [items]=\"decisions\"\n [fields]=\"fields\"\n (rowClicked)=\"viewDecisionTable($event)\"\n [header]=\"true\"\n [viewMode]=\"true\"\n [isSearchable]=\"true\"\n >\n <div header>\n <h3 class=\"list-header-title\">{{ 'Decision tables' | translate }}</h3>\n <h5 class=\"list-header-description\">\n {{ 'Overview of all Decision tables' | translate }}\n </h5>\n </div>\n </valtimo-list>\n </valtimo-widget>\n </ng-container>\n</ng-container>\n\n<ng-container *ngIf=\"loading$ | async\">\n <valtimo-spinner></valtimo-spinner>\n</ng-container>\n", styles: ["/*!\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: "component", type: i3.WidgetComponent, selector: "valtimo-widget", inputs: ["type", "name", "icon", "contrast", "divider", "title", "subtitle", "collapseAble", "collapse", "additionalClasses"] }, { kind: "component", type: i3.ListComponent, selector: "valtimo-list", inputs: ["items", "fields", "pagination", "viewMode", "isSearchable", "header", "actions", "paginationIdentifier", "initialSortState", "lastColumnTemplate"], outputs: ["rowClicked", "paginationClicked", "paginationSet", "search", "sortChanged"] }, { kind: "directive", type: i6.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i3.SpinnerComponent, selector: "valtimo-spinner", inputs: ["useBootstrapSpinner", "name", "type", "size", "color", "bdColor", "fullScreen", "noMarginTop"] }, { kind: "pipe", type: i4.TranslatePipe, name: "translate" }, { kind: "pipe", type: i6.AsyncPipe, name: "async" }] });
243
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: DecisionListComponent, decorators: [{
244
- type: Component,
245
- args: [{ selector: 'valtimo-decision-list', 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 *ngIf=\"decisionsLatestVersions$ | async as decisions\">\n <ng-container *ngIf=\"(loading$ | async) === false\">\n <valtimo-widget>\n <valtimo-list\n [items]=\"decisions\"\n [fields]=\"fields\"\n (rowClicked)=\"viewDecisionTable($event)\"\n [header]=\"true\"\n [viewMode]=\"true\"\n [isSearchable]=\"true\"\n >\n <div header>\n <h3 class=\"list-header-title\">{{ 'Decision tables' | translate }}</h3>\n <h5 class=\"list-header-description\">\n {{ 'Overview of all Decision tables' | translate }}\n </h5>\n </div>\n </valtimo-list>\n </valtimo-widget>\n </ng-container>\n</ng-container>\n\n<ng-container *ngIf=\"loading$ | async\">\n <valtimo-spinner></valtimo-spinner>\n</ng-container>\n", styles: ["/*!\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"] }]
246
- }], ctorParameters: function () { return [{ type: DecisionService }, { type: i2$1.Router }, { type: i1.ConfigService }, { type: DecisionStateService }]; } });
247
-
248
- /*
249
- * Copyright 2015-2023 Ritense BV, the Netherlands.
250
- *
251
- * Licensed under EUPL, Version 1.2 (the "License");
252
- * you may not use this file except in compliance with the License.
253
- * You may obtain a copy of the License at
254
- *
255
- * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
256
- *
257
- * Unless required by applicable law or agreed to in writing, software
258
- * distributed under the License is distributed on an "AS IS" basis,
259
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
260
- * See the License for the specific language governing permissions and
261
- * limitations under the License.
262
- */
263
- class DecisionComponent {
264
- constructor(configService) {
265
- this.configService = configService;
266
- this.experimentalEditing = this.configService.config.featureToggles.experimentalDmnEditing;
267
- }
268
- }
269
- DecisionComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: DecisionComponent, deps: [{ token: i1.ConfigService }], target: i0.ɵɵFactoryTarget.Component });
270
- DecisionComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: DecisionComponent, selector: "valtimo-decision", viewQueries: [{ propertyName: "deploy", first: true, predicate: ["decisionDeploy"], descendants: true }, { propertyName: "list", first: true, predicate: ["decisionList"], descendants: true }], 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<div class=\"main-content pt-0\">\n <div class=\"container-fluid\">\n <div class=\"text-right\">\n <div class=\"btn-group mt-m3px mb-3\">\n <button (click)=\"this.deploy.openModal()\" class=\"btn btn-secondary btn-space mr-0\">\n <i class=\"icon mdi mdi-upload mr-1\"></i>\n {{ 'Upload' | translate }}\n </button>\n <!-- <button-->\n <!-- *ngIf=\"experimentalEditing\"-->\n <!-- class=\"btn btn-primary btn-space\"-->\n <!-- [routerLink]=\"'edit/create'\"-->\n <!-- >-->\n <!-- <i class=\"icon mdi mdi-plus mr-1\"></i>-->\n <!-- {{ 'Create decision table' | translate }}-->\n <!-- </button>-->\n </div>\n </div>\n <valtimo-decision-list #decisionList></valtimo-decision-list>\n <valtimo-decision-deploy #decisionDeploy></valtimo-decision-deploy>\n </div>\n</div>\n", styles: ["/*!\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: "component", type: DecisionDeployComponent, selector: "valtimo-decision-deploy", outputs: ["deploySuccessful"] }, { kind: "component", type: DecisionListComponent, selector: "valtimo-decision-list" }, { kind: "pipe", type: i4.TranslatePipe, name: "translate" }] });
271
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: DecisionComponent, decorators: [{
272
- type: Component,
273
- args: [{ selector: 'valtimo-decision', 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<div class=\"main-content pt-0\">\n <div class=\"container-fluid\">\n <div class=\"text-right\">\n <div class=\"btn-group mt-m3px mb-3\">\n <button (click)=\"this.deploy.openModal()\" class=\"btn btn-secondary btn-space mr-0\">\n <i class=\"icon mdi mdi-upload mr-1\"></i>\n {{ 'Upload' | translate }}\n </button>\n <!-- <button-->\n <!-- *ngIf=\"experimentalEditing\"-->\n <!-- class=\"btn btn-primary btn-space\"-->\n <!-- [routerLink]=\"'edit/create'\"-->\n <!-- >-->\n <!-- <i class=\"icon mdi mdi-plus mr-1\"></i>-->\n <!-- {{ 'Create decision table' | translate }}-->\n <!-- </button>-->\n </div>\n </div>\n <valtimo-decision-list #decisionList></valtimo-decision-list>\n <valtimo-decision-deploy #decisionDeploy></valtimo-decision-deploy>\n </div>\n</div>\n", styles: ["/*!\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"] }]
274
- }], ctorParameters: function () { return [{ type: i1.ConfigService }]; }, propDecorators: { deploy: [{
275
- type: ViewChild,
276
- args: ['decisionDeploy']
277
- }], list: [{
278
- type: ViewChild,
279
- args: ['decisionList']
280
- }] } });
281
-
282
- /*
283
- * Copyright 2015-2023 Ritense BV, the Netherlands.
284
- *
285
- * Licensed under EUPL, Version 1.2 (the "License");
286
- * you may not use this file except in compliance with the License.
287
- * You may obtain a copy of the License at
288
- *
289
- * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
290
- *
291
- * Unless required by applicable law or agreed to in writing, software
292
- * distributed under the License is distributed on an "AS IS" basis,
293
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
294
- * See the License for the specific language governing permissions and
295
- * limitations under the License.
296
- */
297
- const EMPTY_DECISION = {
298
- id: '',
299
- dmnXml: `<?xml version="1.0" encoding="UTF-8"?>
300
- <definitions xmlns="https://www.omg.org/spec/DMN/20191111/MODEL/" xmlns:dmndi="https://www.omg.org/spec/DMN/20191111/DMNDI/" xmlns:dc="http://www.omg.org/spec/DMN/20180521/DC/" id="Definitions_1h198v9" name="DRD" namespace="http://camunda.org/schema/1.0/dmn" xmlns:modeler="http://camunda.org/schema/modeler/1.0" exporter="Camunda Modeler" exporterVersion="5.2.0" modeler:executionPlatform="Camunda Cloud" modeler:executionPlatformVersion="8.0.0">
301
- <decision id="Decision_1e18q76" name="Decision 1">
302
- <decisionTable id="DecisionTable_1apu23m">
303
- <input id="Input_1">
304
- <inputExpression id="InputExpression_1" typeRef="string">
305
- <text></text>
306
- </inputExpression>
307
- </input>
308
- <output id="Output_1" typeRef="string" />
309
- </decisionTable>
310
- </decision>
311
- <dmndi:DMNDI>
312
- <dmndi:DMNDiagram>
313
- <dmndi:DMNShape dmnElementRef="Decision_1e18q76">
314
- <dc:Bounds height="80" width="180" x="160" y="100" />
315
- </dmndi:DMNShape>
316
- </dmndi:DMNDiagram>
317
- </dmndi:DMNDI>
318
- </definitions>
319
- `,
320
- };
321
-
322
- class DecisionModelerComponent {
323
- constructor(decisionService, route, router, alertService, translateService, layoutService, pageTitleService) {
324
- this.decisionService = decisionService;
325
- this.route = route;
326
- this.router = router;
327
- this.alertService = alertService;
328
- this.translateService = translateService;
329
- this.layoutService = layoutService;
330
- this.pageTitleService = pageTitleService;
331
- this.CLASS_NAMES = {
332
- drd: 'dmn-icon-lasso-tool',
333
- decisionTable: 'dmn-icon-decision-table',
334
- literalExpression: 'dmn-icon-literal-expression',
335
- };
336
- this.versionSelectionDisabled$ = new BehaviorSubject(true);
337
- this.isCreating$ = new BehaviorSubject(false);
338
- this.decisionId$ = this.route.params.pipe(map(params => params === null || params === void 0 ? void 0 : params.id), tap(decisionId => this.isCreating$.next(decisionId === 'create')), filter(decisionId => !!decisionId && decisionId !== 'create'), tap(() => this.versionSelectionDisabled$.next(true)));
339
- this.selectionId$ = new BehaviorSubject('');
340
- this.decision$ = this.decisionId$.pipe(switchMap(decisionId => this.decisionService.getDecisionById(decisionId)), tap(decision => {
341
- if (decision) {
342
- this.selectionId$.next(decision.id);
343
- }
344
- }));
345
- this.decisionTitle$ = this.decision$.pipe(map(decision => (decision === null || decision === void 0 ? void 0 : decision.key) || ''), tap(decisionTitle => {
346
- this.pageTitleService.setCustomPageTitle(decisionTitle);
347
- }));
348
- this.createdDecisionVersionSelectItems$ = new BehaviorSubject([]);
349
- this.decisionVersionSelectItems$ = combineLatest([
350
- this.decision$,
351
- this.decisionService.getDecisions(),
352
- this.createdDecisionVersionSelectItems$,
353
- ]).pipe(map(([currentDecision, decisions, createdDecisionVersionSelectItems]) => {
354
- const decisionsWithKey = decisions.filter(decision => decision.key === currentDecision.key);
355
- return [
356
- ...decisionsWithKey.map(decision => ({
357
- id: decision.id,
358
- text: decision.version.toString(),
359
- })),
360
- ...createdDecisionVersionSelectItems,
361
- ].sort((a, b) => Number(b.text) - Number(a.text));
362
- }), tap(() => this.versionSelectionDisabled$.next(false)));
363
- this.decisionXml$ = this.decisionId$.pipe(switchMap(decisionId => this.decisionService.getDecisionXml(decisionId)), tap(decisionXml => {
364
- if (decisionXml) {
365
- this.loadDecisionXml(decisionXml);
366
- }
367
- }));
368
- this.setTabEvents = () => {
369
- const $tabs = this.$tabs;
370
- const dmnModeler = this.dmnModeler;
371
- $tabs.delegate('.tab', 'click', function (e) {
372
- return __awaiter(this, void 0, void 0, function* () {
373
- // get index of view from clicked tab
374
- const viewIdx = parseInt(this.getAttribute('data-id'), 10);
375
- // get view using index
376
- const view = dmnModeler.getViews()[viewIdx];
377
- // open view
378
- try {
379
- yield dmnModeler.open(view);
380
- }
381
- catch (err) {
382
- console.error('error opening tab', err);
383
- }
384
- });
385
- });
386
- };
387
- this.setModelerEvents = () => {
388
- const $tabs = this.$tabs;
389
- const CLASS_NAMES = this.CLASS_NAMES;
390
- this.dmnModeler.on('views.changed', function (event) {
391
- // get views from event
392
- const { views, activeView } = event;
393
- // clear tabs
394
- $tabs.empty();
395
- // create a new tab for each view
396
- views.forEach(function (v, idx) {
397
- const className = CLASS_NAMES[v.type];
398
- const tab = $(`
399
- <div class="tab ${v === activeView ? 'active' : ''}" data-id="${idx}">
400
- <span class="${className}"></span>
401
- ${v.element.name || v.element.id}
402
- </div>
403
- `);
404
- $tabs.append(tab);
405
- });
406
- });
407
- };
408
- }
409
- ngAfterViewInit() {
410
- this.setProperties();
411
- this.setTabEvents();
412
- this.setModelerEvents();
413
- }
414
- switchVersion(decisionId) {
415
- if (decisionId) {
416
- this.router.navigate(['/decision-tables/edit', decisionId]);
417
- }
418
- }
419
- deploy() {
420
- from(this.dmnModeler.saveXML({ format: true }))
421
- .pipe(map(result => result.xml), map(xml => new File([xml], 'decision.dmn', {
422
- type: 'text/xml',
423
- })), switchMap(file => this.decisionService.deployDmn(file)), tap(res => {
424
- const deployedDefinitions = res.deployedDecisionDefinitions;
425
- const deployedDecisionDefinition = deployedDefinitions[Object.keys(deployedDefinitions)[0]];
426
- const deployedId = deployedDecisionDefinition.id;
427
- this.createdDecisionVersionSelectItems$
428
- .pipe(take(1))
429
- .subscribe(createdDecisionVersionSelectItems => {
430
- if (deployedDecisionDefinition) {
431
- this.createdDecisionVersionSelectItems$.next([
432
- ...createdDecisionVersionSelectItems,
433
- {
434
- id: deployedId,
435
- text: deployedDecisionDefinition.version.toString(),
436
- },
437
- ]);
438
- }
439
- if (deployedId) {
440
- setTimeout(() => {
441
- this.switchVersion(deployedId);
442
- this.alertService.success(this.translateService.instant('decisions.deploySuccess'));
443
- });
444
- }
445
- });
446
- }), catchError(() => {
447
- this.alertService.error(this.translateService.instant('decisions.deployFailure'));
448
- return of(null);
449
- }))
450
- .subscribe();
451
- }
452
- download() {
453
- from(this.dmnModeler.saveXML({ format: true }))
454
- .pipe(map(result => result.xml), map(xml => new File([xml], 'decision.dmn', {
455
- type: 'text/xml',
456
- })), tap(file => {
457
- const link = document.createElement('a');
458
- link.download = 'diagram.dmn';
459
- link.href = window.URL.createObjectURL(file);
460
- link.click();
461
- window.URL.revokeObjectURL(link.href);
462
- link.remove();
463
- }))
464
- .subscribe();
465
- }
466
- setProperties() {
467
- const isCreating = this.isCreating$.getValue();
468
- this.$container = $('.editor-container');
469
- this.$tabs = $('.editor-tabs');
470
- this.dmnModeler = new DmnJS({
471
- container: this.$container,
472
- height: 500,
473
- width: '100%',
474
- keyboard: {
475
- bindTo: window,
476
- },
477
- });
478
- if (isCreating) {
479
- this.loadEmptyDecisionTable();
480
- }
481
- }
482
- loadEmptyDecisionTable() {
483
- this.loadDecisionXml(EMPTY_DECISION);
484
- }
485
- loadDecisionXml(decision) {
486
- from(this.dmnModeler.importXML(decision.dmnXml))
487
- .pipe(tap(() => {
488
- this.setEditor();
489
- }), catchError(() => {
490
- this.migrateAndLoadDecisionXml(decision);
491
- return of(null);
492
- }))
493
- .subscribe();
494
- }
495
- migrateAndLoadDecisionXml(decision) {
496
- from(migrateDiagram(decision.dmnXml))
497
- .pipe(switchMap(decisionXml => this.dmnModeler.importXML(decisionXml)), tap(() => {
498
- this.setEditor();
499
- }), catchError(() => {
500
- this.alertService.error(this.translateService.instant('decisions.loadFailure'));
501
- return of(null);
502
- }))
503
- .subscribe();
504
- }
505
- setEditor() {
506
- const dmnModeler = this.dmnModeler;
507
- const activeView = dmnModeler.getActiveView();
508
- // apply initial logic in DRD view
509
- if (activeView.type === 'drd') {
510
- const activeEditor = dmnModeler.getActiveViewer();
511
- // access active editor components
512
- const canvas = activeEditor.get('canvas');
513
- // zoom to fit full viewport
514
- canvas.zoom('fit-viewport');
515
- }
516
- }
517
- }
518
- DecisionModelerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: DecisionModelerComponent, deps: [{ token: DecisionService }, { token: i2$1.ActivatedRoute }, { token: i2$1.Router }, { token: i3.AlertService }, { token: i4.TranslateService }, { token: i5.LayoutService }, { token: i3.PageTitleService }], target: i0.ɵɵFactoryTarget.Component });
519
- DecisionModelerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: DecisionModelerComponent, selector: "valtimo-decision-modeler", 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<div\n [ngClass]=\"{'main-content pt-0': !layoutService.isFullscreen}\"\n class=\"mb-5\"\n *ngIf=\"{\n decisionXml: decisionXml$ | async,\n decisionTitle: decisionTitle$ | async\n } as obs\"\n>\n <div [ngClass]=\"{'container-fluid': !layoutService.isFullscreen}\">\n <ng-container *ngTemplateOutlet=\"buttons\"></ng-container>\n <ng-container *ngTemplateOutlet=\"createButtons\"></ng-container>\n <div [ngClass]=\"{'mt-4': !layoutService.isFullscreen}\" class=\"modeler pl-3 pr-3 mb-3\">\n <ng-container *ngTemplateOutlet=\"diagramHeader\"></ng-container>\n <ng-container *ngTemplateOutlet=\"diagram\"></ng-container>\n </div>\n </div>\n</div>\n\n<ng-template #buttons>\n <div\n class=\"text-right\"\n *ngIf=\"(isCreating$ | async) === false && {selectionId: selectionId$ | async} as obs\"\n >\n <div class=\"btn-group mt-m3px mb-3\" *ngIf=\"obs.selectionId && !layoutService.isFullscreen\">\n <button class=\"btn btn-primary btn-space\" (click)=\"download()\">\n <i class=\"icon mdi mdi-download mr-1\"></i>{{ 'processManagement.download' | translate }}\n </button>\n <button\n class=\"btn btn-success btn-space\"\n (click)=\"deploy()\"\n [ngClass]=\"{'mr-0': obs.selectionId !== null}\"\n >\n <i class=\"icon mdi mdi-upload mr-1\"></i>{{ 'decisions.deploy' | translate }}\n </button>\n </div>\n </div>\n</ng-template>\n\n<ng-template #createButtons>\n <div class=\"text-right\" *ngIf=\"isCreating$ | async\">\n <div class=\"btn-group mt-m3px mb-3\" *ngIf=\"!layoutService.isFullscreen\">\n <button class=\"btn btn-success btn-space\" (click)=\"deploy()\">\n <i class=\"icon mdi mdi-upload mr-1\"></i>{{ 'decisions.deploy' | translate }}\n </button>\n <!-- <button-->\n <!-- *ngIf=\"selectedVersion === null\"-->\n <!-- class=\"btn btn-danger btn-space mr-0\"-->\n <!-- (click)=\"reset()\"-->\n <!-- >-->\n <!-- <i class=\"icon mdi mdi-delete mr-1\"></i>{{ 'processManagement.clear' | translate }}-->\n <!-- </button>-->\n </div>\n </div>\n</ng-template>\n\n<ng-template #diagramHeader>\n <div class=\"row pt-4 pb-3 bg-light diagram-header justify-content-between\">\n <ng-container *ngTemplateOutlet=\"versionSelection\"></ng-container>\n <ng-container *ngTemplateOutlet=\"fullScreenToggle\"></ng-container>\n </div>\n</ng-template>\n\n<ng-template #versionSelection>\n <div class=\"col-md-2 d-flex justify-content-center align-items-center\">\n <ng-container\n *ngIf=\"\n (isCreating$ | async) === false && {\n versionSelectItems: decisionVersionSelectItems$ | async,\n defaultSelectionId: selectionId$ | async,\n disabled: versionSelectionDisabled$ | async\n } as obs\n \"\n >\n <v-select\n name=\"version\"\n [title]=\"'decisions.version' | translate\"\n [disabled]=\"obs.disabled\"\n [clearable]=\"false\"\n [loading]=\"!obs.versionSelectItems\"\n [items]=\"obs.versionSelectItems\"\n [defaultSelectionId]=\"obs.defaultSelectionId\"\n [widthInPx]=\"100\"\n (selectedChange)=\"switchVersion($event)\"\n ></v-select>\n </ng-container>\n </div>\n</ng-template>\n\n<ng-template #fullScreenToggle>\n <div class=\"col-md-2 d-flex fullscreen-toggle align-items-start justify-content-end\">\n <i\n (click)=\"layoutService.toggleFullscreen()\"\n [ngClass]=\"{\n 'mdi-fullscreen': !layoutService.isFullscreen,\n 'mdi-fullscreen-exit': layoutService.isFullscreen\n }\"\n class=\"mdi\"\n ></i>\n </div>\n</ng-template>\n\n<ng-template #diagram>\n <div class=\"row bg-white diagram mb-3\">\n <div class=\"dmn-modeler\">\n <div class=\"test-container\">\n <div class=\"editor-parent\">\n <div class=\"editor-container\"></div>\n <div class=\"editor-tabs\"></div>\n </div>\n </div>\n </div>\n </div>\n</ng-template>\n", styles: ["/*!\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 */#save-button{position:absolute;bottom:10px;left:10px;background:white;border:solid 1px #ccc;border-radius:2px;padding:8px;font-family:Arial,sans-serif;font-weight:700;cursor:default;font-size:14px;color:#444}.dmn-modeler{display:flex;flex-direction:column;width:100%;padding:1rem}.diagram,.diagram-header{border:1px solid #dee2e6}.decision-title{color:#6b6b6b;font-size:1.5rem;margin:0}.fullscreen-toggle{font-size:2rem}.fullscreen-toggle>i{cursor:pointer}\n"], dependencies: [{ kind: "directive", type: i6.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i6.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i6.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: i7.SelectComponent, selector: "v-select", inputs: ["items", "defaultSelection", "defaultSelectionId", "defaultSelectionIds", "clearable", "disabled", "multiple", "margin", "widthInPx", "notFoundText", "clearAllText", "name", "title", "titleTranslationKey", "clearSelectionSubject$", "tooltip", "required", "loading", "loadingText", "placeholder", "smallMargin"], outputs: ["selectedChange", "clear"] }, { kind: "pipe", type: i4.TranslatePipe, name: "translate" }, { kind: "pipe", type: i6.AsyncPipe, name: "async" }] });
520
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: DecisionModelerComponent, decorators: [{
521
- type: Component,
522
- args: [{ selector: 'valtimo-decision-modeler', 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<div\n [ngClass]=\"{'main-content pt-0': !layoutService.isFullscreen}\"\n class=\"mb-5\"\n *ngIf=\"{\n decisionXml: decisionXml$ | async,\n decisionTitle: decisionTitle$ | async\n } as obs\"\n>\n <div [ngClass]=\"{'container-fluid': !layoutService.isFullscreen}\">\n <ng-container *ngTemplateOutlet=\"buttons\"></ng-container>\n <ng-container *ngTemplateOutlet=\"createButtons\"></ng-container>\n <div [ngClass]=\"{'mt-4': !layoutService.isFullscreen}\" class=\"modeler pl-3 pr-3 mb-3\">\n <ng-container *ngTemplateOutlet=\"diagramHeader\"></ng-container>\n <ng-container *ngTemplateOutlet=\"diagram\"></ng-container>\n </div>\n </div>\n</div>\n\n<ng-template #buttons>\n <div\n class=\"text-right\"\n *ngIf=\"(isCreating$ | async) === false && {selectionId: selectionId$ | async} as obs\"\n >\n <div class=\"btn-group mt-m3px mb-3\" *ngIf=\"obs.selectionId && !layoutService.isFullscreen\">\n <button class=\"btn btn-primary btn-space\" (click)=\"download()\">\n <i class=\"icon mdi mdi-download mr-1\"></i>{{ 'processManagement.download' | translate }}\n </button>\n <button\n class=\"btn btn-success btn-space\"\n (click)=\"deploy()\"\n [ngClass]=\"{'mr-0': obs.selectionId !== null}\"\n >\n <i class=\"icon mdi mdi-upload mr-1\"></i>{{ 'decisions.deploy' | translate }}\n </button>\n </div>\n </div>\n</ng-template>\n\n<ng-template #createButtons>\n <div class=\"text-right\" *ngIf=\"isCreating$ | async\">\n <div class=\"btn-group mt-m3px mb-3\" *ngIf=\"!layoutService.isFullscreen\">\n <button class=\"btn btn-success btn-space\" (click)=\"deploy()\">\n <i class=\"icon mdi mdi-upload mr-1\"></i>{{ 'decisions.deploy' | translate }}\n </button>\n <!-- <button-->\n <!-- *ngIf=\"selectedVersion === null\"-->\n <!-- class=\"btn btn-danger btn-space mr-0\"-->\n <!-- (click)=\"reset()\"-->\n <!-- >-->\n <!-- <i class=\"icon mdi mdi-delete mr-1\"></i>{{ 'processManagement.clear' | translate }}-->\n <!-- </button>-->\n </div>\n </div>\n</ng-template>\n\n<ng-template #diagramHeader>\n <div class=\"row pt-4 pb-3 bg-light diagram-header justify-content-between\">\n <ng-container *ngTemplateOutlet=\"versionSelection\"></ng-container>\n <ng-container *ngTemplateOutlet=\"fullScreenToggle\"></ng-container>\n </div>\n</ng-template>\n\n<ng-template #versionSelection>\n <div class=\"col-md-2 d-flex justify-content-center align-items-center\">\n <ng-container\n *ngIf=\"\n (isCreating$ | async) === false && {\n versionSelectItems: decisionVersionSelectItems$ | async,\n defaultSelectionId: selectionId$ | async,\n disabled: versionSelectionDisabled$ | async\n } as obs\n \"\n >\n <v-select\n name=\"version\"\n [title]=\"'decisions.version' | translate\"\n [disabled]=\"obs.disabled\"\n [clearable]=\"false\"\n [loading]=\"!obs.versionSelectItems\"\n [items]=\"obs.versionSelectItems\"\n [defaultSelectionId]=\"obs.defaultSelectionId\"\n [widthInPx]=\"100\"\n (selectedChange)=\"switchVersion($event)\"\n ></v-select>\n </ng-container>\n </div>\n</ng-template>\n\n<ng-template #fullScreenToggle>\n <div class=\"col-md-2 d-flex fullscreen-toggle align-items-start justify-content-end\">\n <i\n (click)=\"layoutService.toggleFullscreen()\"\n [ngClass]=\"{\n 'mdi-fullscreen': !layoutService.isFullscreen,\n 'mdi-fullscreen-exit': layoutService.isFullscreen\n }\"\n class=\"mdi\"\n ></i>\n </div>\n</ng-template>\n\n<ng-template #diagram>\n <div class=\"row bg-white diagram mb-3\">\n <div class=\"dmn-modeler\">\n <div class=\"test-container\">\n <div class=\"editor-parent\">\n <div class=\"editor-container\"></div>\n <div class=\"editor-tabs\"></div>\n </div>\n </div>\n </div>\n </div>\n</ng-template>\n", styles: ["/*!\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 */#save-button{position:absolute;bottom:10px;left:10px;background:white;border:solid 1px #ccc;border-radius:2px;padding:8px;font-family:Arial,sans-serif;font-weight:700;cursor:default;font-size:14px;color:#444}.dmn-modeler{display:flex;flex-direction:column;width:100%;padding:1rem}.diagram,.diagram-header{border:1px solid #dee2e6}.decision-title{color:#6b6b6b;font-size:1.5rem;margin:0}.fullscreen-toggle{font-size:2rem}.fullscreen-toggle>i{cursor:pointer}\n"] }]
523
- }], ctorParameters: function () { return [{ type: DecisionService }, { type: i2$1.ActivatedRoute }, { type: i2$1.Router }, { type: i3.AlertService }, { type: i4.TranslateService }, { type: i5.LayoutService }, { type: i3.PageTitleService }]; } });
524
-
525
- class DecisionDisplayComponent {
526
- constructor(decisionService, route, toasterService) {
527
- this.decisionService = decisionService;
528
- this.route = route;
529
- this.toasterService = toasterService;
530
- }
531
- ngOnInit() {
532
- this.viewer = new DmnViewer({
533
- container: '#canvas',
534
- });
535
- this.decisionId = this.route.snapshot.paramMap.get('id');
536
- this.loadDecisionXml();
537
- }
538
- loadDecisionXml() {
539
- this.decisionService.getDecisionXml(this.decisionId).subscribe((decision) => {
540
- this.viewer.importXML(decision.dmnXml, error => {
541
- if (error) {
542
- this.migrateAndLoadDecisionXml(decision);
543
- }
544
- });
545
- this.decisionXml = decision.dmnXml;
546
- });
547
- }
548
- migrateAndLoadDecisionXml(decision) {
549
- return __awaiter(this, void 0, void 0, function* () {
550
- const decisionXml = yield migrateDiagram(decision.dmnXml);
551
- if (decisionXml) {
552
- this.viewer.importXML(decisionXml, error => {
553
- if (error) {
554
- console.log('error');
555
- }
556
- });
557
- this.decisionXml = decisionXml;
558
- }
559
- });
560
- }
561
- download() {
562
- const file = new Blob([this.decisionXml], { type: 'text/xml' });
563
- const link = document.createElement('a');
564
- link.download = `decision_table_${this.decisionId}.dmn`;
565
- link.href = window.URL.createObjectURL(file);
566
- link.click();
567
- window.URL.revokeObjectURL(link.href);
568
- link.remove();
569
- }
570
- }
571
- DecisionDisplayComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: DecisionDisplayComponent, deps: [{ token: DecisionService }, { token: i2$1.ActivatedRoute }, { token: i3$1.ToastrService }], target: i0.ɵɵFactoryTarget.Component });
572
- DecisionDisplayComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: DecisionDisplayComponent, selector: "valtimo-decision-display", 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<div class=\"main-content pt-0\">\n <div class=\"container-fluid\">\n <div class=\"text-right\">\n <div class=\"btn-group mt-m3px mb-3\">\n <button (click)=\"download()\" class=\"btn btn-primary btn-space mr-0\">\n <i class=\"fa fa-save\"></i> &nbsp;\n <span>{{ 'Download' | translate }}</span>\n </button>\n </div>\n </div>\n <div id=\"canvas\" class=\"canvas-dmn\"></div>\n </div>\n</div>\n", styles: ["/*!\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 */.canvas-dmn{height:70vh}\n"], dependencies: [{ kind: "pipe", type: i4.TranslatePipe, name: "translate" }], encapsulation: i0.ViewEncapsulation.None });
573
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: DecisionDisplayComponent, decorators: [{
574
- type: Component,
575
- args: [{ selector: 'valtimo-decision-display', encapsulation: ViewEncapsulation.None, 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<div class=\"main-content pt-0\">\n <div class=\"container-fluid\">\n <div class=\"text-right\">\n <div class=\"btn-group mt-m3px mb-3\">\n <button (click)=\"download()\" class=\"btn btn-primary btn-space mr-0\">\n <i class=\"fa fa-save\"></i> &nbsp;\n <span>{{ 'Download' | translate }}</span>\n </button>\n </div>\n </div>\n <div id=\"canvas\" class=\"canvas-dmn\"></div>\n </div>\n</div>\n", styles: ["/*!\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 */.canvas-dmn{height:70vh}\n"] }]
576
- }], ctorParameters: function () { return [{ type: DecisionService }, { type: i2$1.ActivatedRoute }, { type: i3$1.ToastrService }]; } });
577
-
578
- /*
579
- * Copyright 2015-2023 Ritense BV, the Netherlands.
580
- *
581
- * Licensed under EUPL, Version 1.2 (the "License");
582
- * you may not use this file except in compliance with the License.
583
- * You may obtain a copy of the License at
584
- *
585
- * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
586
- *
587
- * Unless required by applicable law or agreed to in writing, software
588
- * distributed under the License is distributed on an "AS IS" basis,
589
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
590
- * See the License for the specific language governing permissions and
591
- * limitations under the License.
592
- */
593
- const routes = [
594
- {
595
- path: 'decision-tables',
596
- component: DecisionComponent,
597
- canActivate: [AuthGuardService],
598
- data: { title: 'Decision tables', roles: [ROLE_ADMIN] },
599
- },
600
- {
601
- path: 'decision-tables/:id',
602
- component: DecisionDisplayComponent,
603
- canActivate: [AuthGuardService],
604
- data: { title: 'Decision tables', roles: [ROLE_ADMIN] },
605
- },
606
- {
607
- path: 'decision-tables/edit/:id',
608
- component: DecisionModelerComponent,
609
- canActivate: [AuthGuardService],
610
- data: { title: 'Edit decision table', roles: [ROLE_ADMIN], customPageTitle: true },
611
- },
612
- {
613
- path: 'decision-tables/edit/create',
614
- component: DecisionModelerComponent,
615
- canActivate: [AuthGuardService],
616
- data: { title: 'Create decision table', roles: [ROLE_ADMIN] },
617
- },
618
- ];
619
- class DecisionRoutingModule {
620
- }
621
- DecisionRoutingModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: DecisionRoutingModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
622
- DecisionRoutingModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.3.0", ngImport: i0, type: DecisionRoutingModule, imports: [CommonModule, i2$1.RouterModule], exports: [RouterModule] });
623
- DecisionRoutingModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: DecisionRoutingModule, imports: [CommonModule, RouterModule.forChild(routes), RouterModule] });
624
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: DecisionRoutingModule, decorators: [{
625
- type: NgModule,
626
- args: [{
627
- declarations: [],
628
- imports: [CommonModule, RouterModule.forChild(routes)],
629
- exports: [RouterModule],
630
- }]
631
- }] });
632
-
633
- /*
634
- * Copyright 2015-2023 Ritense BV, the Netherlands.
635
- *
636
- * Licensed under EUPL, Version 1.2 (the "License");
637
- * you may not use this file except in compliance with the License.
638
- * You may obtain a copy of the License at
639
- *
640
- * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
641
- *
642
- * Unless required by applicable law or agreed to in writing, software
643
- * distributed under the License is distributed on an "AS IS" basis,
644
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
645
- * See the License for the specific language governing permissions and
646
- * limitations under the License.
647
- */
648
- class DecisionModule {
649
- }
650
- DecisionModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: DecisionModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
651
- DecisionModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.3.0", ngImport: i0, type: DecisionModule, declarations: [DecisionComponent,
652
- DecisionDeployComponent,
653
- DecisionDisplayComponent,
654
- DecisionListComponent,
655
- DecisionModelerComponent], imports: [DecisionRoutingModule,
656
- WidgetModule,
657
- ListModule,
658
- TranslateModule,
659
- ModalModule,
660
- CommonModule,
661
- FormsModule,
662
- SelectModule,
663
- SpinnerModule], exports: [DecisionComponent, DecisionModelerComponent] });
664
- DecisionModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: DecisionModule, imports: [DecisionRoutingModule,
665
- WidgetModule,
666
- ListModule,
667
- TranslateModule,
668
- ModalModule,
669
- CommonModule,
670
- FormsModule,
671
- SelectModule,
672
- SpinnerModule] });
673
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: DecisionModule, decorators: [{
674
- type: NgModule,
675
- args: [{
676
- declarations: [
677
- DecisionComponent,
678
- DecisionDeployComponent,
679
- DecisionDisplayComponent,
680
- DecisionListComponent,
681
- DecisionModelerComponent,
682
- ],
683
- imports: [
684
- DecisionRoutingModule,
685
- WidgetModule,
686
- ListModule,
687
- TranslateModule,
688
- ModalModule,
689
- CommonModule,
690
- FormsModule,
691
- SelectModule,
692
- SpinnerModule,
693
- ],
694
- exports: [DecisionComponent, DecisionModelerComponent],
695
- }]
696
- }] });
697
-
698
- /*
699
- * Copyright 2015-2023 Ritense BV, the Netherlands.
700
- *
701
- * Licensed under EUPL, Version 1.2 (the "License");
702
- * you may not use this file except in compliance with the License.
703
- * You may obtain a copy of the License at
704
- *
705
- * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
706
- *
707
- * Unless required by applicable law or agreed to in writing, software
708
- * distributed under the License is distributed on an "AS IS" basis,
709
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
710
- * See the License for the specific language governing permissions and
711
- * limitations under the License.
712
- */
713
-
714
- /**
715
- * Generated bundle index. Do not edit.
716
- */
717
-
718
- export { DecisionComponent, DecisionModelerComponent, DecisionModule };
719
- //# sourceMappingURL=valtimo-decision.mjs.map