@veloceapps/sdk 6.0.0-10 → 6.0.0-101
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/README.md +10 -2
- package/bundles/veloceapps-sdk-cms.umd.js +1269 -798
- package/bundles/veloceapps-sdk-cms.umd.js.map +1 -1
- package/bundles/veloceapps-sdk-core.umd.js +783 -650
- package/bundles/veloceapps-sdk-core.umd.js.map +1 -1
- package/bundles/veloceapps-sdk-runtime.umd.js +216 -150
- package/bundles/veloceapps-sdk-runtime.umd.js.map +1 -1
- package/bundles/veloceapps-sdk.umd.js +582 -310
- package/bundles/veloceapps-sdk.umd.js.map +1 -1
- package/cms/cms.actions.d.ts +2 -4
- package/cms/components/element-children/element-children.component.d.ts +13 -3
- package/cms/components/element-children/element-children.module.d.ts +4 -2
- package/cms/components/element-drop-handle/element-drop-handle.component.d.ts +12 -0
- package/cms/components/element-drop-handle/element-drop-handle.module.d.ts +9 -0
- package/cms/components/element-renderer/element-renderer.component.d.ts +3 -3
- package/cms/components/preview/index.d.ts +1 -0
- package/cms/components/preview/preview.component.d.ts +9 -8
- package/cms/components/preview/preview.module.d.ts +2 -1
- package/cms/components/preview/preview.types.d.ts +11 -0
- package/cms/index.d.ts +2 -0
- package/cms/launcher.module.d.ts +3 -1
- package/cms/modules/migrations/index.d.ts +2 -0
- package/cms/modules/migrations/migrations.d.ts +2 -0
- package/cms/modules/migrations/migrations.module.d.ts +6 -0
- package/cms/modules/migrations/services/migrations.service.d.ts +10 -0
- package/cms/modules/migrations/types/migrations.types.d.ts +2 -0
- package/cms/modules/runtime/index.d.ts +2 -0
- package/cms/modules/runtime/runtime.module.d.ts +8 -0
- package/cms/modules/runtime/services/compilation.service.d.ts +18 -0
- package/cms/modules/runtime/services/runtime-editor.service.d.ts +18 -0
- package/cms/modules/runtime/services/runtime.service.d.ts +27 -0
- package/cms/modules/runtime/tokens.d.ts +3 -0
- package/cms/{types → modules/runtime/types}/compilation.types.d.ts +1 -1
- package/cms/modules/runtime/types/runtime.actions.d.ts +9 -0
- package/cms/services/index.d.ts +1 -1
- package/cms/services/integration.state.d.ts +2 -3
- package/cms/services/io-provider.service.d.ts +3 -3
- package/cms/services/resources.service.d.ts +10 -0
- package/cms/types/common.types.d.ts +1 -1
- package/cms/types/configuration.types.d.ts +1 -0
- package/cms/types/index.d.ts +1 -1
- package/cms/types/integration.types.d.ts +5 -0
- package/cms/utils/elements-resolver.d.ts +3 -2
- package/cms/utils/index.d.ts +1 -0
- package/cms/utils/path.utils.d.ts +0 -1
- package/cms/utils/ui-definition.utils.d.ts +6 -0
- package/cms/vendor-map.d.ts +52 -31
- package/core/modules/configuration/services/configuration-runtime.service.d.ts +2 -4
- package/core/modules/configuration/services/configuration.service.d.ts +6 -4
- package/core/modules/configuration/types/configuration-runtime.types.d.ts +0 -2
- package/core/modules/flow-configuration/services/flow-configuration.service.d.ts +3 -2
- package/core/modules/flow-configuration/services/flow-update.service.d.ts +3 -2
- package/core/services/context.service.d.ts +1 -0
- package/core/services/metric-calculation/metric-calculation.service.d.ts +5 -1
- package/core/services/quote-draft.service.d.ts +2 -2
- package/core/types/index.d.ts +0 -1
- package/core/types/ui-definition.types.d.ts +19 -4
- package/core/utils/index.d.ts +1 -0
- package/core/utils/line-item.utils.d.ts +3 -0
- package/core/utils/ui-definition.utils.d.ts +2 -0
- package/esm2015/cms/cms.actions.js +1 -6
- package/esm2015/cms/components/element-children/element-children.component.js +24 -8
- package/esm2015/cms/components/element-children/element-children.module.js +8 -6
- package/esm2015/cms/components/element-drop-handle/element-drop-handle.component.js +32 -0
- package/esm2015/cms/components/element-drop-handle/element-drop-handle.module.js +19 -0
- package/esm2015/cms/components/element-renderer/element-renderer.component.js +9 -9
- package/esm2015/cms/components/element-renderer/element-renderer.module.js +4 -4
- package/esm2015/cms/components/plugin.component.js +3 -3
- package/esm2015/cms/components/preview/index.js +2 -1
- package/esm2015/cms/components/preview/preview.component.js +21 -36
- package/esm2015/cms/components/preview/preview.module.js +7 -6
- package/esm2015/cms/components/preview/preview.types.js +2 -0
- package/esm2015/cms/directives/custom-template.directive.js +3 -3
- package/esm2015/cms/index.js +3 -1
- package/esm2015/cms/launcher.module.js +11 -10
- package/esm2015/cms/modules/federated/federated.component.js +3 -3
- package/esm2015/cms/modules/federated/federated.module.js +4 -4
- package/esm2015/cms/modules/migrations/index.js +3 -0
- package/esm2015/cms/modules/migrations/migrations.js +11 -0
- package/esm2015/cms/modules/migrations/migrations.module.js +15 -0
- package/esm2015/cms/modules/migrations/services/migrations.service.js +43 -0
- package/esm2015/cms/modules/migrations/types/migrations.types.js +2 -0
- package/esm2015/cms/modules/runtime/index.js +3 -0
- package/esm2015/cms/modules/runtime/runtime.module.js +32 -0
- package/esm2015/cms/modules/runtime/services/compilation.service.js +84 -0
- package/esm2015/cms/modules/runtime/services/runtime-editor.service.js +27 -0
- package/esm2015/cms/modules/runtime/services/runtime.service.js +74 -0
- package/esm2015/cms/modules/runtime/tokens.js +3 -0
- package/esm2015/cms/modules/runtime/types/compilation.types.js +2 -0
- package/esm2015/cms/modules/runtime/types/runtime.actions.js +2 -0
- package/esm2015/cms/plugins/configuration.plugin.js +12 -4
- package/esm2015/cms/plugins/io.plugin.js +3 -3
- package/esm2015/cms/plugins/script.plugin.js +3 -3
- package/esm2015/cms/services/element-context.service.js +3 -3
- package/esm2015/cms/services/index.js +2 -2
- package/esm2015/cms/services/integration.state.js +4 -4
- package/esm2015/cms/services/io-provider.service.js +9 -9
- package/esm2015/cms/services/resources.service.js +50 -0
- package/esm2015/cms/services/templates.service.js +3 -3
- package/esm2015/cms/types/common.types.js +1 -1
- package/esm2015/cms/types/configuration.types.js +1 -1
- package/esm2015/cms/types/index.js +2 -2
- package/esm2015/cms/types/integration.types.js +1 -1
- package/esm2015/cms/utils/elements-resolver.js +18 -8
- package/esm2015/cms/utils/index.js +2 -1
- package/esm2015/cms/utils/path.utils.js +2 -13
- package/esm2015/cms/utils/ui-definition.utils.js +82 -0
- package/esm2015/cms/vendor-map.js +26 -10
- package/esm2015/core/core.module.js +4 -4
- package/esm2015/core/modules/configuration/configuration.module.js +4 -4
- package/esm2015/core/modules/configuration/services/configuration-runtime.service.js +5 -10
- package/esm2015/core/modules/configuration/services/configuration.service.js +38 -34
- package/esm2015/core/modules/configuration/services/runtime-context.service.js +3 -3
- package/esm2015/core/modules/configuration/types/configuration-runtime.types.js +1 -1
- package/esm2015/core/modules/flow-configuration/flow-configuration.module.js +4 -4
- package/esm2015/core/modules/flow-configuration/services/flow-configuration.service.js +11 -10
- package/esm2015/core/modules/flow-configuration/services/flow-update.service.js +9 -9
- package/esm2015/core/services/context.service.js +7 -4
- package/esm2015/core/services/metric-calculation/metric-calculation.service.js +18 -9
- package/esm2015/core/services/product-images.service.js +3 -3
- package/esm2015/core/services/quote-draft.service.js +7 -7
- package/esm2015/core/types/index.js +1 -2
- package/esm2015/core/types/ui-definition.types.js +2 -2
- package/esm2015/core/utils/index.js +2 -1
- package/esm2015/core/utils/line-item.utils.js +43 -11
- package/esm2015/core/utils/ui-definition.utils.js +9 -0
- package/esm2015/runtime/components/component-preview/component-preview.component.js +4 -4
- package/esm2015/runtime/components/section-renderer/section-renderer.component.js +3 -3
- package/esm2015/runtime/components/ui-runtime/runtime.component.js +3 -3
- package/esm2015/runtime/components/ui-runtime-preview/runtime-preview.component.js +3 -3
- package/esm2015/runtime/execution/components/children-placeholder/children-placeholder.component.js +6 -6
- package/esm2015/runtime/execution/components/context-provider/context-provider.component.js +3 -3
- package/esm2015/runtime/execution/components/execution-section-renderer/execution-section-renderer.component.js +3 -3
- package/esm2015/runtime/execution/components/federated/federated.component.js +3 -3
- package/esm2015/runtime/execution/components/velo-attribute/velo-attribute.component.js +3 -3
- package/esm2015/runtime/execution/components/velo-multiselect/velo-multiselect.component.js +3 -3
- package/esm2015/runtime/execution/components/velo-port-checkbox/velo-port-checkbox.component.js +3 -3
- package/esm2015/runtime/execution/components/velo-port-dropdown/velo-port-dropdown.component.js +3 -3
- package/esm2015/runtime/execution/components/velo-port-radio/velo-port-radio.component.js +3 -3
- package/esm2015/runtime/execution/components/velo-type/velo-type.component.js +3 -3
- package/esm2015/runtime/execution/directives/section-script.directive.js +3 -3
- package/esm2015/runtime/execution/directives/sf-query.directive.js +3 -3
- package/esm2015/runtime/execution/directives/velo-attribute.directive.js +3 -3
- package/esm2015/runtime/execution/directives/velo-port.directive.js +18 -18
- package/esm2015/runtime/execution/directives/vl-approval.directive.js +3 -3
- package/esm2015/runtime/execution/directives/vl-document-attachments.directive.js +3 -3
- package/esm2015/runtime/execution/directives/vl-document-templates.directive.js +3 -3
- package/esm2015/runtime/execution/directives/vl-quote.directive.js +4 -4
- package/esm2015/runtime/execution/directives/vl-ramp.directive.js +3 -3
- package/esm2015/runtime/execution/runtime-execution.module.js +4 -4
- package/esm2015/runtime/runtime.module.js +4 -4
- package/esm2015/runtime/services/cart.service.js +3 -3
- package/esm2015/runtime/services/collapsible-state.service.js +3 -3
- package/esm2015/runtime/services/configuration.service.js +11 -12
- package/esm2015/runtime/services/current-state.service.js +3 -3
- package/esm2015/runtime/services/form-scope.service.js +3 -3
- package/esm2015/runtime/services/product-model-cache.service.js +3 -3
- package/esm2015/runtime/services/runtime-context.service.js +3 -3
- package/esm2015/runtime/services/runtime-form.service.js +3 -3
- package/esm2015/runtime/services/runtime.service.js +4 -4
- package/esm2015/runtime/services/section-helper.service.js +3 -3
- package/esm2015/runtime/services/section-scope.service.js +3 -3
- package/esm2015/runtime/services/section-store.service.js +3 -3
- package/esm2015/runtime/services/section.service.js +6 -6
- package/esm2015/runtime/types/index.js +2 -1
- package/esm2015/runtime/types/quote-states.types.js +2 -0
- package/esm2015/src/components/dialog/dialog.component.js +16 -6
- package/esm2015/src/components/dialog/dialog.module.js +4 -4
- package/esm2015/src/components/dialog/dialog.types.js +1 -1
- package/esm2015/src/components/doc-gen/doc-gen.component.js +3 -3
- package/esm2015/src/components/doc-gen/doc-gen.module.js +4 -4
- package/esm2015/src/components/header/cart-overlay/cart-preview.component.js +3 -3
- package/esm2015/src/components/header/cart-overlay/cart-preview.module.js +4 -4
- package/esm2015/src/components/header/header.component.js +39 -13
- package/esm2015/src/components/header/header.module.js +4 -4
- package/esm2015/src/components/header/metrics/metrics.component.js +79 -67
- package/esm2015/src/components/header/metrics/metrics.definitions.js +1 -8
- package/esm2015/src/components/header/metrics/metrics.module.js +4 -4
- package/esm2015/src/flow-routing.module.js +18 -5
- package/esm2015/src/flow.component.js +3 -3
- package/esm2015/src/flow.module.js +4 -4
- package/esm2015/src/guards/context.guard.js +3 -3
- package/esm2015/src/guards/product-unload.guard.js +5 -5
- package/esm2015/src/guards/root.guard.js +3 -3
- package/esm2015/src/pages/assets/assets.component.js +117 -0
- package/esm2015/src/pages/assets/assets.module.js +20 -0
- package/esm2015/src/pages/catalog/catalog.component.js +6 -6
- package/esm2015/src/pages/catalog/catalog.module.js +4 -4
- package/esm2015/src/pages/debug/debug.component.js +3 -3
- package/esm2015/src/pages/debug/debug.module.js +4 -4
- package/esm2015/src/pages/empty-account/empty-account.component.js +3 -3
- package/esm2015/src/pages/empty-account/empty-account.module.js +4 -4
- package/esm2015/src/pages/legacy-product/legacy-product.component.js +4 -4
- package/esm2015/src/pages/legacy-product/legacy-product.module.js +4 -4
- package/esm2015/src/pages/product/product.component.js +5 -12
- package/esm2015/src/pages/product/product.module.js +4 -4
- package/esm2015/src/pages/record-not-found/record-not-found.component.js +3 -3
- package/esm2015/src/pages/record-not-found/record-not-found.module.js +4 -4
- package/esm2015/src/pages/remote/remote.component.js +5 -8
- package/esm2015/src/pages/remote/remote.module.js +4 -4
- package/esm2015/src/pages/shopping-cart/shopping-cart.component.js +6 -6
- package/esm2015/src/pages/shopping-cart/shopping-cart.module.js +4 -4
- package/esm2015/src/resolvers/flow.resolver.js +3 -3
- package/esm2015/src/resolvers/quote.resolver.js +28 -14
- package/esm2015/src/services/doc-gen.service.js +3 -3
- package/esm2015/src/services/flow-dialog.service.js +5 -4
- package/esm2015/src/services/flow-router.service.js +12 -4
- package/esm2015/src/services/flow.service.js +12 -5
- package/esm2015/src/types/flow-customization.types.js +1 -1
- package/esm2015/src/utils/flow.utils.js +3 -3
- package/fesm2015/veloceapps-sdk-cms.js +1073 -718
- package/fesm2015/veloceapps-sdk-cms.js.map +1 -1
- package/fesm2015/veloceapps-sdk-core.js +574 -520
- package/fesm2015/veloceapps-sdk-core.js.map +1 -1
- package/fesm2015/veloceapps-sdk-runtime.js +145 -146
- package/fesm2015/veloceapps-sdk-runtime.js.map +1 -1
- package/fesm2015/veloceapps-sdk.js +455 -264
- package/fesm2015/veloceapps-sdk.js.map +1 -1
- package/package.json +5 -3
- package/runtime/services/configuration.service.d.ts +2 -1
- package/runtime/services/runtime.service.d.ts +2 -1
- package/runtime/types/index.d.ts +1 -0
- package/src/components/dialog/dialog.types.d.ts +1 -0
- package/src/components/header/header.component.d.ts +10 -3
- package/src/components/header/metrics/metrics.component.d.ts +15 -6
- package/src/components/header/metrics/metrics.definitions.d.ts +0 -3
- package/src/flow-routing.module.d.ts +4 -3
- package/src/pages/assets/assets.component.d.ts +32 -0
- package/src/pages/assets/assets.module.d.ts +10 -0
- package/src/pages/product/product.component.d.ts +0 -1
- package/src/resolvers/quote.resolver.d.ts +5 -1
- package/src/services/flow-router.service.d.ts +2 -0
- package/src/services/flow.service.d.ts +1 -0
- package/src/types/flow-customization.types.d.ts +1 -0
- package/cms/services/dynamic-module.service.d.ts +0 -15
- package/cms/services/launcher.service.d.ts +0 -18
- package/esm2015/cms/services/dynamic-module.service.js +0 -33
- package/esm2015/cms/services/launcher.service.js +0 -58
- package/esm2015/cms/types/compilation.types.js +0 -2
- package/esm2015/core/types/quote-states.types.js +0 -2
- /package/{core → runtime}/types/quote-states.types.d.ts +0 -0
@@ -1,8 +1,8 @@
|
|
1
1
|
(function (global, factory) {
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('rxjs'), require('lodash'), require('
|
3
|
-
typeof define === 'function' && define.amd ? define('@veloceapps/sdk/cms', ['exports', '@angular/core', 'rxjs', 'lodash', '
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.veloceapps = global.veloceapps || {}, global.veloceapps.sdk = global.veloceapps.sdk || {}, global.veloceapps.sdk.cms = {}), global.ng.core, global.rxjs, global.lodash, global.
|
5
|
-
})(this, (function (exports, i0, rxjs, lodash,
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('rxjs'), require('lodash'), require('rfc6902'), require('@veloceapps/sdk/core'), require('primeng/api'), require('@veloceapps/components'), require('@veloceapps/core'), require('@angular/common'), require('ngx-drag-drop'), require('@veloceapps/api'), require('primeng/dynamicdialog'), require('@angular/cdk/drag-drop'), require('@angular/cdk/scrolling'), require('@angular/forms'), require('@babel/standalone'), require('rxjs/operators')) :
|
3
|
+
typeof define === 'function' && define.amd ? define('@veloceapps/sdk/cms', ['exports', '@angular/core', 'rxjs', 'lodash', 'rfc6902', '@veloceapps/sdk/core', 'primeng/api', '@veloceapps/components', '@veloceapps/core', '@angular/common', 'ngx-drag-drop', '@veloceapps/api', 'primeng/dynamicdialog', '@angular/cdk/drag-drop', '@angular/cdk/scrolling', '@angular/forms', '@babel/standalone', 'rxjs/operators'], factory) :
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.veloceapps = global.veloceapps || {}, global.veloceapps.sdk = global.veloceapps.sdk || {}, global.veloceapps.sdk.cms = {}), global.ng.core, global.rxjs, global.lodash, global.rfc6902, global.veloceapps.sdk.core, global["primeng/api"], global["@veloceapps/components"], global["@veloceapps/core"], global.ng.common, global["ngx-drag-drop"], global["@veloceapps/api"], global["primeng/dynamicdialog"], global.ng.cdk.dragDrop, global.ng.cdk.scrolling, global.ng.forms, global["@babel/standalone"], global.rxjs.operators));
|
5
|
+
})(this, (function (exports, i0, rxjs, lodash, rfc6902, i2, i3, i1, core, i7, i2$1, api, dynamicdialog, dragDrop, scrolling, angularForms, standalone, rxjsOperators) { 'use strict';
|
6
6
|
|
7
7
|
function _interopNamespace(e) {
|
8
8
|
if (e && e.__esModule) return e;
|
@@ -25,12 +25,13 @@
|
|
25
25
|
var i0__namespace = /*#__PURE__*/_interopNamespace(i0);
|
26
26
|
var rxjs__namespace = /*#__PURE__*/_interopNamespace(rxjs);
|
27
27
|
var lodash__namespace = /*#__PURE__*/_interopNamespace(lodash);
|
28
|
-
var i7__namespace = /*#__PURE__*/_interopNamespace(i7);
|
29
|
-
var angularForms__namespace = /*#__PURE__*/_interopNamespace(angularForms);
|
30
28
|
var i2__namespace = /*#__PURE__*/_interopNamespace(i2);
|
29
|
+
var i3__namespace = /*#__PURE__*/_interopNamespace(i3);
|
31
30
|
var i1__namespace = /*#__PURE__*/_interopNamespace(i1);
|
31
|
+
var i7__namespace = /*#__PURE__*/_interopNamespace(i7);
|
32
|
+
var i2__namespace$1 = /*#__PURE__*/_interopNamespace(i2$1);
|
33
|
+
var angularForms__namespace = /*#__PURE__*/_interopNamespace(angularForms);
|
32
34
|
var rxjsOperators__namespace = /*#__PURE__*/_interopNamespace(rxjsOperators);
|
33
|
-
var i3__namespace = /*#__PURE__*/_interopNamespace(i3);
|
34
35
|
|
35
36
|
exports.FlowAction = void 0;
|
36
37
|
(function (FlowAction) {
|
@@ -43,7 +44,6 @@
|
|
43
44
|
FlowAction["FLOW_SWITCH_OBJECT"] = "FLOW_SWITCH_OBJECT";
|
44
45
|
FlowAction["REMOTE_APPLY"] = "REMOTE_APPLY";
|
45
46
|
FlowAction["REMOTE_CANCEL"] = "REMOTE_CANCEL";
|
46
|
-
FlowAction["SET_DEFAULT_METRICS"] = "SET_DEFAULT_METRICS";
|
47
47
|
})(exports.FlowAction || (exports.FlowAction = {}));
|
48
48
|
var ConfigureProductAction = function (_a) {
|
49
49
|
var lineItemId = _a.lineItemId, productId = _a.productId;
|
@@ -77,10 +77,6 @@
|
|
77
77
|
type: exports.FlowAction.FLOW_SWITCH_OBJECT,
|
78
78
|
payload: payload,
|
79
79
|
}); };
|
80
|
-
var SetDefaultMetrics = function (metrics) { return ({
|
81
|
-
type: exports.FlowAction.SET_DEFAULT_METRICS,
|
82
|
-
payload: { metrics: metrics },
|
83
|
-
}); };
|
84
80
|
|
85
81
|
var cmsActions = /*#__PURE__*/Object.freeze({
|
86
82
|
__proto__: null,
|
@@ -93,11 +89,10 @@
|
|
93
89
|
CloseDocGenAction: CloseDocGenAction,
|
94
90
|
RemoteApplyAction: RemoteApplyAction,
|
95
91
|
RemoteCancelAction: RemoteCancelAction,
|
96
|
-
SwitchObjectAction: SwitchObjectAction
|
97
|
-
SetDefaultMetrics: SetDefaultMetrics
|
92
|
+
SwitchObjectAction: SwitchObjectAction
|
98
93
|
});
|
99
94
|
|
100
|
-
|
95
|
+
/******************************************************************************
|
101
96
|
Copyright (c) Microsoft Corporation.
|
102
97
|
|
103
98
|
Permission to use, copy, modify, and/or distribute this software for any
|
@@ -164,6 +159,64 @@
|
|
164
159
|
function __param(paramIndex, decorator) {
|
165
160
|
return function (target, key) { decorator(target, key, paramIndex); };
|
166
161
|
}
|
162
|
+
function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
163
|
+
function accept(f) { if (f !== void 0 && typeof f !== "function")
|
164
|
+
throw new TypeError("Function expected"); return f; }
|
165
|
+
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
166
|
+
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
167
|
+
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
168
|
+
var _, done = false;
|
169
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
170
|
+
var context = {};
|
171
|
+
for (var p in contextIn)
|
172
|
+
context[p] = p === "access" ? {} : contextIn[p];
|
173
|
+
for (var p in contextIn.access)
|
174
|
+
context.access[p] = contextIn.access[p];
|
175
|
+
context.addInitializer = function (f) { if (done)
|
176
|
+
throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
177
|
+
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
178
|
+
if (kind === "accessor") {
|
179
|
+
if (result === void 0)
|
180
|
+
continue;
|
181
|
+
if (result === null || typeof result !== "object")
|
182
|
+
throw new TypeError("Object expected");
|
183
|
+
if (_ = accept(result.get))
|
184
|
+
descriptor.get = _;
|
185
|
+
if (_ = accept(result.set))
|
186
|
+
descriptor.set = _;
|
187
|
+
if (_ = accept(result.init))
|
188
|
+
initializers.push(_);
|
189
|
+
}
|
190
|
+
else if (_ = accept(result)) {
|
191
|
+
if (kind === "field")
|
192
|
+
initializers.push(_);
|
193
|
+
else
|
194
|
+
descriptor[key] = _;
|
195
|
+
}
|
196
|
+
}
|
197
|
+
if (target)
|
198
|
+
Object.defineProperty(target, contextIn.name, descriptor);
|
199
|
+
done = true;
|
200
|
+
}
|
201
|
+
;
|
202
|
+
function __runInitializers(thisArg, initializers, value) {
|
203
|
+
var useValue = arguments.length > 2;
|
204
|
+
for (var i = 0; i < initializers.length; i++) {
|
205
|
+
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
206
|
+
}
|
207
|
+
return useValue ? value : void 0;
|
208
|
+
}
|
209
|
+
;
|
210
|
+
function __propKey(x) {
|
211
|
+
return typeof x === "symbol" ? x : "".concat(x);
|
212
|
+
}
|
213
|
+
;
|
214
|
+
function __setFunctionName(f, name, prefix) {
|
215
|
+
if (typeof name === "symbol")
|
216
|
+
name = name.description ? "[".concat(name.description, "]") : "";
|
217
|
+
return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
|
218
|
+
}
|
219
|
+
;
|
167
220
|
function __metadata(metadataKey, metadataValue) {
|
168
221
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
169
222
|
return Reflect.metadata(metadataKey, metadataValue);
|
@@ -195,7 +248,7 @@
|
|
195
248
|
function step(op) {
|
196
249
|
if (f)
|
197
250
|
throw new TypeError("Generator is already executing.");
|
198
|
-
while (_)
|
251
|
+
while (g && (g = 0, op[0] && (_ = 0)), _)
|
199
252
|
try {
|
200
253
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
|
201
254
|
return t;
|
@@ -259,7 +312,11 @@
|
|
259
312
|
var __createBinding = Object.create ? (function (o, m, k, k2) {
|
260
313
|
if (k2 === undefined)
|
261
314
|
k2 = k;
|
262
|
-
Object.
|
315
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
316
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
317
|
+
desc = { enumerable: true, get: function () { return m[k]; } };
|
318
|
+
}
|
319
|
+
Object.defineProperty(o, k2, desc);
|
263
320
|
}) : (function (o, m, k, k2) {
|
264
321
|
if (k2 === undefined)
|
265
322
|
k2 = k;
|
@@ -359,7 +416,7 @@
|
|
359
416
|
function __asyncDelegator(o) {
|
360
417
|
var i, p;
|
361
418
|
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
|
362
|
-
function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done:
|
419
|
+
function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }
|
363
420
|
}
|
364
421
|
function __asyncValues(o) {
|
365
422
|
if (!Symbol.asyncIterator)
|
@@ -414,6 +471,11 @@
|
|
414
471
|
throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
415
472
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
416
473
|
}
|
474
|
+
function __classPrivateFieldIn(state, receiver) {
|
475
|
+
if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function"))
|
476
|
+
throw new TypeError("Cannot use 'in' operator on non-object");
|
477
|
+
return typeof state === "function" ? receiver === state : state.has(receiver);
|
478
|
+
}
|
417
479
|
|
418
480
|
var DEFAULT_PLUGINS_TOKEN = new i0.InjectionToken('DEFAULT_PLUGINS_TOKEN');
|
419
481
|
var UI_DEFINITION_METADATA = new i0.InjectionToken('UI_DEFINITION_METADATA_TOKEN');
|
@@ -492,6 +554,110 @@
|
|
492
554
|
__param(0, i0.Inject(i0.Injector))
|
493
555
|
], exports.ElementComponent);
|
494
556
|
|
557
|
+
function getElementUniqueName(collection, name, comparator) {
|
558
|
+
var result = '';
|
559
|
+
var index = 0;
|
560
|
+
while (!result) {
|
561
|
+
var candidate = name + (index ? " (" + index + ")" : '');
|
562
|
+
var exists = collection.some(comparator(candidate));
|
563
|
+
if (!exists) {
|
564
|
+
result = candidate;
|
565
|
+
}
|
566
|
+
else {
|
567
|
+
index++;
|
568
|
+
}
|
569
|
+
}
|
570
|
+
return result;
|
571
|
+
}
|
572
|
+
var insertElementAt = function (source, target, parentPath, index) {
|
573
|
+
var result = __spreadArray([], __read(source));
|
574
|
+
var name = getElementUniqueName(result, target.name, function (name) { return function (el) { return el.name === name; }; });
|
575
|
+
var path = parentPath ? parentPath + "/" + name : name;
|
576
|
+
result.splice(index, 0, Object.assign(Object.assign({}, target), { path: path, name: name }));
|
577
|
+
return result;
|
578
|
+
};
|
579
|
+
var insertElement = function (source, target, path, index) {
|
580
|
+
if (!path) {
|
581
|
+
return insertElementAt(source, target, '', index);
|
582
|
+
}
|
583
|
+
return source.map(function (element) {
|
584
|
+
var _a;
|
585
|
+
if (element.path === path) {
|
586
|
+
return Object.assign(Object.assign({}, element), { children: insertElementAt(element.children, target, element.path, index) });
|
587
|
+
}
|
588
|
+
else if ((_a = element.path) === null || _a === void 0 ? void 0 : _a.startsWith(path)) {
|
589
|
+
return Object.assign(Object.assign({}, element), { children: insertElement(element.children, target, path, index) });
|
590
|
+
}
|
591
|
+
else {
|
592
|
+
return element;
|
593
|
+
}
|
594
|
+
});
|
595
|
+
};
|
596
|
+
var removeElement = function (source, path) {
|
597
|
+
return source.reduce(function (trunk, element) {
|
598
|
+
if (path === element.path) {
|
599
|
+
return trunk;
|
600
|
+
}
|
601
|
+
if (element.path) {
|
602
|
+
if (path.startsWith(element.path)) {
|
603
|
+
trunk.push(Object.assign(Object.assign({}, element), { children: removeElement(element.children, path) }));
|
604
|
+
}
|
605
|
+
else {
|
606
|
+
trunk.push(element);
|
607
|
+
}
|
608
|
+
}
|
609
|
+
return trunk;
|
610
|
+
}, []);
|
611
|
+
};
|
612
|
+
var findElementByPath = function (source, path) {
|
613
|
+
var e_1, _b;
|
614
|
+
try {
|
615
|
+
for (var source_1 = __values(source), source_1_1 = source_1.next(); !source_1_1.done; source_1_1 = source_1.next()) {
|
616
|
+
var el = source_1_1.value;
|
617
|
+
if (el.path === path) {
|
618
|
+
return el;
|
619
|
+
}
|
620
|
+
if (el.path && path.startsWith(el.path)) {
|
621
|
+
var found = findElementByPath(el.children, path);
|
622
|
+
if (found) {
|
623
|
+
return found;
|
624
|
+
}
|
625
|
+
}
|
626
|
+
}
|
627
|
+
}
|
628
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
629
|
+
finally {
|
630
|
+
try {
|
631
|
+
if (source_1_1 && !source_1_1.done && (_b = source_1.return)) _b.call(source_1);
|
632
|
+
}
|
633
|
+
finally { if (e_1) throw e_1.error; }
|
634
|
+
}
|
635
|
+
return;
|
636
|
+
};
|
637
|
+
var findElementByModule = function (elements, module, elementName) {
|
638
|
+
var e_2, _b;
|
639
|
+
try {
|
640
|
+
for (var elements_1 = __values(elements), elements_1_1 = elements_1.next(); !elements_1_1.done; elements_1_1 = elements_1.next()) {
|
641
|
+
var el = elements_1_1.value;
|
642
|
+
if (el.module === module && el.name === elementName) {
|
643
|
+
return el;
|
644
|
+
}
|
645
|
+
var child = findElementByModule(el.children, module, elementName);
|
646
|
+
if (child) {
|
647
|
+
return child;
|
648
|
+
}
|
649
|
+
}
|
650
|
+
}
|
651
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
652
|
+
finally {
|
653
|
+
try {
|
654
|
+
if (elements_1_1 && !elements_1_1.done && (_b = elements_1.return)) _b.call(elements_1);
|
655
|
+
}
|
656
|
+
finally { if (e_2) throw e_2.error; }
|
657
|
+
}
|
658
|
+
return;
|
659
|
+
};
|
660
|
+
|
495
661
|
var parseBoundPath = function (path) {
|
496
662
|
var _a, _b;
|
497
663
|
var regexp = new RegExp("(?:\\/)(?:\\w+)(?:\\/)(?:ports|attributes)(?:\\/)(?:\\w+)|(?:\\/)(?:\\w+)", 'g');
|
@@ -524,29 +690,6 @@
|
|
524
690
|
variable: variable,
|
525
691
|
};
|
526
692
|
};
|
527
|
-
var findElementByModule = function (elements, module, elementName) {
|
528
|
-
var e_1, _e;
|
529
|
-
try {
|
530
|
-
for (var elements_1 = __values(elements), elements_1_1 = elements_1.next(); !elements_1_1.done; elements_1_1 = elements_1.next()) {
|
531
|
-
var el = elements_1_1.value;
|
532
|
-
if (el.module === module && el.name === elementName) {
|
533
|
-
return el;
|
534
|
-
}
|
535
|
-
var child = findElementByModule(el.children, module, elementName);
|
536
|
-
if (child) {
|
537
|
-
return child;
|
538
|
-
}
|
539
|
-
}
|
540
|
-
}
|
541
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
542
|
-
finally {
|
543
|
-
try {
|
544
|
-
if (elements_1_1 && !elements_1_1.done && (_e = elements_1.return)) _e.call(elements_1);
|
545
|
-
}
|
546
|
-
finally { if (e_1) throw e_1.error; }
|
547
|
-
}
|
548
|
-
return;
|
549
|
-
};
|
550
693
|
var getAbsolutePath = function (elements, subject, path) {
|
551
694
|
var _a, _b, _c;
|
552
695
|
if (path.module) {
|
@@ -569,49 +712,85 @@
|
|
569
712
|
return subjectSegments.join('/');
|
570
713
|
};
|
571
714
|
|
572
|
-
var
|
573
|
-
|
574
|
-
|
575
|
-
|
715
|
+
var CMS_COMPILATION_SERVICE = new i0.InjectionToken('VENDOR_MAP');
|
716
|
+
|
717
|
+
var RuntimeService = /** @class */ (function () {
|
718
|
+
function RuntimeService(injector) {
|
719
|
+
this.injector = injector;
|
720
|
+
this.modules = [];
|
721
|
+
this.componentFactories = {};
|
722
|
+
this.applicationTree = [];
|
723
|
+
this.isInitialized$ = new rxjs.BehaviorSubject(false);
|
724
|
+
this.updated$ = new rxjs.Subject();
|
725
|
+
this.compilationService = this.injector.get(CMS_COMPILATION_SERVICE);
|
576
726
|
}
|
577
|
-
|
578
|
-
|
579
|
-
|
580
|
-
|
581
|
-
|
582
|
-
|
583
|
-
|
584
|
-
|
585
|
-
|
586
|
-
|
587
|
-
|
588
|
-
return this.componentFactories.find(function (f) { return f.componentType.path === element.path; });
|
727
|
+
RuntimeService.prototype.initialize$ = function (uiDefinition, config) {
|
728
|
+
var _this = this;
|
729
|
+
this.config = config;
|
730
|
+
if (!uiDefinition) {
|
731
|
+
return rxjs.of([]);
|
732
|
+
}
|
733
|
+
return this.compilationService.compileUIDefinition$(uiDefinition).pipe(rxjs.map(function (result) {
|
734
|
+
_this.applicationTree = result.elements;
|
735
|
+
_this.addComponentFactories(result.module.componentFactories);
|
736
|
+
return result.elements;
|
737
|
+
}), rxjs.tap(function () { return _this.isInitialized$.next(true); }));
|
589
738
|
};
|
590
|
-
|
591
|
-
|
592
|
-
|
593
|
-
|
594
|
-
|
595
|
-
|
596
|
-
|
597
|
-
|
598
|
-
|
599
|
-
|
600
|
-
|
601
|
-
|
602
|
-
|
739
|
+
RuntimeService.prototype.applyPatch$ = function (patch) {
|
740
|
+
var _this = this;
|
741
|
+
var observable$ = rxjs.of(undefined);
|
742
|
+
patch.forEach(function (operation) {
|
743
|
+
switch (operation.op) {
|
744
|
+
case 'add': {
|
745
|
+
observable$ = observable$.pipe(rxjs.switchMap(function () { return _this.addElement$(operation); }));
|
746
|
+
break;
|
747
|
+
}
|
748
|
+
case 'remove': {
|
749
|
+
observable$ = observable$.pipe(rxjs.map(function () { return _this.deleteElement(operation); }));
|
750
|
+
break;
|
751
|
+
}
|
752
|
+
default:
|
753
|
+
observable$ = rxjs.of();
|
754
|
+
}
|
755
|
+
});
|
756
|
+
return observable$.pipe(rxjs.tap(function () { return _this.updated$.next(); }));
|
757
|
+
};
|
758
|
+
RuntimeService.prototype.getCompiledElement$ = function (path) {
|
759
|
+
var _this = this;
|
760
|
+
return this.updated$.pipe(rxjs.startWith(undefined), rxjs.map(function () { return findElementByPath(_this.applicationTree, path); }), rxjs.distinctUntilChanged());
|
761
|
+
};
|
762
|
+
RuntimeService.prototype.clear = function () {
|
763
|
+
this.compilationService.clearModuleCache(this.modules);
|
764
|
+
this.modules = [];
|
765
|
+
this.applicationTree = [];
|
766
|
+
this.componentFactories = {};
|
767
|
+
this.isInitialized$.next(false);
|
768
|
+
};
|
769
|
+
RuntimeService.prototype.addElement$ = function (operation) {
|
770
|
+
var _this = this;
|
771
|
+
return this.compilationService.compileElement$(operation.value).pipe(rxjs.map(function (result) {
|
772
|
+
_this.addComponentFactories(result.module.componentFactories);
|
773
|
+
rfc6902.applyPatch(_this.applicationTree, [Object.assign(Object.assign({}, operation), { value: result.elements[0] })]);
|
774
|
+
}));
|
775
|
+
};
|
776
|
+
RuntimeService.prototype.deleteElement = function (operation) {
|
777
|
+
rfc6902.applyPatch(this.applicationTree, [operation]);
|
778
|
+
};
|
779
|
+
RuntimeService.prototype.addComponentFactories = function (list) {
|
780
|
+
var _this = this;
|
781
|
+
list.forEach(function (item) { return (_this.componentFactories[item.componentType.path] = item); });
|
603
782
|
};
|
604
|
-
return
|
783
|
+
return RuntimeService;
|
605
784
|
}());
|
606
|
-
|
607
|
-
|
608
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.
|
785
|
+
RuntimeService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: RuntimeService, deps: [{ token: i0__namespace.Injector }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
786
|
+
RuntimeService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: RuntimeService });
|
787
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: RuntimeService, decorators: [{
|
609
788
|
type: i0.Injectable
|
610
|
-
}] });
|
789
|
+
}], ctorParameters: function () { return [{ type: i0__namespace.Injector }]; } });
|
611
790
|
|
612
791
|
var IOProviderService = /** @class */ (function () {
|
613
|
-
function IOProviderService(
|
614
|
-
this.
|
792
|
+
function IOProviderService(runtimeService) {
|
793
|
+
this.runtimeService = runtimeService;
|
615
794
|
this.inputs = {};
|
616
795
|
}
|
617
796
|
IOProviderService.prototype.connect = function (el, name, target) {
|
@@ -631,7 +810,7 @@
|
|
631
810
|
var pathIsValue = elPath.segments.length === 1 && elPath.segments[0].startsWith('"') && elPath.segments[0].endsWith('"');
|
632
811
|
var finalName = (_b = elPath.variable) !== null && _b !== void 0 ? _b : name;
|
633
812
|
var value = pathIsValue ? new rxjs.BehaviorSubject(elPath.segments[0].slice(1, -1)) : undefined;
|
634
|
-
var absolutePath = !pathIsValue ? getAbsolutePath(this.
|
813
|
+
var absolutePath = !pathIsValue ? getAbsolutePath(this.runtimeService.applicationTree, el, elPath) : el.path;
|
635
814
|
return this.createSubjectSafe(absolutePath !== null && absolutePath !== void 0 ? absolutePath : '', finalName, value);
|
636
815
|
};
|
637
816
|
IOProviderService.prototype.createSubjectSafe = function (path, name, subject) {
|
@@ -651,11 +830,11 @@
|
|
651
830
|
};
|
652
831
|
return IOProviderService;
|
653
832
|
}());
|
654
|
-
IOProviderService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.
|
655
|
-
IOProviderService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.
|
656
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.
|
833
|
+
IOProviderService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: IOProviderService, deps: [{ token: RuntimeService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
834
|
+
IOProviderService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: IOProviderService });
|
835
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: IOProviderService, decorators: [{
|
657
836
|
type: i0.Injectable
|
658
|
-
}], ctorParameters: function () { return [{ type:
|
837
|
+
}], ctorParameters: function () { return [{ type: RuntimeService }]; } });
|
659
838
|
|
660
839
|
var TemplatesService = /** @class */ (function () {
|
661
840
|
function TemplatesService() {
|
@@ -680,318 +859,122 @@
|
|
680
859
|
};
|
681
860
|
return TemplatesService;
|
682
861
|
}());
|
683
|
-
TemplatesService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.
|
684
|
-
TemplatesService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.
|
685
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.
|
862
|
+
TemplatesService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: TemplatesService, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
863
|
+
TemplatesService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: TemplatesService });
|
864
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: TemplatesService, decorators: [{
|
686
865
|
type: i0.Injectable
|
687
866
|
}] });
|
688
867
|
|
689
|
-
var
|
690
|
-
|
691
|
-
|
692
|
-
|
693
|
-
this.
|
694
|
-
|
695
|
-
var inputProvider = this.host.injector.get(IOProviderService);
|
696
|
-
var inputs = Object.entries((_a = elementMetadata.inputs) !== null && _a !== void 0 ? _a : {});
|
697
|
-
var outputs = Object.entries((_b = elementMetadata.outputs) !== null && _b !== void 0 ? _b : {});
|
698
|
-
inputs.forEach(function (_c) {
|
699
|
-
var _d = __read(_c, 2), key = _d[0], path = _d[1];
|
700
|
-
var _a;
|
701
|
-
if (path && typeof path !== 'string') {
|
702
|
-
console.error("The value of '" + key + "' input should be a string");
|
703
|
-
}
|
704
|
-
if (((_a = elementMetadata.outputs) === null || _a === void 0 ? void 0 : _a[key]) !== undefined) {
|
705
|
-
console.warn("'" + key + "' appears both in inputs and outputs. To prevent inconsistent behavior please keep them unique ");
|
706
|
-
}
|
707
|
-
_this.host[key] = inputProvider.connect(elementMetadata, key, path);
|
708
|
-
});
|
709
|
-
outputs.forEach(function (_c) {
|
710
|
-
var _d = __read(_c, 2), key = _d[0], path = _d[1];
|
711
|
-
if (path && typeof path !== 'string') {
|
712
|
-
console.error("The value of '" + key + "' output should be a string");
|
713
|
-
}
|
714
|
-
_this.host[key] = inputProvider.provide(elementMetadata, key, path);
|
715
|
-
});
|
868
|
+
var InitAction = { type: 'INIT' };
|
869
|
+
var ClearAction = { type: 'CLEAR' };
|
870
|
+
var IntegrationState = /** @class */ (function () {
|
871
|
+
function IntegrationState() {
|
872
|
+
this.stateSubj$ = new rxjs.BehaviorSubject({});
|
873
|
+
this.action$ = new rxjs.BehaviorSubject(InitAction);
|
716
874
|
}
|
717
|
-
|
875
|
+
Object.defineProperty(IntegrationState.prototype, "state$", {
|
876
|
+
get: function () {
|
877
|
+
return this.stateSubj$.asObservable();
|
878
|
+
},
|
879
|
+
enumerable: false,
|
880
|
+
configurable: true
|
881
|
+
});
|
882
|
+
Object.defineProperty(IntegrationState.prototype, "state", {
|
883
|
+
get: function () {
|
884
|
+
return this.stateSubj$.getValue();
|
885
|
+
},
|
886
|
+
enumerable: false,
|
887
|
+
configurable: true
|
888
|
+
});
|
889
|
+
IntegrationState.prototype.patchState = function (update) {
|
890
|
+
this.stateSubj$.next(Object.assign(Object.assign({}, this.stateSubj$.getValue()), update));
|
891
|
+
};
|
892
|
+
IntegrationState.prototype.dispatch = function (action) {
|
893
|
+
this.action$.next(action);
|
894
|
+
};
|
895
|
+
IntegrationState.prototype.listen$ = function (actionType) {
|
896
|
+
return this.action$.pipe(rxjs.filter(function (action) { return action.type === actionType; }), rxjs.map(function (action) { return action.payload; }));
|
897
|
+
};
|
898
|
+
IntegrationState.prototype.listenAll$ = function () {
|
899
|
+
return this.action$.asObservable();
|
900
|
+
};
|
901
|
+
IntegrationState.prototype.clear = function () {
|
902
|
+
this.stateSubj$.next({});
|
903
|
+
this.action$.next(ClearAction);
|
904
|
+
};
|
905
|
+
return IntegrationState;
|
718
906
|
}());
|
719
|
-
|
720
|
-
|
721
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.
|
722
|
-
type: i0.
|
723
|
-
|
907
|
+
IntegrationState.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: IntegrationState, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
908
|
+
IntegrationState.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: IntegrationState, providedIn: 'root' });
|
909
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: IntegrationState, decorators: [{
|
910
|
+
type: i0.Injectable,
|
911
|
+
args: [{ providedIn: 'root' }]
|
912
|
+
}] });
|
724
913
|
|
725
|
-
var
|
726
|
-
function
|
727
|
-
|
728
|
-
this.
|
729
|
-
this.normalizeImports = function (script, elementPath) {
|
730
|
-
var regexp = new RegExp("import([ \\n\\t]*(?:[^ \\n\\t\\{\\}]+[ \\n\\t]*,?)?(?:[ \\n\\t]*\\{(?:[ \\n\\t]*[^ \\n\\t\"'\\{\\}]+[ \\n\\t]*,?)+\\})?[ \\n\\t]*)from[ \\n\\t]*(['\"])([^'\"\\n]+)(?:['\"]);", 'g');
|
731
|
-
var result = script.replace(regexp, function (match, g1, g2, src) {
|
732
|
-
var imports = g1
|
733
|
-
.trim()
|
734
|
-
.slice(1, -1)
|
735
|
-
.split(',')
|
736
|
-
.map(function (item) { return item.trim(); });
|
737
|
-
imports.forEach(function (item) {
|
738
|
-
var _a;
|
739
|
-
if (!((_a = _this.vendorMap[src]) === null || _a === void 0 ? void 0 : _a[item])) {
|
740
|
-
throw new Error("Failed to import " + item + " from '" + src + "' in " + elementPath + "/script.ts");
|
741
|
-
}
|
742
|
-
});
|
743
|
-
return "const " + g1 + " = vendor['" + src + "'];";
|
744
|
-
});
|
745
|
-
return result;
|
746
|
-
};
|
747
|
-
this.document = this.host.injector.get(i7.DOCUMENT);
|
748
|
-
this.vendorMap = this.host.injector.get(VENDOR_MAP);
|
749
|
-
var elementMetadata = this.host.injector.get(ELEMENT_METADATA);
|
750
|
-
var sharedElementMetadata = this.host.injector.get(SHARED_ELEMENT_METADATA);
|
751
|
-
this.addScript(sharedElementMetadata);
|
752
|
-
this.addScript(elementMetadata);
|
914
|
+
var ResourcesService = /** @class */ (function () {
|
915
|
+
function ResourcesService() {
|
916
|
+
this.scripts = new Map();
|
917
|
+
this.loaded$ = new rxjs.ReplaySubject();
|
753
918
|
}
|
754
|
-
|
755
|
-
var
|
756
|
-
|
757
|
-
|
758
|
-
|
759
|
-
var id = btoa(core.UUID.UUID());
|
760
|
-
var script = this.document.createElement('script');
|
761
|
-
script.type = "text/javascript";
|
762
|
-
var scriptContent = this.normalizeImports(metadata.script, (_a = metadata.path) !== null && _a !== void 0 ? _a : metadata.name);
|
763
|
-
var classMatch = /export class (\S+)/.exec(scriptContent);
|
764
|
-
var className = classMatch === null || classMatch === void 0 ? void 0 : classMatch[1];
|
765
|
-
if (!classMatch || !className) {
|
766
|
-
console.error("Script doesn't have exported class");
|
767
|
-
return;
|
919
|
+
ResourcesService.prototype.loadScript = function (url) {
|
920
|
+
var _this = this;
|
921
|
+
var loaded = this.scripts.get(url);
|
922
|
+
if (loaded === true) {
|
923
|
+
return rxjs.of(rxjs.noop());
|
768
924
|
}
|
769
|
-
|
770
|
-
|
771
|
-
|
772
|
-
|
773
|
-
|
774
|
-
|
925
|
+
if (loaded == null) {
|
926
|
+
this.scripts.set(url, false);
|
927
|
+
var script = document.createElement('script');
|
928
|
+
script.src = url;
|
929
|
+
script.onload = function () {
|
930
|
+
_this.scripts.set(url, true);
|
931
|
+
_this.loaded$.next();
|
932
|
+
};
|
933
|
+
document.body.appendChild(script);
|
775
934
|
}
|
776
|
-
this.
|
935
|
+
return this.loaded$.pipe(rxjs.filter(function () { return _this.scripts.get(url) === true; }), rxjs.take(1));
|
777
936
|
};
|
778
|
-
|
937
|
+
ResourcesService.prototype.loadStyles = function (url) {
|
938
|
+
var _a, _b;
|
939
|
+
var previewEl = document.querySelector('vl-cms-preview');
|
940
|
+
var rootEl = (_b = (_a = previewEl === null || previewEl === void 0 ? void 0 : previewEl.shadowRoot) !== null && _a !== void 0 ? _a : previewEl) !== null && _b !== void 0 ? _b : document.body;
|
941
|
+
return new rxjs.Observable(function (subscriber) {
|
942
|
+
var link = document.createElement('link');
|
943
|
+
link.rel = 'stylesheet';
|
944
|
+
link.type = 'text/css';
|
945
|
+
link.href = url;
|
946
|
+
link.media = 'all';
|
947
|
+
link.onload = function () {
|
948
|
+
subscriber.next();
|
949
|
+
subscriber.complete();
|
950
|
+
};
|
951
|
+
rootEl.appendChild(link);
|
952
|
+
});
|
953
|
+
};
|
954
|
+
return ResourcesService;
|
779
955
|
}());
|
780
|
-
|
781
|
-
|
782
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.
|
783
|
-
type: i0.
|
784
|
-
|
785
|
-
|
786
|
-
/*
|
787
|
-
* ScriptPlugin must always be the last plugin in the list to make sure user code is running after all pre-initializers.
|
788
|
-
*/
|
789
|
-
var CONFIG = {
|
790
|
-
CUSTOM: {
|
791
|
-
component: exports.ElementComponent,
|
792
|
-
plugins: [IOPlugin, ScriptPlugin],
|
793
|
-
},
|
794
|
-
CONTAINER: {
|
795
|
-
component: exports.ElementComponent,
|
796
|
-
defaultTemplate: '<element-children></element-children>',
|
797
|
-
plugins: [ScriptPlugin],
|
798
|
-
},
|
799
|
-
SERVICE: {
|
800
|
-
component: exports.ElementComponent,
|
801
|
-
plugins: [IOPlugin, ScriptPlugin],
|
802
|
-
suppressTemplate: true,
|
803
|
-
suppressStyles: true,
|
804
|
-
},
|
805
|
-
REFERENCE: {
|
806
|
-
component: exports.ElementComponent,
|
807
|
-
plugins: [IOPlugin, ScriptPlugin],
|
808
|
-
suppressTemplate: true,
|
809
|
-
},
|
810
|
-
};
|
811
|
-
|
812
|
-
var EXPORTED_CLASS_REGEX = /export class (\S+)/;
|
813
|
-
var METADATA_DECORATOR_REGEX = /@ElementDefinition\(([\s\S]+)\)(\n|\r\n|.)*export class/g;
|
814
|
-
var UiBuildError = /** @class */ (function (_super) {
|
815
|
-
__extends(UiBuildError, _super);
|
816
|
-
function UiBuildError(message, affectedMetadata) {
|
817
|
-
var _this = _super.call(this, message) || this;
|
818
|
-
_this.name = _this.constructor.name;
|
819
|
-
_this.affectedMetadata = affectedMetadata;
|
820
|
-
return _this;
|
821
|
-
}
|
822
|
-
return UiBuildError;
|
823
|
-
}(Error));
|
824
|
-
var elementToMetadata = function (el, parentPath) {
|
825
|
-
var _a;
|
826
|
-
var script = el.script && window.atob(el.script);
|
827
|
-
var template = el.template && window.atob(el.template);
|
828
|
-
var styles = el.styles && window.atob(el.styles);
|
829
|
-
var exportedClassName = script && ((_a = EXPORTED_CLASS_REGEX.exec(script)) !== null && _a !== void 0 ? _a : [])[1];
|
830
|
-
if (!exportedClassName) {
|
831
|
-
throw new Error("Script doesn't have exported class");
|
832
|
-
}
|
833
|
-
var elementMetadata = extractElementMetadata(script || '');
|
834
|
-
var path = (parentPath ? parentPath + '/' : '') + elementMetadata.name;
|
835
|
-
return Object.assign(Object.assign({}, elementMetadata), { path: path, script: script === null || script === void 0 ? void 0 : script.replace(METADATA_DECORATOR_REGEX, 'export class'), template: template, styles: styles, children: el.children.map(function (child) { return elementToMetadata(child, path); }) });
|
836
|
-
};
|
837
|
-
var metadataToElement = function (metadata, recursive) {
|
838
|
-
if (recursive === void 0) { recursive = true; }
|
839
|
-
var elMetadata = {
|
840
|
-
name: metadata.name,
|
841
|
-
isShared: metadata.isShared,
|
842
|
-
type: metadata.type,
|
843
|
-
model: metadata.model,
|
844
|
-
module: metadata.module,
|
845
|
-
reference: metadata.reference,
|
846
|
-
inputs: metadata.inputs,
|
847
|
-
outputs: metadata.outputs,
|
848
|
-
children: metadata.children.map(function (_e) {
|
849
|
-
var name = _e.name;
|
850
|
-
return name;
|
851
|
-
}),
|
852
|
-
configuredStyles: metadata.configuredStyles,
|
853
|
-
};
|
854
|
-
var normalizedElMetadata = normalizeElementMetadata(elMetadata);
|
855
|
-
if (!metadata.script || !EXPORTED_CLASS_REGEX.test(metadata.script)) {
|
856
|
-
throw new UiBuildError("'" + metadata.name + "' component script is missing an exported class", metadata);
|
857
|
-
}
|
858
|
-
var script = metadata.script &&
|
859
|
-
window.btoa(metadata.script.replace(EXPORTED_CLASS_REGEX, "@ElementDefinition(" + stringifyElementMetadata(normalizedElMetadata) + ")\nexport class Script"));
|
860
|
-
var template = metadata.template && window.btoa(metadata.template);
|
861
|
-
var styles = metadata.styles && window.btoa(metadata.styles);
|
862
|
-
return {
|
863
|
-
script: script,
|
864
|
-
template: template,
|
865
|
-
styles: styles,
|
866
|
-
children: recursive ? metadata.children.map(function (meta) { return metadataToElement(meta); }) : [],
|
867
|
-
};
|
868
|
-
};
|
869
|
-
var normalizeElementMetadata = function (elementMetadata) {
|
870
|
-
var _a, _b, _c, _d;
|
871
|
-
var metadata = Object.assign({}, elementMetadata);
|
872
|
-
// model
|
873
|
-
var _e = (_a = metadata.model) !== null && _a !== void 0 ? _a : {}, lineItem = _e.lineItem, path = _e.path;
|
874
|
-
var model = lineItem ? { lineItem: lineItem } : path ? { path: path } : undefined;
|
875
|
-
if (model) {
|
876
|
-
metadata.model = model;
|
877
|
-
}
|
878
|
-
else {
|
879
|
-
delete metadata.model;
|
880
|
-
}
|
881
|
-
// module
|
882
|
-
if (!metadata.module) {
|
883
|
-
delete metadata.module;
|
884
|
-
}
|
885
|
-
// reference
|
886
|
-
if (!metadata.reference) {
|
887
|
-
delete metadata.reference;
|
888
|
-
}
|
889
|
-
// inputs
|
890
|
-
var inputs = Object.entries((_b = metadata.inputs) !== null && _b !== void 0 ? _b : {}).reduce(function (acc, _e) {
|
891
|
-
var _f;
|
892
|
-
var _g = __read(_e, 2), key = _g[0], value = _g[1];
|
893
|
-
return Object.assign(Object.assign({}, acc), (_f = {}, _f[key] = value || null, _f));
|
894
|
-
}, {});
|
895
|
-
if (inputs && Object.keys(inputs).length > 0) {
|
896
|
-
metadata.inputs = inputs;
|
897
|
-
}
|
898
|
-
else {
|
899
|
-
delete metadata.inputs;
|
900
|
-
}
|
901
|
-
// outputs
|
902
|
-
var outputs = Object.entries((_c = metadata.outputs) !== null && _c !== void 0 ? _c : {}).reduce(function (acc, _e) {
|
903
|
-
var _f;
|
904
|
-
var _g = __read(_e, 2), key = _g[0], value = _g[1];
|
905
|
-
return Object.assign(Object.assign({}, acc), (_f = {}, _f[key] = value || null, _f));
|
906
|
-
}, {});
|
907
|
-
if (outputs && Object.keys(outputs).length > 0) {
|
908
|
-
metadata.outputs = outputs;
|
909
|
-
}
|
910
|
-
else {
|
911
|
-
delete metadata.outputs;
|
912
|
-
}
|
913
|
-
// children
|
914
|
-
if (!((_d = metadata.children) === null || _d === void 0 ? void 0 : _d.length)) {
|
915
|
-
delete metadata.children;
|
916
|
-
}
|
917
|
-
// isShared
|
918
|
-
if (!metadata.isShared) {
|
919
|
-
delete metadata.isShared;
|
920
|
-
}
|
921
|
-
// configuredStyles
|
922
|
-
if (!metadata.configuredStyles) {
|
923
|
-
delete metadata.configuredStyles;
|
924
|
-
}
|
925
|
-
return metadata;
|
926
|
-
};
|
927
|
-
var extractElementMetadata = function (script) {
|
928
|
-
var _a;
|
929
|
-
var metadataString = ((_a = METADATA_DECORATOR_REGEX.exec(script)) !== null && _a !== void 0 ? _a : [])[1];
|
930
|
-
// need to reset regex last index to prevent null result for next execution
|
931
|
-
METADATA_DECORATOR_REGEX.lastIndex = 0;
|
932
|
-
return new Function("return " + metadataString)();
|
933
|
-
};
|
934
|
-
var extendElementMetadata = function (script, extend) {
|
935
|
-
var _a;
|
936
|
-
var metadataString = ((_a = METADATA_DECORATOR_REGEX.exec(script)) !== null && _a !== void 0 ? _a : [])[1];
|
937
|
-
// need to reset regex last index to prevent null result for next execution
|
938
|
-
METADATA_DECORATOR_REGEX.lastIndex = 0;
|
939
|
-
if (!metadataString) {
|
940
|
-
return script;
|
941
|
-
}
|
942
|
-
var updated = Object.assign(Object.assign({}, new Function("return " + metadataString)()), extend);
|
943
|
-
return script.replace(metadataString, stringifyElementMetadata(updated));
|
944
|
-
};
|
945
|
-
var getElementConfig = function (type) {
|
946
|
-
return CONFIG[type];
|
947
|
-
};
|
948
|
-
var doesElementSupportIO = function (type) {
|
949
|
-
var _a, _b;
|
950
|
-
return (_b = (_a = getElementConfig(type).plugins) === null || _a === void 0 ? void 0 : _a.includes(IOPlugin)) !== null && _b !== void 0 ? _b : false;
|
951
|
-
};
|
952
|
-
function stringifyElementMetadata(elementMetadata) {
|
953
|
-
var cleaned = JSON.stringify(elementMetadata, null, 2);
|
954
|
-
return cleaned.replace(/^[\t ]*"[^:\n\r]+(?<!\\)":/gm, function (match) {
|
955
|
-
return match.replace(/"/g, '');
|
956
|
-
});
|
957
|
-
}
|
958
|
-
var isValidScript = function (script) {
|
959
|
-
var _a;
|
960
|
-
if (!script) {
|
961
|
-
return false;
|
962
|
-
}
|
963
|
-
var exportedClassName = script && ((_a = EXPORTED_CLASS_REGEX.exec(script)) !== null && _a !== void 0 ? _a : [])[1];
|
964
|
-
if (!exportedClassName) {
|
965
|
-
return false;
|
966
|
-
}
|
967
|
-
var meta = extractElementMetadata(script);
|
968
|
-
if (!meta.name || !meta.type) {
|
969
|
-
return false;
|
970
|
-
}
|
971
|
-
return true;
|
972
|
-
};
|
973
|
-
function flattenElements(elements) {
|
974
|
-
return lodash.flatten(elements.map(function (el) { return __spreadArray([el], __read(flattenElements(el.children))); }));
|
975
|
-
}
|
976
|
-
function isSharedElement(el) {
|
977
|
-
return Boolean(el.isShared) && el.type !== 'REFERENCE';
|
978
|
-
}
|
956
|
+
ResourcesService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ResourcesService, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
957
|
+
ResourcesService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ResourcesService, providedIn: 'root' });
|
958
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ResourcesService, decorators: [{
|
959
|
+
type: i0.Injectable,
|
960
|
+
args: [{ providedIn: 'root' }]
|
961
|
+
}] });
|
979
962
|
|
980
963
|
var ElementContextService = /** @class */ (function () {
|
981
964
|
function ElementContextService() {
|
982
965
|
}
|
983
966
|
return ElementContextService;
|
984
967
|
}());
|
985
|
-
ElementContextService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.
|
986
|
-
ElementContextService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.
|
987
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.
|
968
|
+
ElementContextService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ElementContextService, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
969
|
+
ElementContextService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ElementContextService });
|
970
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ElementContextService, decorators: [{
|
988
971
|
type: i0.Injectable
|
989
972
|
}] });
|
990
973
|
|
991
974
|
var ElementRendererComponent = /** @class */ (function () {
|
992
|
-
function ElementRendererComponent(parentInjector,
|
975
|
+
function ElementRendererComponent(parentInjector, runtimeService, elementContext, ioProviderService, configurationService, elementRef, cdr) {
|
993
976
|
this.parentInjector = parentInjector;
|
994
|
-
this.
|
977
|
+
this.runtimeService = runtimeService;
|
995
978
|
this.elementContext = elementContext;
|
996
979
|
this.ioProviderService = ioProviderService;
|
997
980
|
this.configurationService = configurationService;
|
@@ -1002,7 +985,7 @@
|
|
1002
985
|
}
|
1003
986
|
ElementRendererComponent.prototype.ngOnInit = function () {
|
1004
987
|
this.elementContext.metadata = this.meta;
|
1005
|
-
this.factory = this.
|
988
|
+
this.factory = this.meta.path ? this.runtimeService.componentFactories[this.meta.path] : undefined;
|
1006
989
|
this.createComponents();
|
1007
990
|
};
|
1008
991
|
ElementRendererComponent.prototype.ngOnDestroy = function () {
|
@@ -1135,9 +1118,9 @@
|
|
1135
1118
|
};
|
1136
1119
|
return ElementRendererComponent;
|
1137
1120
|
}());
|
1138
|
-
ElementRendererComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.
|
1139
|
-
ElementRendererComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.
|
1140
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.
|
1121
|
+
ElementRendererComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ElementRendererComponent, deps: [{ token: i0__namespace.Injector, skipSelf: true }, { token: RuntimeService }, { token: ElementContextService }, { token: IOProviderService }, { token: i2__namespace.ConfigurationService }, { token: i0__namespace.ElementRef }, { token: i0__namespace.ChangeDetectorRef }], target: i0__namespace.ɵɵFactoryTarget.Component });
|
1122
|
+
ElementRendererComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: ElementRendererComponent, selector: "vl-cms-element-renderer", inputs: { meta: "meta" }, providers: [ElementContextService], viewQueries: [{ propertyName: "el", first: true, predicate: ["el"], descendants: true, read: i0.ViewContainerRef, static: true }], ngImport: i0__namespace, template: "<ng-template #el></ng-template>\n", styles: [":host{display:contents}\n"], changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
|
1123
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ElementRendererComponent, decorators: [{
|
1141
1124
|
type: i0.Component,
|
1142
1125
|
args: [{
|
1143
1126
|
selector: 'vl-cms-element-renderer',
|
@@ -1149,7 +1132,7 @@
|
|
1149
1132
|
}], ctorParameters: function () {
|
1150
1133
|
return [{ type: i0__namespace.Injector, decorators: [{
|
1151
1134
|
type: i0.SkipSelf
|
1152
|
-
}] }, { type:
|
1135
|
+
}] }, { type: RuntimeService }, { type: ElementContextService }, { type: IOProviderService }, { type: i2__namespace.ConfigurationService }, { type: i0__namespace.ElementRef }, { type: i0__namespace.ChangeDetectorRef }];
|
1153
1136
|
}, propDecorators: { el: [{
|
1154
1137
|
type: i0.ViewChild,
|
1155
1138
|
args: ['el', { read: i0.ViewContainerRef, static: true }]
|
@@ -1157,25 +1140,252 @@
|
|
1157
1140
|
type: i0.Input
|
1158
1141
|
}] } });
|
1159
1142
|
|
1160
|
-
var
|
1161
|
-
function
|
1162
|
-
|
1163
|
-
this.
|
1143
|
+
var PreviewComponent = /** @class */ (function () {
|
1144
|
+
function PreviewComponent(runtimeService, configurationService, messageService, configurationRuntimeService, integrationState, cdr) {
|
1145
|
+
var _this = this;
|
1146
|
+
this.runtimeService = runtimeService;
|
1147
|
+
this.configurationService = configurationService;
|
1148
|
+
this.messageService = messageService;
|
1149
|
+
this.configurationRuntimeService = configurationRuntimeService;
|
1150
|
+
this.integrationState = integrationState;
|
1151
|
+
this.cdr = cdr;
|
1152
|
+
this.state$ = new rxjs.BehaviorSubject({ loading: true, failure: false });
|
1153
|
+
this.elements = [];
|
1154
|
+
this.destroy$ = new rxjs.Subject();
|
1155
|
+
this.runtimeService.updated$.pipe(rxjs.takeUntil(this.destroy$)).subscribe(function () { return _this.cdr.detectChanges(); });
|
1164
1156
|
}
|
1165
|
-
|
1157
|
+
PreviewComponent.prototype.ngOnInit = function () {
|
1158
|
+
var _a;
|
1159
|
+
if ((_a = this.config) === null || _a === void 0 ? void 0 : _a.clearStateOnInit) {
|
1160
|
+
this.integrationState.clear();
|
1161
|
+
}
|
1162
|
+
this.startPreview();
|
1163
|
+
};
|
1164
|
+
PreviewComponent.prototype.ngOnDestroy = function () {
|
1165
|
+
this.destroy$.next();
|
1166
|
+
this.destroy$.complete();
|
1167
|
+
this.configurationService.reset();
|
1168
|
+
this.runtimeService.clear();
|
1169
|
+
};
|
1170
|
+
PreviewComponent.prototype.initializeConfiguration$ = function () {
|
1171
|
+
var _this = this;
|
1172
|
+
var isAlreadyInitialized = this.configurationRuntimeService.isInitialized;
|
1173
|
+
if (!this.uiDefinition || this.uiDefinition.type !== 'CONFIGURATION' || isAlreadyInitialized) {
|
1174
|
+
return rxjs.of({});
|
1175
|
+
}
|
1176
|
+
if (!this.modelId) {
|
1177
|
+
console.warn("No modelId is given for uiDefinition with '" + this.uiDefinition.type + "' type");
|
1178
|
+
return rxjs.of({});
|
1179
|
+
}
|
1180
|
+
// If still not initialized - init configuration in Test mode
|
1181
|
+
return this.configurationRuntimeService
|
1182
|
+
.initTestMode(this.modelId, this.uiDefinition)
|
1183
|
+
.pipe(rxjs.switchMap(function () { return _this.configurationService.configure(); }));
|
1184
|
+
};
|
1185
|
+
PreviewComponent.prototype.startPreview = function () {
|
1186
|
+
var _this = this;
|
1187
|
+
if (!this.uiDefinition) {
|
1188
|
+
return;
|
1189
|
+
}
|
1190
|
+
rxjs.forkJoin([this.runtimeService.initialize$(this.uiDefinition, this.config), this.initializeConfiguration$()])
|
1191
|
+
.pipe(rxjs.tap(function (_c) {
|
1192
|
+
var _d = __read(_c, 1), elements = _d[0];
|
1193
|
+
_this.elements = elements;
|
1194
|
+
_this.state$.next({ loading: false, failure: false });
|
1195
|
+
}), rxjs.catchError(function (error) {
|
1196
|
+
var _a, _b;
|
1197
|
+
console.error(error);
|
1198
|
+
if (!((_b = (_a = _this.uiDefinition) === null || _a === void 0 ? void 0 : _a.properties) === null || _b === void 0 ? void 0 : _b.suppressToastMessages)) {
|
1199
|
+
_this.messageService.add({ severity: 'error', summary: error });
|
1200
|
+
}
|
1201
|
+
_this.state$.next({ loading: false, failure: true });
|
1202
|
+
return rxjs.of();
|
1203
|
+
}), rxjs.takeUntil(this.destroy$))
|
1204
|
+
.subscribe();
|
1205
|
+
};
|
1206
|
+
return PreviewComponent;
|
1166
1207
|
}());
|
1167
|
-
|
1168
|
-
|
1169
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.
|
1208
|
+
PreviewComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: PreviewComponent, deps: [{ token: RuntimeService }, { token: i2__namespace.ConfigurationService }, { token: i3__namespace.MessageService }, { token: i2__namespace.ConfigurationRuntimeService }, { token: IntegrationState }, { token: i0__namespace.ChangeDetectorRef }], target: i0__namespace.ɵɵFactoryTarget.Component });
|
1209
|
+
PreviewComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: PreviewComponent, selector: "vl-cms-preview", inputs: { modelId: "modelId", uiDefinition: "uiDefinition", config: "config" }, providers: [IOProviderService, TemplatesService], ngImport: i0__namespace, template: "<ng-container *ngIf=\"state$ | async as state\">\n <vl-loader *ngIf=\"state.loading; else content\" [label]=\"'Loading UI'\"></vl-loader>\n\n <ng-template #content>\n <ng-container *ngIf=\"!state.failure\">\n <vl-cms-element-renderer *ngFor=\"let el of elements\" [meta]=\"el\"></vl-cms-element-renderer>\n </ng-container>\n </ng-template>\n</ng-container>\n", styles: [":host{flex-grow:1;display:flex;flex-direction:column;height:100%}\n"], components: [{ type: i1__namespace.LoaderComponent, selector: "vl-loader", inputs: ["label", "overlayVisible"] }, { type: ElementRendererComponent, selector: "vl-cms-element-renderer", inputs: ["meta"] }], directives: [{ type: i7__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i7__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], pipes: { "async": i7__namespace.AsyncPipe }, changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush, encapsulation: i0__namespace.ViewEncapsulation.ShadowDom });
|
1210
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: PreviewComponent, decorators: [{
|
1170
1211
|
type: i0.Component,
|
1171
1212
|
args: [{
|
1172
|
-
|
1213
|
+
selector: 'vl-cms-preview',
|
1214
|
+
templateUrl: './preview.component.html',
|
1215
|
+
styleUrls: ['./preview.component.scss'],
|
1216
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush,
|
1217
|
+
providers: [IOProviderService, TemplatesService],
|
1218
|
+
// use shadow DOM to prevent UI from being affected by global styles
|
1219
|
+
encapsulation: i0.ViewEncapsulation.ShadowDom,
|
1220
|
+
}]
|
1221
|
+
}], ctorParameters: function () { return [{ type: RuntimeService }, { type: i2__namespace.ConfigurationService }, { type: i3__namespace.MessageService }, { type: i2__namespace.ConfigurationRuntimeService }, { type: IntegrationState }, { type: i0__namespace.ChangeDetectorRef }]; }, propDecorators: { modelId: [{
|
1222
|
+
type: i0.Input
|
1223
|
+
}], uiDefinition: [{
|
1224
|
+
type: i0.Input
|
1225
|
+
}], config: [{
|
1226
|
+
type: i0.Input
|
1227
|
+
}] } });
|
1228
|
+
|
1229
|
+
var RuntimeEditorService = /** @class */ (function () {
|
1230
|
+
function RuntimeEditorService(runtimeService) {
|
1231
|
+
var _this = this;
|
1232
|
+
this.runtimeService = runtimeService;
|
1233
|
+
this.editorModeSubj$ = new rxjs.BehaviorSubject(false);
|
1234
|
+
this.dragMode$ = new rxjs.BehaviorSubject(false);
|
1235
|
+
this.elementDropped$ = new rxjs.ReplaySubject();
|
1236
|
+
this.elementDeleted$ = new rxjs.ReplaySubject();
|
1237
|
+
this.editorMode$ = this.editorModeSubj$.asObservable();
|
1238
|
+
this.runtimeService.isInitialized$.subscribe(function () { var _a; return _this.editorModeSubj$.next(Boolean((_a = _this.runtimeService.config) === null || _a === void 0 ? void 0 : _a.uiBuilderMode)); });
|
1239
|
+
}
|
1240
|
+
RuntimeEditorService.prototype.applyPatch$ = function (patch) {
|
1241
|
+
return this.runtimeService.applyPatch$(patch);
|
1242
|
+
};
|
1243
|
+
RuntimeEditorService.prototype.toggleEditorMode = function () {
|
1244
|
+
this.editorModeSubj$.next(!this.editorModeSubj$.value);
|
1245
|
+
};
|
1246
|
+
return RuntimeEditorService;
|
1247
|
+
}());
|
1248
|
+
RuntimeEditorService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: RuntimeEditorService, deps: [{ token: RuntimeService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
1249
|
+
RuntimeEditorService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: RuntimeEditorService });
|
1250
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: RuntimeEditorService, decorators: [{
|
1251
|
+
type: i0.Injectable
|
1252
|
+
}], ctorParameters: function () { return [{ type: RuntimeService }]; } });
|
1253
|
+
|
1254
|
+
var ElementDropHandleComponent = /** @class */ (function () {
|
1255
|
+
function ElementDropHandleComponent(runtimeService) {
|
1256
|
+
this.runtimeService = runtimeService;
|
1257
|
+
}
|
1258
|
+
ElementDropHandleComponent.prototype.handleDrop = function (e) {
|
1259
|
+
this.runtimeService.elementDropped$.next({
|
1260
|
+
element: e.data,
|
1261
|
+
index: this.index,
|
1262
|
+
path: this.parentPath,
|
1263
|
+
});
|
1264
|
+
};
|
1265
|
+
return ElementDropHandleComponent;
|
1266
|
+
}());
|
1267
|
+
ElementDropHandleComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ElementDropHandleComponent, deps: [{ token: RuntimeEditorService }], target: i0__namespace.ɵɵFactoryTarget.Component });
|
1268
|
+
ElementDropHandleComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: ElementDropHandleComponent, selector: "vl-element-drop-handle", inputs: { index: "index", parentPath: "parentPath" }, ngImport: i0__namespace, template: "<div class=\"container\" dndDropzone (dndDrop)=\"handleDrop($event)\">\n <div class=\"handle\"></div>\n</div>\n", styles: [":host{width:0;position:relative}.container{width:40px;height:100%;position:absolute;transform:translate(-50%);display:flex;justify-content:center;align-items:center}.handle{display:none;background:red;height:calc(100% - 10px);width:2px;pointer-events:none}.container.dndDragover .handle{display:block}\n"], directives: [{ type: i2__namespace$1.DndDropzoneDirective, selector: "[dndDropzone]", inputs: ["dndDropzone", "dndEffectAllowed", "dndAllowExternal", "dndHorizontal", "dndDragoverClass", "dndDropzoneDisabledClass", "dndDisableIf", "dndDisableDropIf"], outputs: ["dndDragover", "dndDrop"] }], changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
|
1269
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ElementDropHandleComponent, decorators: [{
|
1270
|
+
type: i0.Component,
|
1271
|
+
args: [{
|
1272
|
+
selector: 'vl-element-drop-handle',
|
1273
|
+
templateUrl: './element-drop-handle.component.html',
|
1274
|
+
styleUrls: ['./element-drop-handle.component.scss'],
|
1275
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush,
|
1276
|
+
}]
|
1277
|
+
}], ctorParameters: function () { return [{ type: RuntimeEditorService }]; }, propDecorators: { index: [{
|
1278
|
+
type: i0.Input
|
1279
|
+
}], parentPath: [{
|
1280
|
+
type: i0.Input
|
1281
|
+
}] } });
|
1282
|
+
|
1283
|
+
var ElementDropHandleModule = /** @class */ (function () {
|
1284
|
+
function ElementDropHandleModule() {
|
1285
|
+
}
|
1286
|
+
return ElementDropHandleModule;
|
1287
|
+
}());
|
1288
|
+
ElementDropHandleModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ElementDropHandleModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
|
1289
|
+
ElementDropHandleModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ElementDropHandleModule, declarations: [ElementDropHandleComponent], imports: [i7.CommonModule, i2$1.DndModule], exports: [ElementDropHandleComponent] });
|
1290
|
+
ElementDropHandleModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ElementDropHandleModule, imports: [[i7.CommonModule, i2$1.DndModule]] });
|
1291
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ElementDropHandleModule, decorators: [{
|
1292
|
+
type: i0.NgModule,
|
1293
|
+
args: [{
|
1294
|
+
declarations: [ElementDropHandleComponent],
|
1295
|
+
imports: [i7.CommonModule, i2$1.DndModule],
|
1296
|
+
exports: [ElementDropHandleComponent],
|
1297
|
+
}]
|
1298
|
+
}] });
|
1299
|
+
|
1300
|
+
var ElementRendererModule = /** @class */ (function () {
|
1301
|
+
function ElementRendererModule() {
|
1302
|
+
}
|
1303
|
+
return ElementRendererModule;
|
1304
|
+
}());
|
1305
|
+
ElementRendererModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ElementRendererModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
|
1306
|
+
ElementRendererModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ElementRendererModule, declarations: [ElementRendererComponent], exports: [ElementRendererComponent] });
|
1307
|
+
ElementRendererModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ElementRendererModule });
|
1308
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ElementRendererModule, decorators: [{
|
1309
|
+
type: i0.NgModule,
|
1310
|
+
args: [{
|
1311
|
+
declarations: [ElementRendererComponent],
|
1312
|
+
exports: [ElementRendererComponent],
|
1313
|
+
}]
|
1314
|
+
}] });
|
1315
|
+
|
1316
|
+
var ElementChildrenComponent = /** @class */ (function () {
|
1317
|
+
function ElementChildrenComponent(elementContext, runtimeService, runtimeEditorService, cdr) {
|
1318
|
+
var _this = this;
|
1319
|
+
var _a, _b;
|
1320
|
+
this.elementContext = elementContext;
|
1321
|
+
this.runtimeService = runtimeService;
|
1322
|
+
this.runtimeEditorService = runtimeEditorService;
|
1323
|
+
this.cdr = cdr;
|
1324
|
+
this.destroyed$ = new rxjs.Subject();
|
1325
|
+
var path = (_b = (_a = this.elementContext) === null || _a === void 0 ? void 0 : _a.metadata) === null || _b === void 0 ? void 0 : _b.path;
|
1326
|
+
this.metadata$ = path ? this.runtimeService.getCompiledElement$(path) : rxjs.of(undefined);
|
1327
|
+
this.dragMode$ = rxjs.combineLatest([this.runtimeEditorService.editorMode$, this.runtimeEditorService.dragMode$]).pipe(rxjs.map(function (flags) { return flags.every(Boolean); }));
|
1328
|
+
this.runtimeService.updated$.pipe(rxjs.takeUntil(this.destroyed$)).subscribe(function () { return _this.cdr.detectChanges(); });
|
1329
|
+
}
|
1330
|
+
ElementChildrenComponent.prototype.ngOnDestroy = function () {
|
1331
|
+
this.destroyed$.next();
|
1332
|
+
this.destroyed$.complete();
|
1333
|
+
};
|
1334
|
+
return ElementChildrenComponent;
|
1335
|
+
}());
|
1336
|
+
ElementChildrenComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ElementChildrenComponent, deps: [{ token: ElementContextService }, { token: RuntimeService }, { token: RuntimeEditorService }, { token: i0__namespace.ChangeDetectorRef }], target: i0__namespace.ɵɵFactoryTarget.Component });
|
1337
|
+
ElementChildrenComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: ElementChildrenComponent, selector: "element-children", ngImport: i0__namespace, template: "<ng-container *ngIf=\"metadata$ | async as metadata\">\n <vl-element-drop-handle *ngIf=\"dragMode$ | async\" [index]=\"0\" [parentPath]=\"metadata.path\"></vl-element-drop-handle>\n <ng-container *ngFor=\"let child of metadata.children; let i = index\">\n <vl-cms-element-renderer [meta]=\"child\"></vl-cms-element-renderer>\n <vl-element-drop-handle\n *ngIf=\"dragMode$ | async\"\n [index]=\"i + 1\"\n [parentPath]=\"metadata.path\"\n ></vl-element-drop-handle>\n </ng-container>\n</ng-container>\n", styles: [":host{display:contents}\n"], components: [{ type: ElementDropHandleComponent, selector: "vl-element-drop-handle", inputs: ["index", "parentPath"] }, { type: ElementRendererComponent, selector: "vl-cms-element-renderer", inputs: ["meta"] }], changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
|
1338
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ElementChildrenComponent, decorators: [{
|
1339
|
+
type: i0.Component,
|
1340
|
+
args: [{
|
1341
|
+
// eslint-disable-next-line @angular-eslint/component-selector
|
1173
1342
|
selector: 'element-children',
|
1174
1343
|
templateUrl: 'element-children.component.html',
|
1175
1344
|
styleUrls: ['./element-children.component.scss'],
|
1176
1345
|
changeDetection: i0.ChangeDetectionStrategy.OnPush,
|
1177
1346
|
}]
|
1178
|
-
}], ctorParameters: function () { return [{ type: ElementContextService }]; } });
|
1347
|
+
}], ctorParameters: function () { return [{ type: ElementContextService }, { type: RuntimeService }, { type: RuntimeEditorService }, { type: i0__namespace.ChangeDetectorRef }]; } });
|
1348
|
+
|
1349
|
+
var ElementChildrenModule = /** @class */ (function () {
|
1350
|
+
function ElementChildrenModule() {
|
1351
|
+
}
|
1352
|
+
return ElementChildrenModule;
|
1353
|
+
}());
|
1354
|
+
ElementChildrenModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ElementChildrenModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
|
1355
|
+
ElementChildrenModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ElementChildrenModule, declarations: [ElementChildrenComponent], imports: [i1.LetDirectiveModule, ElementRendererModule, ElementDropHandleModule], exports: [ElementChildrenComponent] });
|
1356
|
+
ElementChildrenModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ElementChildrenModule, imports: [[i1.LetDirectiveModule, ElementRendererModule, ElementDropHandleModule]] });
|
1357
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ElementChildrenModule, decorators: [{
|
1358
|
+
type: i0.NgModule,
|
1359
|
+
args: [{
|
1360
|
+
declarations: [ElementChildrenComponent],
|
1361
|
+
imports: [i1.LetDirectiveModule, ElementRendererModule, ElementDropHandleModule],
|
1362
|
+
exports: [ElementChildrenComponent],
|
1363
|
+
}]
|
1364
|
+
}] });
|
1365
|
+
|
1366
|
+
var PreviewModule = /** @class */ (function () {
|
1367
|
+
function PreviewModule() {
|
1368
|
+
}
|
1369
|
+
return PreviewModule;
|
1370
|
+
}());
|
1371
|
+
PreviewModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: PreviewModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
|
1372
|
+
PreviewModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: PreviewModule, declarations: [PreviewComponent], imports: [i7.CommonModule, i1.LoaderModule, ElementRendererModule, ElementChildrenModule, ElementDropHandleModule], exports: [PreviewComponent] });
|
1373
|
+
PreviewModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: PreviewModule, providers: [IntegrationState], imports: [[i7.CommonModule, i1.LoaderModule, ElementRendererModule, ElementChildrenModule, ElementDropHandleModule]] });
|
1374
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: PreviewModule, decorators: [{
|
1375
|
+
type: i0.NgModule,
|
1376
|
+
args: [{
|
1377
|
+
declarations: [PreviewComponent],
|
1378
|
+
imports: [i7.CommonModule, i1.LoaderModule, ElementRendererModule, ElementChildrenModule, ElementDropHandleModule],
|
1379
|
+
providers: [IntegrationState],
|
1380
|
+
exports: [PreviewComponent],
|
1381
|
+
}]
|
1382
|
+
}] });
|
1383
|
+
|
1384
|
+
function ElementDefinition(definition) {
|
1385
|
+
return function (constructor) {
|
1386
|
+
return constructor;
|
1387
|
+
};
|
1388
|
+
}
|
1179
1389
|
|
1180
1390
|
// eslint-disable-next-line @angular-eslint/directive-selector
|
1181
1391
|
var CustomTemplateDirective = /** @class */ (function () {
|
@@ -1191,170 +1401,305 @@
|
|
1191
1401
|
};
|
1192
1402
|
return CustomTemplateDirective;
|
1193
1403
|
}());
|
1194
|
-
CustomTemplateDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.
|
1195
|
-
CustomTemplateDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.
|
1196
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.
|
1404
|
+
CustomTemplateDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: CustomTemplateDirective, deps: [{ token: i0__namespace.TemplateRef }, { token: TemplatesService }], target: i0__namespace.ɵɵFactoryTarget.Directive });
|
1405
|
+
CustomTemplateDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.17", type: CustomTemplateDirective, selector: "[customTemplate]", inputs: { customTemplate: "customTemplate" }, ngImport: i0__namespace });
|
1406
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: CustomTemplateDirective, decorators: [{
|
1197
1407
|
type: i0.Directive,
|
1198
1408
|
args: [{ selector: '[customTemplate]' }]
|
1199
1409
|
}], ctorParameters: function () { return [{ type: i0__namespace.TemplateRef }, { type: TemplatesService }]; }, propDecorators: { customTemplate: [{
|
1200
1410
|
type: i0.Input
|
1201
1411
|
}] } });
|
1202
1412
|
|
1203
|
-
var
|
1204
|
-
|
1205
|
-
|
1206
|
-
|
1207
|
-
|
1208
|
-
|
1209
|
-
|
1210
|
-
|
1211
|
-
|
1212
|
-
|
1213
|
-
|
1214
|
-
|
1215
|
-
|
1216
|
-
|
1217
|
-
|
1218
|
-
|
1219
|
-
|
1220
|
-
resolve(); // window is the global namespace
|
1221
|
-
};
|
1222
|
-
document.body.append(script);
|
1223
|
-
});
|
1224
|
-
}
|
1225
|
-
function lookupExposedModule(remoteName, exposedModule) {
|
1226
|
-
return __awaiter(this, void 0, void 0, function () {
|
1227
|
-
var container, factory, Module;
|
1228
|
-
return __generator(this, function (_a) {
|
1229
|
-
switch (_a.label) {
|
1230
|
-
case 0:
|
1231
|
-
// Initializes the share scope. This fills it with known provided modules from this build and all remotes
|
1232
|
-
return [4 /*yield*/, __webpack_init_sharing__('default')];
|
1233
|
-
case 1:
|
1234
|
-
// Initializes the share scope. This fills it with known provided modules from this build and all remotes
|
1235
|
-
_a.sent();
|
1236
|
-
container = window[remoteName];
|
1237
|
-
// Initialize the container, it may provide shared modules
|
1238
|
-
return [4 /*yield*/, container.init(__webpack_share_scopes__.default)];
|
1239
|
-
case 2:
|
1240
|
-
// Initialize the container, it may provide shared modules
|
1241
|
-
_a.sent();
|
1242
|
-
return [4 /*yield*/, container.get(exposedModule)];
|
1243
|
-
case 3:
|
1244
|
-
factory = _a.sent();
|
1245
|
-
Module = factory();
|
1246
|
-
return [2 /*return*/, Module];
|
1413
|
+
var IOPlugin = /** @class */ (function () {
|
1414
|
+
function IOPlugin(host) {
|
1415
|
+
var _this = this;
|
1416
|
+
var _a, _b;
|
1417
|
+
this.host = host;
|
1418
|
+
var elementMetadata = this.host.injector.get(ELEMENT_METADATA);
|
1419
|
+
var inputProvider = this.host.injector.get(IOProviderService);
|
1420
|
+
var inputs = Object.entries((_a = elementMetadata.inputs) !== null && _a !== void 0 ? _a : {});
|
1421
|
+
var outputs = Object.entries((_b = elementMetadata.outputs) !== null && _b !== void 0 ? _b : {});
|
1422
|
+
inputs.forEach(function (_c) {
|
1423
|
+
var _d = __read(_c, 2), key = _d[0], path = _d[1];
|
1424
|
+
var _a;
|
1425
|
+
if (path && typeof path !== 'string') {
|
1426
|
+
console.error("The value of '" + key + "' input should be a string");
|
1427
|
+
}
|
1428
|
+
if (((_a = elementMetadata.outputs) === null || _a === void 0 ? void 0 : _a[key]) !== undefined) {
|
1429
|
+
console.warn("'" + key + "' appears both in inputs and outputs. To prevent inconsistent behavior please keep them unique ");
|
1247
1430
|
}
|
1431
|
+
_this.host[key] = inputProvider.connect(elementMetadata, key, path);
|
1248
1432
|
});
|
1249
|
-
|
1250
|
-
|
1251
|
-
|
1252
|
-
|
1253
|
-
return __generator(this, function (_a) {
|
1254
|
-
switch (_a.label) {
|
1255
|
-
case 0: return [4 /*yield*/, loadRemoteEntry(remoteEntry)];
|
1256
|
-
case 1:
|
1257
|
-
_a.sent();
|
1258
|
-
return [4 /*yield*/, lookupExposedModule(remoteName, exposedModule)];
|
1259
|
-
case 2: return [2 /*return*/, _a.sent()];
|
1433
|
+
outputs.forEach(function (_c) {
|
1434
|
+
var _d = __read(_c, 2), key = _d[0], path = _d[1];
|
1435
|
+
if (path && typeof path !== 'string') {
|
1436
|
+
console.error("The value of '" + key + "' output should be a string");
|
1260
1437
|
}
|
1438
|
+
_this.host[key] = inputProvider.provide(elementMetadata, key, path);
|
1261
1439
|
});
|
1440
|
+
}
|
1441
|
+
return IOPlugin;
|
1442
|
+
}());
|
1443
|
+
IOPlugin.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: IOPlugin, deps: [{ token: exports.ElementComponent }], target: i0__namespace.ɵɵFactoryTarget.Directive });
|
1444
|
+
IOPlugin.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.17", type: IOPlugin, ngImport: i0__namespace });
|
1445
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: IOPlugin, decorators: [{
|
1446
|
+
type: i0.Directive
|
1447
|
+
}], ctorParameters: function () { return [{ type: exports.ElementComponent }]; } });
|
1448
|
+
|
1449
|
+
var ScriptPlugin = /** @class */ (function () {
|
1450
|
+
function ScriptPlugin(host) {
|
1451
|
+
var _this = this;
|
1452
|
+
this.host = host;
|
1453
|
+
this.normalizeImports = function (script, elementPath) {
|
1454
|
+
var regexp = new RegExp("import([ \\n\\t]*(?:[^ \\n\\t\\{\\}]+[ \\n\\t]*,?)?(?:[ \\n\\t]*\\{(?:[ \\n\\t]*[^ \\n\\t\"'\\{\\}]+[ \\n\\t]*,?)+\\})?[ \\n\\t]*)from[ \\n\\t]*(['\"])([^'\"\\n]+)(?:['\"]);", 'g');
|
1455
|
+
var result = script.replace(regexp, function (match, g1, g2, src) {
|
1456
|
+
var imports = g1
|
1457
|
+
.trim()
|
1458
|
+
.slice(1, -1)
|
1459
|
+
.split(',')
|
1460
|
+
.map(function (item) { return item.trim(); });
|
1461
|
+
imports.forEach(function (item) {
|
1462
|
+
var _a;
|
1463
|
+
if (!((_a = _this.vendorMap[src]) === null || _a === void 0 ? void 0 : _a[item])) {
|
1464
|
+
throw new Error("Failed to import " + item + " from '" + src + "' in " + elementPath + "/script.ts");
|
1465
|
+
}
|
1466
|
+
});
|
1467
|
+
return "const " + g1 + " = vendor['" + src + "'];";
|
1468
|
+
});
|
1469
|
+
return result;
|
1470
|
+
};
|
1471
|
+
this.document = this.host.injector.get(i7.DOCUMENT);
|
1472
|
+
this.vendorMap = this.host.injector.get(VENDOR_MAP);
|
1473
|
+
var elementMetadata = this.host.injector.get(ELEMENT_METADATA);
|
1474
|
+
var sharedElementMetadata = this.host.injector.get(SHARED_ELEMENT_METADATA);
|
1475
|
+
this.addScript(sharedElementMetadata);
|
1476
|
+
this.addScript(elementMetadata);
|
1477
|
+
}
|
1478
|
+
ScriptPlugin.prototype.addScript = function (metadata) {
|
1479
|
+
var _a;
|
1480
|
+
if (!(metadata === null || metadata === void 0 ? void 0 : metadata.script)) {
|
1481
|
+
return;
|
1482
|
+
}
|
1483
|
+
var id = btoa(core.UUID.UUID());
|
1484
|
+
var script = this.document.createElement('script');
|
1485
|
+
script.type = "text/javascript";
|
1486
|
+
var scriptContent = this.normalizeImports(metadata.script, (_a = metadata.path) !== null && _a !== void 0 ? _a : metadata.name);
|
1487
|
+
var classMatch = /export class (\S+)/.exec(scriptContent);
|
1488
|
+
var className = classMatch === null || classMatch === void 0 ? void 0 : classMatch[1];
|
1489
|
+
if (!classMatch || !className) {
|
1490
|
+
console.error("Script doesn't have exported class");
|
1491
|
+
return;
|
1492
|
+
}
|
1493
|
+
scriptContent = scriptContent.replace(classMatch[0], "class " + className);
|
1494
|
+
script.text = "var " + id + " = function(vendor) {" + scriptContent + "\n return " + className + "; };";
|
1495
|
+
this.document.body.appendChild(script);
|
1496
|
+
var ScriptClass = window[id](this.vendorMap);
|
1497
|
+
if (ScriptClass instanceof Object) {
|
1498
|
+
this.host.registerPlugin(new ScriptClass(this.host));
|
1499
|
+
}
|
1500
|
+
this.document.body.removeChild(script);
|
1501
|
+
};
|
1502
|
+
return ScriptPlugin;
|
1503
|
+
}());
|
1504
|
+
ScriptPlugin.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ScriptPlugin, deps: [{ token: exports.ElementComponent }], target: i0__namespace.ɵɵFactoryTarget.Directive });
|
1505
|
+
ScriptPlugin.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.17", type: ScriptPlugin, ngImport: i0__namespace });
|
1506
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ScriptPlugin, decorators: [{
|
1507
|
+
type: i0.Directive
|
1508
|
+
}], ctorParameters: function () { return [{ type: exports.ElementComponent }]; } });
|
1509
|
+
|
1510
|
+
/*
|
1511
|
+
* ScriptPlugin must always be the last plugin in the list to make sure user code is running after all pre-initializers.
|
1512
|
+
*/
|
1513
|
+
var CONFIG = {
|
1514
|
+
CUSTOM: {
|
1515
|
+
component: exports.ElementComponent,
|
1516
|
+
plugins: [IOPlugin, ScriptPlugin],
|
1517
|
+
},
|
1518
|
+
CONTAINER: {
|
1519
|
+
component: exports.ElementComponent,
|
1520
|
+
defaultTemplate: '<element-children></element-children>',
|
1521
|
+
plugins: [ScriptPlugin],
|
1522
|
+
},
|
1523
|
+
SERVICE: {
|
1524
|
+
component: exports.ElementComponent,
|
1525
|
+
plugins: [IOPlugin, ScriptPlugin],
|
1526
|
+
suppressTemplate: true,
|
1527
|
+
suppressStyles: true,
|
1528
|
+
},
|
1529
|
+
REFERENCE: {
|
1530
|
+
component: exports.ElementComponent,
|
1531
|
+
plugins: [IOPlugin, ScriptPlugin],
|
1532
|
+
suppressTemplate: true,
|
1533
|
+
},
|
1534
|
+
};
|
1535
|
+
|
1536
|
+
var EXPORTED_CLASS_REGEX = /export class (\S+)/;
|
1537
|
+
var METADATA_DECORATOR_REGEX = /@ElementDefinition\(([\s\S]+)\)(\n|\r\n|.)*export class/g;
|
1538
|
+
var UiBuildError = /** @class */ (function (_super) {
|
1539
|
+
__extends(UiBuildError, _super);
|
1540
|
+
function UiBuildError(message, affectedMetadata) {
|
1541
|
+
var _this = _super.call(this, message) || this;
|
1542
|
+
_this.name = _this.constructor.name;
|
1543
|
+
_this.affectedMetadata = affectedMetadata;
|
1544
|
+
return _this;
|
1545
|
+
}
|
1546
|
+
return UiBuildError;
|
1547
|
+
}(Error));
|
1548
|
+
var elementToMetadata = function (el, parentPath) {
|
1549
|
+
var _a;
|
1550
|
+
var script = el.script && window.atob(el.script);
|
1551
|
+
var template = el.template && window.atob(el.template);
|
1552
|
+
var styles = el.styles && window.atob(el.styles);
|
1553
|
+
var exportedClassName = script && ((_a = EXPORTED_CLASS_REGEX.exec(script)) !== null && _a !== void 0 ? _a : [])[1];
|
1554
|
+
if (!exportedClassName) {
|
1555
|
+
throw new Error("Script doesn't have exported class");
|
1556
|
+
}
|
1557
|
+
var elementMetadata = extractElementMetadata(script || '');
|
1558
|
+
var path = (parentPath ? parentPath + '/' : '') + elementMetadata.name;
|
1559
|
+
return Object.assign(Object.assign({}, elementMetadata), { path: path, script: script === null || script === void 0 ? void 0 : script.replace(METADATA_DECORATOR_REGEX, 'export class'), template: template, styles: styles, children: el.children.map(function (child) { return elementToMetadata(child, path); }) });
|
1560
|
+
};
|
1561
|
+
var metadataToElement = function (metadata, recursive) {
|
1562
|
+
if (recursive === void 0) { recursive = true; }
|
1563
|
+
var elMetadata = {
|
1564
|
+
name: metadata.name,
|
1565
|
+
isShared: metadata.isShared,
|
1566
|
+
type: metadata.type,
|
1567
|
+
model: metadata.model,
|
1568
|
+
module: metadata.module,
|
1569
|
+
reference: metadata.reference,
|
1570
|
+
inputs: metadata.inputs,
|
1571
|
+
outputs: metadata.outputs,
|
1572
|
+
children: metadata.children.map(function (_e) {
|
1573
|
+
var name = _e.name;
|
1574
|
+
return name;
|
1575
|
+
}),
|
1576
|
+
configuredStyles: metadata.configuredStyles,
|
1577
|
+
};
|
1578
|
+
var normalizedElMetadata = normalizeElementMetadata(elMetadata);
|
1579
|
+
if (!metadata.script || !EXPORTED_CLASS_REGEX.test(metadata.script)) {
|
1580
|
+
throw new UiBuildError("'" + metadata.name + "' component script is missing an exported class", metadata);
|
1581
|
+
}
|
1582
|
+
var script = metadata.script &&
|
1583
|
+
window.btoa(metadata.script.replace(EXPORTED_CLASS_REGEX, "@ElementDefinition(" + stringifyElementMetadata(normalizedElMetadata) + ")\nexport class Script"));
|
1584
|
+
var template = metadata.template && window.btoa(metadata.template);
|
1585
|
+
var styles = metadata.styles && window.btoa(metadata.styles);
|
1586
|
+
return {
|
1587
|
+
script: script,
|
1588
|
+
template: template,
|
1589
|
+
styles: styles,
|
1590
|
+
children: recursive ? metadata.children.map(function (meta) { return metadataToElement(meta); }) : [],
|
1591
|
+
};
|
1592
|
+
};
|
1593
|
+
var normalizeElementMetadata = function (elementMetadata) {
|
1594
|
+
var _a, _b, _c, _d;
|
1595
|
+
var metadata = Object.assign({}, elementMetadata);
|
1596
|
+
// model
|
1597
|
+
var _e = (_a = metadata.model) !== null && _a !== void 0 ? _a : {}, lineItem = _e.lineItem, path = _e.path;
|
1598
|
+
var model = lineItem ? { lineItem: lineItem } : path ? { path: path } : undefined;
|
1599
|
+
if (model) {
|
1600
|
+
metadata.model = model;
|
1601
|
+
}
|
1602
|
+
else {
|
1603
|
+
delete metadata.model;
|
1604
|
+
}
|
1605
|
+
// module
|
1606
|
+
if (!metadata.module) {
|
1607
|
+
delete metadata.module;
|
1608
|
+
}
|
1609
|
+
// reference
|
1610
|
+
if (!metadata.reference) {
|
1611
|
+
delete metadata.reference;
|
1612
|
+
}
|
1613
|
+
// inputs
|
1614
|
+
var inputs = Object.entries((_b = metadata.inputs) !== null && _b !== void 0 ? _b : {}).reduce(function (acc, _e) {
|
1615
|
+
var _f;
|
1616
|
+
var _g = __read(_e, 2), key = _g[0], value = _g[1];
|
1617
|
+
return Object.assign(Object.assign({}, acc), (_f = {}, _f[key] = value || null, _f));
|
1618
|
+
}, {});
|
1619
|
+
if (inputs && Object.keys(inputs).length > 0) {
|
1620
|
+
metadata.inputs = inputs;
|
1621
|
+
}
|
1622
|
+
else {
|
1623
|
+
delete metadata.inputs;
|
1624
|
+
}
|
1625
|
+
// outputs
|
1626
|
+
var outputs = Object.entries((_c = metadata.outputs) !== null && _c !== void 0 ? _c : {}).reduce(function (acc, _e) {
|
1627
|
+
var _f;
|
1628
|
+
var _g = __read(_e, 2), key = _g[0], value = _g[1];
|
1629
|
+
return Object.assign(Object.assign({}, acc), (_f = {}, _f[key] = value || null, _f));
|
1630
|
+
}, {});
|
1631
|
+
if (outputs && Object.keys(outputs).length > 0) {
|
1632
|
+
metadata.outputs = outputs;
|
1633
|
+
}
|
1634
|
+
else {
|
1635
|
+
delete metadata.outputs;
|
1636
|
+
}
|
1637
|
+
// children
|
1638
|
+
if (!((_d = metadata.children) === null || _d === void 0 ? void 0 : _d.length)) {
|
1639
|
+
delete metadata.children;
|
1640
|
+
}
|
1641
|
+
// isShared
|
1642
|
+
if (!metadata.isShared) {
|
1643
|
+
delete metadata.isShared;
|
1644
|
+
}
|
1645
|
+
// configuredStyles
|
1646
|
+
if (!metadata.configuredStyles) {
|
1647
|
+
delete metadata.configuredStyles;
|
1648
|
+
}
|
1649
|
+
return metadata;
|
1650
|
+
};
|
1651
|
+
var extractElementMetadata = function (script) {
|
1652
|
+
var _a;
|
1653
|
+
var metadataString = ((_a = METADATA_DECORATOR_REGEX.exec(script)) !== null && _a !== void 0 ? _a : [])[1];
|
1654
|
+
// need to reset regex last index to prevent null result for next execution
|
1655
|
+
METADATA_DECORATOR_REGEX.lastIndex = 0;
|
1656
|
+
return new Function("return " + metadataString)();
|
1657
|
+
};
|
1658
|
+
var extendElementMetadata = function (script, extend) {
|
1659
|
+
var _a;
|
1660
|
+
var metadataString = ((_a = METADATA_DECORATOR_REGEX.exec(script)) !== null && _a !== void 0 ? _a : [])[1];
|
1661
|
+
// need to reset regex last index to prevent null result for next execution
|
1662
|
+
METADATA_DECORATOR_REGEX.lastIndex = 0;
|
1663
|
+
if (!metadataString) {
|
1664
|
+
return script;
|
1665
|
+
}
|
1666
|
+
var updated = Object.assign(Object.assign({}, new Function("return " + metadataString)()), extend);
|
1667
|
+
return script.replace(metadataString, stringifyElementMetadata(updated));
|
1668
|
+
};
|
1669
|
+
var getElementConfig = function (type) {
|
1670
|
+
return CONFIG[type];
|
1671
|
+
};
|
1672
|
+
var doesElementSupportIO = function (type) {
|
1673
|
+
var _a, _b;
|
1674
|
+
return (_b = (_a = getElementConfig(type).plugins) === null || _a === void 0 ? void 0 : _a.includes(IOPlugin)) !== null && _b !== void 0 ? _b : false;
|
1675
|
+
};
|
1676
|
+
function stringifyElementMetadata(elementMetadata) {
|
1677
|
+
var cleaned = JSON.stringify(elementMetadata, null, 2);
|
1678
|
+
return cleaned.replace(/^[\t ]*"[^:\n\r]+(?<!\\)":/gm, function (match) {
|
1679
|
+
return match.replace(/"/g, '');
|
1262
1680
|
});
|
1263
1681
|
}
|
1264
|
-
|
1265
|
-
|
1266
|
-
|
1267
|
-
|
1268
|
-
this.compiler = compiler;
|
1269
|
-
this.appRef = appRef;
|
1270
|
-
this.renderer = renderer;
|
1271
|
-
this.isLoading$ = new rxjs.BehaviorSubject(false);
|
1272
|
-
// configs
|
1273
|
-
this.suppressLoading = defaultOptions.suppressLoading;
|
1274
|
-
this.loadingLabel = defaultOptions.loadingLabel;
|
1682
|
+
var isValidScript = function (script) {
|
1683
|
+
var _a;
|
1684
|
+
if (!script) {
|
1685
|
+
return false;
|
1275
1686
|
}
|
1276
|
-
|
1277
|
-
|
1278
|
-
|
1279
|
-
this.instance.data = this.data;
|
1280
|
-
}
|
1281
|
-
if (changes.options) {
|
1282
|
-
this.suppressLoading = (_b = (_a = this.options) === null || _a === void 0 ? void 0 : _a.suppressLoading) !== null && _b !== void 0 ? _b : defaultOptions.suppressLoading;
|
1283
|
-
this.loadingLabel = (_d = (_c = this.options) === null || _c === void 0 ? void 0 : _c.loadingLabel) !== null && _d !== void 0 ? _d : defaultOptions.loadingLabel;
|
1284
|
-
}
|
1285
|
-
};
|
1286
|
-
FederatedComponent.prototype.ngOnInit = function () {
|
1287
|
-
this.isLoading$.next(true);
|
1288
|
-
};
|
1289
|
-
FederatedComponent.prototype.ngAfterViewInit = function () {
|
1290
|
-
var _this = this;
|
1291
|
-
var _a, _b, _c, _d, _e, _f;
|
1292
|
-
var remoteEntry = (_b = (_a = this.options) === null || _a === void 0 ? void 0 : _a.remoteEntry) !== null && _b !== void 0 ? _b : this.remoteEntry;
|
1293
|
-
var remoteName = (_d = (_c = this.options) === null || _c === void 0 ? void 0 : _c.remoteName) !== null && _d !== void 0 ? _d : this.remoteName;
|
1294
|
-
var exposedModule = (_f = (_e = this.options) === null || _e === void 0 ? void 0 : _e.exposedModule) !== null && _f !== void 0 ? _f : this.exposedModule;
|
1295
|
-
if (!remoteEntry || !remoteName || !exposedModule) {
|
1296
|
-
return;
|
1297
|
-
}
|
1298
|
-
loadRemoteModule(remoteEntry, remoteName, exposedModule).then(function (federated) {
|
1299
|
-
_this.compiler.compileModuleAsync(federated[exposedModule]).then(function (moduleFactory) {
|
1300
|
-
var _a, _b, _c;
|
1301
|
-
var rootModuleRef = moduleFactory.create(_this.injector);
|
1302
|
-
var rootComponentFactory = rootModuleRef.componentFactoryResolver.resolveComponentFactory(federated[exposedModule].rootComponent);
|
1303
|
-
var node = document.createElement('div');
|
1304
|
-
var _g = rootComponentFactory.create(_this.injector, [], node), instance = _g.instance, hostView = _g.hostView;
|
1305
|
-
_this.instance = instance;
|
1306
|
-
_this.instance.data = _this.data;
|
1307
|
-
_this.renderer.appendChild((_a = _this.moduleHostRef) === null || _a === void 0 ? void 0 : _a.nativeElement, node);
|
1308
|
-
_this.appRef.attachView(hostView);
|
1309
|
-
(_c = (_b = _this.options) === null || _b === void 0 ? void 0 : _b.onReady) === null || _c === void 0 ? void 0 : _c.call(_b);
|
1310
|
-
_this.isLoading$.next(false);
|
1311
|
-
});
|
1312
|
-
});
|
1313
|
-
};
|
1314
|
-
return FederatedComponent;
|
1315
|
-
}());
|
1316
|
-
FederatedComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: FederatedComponent, deps: [{ token: i0__namespace.Injector }, { token: i0__namespace.Compiler }, { token: i0__namespace.ApplicationRef }, { token: i0__namespace.Renderer2 }], target: i0__namespace.ɵɵFactoryTarget.Component });
|
1317
|
-
FederatedComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: FederatedComponent, selector: "veloce-host-federated", inputs: { remoteEntry: "remoteEntry", remoteName: "remoteName", exposedModule: "exposedModule", data: "data", options: "options" }, viewQueries: [{ propertyName: "moduleHostRef", first: true, predicate: ["moduleHost"], descendants: true }], usesOnChanges: true, ngImport: i0__namespace, template: "<div #moduleHost></div>\n\n<vl-loader *ngIf=\"!suppressLoading && (isLoading$ | async)\" [label]=\"loadingLabel\"></vl-loader>\n", styles: [":host{display:block}div{height:100%}\n"], components: [{ type: i1__namespace.LoaderComponent, selector: "vl-loader", inputs: ["label", "overlayVisible"] }], directives: [{ type: i7__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], pipes: { "async": i7__namespace.AsyncPipe }, changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
|
1318
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: FederatedComponent, decorators: [{
|
1319
|
-
type: i0.Component,
|
1320
|
-
args: [{
|
1321
|
-
// eslint-disable-next-line @angular-eslint/component-selector
|
1322
|
-
selector: 'veloce-host-federated',
|
1323
|
-
templateUrl: './federated.component.html',
|
1324
|
-
styleUrls: ['./federated.component.scss'],
|
1325
|
-
changeDetection: i0.ChangeDetectionStrategy.OnPush,
|
1326
|
-
}]
|
1327
|
-
}], ctorParameters: function () { return [{ type: i0__namespace.Injector }, { type: i0__namespace.Compiler }, { type: i0__namespace.ApplicationRef }, { type: i0__namespace.Renderer2 }]; }, propDecorators: { moduleHostRef: [{
|
1328
|
-
type: i0.ViewChild,
|
1329
|
-
args: ['moduleHost', { static: false }]
|
1330
|
-
}], remoteEntry: [{
|
1331
|
-
type: i0.Input
|
1332
|
-
}], remoteName: [{
|
1333
|
-
type: i0.Input
|
1334
|
-
}], exposedModule: [{
|
1335
|
-
type: i0.Input
|
1336
|
-
}], data: [{
|
1337
|
-
type: i0.Input
|
1338
|
-
}], options: [{
|
1339
|
-
type: i0.Input
|
1340
|
-
}] } });
|
1341
|
-
|
1342
|
-
var FederatedModule = /** @class */ (function () {
|
1343
|
-
function FederatedModule() {
|
1687
|
+
var exportedClassName = script && ((_a = EXPORTED_CLASS_REGEX.exec(script)) !== null && _a !== void 0 ? _a : [])[1];
|
1688
|
+
if (!exportedClassName) {
|
1689
|
+
return false;
|
1344
1690
|
}
|
1345
|
-
|
1346
|
-
|
1347
|
-
|
1348
|
-
|
1349
|
-
|
1350
|
-
|
1351
|
-
|
1352
|
-
|
1353
|
-
|
1354
|
-
|
1355
|
-
|
1356
|
-
|
1357
|
-
}] });
|
1691
|
+
var meta = extractElementMetadata(script);
|
1692
|
+
if (!meta.name || !meta.type) {
|
1693
|
+
return false;
|
1694
|
+
}
|
1695
|
+
return true;
|
1696
|
+
};
|
1697
|
+
function flattenElements(elements) {
|
1698
|
+
return lodash.flatten(elements.map(function (el) { return __spreadArray([el], __read(flattenElements(el.children))); }));
|
1699
|
+
}
|
1700
|
+
function isSharedElement(el) {
|
1701
|
+
return Boolean(el.isShared) && el.type !== 'REFERENCE';
|
1702
|
+
}
|
1358
1703
|
|
1359
1704
|
var ConfigurationPlugin = /** @class */ (function () {
|
1360
1705
|
function ConfigurationPlugin(host) {
|
@@ -1399,7 +1744,15 @@
|
|
1399
1744
|
}
|
1400
1745
|
_this.configurationService.patch(new i2.LineItemWorker(rootLineItem).remove(_this.modelSnapshot.id).li);
|
1401
1746
|
};
|
1747
|
+
var updateQty = function (qty) {
|
1748
|
+
var rootLineItem = _this.configurationService.getSnapshot();
|
1749
|
+
if (!rootLineItem || !_this.modelSnapshot) {
|
1750
|
+
return;
|
1751
|
+
}
|
1752
|
+
_this.configurationService.patch(new i2.LineItemWorker(rootLineItem).replace(Object.assign(Object.assign({}, _this.modelSnapshot), { qty: qty })).li);
|
1753
|
+
};
|
1402
1754
|
this.typeHost.remove = remove;
|
1755
|
+
this.typeHost.updateQty = updateQty;
|
1403
1756
|
};
|
1404
1757
|
ConfigurationPlugin.prototype.registerPort = function (name) {
|
1405
1758
|
var _this = this;
|
@@ -1460,9 +1813,9 @@
|
|
1460
1813
|
});
|
1461
1814
|
return ConfigurationPlugin;
|
1462
1815
|
}());
|
1463
|
-
ConfigurationPlugin.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.
|
1464
|
-
ConfigurationPlugin.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.
|
1465
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.
|
1816
|
+
ConfigurationPlugin.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ConfigurationPlugin, deps: "invalid", target: i0__namespace.ɵɵFactoryTarget.Directive });
|
1817
|
+
ConfigurationPlugin.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.17", type: ConfigurationPlugin, ngImport: i0__namespace });
|
1818
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ConfigurationPlugin, decorators: [{
|
1466
1819
|
type: i0.Directive
|
1467
1820
|
}], ctorParameters: function () { return [{ type: undefined }]; } });
|
1468
1821
|
|
@@ -1471,55 +1824,16 @@
|
|
1471
1824
|
DEFAULT: [],
|
1472
1825
|
};
|
1473
1826
|
|
1474
|
-
var InitAction = { type: 'INIT' };
|
1475
|
-
var ClearAction = { type: 'CLEAR' };
|
1476
|
-
var IntegrationState = /** @class */ (function () {
|
1477
|
-
function IntegrationState() {
|
1478
|
-
this.stateSubj$ = new rxjs.BehaviorSubject({});
|
1479
|
-
this.action$ = new rxjs.BehaviorSubject(InitAction);
|
1480
|
-
}
|
1481
|
-
Object.defineProperty(IntegrationState.prototype, "state$", {
|
1482
|
-
get: function () {
|
1483
|
-
return this.stateSubj$.asObservable();
|
1484
|
-
},
|
1485
|
-
enumerable: false,
|
1486
|
-
configurable: true
|
1487
|
-
});
|
1488
|
-
Object.defineProperty(IntegrationState.prototype, "state", {
|
1489
|
-
get: function () {
|
1490
|
-
return this.stateSubj$.getValue();
|
1491
|
-
},
|
1492
|
-
enumerable: false,
|
1493
|
-
configurable: true
|
1494
|
-
});
|
1495
|
-
IntegrationState.prototype.patchState = function (update) {
|
1496
|
-
this.stateSubj$.next(Object.assign(Object.assign({}, this.stateSubj$.getValue()), update));
|
1497
|
-
};
|
1498
|
-
IntegrationState.prototype.dispatch = function (action) {
|
1499
|
-
this.action$.next(action);
|
1500
|
-
};
|
1501
|
-
IntegrationState.prototype.listen$ = function (actionType) {
|
1502
|
-
return this.action$.pipe(rxjs.filter(function (action) { return action.type === actionType; }), rxjs.map(function (action) { return action.payload; }));
|
1503
|
-
};
|
1504
|
-
IntegrationState.prototype.listenAll$ = function () {
|
1505
|
-
return this.action$.asObservable();
|
1506
|
-
};
|
1507
|
-
IntegrationState.prototype.clear = function () {
|
1508
|
-
this.stateSubj$.next({});
|
1509
|
-
this.action$.next(ClearAction);
|
1510
|
-
};
|
1511
|
-
return IntegrationState;
|
1512
|
-
}());
|
1513
|
-
IntegrationState.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: IntegrationState, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
1514
|
-
IntegrationState.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: IntegrationState, providedIn: 'root' });
|
1515
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: IntegrationState, decorators: [{
|
1516
|
-
type: i0.Injectable,
|
1517
|
-
args: [{ providedIn: 'root' }]
|
1518
|
-
}] });
|
1519
|
-
|
1520
1827
|
var VELOCE_LIBS = {
|
1521
|
-
'@veloceapps/
|
1522
|
-
|
1828
|
+
'@veloceapps/core': {
|
1829
|
+
isDefined: core.isDefined,
|
1830
|
+
Operator: core.Operator,
|
1831
|
+
Predicate: core.Predicate,
|
1832
|
+
parseJsonSafely: core.parseJsonSafely,
|
1833
|
+
},
|
1834
|
+
'@veloceapps/components': {
|
1835
|
+
ToastService: i1.ToastService,
|
1836
|
+
},
|
1523
1837
|
'@veloceapps/api': {
|
1524
1838
|
SalesforceApiService: api.SalesforceApiService,
|
1525
1839
|
QuoteApiService: api.QuoteApiService,
|
@@ -1531,7 +1845,11 @@
|
|
1531
1845
|
PicklistsApiService: api.PicklistsApiService,
|
1532
1846
|
PriceApiService: api.PriceApiService,
|
1533
1847
|
ShoppingCartSettingsApiService: api.ShoppingCartSettingsApiService,
|
1848
|
+
ConfigurationSettingsApiService: api.ConfigurationSettingsApiService,
|
1849
|
+
GuidedSellingApiService: api.GuidedSellingApiService,
|
1534
1850
|
},
|
1851
|
+
'@veloceapps/sdk/core': Object.assign({ ConfigurationService: i2.ConfigurationService, QuoteDraftService: i2.QuoteDraftService, FlowConfigurationService: i2.FlowConfigurationService, LineItemWorker: i2.LineItemWorker, ProductImagesService: i2.ProductImagesService, ContextService: i2.ContextService }, i2.lineItemUtils),
|
1852
|
+
'@veloceapps/sdk/cms': Object.assign(Object.assign(Object.assign({}, cmsInjectionTokens), cmsActions), { TemplatesService: TemplatesService, IntegrationState: IntegrationState, ResourcesService: ResourcesService }),
|
1535
1853
|
};
|
1536
1854
|
var VELOCE_LIBS_BACKWARDS_COMPATIBLE = Object.entries(VELOCE_LIBS).reduce(function (trunk, _a) {
|
1537
1855
|
var _b;
|
@@ -1541,19 +1859,32 @@
|
|
1541
1859
|
var vendorMap = Object.assign(Object.assign(Object.assign({}, VELOCE_LIBS), VELOCE_LIBS_BACKWARDS_COMPATIBLE), { '@angular/core': i0__namespace, '@angular/forms': angularForms__namespace, rxjs: rxjs__namespace, 'rxjs/operators': rxjsOperators__namespace, lodash: lodash__namespace });
|
1542
1860
|
|
1543
1861
|
var ElementsResolver = /** @class */ (function () {
|
1544
|
-
function ElementsResolver(uiDef, elements) {
|
1862
|
+
function ElementsResolver(uiDef, elements, sharedElements) {
|
1545
1863
|
var _this = this;
|
1864
|
+
if (sharedElements === void 0) { sharedElements = []; }
|
1546
1865
|
this.uiDef = uiDef;
|
1547
1866
|
this.renderableElements = [];
|
1548
1867
|
this.sharedElements = [];
|
1549
1868
|
var transpiledElements = this.transpileScripts(elements);
|
1550
|
-
|
1551
|
-
this.
|
1869
|
+
var transpiledSharedElements = this.transpileScripts(sharedElements);
|
1870
|
+
this.sharedElements = this.flattenElements(transpiledElements)
|
1871
|
+
.filter(function (el) { return _this.isSharedElement(el); })
|
1872
|
+
.concat(transpiledSharedElements);
|
1873
|
+
this.elements = transpiledElements.map(function (el) { return _this.processElementMetadata(el); }).filter(core.isDefined);
|
1552
1874
|
this.renderableElements = this.getRenderableElements(this.elements);
|
1553
1875
|
}
|
1876
|
+
ElementsResolver.prototype.addElement = function (element) {
|
1877
|
+
var _this = this;
|
1878
|
+
if (element.isShared) {
|
1879
|
+
return;
|
1880
|
+
}
|
1881
|
+
var transpiledElements = this.transpileScripts([element]);
|
1882
|
+
this.elements = transpiledElements.map(function (el) { return _this.processElementMetadata(el); }).filter(core.isDefined);
|
1883
|
+
this.renderableElements = this.getRenderableElements(this.elements);
|
1884
|
+
};
|
1554
1885
|
ElementsResolver.prototype.getNgComponents = function () {
|
1555
1886
|
var _this = this;
|
1556
|
-
return this.renderableElements.map(function (el) { return _this.resolveElement(el); }).filter(
|
1887
|
+
return this.renderableElements.map(function (el) { return _this.resolveElement(el); }).filter(core.isDefined);
|
1557
1888
|
};
|
1558
1889
|
ElementsResolver.prototype.transpile = function (el) {
|
1559
1890
|
var _a;
|
@@ -1635,9 +1966,7 @@
|
|
1635
1966
|
}
|
1636
1967
|
finalElement.template = this.resolveElementTemplate(finalElement);
|
1637
1968
|
finalElement.styles = this.resolveElementStyles(finalElement);
|
1638
|
-
return Object.assign(Object.assign({}, finalElement), { children: finalElement.children
|
1639
|
-
.map(function (child) { return _this.processElementMetadata(child); })
|
1640
|
-
.filter(Boolean) });
|
1969
|
+
return Object.assign(Object.assign({}, finalElement), { children: finalElement.children.map(function (child) { return _this.processElementMetadata(child); }).filter(core.isDefined) });
|
1641
1970
|
};
|
1642
1971
|
ElementsResolver.prototype.getSharedChildren = function (children, parentPath) {
|
1643
1972
|
var _this = this;
|
@@ -1672,256 +2001,391 @@
|
|
1672
2001
|
function C() {
|
1673
2002
|
return _super !== null && _super.apply(this, arguments) || this;
|
1674
2003
|
}
|
1675
|
-
return C;
|
1676
|
-
}(config.component)));
|
1677
|
-
lodash.set(cmp, 'path', element.path);
|
1678
|
-
return cmp;
|
1679
|
-
};
|
1680
|
-
ElementsResolver.prototype.getElementStyles = function (element) {
|
1681
|
-
var result = '';
|
1682
|
-
var configuredStyles = this.convertInlineStylesToCSS(element.configuredStyles);
|
1683
|
-
if (configuredStyles) {
|
1684
|
-
// order is important: styles written by user in CSS code should has higher priority
|
1685
|
-
result += configuredStyles;
|
1686
|
-
}
|
1687
|
-
if (element.styles) {
|
1688
|
-
result += element.styles;
|
1689
|
-
}
|
1690
|
-
return result || undefined;
|
1691
|
-
};
|
1692
|
-
ElementsResolver.prototype.convertInlineStylesToCSS = function (styles) {
|
1693
|
-
if (!styles) {
|
1694
|
-
return '';
|
1695
|
-
}
|
1696
|
-
var entries = Object.entries(styles);
|
1697
|
-
var result = ':host {\n';
|
1698
|
-
entries.forEach(function (_c) {
|
1699
|
-
var _d = __read(_c, 2), style = _d[0], value = _d[1];
|
1700
|
-
result += " " + lodash.kebabCase(style) + ":" + value + ";\n";
|
2004
|
+
return C;
|
2005
|
+
}(config.component)));
|
2006
|
+
lodash.set(cmp, 'path', element.path);
|
2007
|
+
return cmp;
|
2008
|
+
};
|
2009
|
+
ElementsResolver.prototype.getElementStyles = function (element) {
|
2010
|
+
var result = '';
|
2011
|
+
var configuredStyles = this.convertInlineStylesToCSS(element.configuredStyles);
|
2012
|
+
if (configuredStyles) {
|
2013
|
+
// order is important: styles written by user in CSS code should has higher priority
|
2014
|
+
result += configuredStyles;
|
2015
|
+
}
|
2016
|
+
if (element.styles) {
|
2017
|
+
result += element.styles;
|
2018
|
+
}
|
2019
|
+
return result || undefined;
|
2020
|
+
};
|
2021
|
+
ElementsResolver.prototype.convertInlineStylesToCSS = function (styles) {
|
2022
|
+
if (!styles) {
|
2023
|
+
return '';
|
2024
|
+
}
|
2025
|
+
var entries = Object.entries(styles);
|
2026
|
+
var result = ':host {\n';
|
2027
|
+
entries.forEach(function (_c) {
|
2028
|
+
var _d = __read(_c, 2), style = _d[0], value = _d[1];
|
2029
|
+
result += " " + lodash.kebabCase(style) + ":" + value + ";\n";
|
2030
|
+
});
|
2031
|
+
result += '}\n';
|
2032
|
+
return result;
|
2033
|
+
};
|
2034
|
+
return ElementsResolver;
|
2035
|
+
}());
|
2036
|
+
|
2037
|
+
var defaultOptions = {
|
2038
|
+
suppressLoading: false,
|
2039
|
+
loadingLabel: 'LOADING',
|
2040
|
+
};
|
2041
|
+
|
2042
|
+
var moduleMap = {};
|
2043
|
+
function loadRemoteEntry(remoteEntry) {
|
2044
|
+
return new Promise(function (resolve, reject) {
|
2045
|
+
if (moduleMap[remoteEntry]) {
|
2046
|
+
resolve();
|
2047
|
+
return;
|
2048
|
+
}
|
2049
|
+
var script = document.createElement('script');
|
2050
|
+
script.src = remoteEntry;
|
2051
|
+
script.onerror = reject;
|
2052
|
+
script.onload = function () {
|
2053
|
+
moduleMap[remoteEntry] = true;
|
2054
|
+
resolve(); // window is the global namespace
|
2055
|
+
};
|
2056
|
+
document.body.append(script);
|
2057
|
+
});
|
2058
|
+
}
|
2059
|
+
function lookupExposedModule(remoteName, exposedModule) {
|
2060
|
+
return __awaiter(this, void 0, void 0, function () {
|
2061
|
+
var container, factory, Module;
|
2062
|
+
return __generator(this, function (_a) {
|
2063
|
+
switch (_a.label) {
|
2064
|
+
case 0:
|
2065
|
+
// Initializes the share scope. This fills it with known provided modules from this build and all remotes
|
2066
|
+
return [4 /*yield*/, __webpack_init_sharing__('default')];
|
2067
|
+
case 1:
|
2068
|
+
// Initializes the share scope. This fills it with known provided modules from this build and all remotes
|
2069
|
+
_a.sent();
|
2070
|
+
container = window[remoteName];
|
2071
|
+
// Initialize the container, it may provide shared modules
|
2072
|
+
return [4 /*yield*/, container.init(__webpack_share_scopes__.default)];
|
2073
|
+
case 2:
|
2074
|
+
// Initialize the container, it may provide shared modules
|
2075
|
+
_a.sent();
|
2076
|
+
return [4 /*yield*/, container.get(exposedModule)];
|
2077
|
+
case 3:
|
2078
|
+
factory = _a.sent();
|
2079
|
+
Module = factory();
|
2080
|
+
return [2 /*return*/, Module];
|
2081
|
+
}
|
1701
2082
|
});
|
1702
|
-
|
1703
|
-
|
1704
|
-
|
1705
|
-
return
|
1706
|
-
|
1707
|
-
|
1708
|
-
|
1709
|
-
|
1710
|
-
|
1711
|
-
|
1712
|
-
|
1713
|
-
LauncherService.prototype.compileModule = function (uiDef, elements) {
|
1714
|
-
var _this = this;
|
1715
|
-
var elementsResolver = new ElementsResolver(uiDef, elements);
|
1716
|
-
this.dynamicModuleService.elementsTree = elementsResolver.elements;
|
1717
|
-
this.module = this.getModule(elementsResolver.getNgComponents());
|
1718
|
-
return rxjs.from(this.compiler.compileModuleAndAllComponentsAsync(this.module)).pipe(rxjs.tap(function (m) {
|
1719
|
-
_this.dynamicModuleService.componentFactories = m.componentFactories;
|
1720
|
-
_this.moduleInstance = m;
|
1721
|
-
}), rxjs.map(function (m) { return ({ module: m, elements: elementsResolver.elements }); }));
|
1722
|
-
};
|
1723
|
-
LauncherService.prototype.destroy = function () {
|
1724
|
-
if (this.moduleInstance) {
|
1725
|
-
this.dynamicModuleService.clear();
|
1726
|
-
this.moduleInstance = undefined;
|
1727
|
-
}
|
1728
|
-
if (this.module) {
|
1729
|
-
this.compiler.clearCacheFor(this.module);
|
1730
|
-
this.module = undefined;
|
1731
|
-
}
|
1732
|
-
};
|
1733
|
-
LauncherService.prototype.getModule = function (components) {
|
1734
|
-
var staticComponents = [ElementChildrenComponent, ElementRendererComponent, CustomTemplateDirective];
|
1735
|
-
var DynamicModule = /** @class */ (function () {
|
1736
|
-
function DynamicModule() {
|
2083
|
+
});
|
2084
|
+
}
|
2085
|
+
function loadRemoteModule(remoteEntry, remoteName, exposedModule) {
|
2086
|
+
return __awaiter(this, void 0, void 0, function () {
|
2087
|
+
return __generator(this, function (_a) {
|
2088
|
+
switch (_a.label) {
|
2089
|
+
case 0: return [4 /*yield*/, loadRemoteEntry(remoteEntry)];
|
2090
|
+
case 1:
|
2091
|
+
_a.sent();
|
2092
|
+
return [4 /*yield*/, lookupExposedModule(remoteName, exposedModule)];
|
2093
|
+
case 2: return [2 /*return*/, _a.sent()];
|
1737
2094
|
}
|
1738
|
-
|
1739
|
-
|
1740
|
-
|
1741
|
-
i0.NgModule({
|
1742
|
-
imports: [i7.CommonModule, angularForms.FormsModule, angularForms.ReactiveFormsModule, FederatedModule, dragDrop.DragDropModule, scrolling.ScrollingModule],
|
1743
|
-
declarations: __spreadArray(__spreadArray([], __read(staticComponents)), __read(components)),
|
1744
|
-
jit: true,
|
1745
|
-
})
|
1746
|
-
], DynamicModule);
|
1747
|
-
return DynamicModule;
|
1748
|
-
};
|
1749
|
-
return LauncherService;
|
1750
|
-
}());
|
1751
|
-
LauncherService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: LauncherService, deps: [{ token: i0__namespace.Compiler }, { token: DynamicModuleService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
1752
|
-
LauncherService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: LauncherService });
|
1753
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: LauncherService, decorators: [{
|
1754
|
-
type: i0.Injectable
|
1755
|
-
}], ctorParameters: function () { return [{ type: i0__namespace.Compiler }, { type: DynamicModuleService }]; } });
|
2095
|
+
});
|
2096
|
+
});
|
2097
|
+
}
|
1756
2098
|
|
1757
|
-
var
|
1758
|
-
function
|
1759
|
-
this.
|
1760
|
-
this.
|
1761
|
-
this.
|
1762
|
-
this.
|
1763
|
-
this.
|
1764
|
-
|
1765
|
-
this.
|
1766
|
-
this.
|
1767
|
-
this.destroy$ = new rxjs.Subject();
|
2099
|
+
var FederatedComponent = /** @class */ (function () {
|
2100
|
+
function FederatedComponent(injector, compiler, appRef, renderer) {
|
2101
|
+
this.injector = injector;
|
2102
|
+
this.compiler = compiler;
|
2103
|
+
this.appRef = appRef;
|
2104
|
+
this.renderer = renderer;
|
2105
|
+
this.isLoading$ = new rxjs.BehaviorSubject(false);
|
2106
|
+
// configs
|
2107
|
+
this.suppressLoading = defaultOptions.suppressLoading;
|
2108
|
+
this.loadingLabel = defaultOptions.loadingLabel;
|
1768
2109
|
}
|
1769
|
-
|
1770
|
-
|
1771
|
-
|
1772
|
-
|
1773
|
-
this.startPreview();
|
1774
|
-
};
|
1775
|
-
PreviewComponent.prototype.ngOnDestroy = function () {
|
1776
|
-
this.destroy$.next();
|
1777
|
-
this.destroy$.complete();
|
1778
|
-
this.configurationService.reset();
|
1779
|
-
};
|
1780
|
-
PreviewComponent.prototype.initializeConfiguration$ = function () {
|
1781
|
-
var _this = this;
|
1782
|
-
var isAlreadyInitialized = this.runtimeService.isInitialized;
|
1783
|
-
if (!this.uiDefinition || this.uiDefinition.type !== 'CONFIGURATION' || isAlreadyInitialized) {
|
1784
|
-
return rxjs.of({});
|
2110
|
+
FederatedComponent.prototype.ngOnChanges = function (changes) {
|
2111
|
+
var _a, _b, _c, _d;
|
2112
|
+
if (changes.data && this.instance) {
|
2113
|
+
this.instance.data = this.data;
|
1785
2114
|
}
|
1786
|
-
if (
|
1787
|
-
|
1788
|
-
|
2115
|
+
if (changes.options) {
|
2116
|
+
this.suppressLoading = (_b = (_a = this.options) === null || _a === void 0 ? void 0 : _a.suppressLoading) !== null && _b !== void 0 ? _b : defaultOptions.suppressLoading;
|
2117
|
+
this.loadingLabel = (_d = (_c = this.options) === null || _c === void 0 ? void 0 : _c.loadingLabel) !== null && _d !== void 0 ? _d : defaultOptions.loadingLabel;
|
1789
2118
|
}
|
1790
|
-
// If still not initialized - init configuration in Test mode
|
1791
|
-
return this.runtimeService
|
1792
|
-
.initTestMode(this.modelId, this.uiDefinition)
|
1793
|
-
.pipe(rxjs.switchMap(function () { return _this.configurationService.configure(); }));
|
1794
2119
|
};
|
1795
|
-
|
1796
|
-
|
1797
|
-
try {
|
1798
|
-
return elements.map(function (element) { return elementToMetadata(element); });
|
1799
|
-
}
|
1800
|
-
catch (e) {
|
1801
|
-
console.error(e);
|
1802
|
-
if (!((_b = (_a = this.uiDefinition) === null || _a === void 0 ? void 0 : _a.properties) === null || _b === void 0 ? void 0 : _b.suppressToastMessages)) {
|
1803
|
-
this.messageService.add({ severity: 'error', summary: String(e) });
|
1804
|
-
}
|
1805
|
-
return [];
|
1806
|
-
}
|
2120
|
+
FederatedComponent.prototype.ngOnInit = function () {
|
2121
|
+
this.isLoading$.next(true);
|
1807
2122
|
};
|
1808
|
-
|
2123
|
+
FederatedComponent.prototype.ngAfterViewInit = function () {
|
1809
2124
|
var _this = this;
|
1810
|
-
|
2125
|
+
var _a, _b, _c, _d, _e, _f;
|
2126
|
+
var remoteEntry = (_b = (_a = this.options) === null || _a === void 0 ? void 0 : _a.remoteEntry) !== null && _b !== void 0 ? _b : this.remoteEntry;
|
2127
|
+
var remoteName = (_d = (_c = this.options) === null || _c === void 0 ? void 0 : _c.remoteName) !== null && _d !== void 0 ? _d : this.remoteName;
|
2128
|
+
var exposedModule = (_f = (_e = this.options) === null || _e === void 0 ? void 0 : _e.exposedModule) !== null && _f !== void 0 ? _f : this.exposedModule;
|
2129
|
+
if (!remoteEntry || !remoteName || !exposedModule) {
|
1811
2130
|
return;
|
1812
2131
|
}
|
1813
|
-
|
1814
|
-
|
1815
|
-
|
1816
|
-
|
1817
|
-
|
1818
|
-
|
1819
|
-
|
1820
|
-
|
1821
|
-
|
1822
|
-
|
1823
|
-
|
1824
|
-
|
1825
|
-
_this.
|
1826
|
-
}
|
1827
|
-
|
1828
|
-
return rxjs.of();
|
1829
|
-
}), rxjs.takeUntil(this.destroy$))
|
1830
|
-
.subscribe();
|
2132
|
+
loadRemoteModule(remoteEntry, remoteName, exposedModule).then(function (federated) {
|
2133
|
+
_this.compiler.compileModuleAsync(federated[exposedModule]).then(function (moduleFactory) {
|
2134
|
+
var _a, _b, _c;
|
2135
|
+
var rootModuleRef = moduleFactory.create(_this.injector);
|
2136
|
+
var rootComponentFactory = rootModuleRef.componentFactoryResolver.resolveComponentFactory(federated[exposedModule].rootComponent);
|
2137
|
+
var node = document.createElement('div');
|
2138
|
+
var _g = rootComponentFactory.create(_this.injector, [], node), instance = _g.instance, hostView = _g.hostView;
|
2139
|
+
_this.instance = instance;
|
2140
|
+
_this.instance.data = _this.data;
|
2141
|
+
_this.renderer.appendChild((_a = _this.moduleHostRef) === null || _a === void 0 ? void 0 : _a.nativeElement, node);
|
2142
|
+
_this.appRef.attachView(hostView);
|
2143
|
+
(_c = (_b = _this.options) === null || _b === void 0 ? void 0 : _b.onReady) === null || _c === void 0 ? void 0 : _c.call(_b);
|
2144
|
+
_this.isLoading$.next(false);
|
2145
|
+
});
|
2146
|
+
});
|
1831
2147
|
};
|
1832
|
-
return
|
2148
|
+
return FederatedComponent;
|
1833
2149
|
}());
|
1834
|
-
|
1835
|
-
|
1836
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.
|
2150
|
+
FederatedComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: FederatedComponent, deps: [{ token: i0__namespace.Injector }, { token: i0__namespace.Compiler }, { token: i0__namespace.ApplicationRef }, { token: i0__namespace.Renderer2 }], target: i0__namespace.ɵɵFactoryTarget.Component });
|
2151
|
+
FederatedComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: FederatedComponent, selector: "veloce-host-federated", inputs: { remoteEntry: "remoteEntry", remoteName: "remoteName", exposedModule: "exposedModule", data: "data", options: "options" }, viewQueries: [{ propertyName: "moduleHostRef", first: true, predicate: ["moduleHost"], descendants: true }], usesOnChanges: true, ngImport: i0__namespace, template: "<div #moduleHost></div>\n\n<vl-loader *ngIf=\"!suppressLoading && (isLoading$ | async)\" [label]=\"loadingLabel\"></vl-loader>\n", styles: [":host{display:block}div{height:100%}\n"], components: [{ type: i1__namespace.LoaderComponent, selector: "vl-loader", inputs: ["label", "overlayVisible"] }], directives: [{ type: i7__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], pipes: { "async": i7__namespace.AsyncPipe }, changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
|
2152
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: FederatedComponent, decorators: [{
|
1837
2153
|
type: i0.Component,
|
1838
2154
|
args: [{
|
1839
|
-
|
1840
|
-
|
1841
|
-
|
2155
|
+
// eslint-disable-next-line @angular-eslint/component-selector
|
2156
|
+
selector: 'veloce-host-federated',
|
2157
|
+
templateUrl: './federated.component.html',
|
2158
|
+
styleUrls: ['./federated.component.scss'],
|
1842
2159
|
changeDetection: i0.ChangeDetectionStrategy.OnPush,
|
1843
|
-
providers: [IOProviderService, TemplatesService],
|
1844
|
-
// use shadow DOM to prevent UI from being affected by global styles
|
1845
|
-
encapsulation: i0.ViewEncapsulation.ShadowDom,
|
1846
2160
|
}]
|
1847
|
-
}], ctorParameters: function () { return [{ type:
|
2161
|
+
}], ctorParameters: function () { return [{ type: i0__namespace.Injector }, { type: i0__namespace.Compiler }, { type: i0__namespace.ApplicationRef }, { type: i0__namespace.Renderer2 }]; }, propDecorators: { moduleHostRef: [{
|
2162
|
+
type: i0.ViewChild,
|
2163
|
+
args: ['moduleHost', { static: false }]
|
2164
|
+
}], remoteEntry: [{
|
1848
2165
|
type: i0.Input
|
1849
|
-
}],
|
2166
|
+
}], remoteName: [{
|
2167
|
+
type: i0.Input
|
2168
|
+
}], exposedModule: [{
|
1850
2169
|
type: i0.Input
|
1851
|
-
}],
|
2170
|
+
}], data: [{
|
2171
|
+
type: i0.Input
|
2172
|
+
}], options: [{
|
1852
2173
|
type: i0.Input
|
1853
2174
|
}] } });
|
1854
2175
|
|
1855
|
-
var
|
1856
|
-
function
|
2176
|
+
var FederatedModule = /** @class */ (function () {
|
2177
|
+
function FederatedModule() {
|
1857
2178
|
}
|
1858
|
-
return
|
2179
|
+
return FederatedModule;
|
1859
2180
|
}());
|
1860
|
-
|
1861
|
-
|
1862
|
-
|
1863
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.
|
2181
|
+
FederatedModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: FederatedModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
|
2182
|
+
FederatedModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: FederatedModule, declarations: [FederatedComponent], imports: [i7.CommonModule, i1.LoaderModule], exports: [FederatedComponent] });
|
2183
|
+
FederatedModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: FederatedModule, imports: [[i7.CommonModule, i1.LoaderModule]] });
|
2184
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: FederatedModule, decorators: [{
|
1864
2185
|
type: i0.NgModule,
|
1865
2186
|
args: [{
|
1866
|
-
declarations: [
|
1867
|
-
|
2187
|
+
declarations: [FederatedComponent],
|
2188
|
+
imports: [i7.CommonModule, i1.LoaderModule],
|
2189
|
+
exports: [FederatedComponent],
|
1868
2190
|
}]
|
1869
2191
|
}] });
|
1870
2192
|
|
1871
|
-
var
|
1872
|
-
function
|
2193
|
+
var CompilationService = /** @class */ (function () {
|
2194
|
+
function CompilationService(compiler) {
|
2195
|
+
this.compiler = compiler;
|
1873
2196
|
}
|
1874
|
-
|
2197
|
+
CompilationService.prototype.compileUIDefinition$ = function (uiDefinition) {
|
2198
|
+
var _this = this;
|
2199
|
+
return rxjs.of([]).pipe(rxjs.switchMap(function () {
|
2200
|
+
var children = uiDefinition.children, pages = uiDefinition.pages, components = uiDefinition.components, uiDefinitionMeta = __rest(uiDefinition, ["children", "pages", "components"]);
|
2201
|
+
_this.uiDefinitionMeta = uiDefinitionMeta;
|
2202
|
+
var elements = __spreadArray(__spreadArray([], __read((children !== null && children !== void 0 ? children : []))), __read((pages !== null && pages !== void 0 ? pages : [])));
|
2203
|
+
var sharedElements = components !== null && components !== void 0 ? components : [];
|
2204
|
+
var metadata = elements.map(function (element) { return elementToMetadata(element); });
|
2205
|
+
var sharedMetadata = sharedElements.map(function (element) { return elementToMetadata(element); });
|
2206
|
+
_this.elementsResolver = new ElementsResolver(uiDefinition, metadata, sharedMetadata);
|
2207
|
+
var module = _this.getModule(_this.elementsResolver.getNgComponents());
|
2208
|
+
return rxjs.combineLatest([
|
2209
|
+
rxjs.from(_this.compiler.compileModuleAndAllComponentsAsync(module)),
|
2210
|
+
rxjs.of(_this.elementsResolver),
|
2211
|
+
]);
|
2212
|
+
}), rxjs.map(function (_b) {
|
2213
|
+
var _c = __read(_b, 2), module = _c[0], elementsResolver = _c[1];
|
2214
|
+
return ({ module: module, elements: elementsResolver.elements });
|
2215
|
+
}));
|
2216
|
+
};
|
2217
|
+
CompilationService.prototype.compileElement$ = function (element) {
|
2218
|
+
var _this = this;
|
2219
|
+
if (!this.uiDefinitionMeta) {
|
2220
|
+
throw 'No UI Definition context';
|
2221
|
+
}
|
2222
|
+
return rxjs.of(this.uiDefinitionMeta).pipe(rxjs.switchMap(function (uiDefinition) {
|
2223
|
+
var _a;
|
2224
|
+
var elementsResolver = (_a = _this.elementsResolver) !== null && _a !== void 0 ? _a : new ElementsResolver(uiDefinition, []);
|
2225
|
+
elementsResolver.addElement(element);
|
2226
|
+
var module = _this.getModule(elementsResolver.getNgComponents());
|
2227
|
+
return rxjs.combineLatest([rxjs.from(_this.compiler.compileModuleAndAllComponentsAsync(module)), rxjs.of(elementsResolver)]);
|
2228
|
+
}), rxjs.map(function (_b) {
|
2229
|
+
var _c = __read(_b, 2), module = _c[0], elementsResolver = _c[1];
|
2230
|
+
return ({ module: module, elements: elementsResolver.elements });
|
2231
|
+
}));
|
2232
|
+
};
|
2233
|
+
CompilationService.prototype.clearModuleCache = function (modules) {
|
2234
|
+
var _this = this;
|
2235
|
+
modules.forEach(function (module) { return _this.compiler.clearCacheFor(module); });
|
2236
|
+
this.uiDefinitionMeta = undefined;
|
2237
|
+
};
|
2238
|
+
CompilationService.prototype.getModule = function (components) {
|
2239
|
+
var staticComponents = [
|
2240
|
+
ElementChildrenComponent,
|
2241
|
+
ElementRendererComponent,
|
2242
|
+
ElementDropHandleComponent,
|
2243
|
+
CustomTemplateDirective,
|
2244
|
+
];
|
2245
|
+
var DynamicModule = /** @class */ (function () {
|
2246
|
+
function DynamicModule() {
|
2247
|
+
}
|
2248
|
+
return DynamicModule;
|
2249
|
+
}());
|
2250
|
+
DynamicModule = __decorate([
|
2251
|
+
i0.NgModule({
|
2252
|
+
imports: [
|
2253
|
+
i7.CommonModule,
|
2254
|
+
angularForms.FormsModule,
|
2255
|
+
angularForms.ReactiveFormsModule,
|
2256
|
+
FederatedModule,
|
2257
|
+
dragDrop.DragDropModule,
|
2258
|
+
i2$1.DndModule,
|
2259
|
+
scrolling.ScrollingModule,
|
2260
|
+
],
|
2261
|
+
declarations: __spreadArray(__spreadArray([], __read(staticComponents)), __read(components)),
|
2262
|
+
jit: true,
|
2263
|
+
})
|
2264
|
+
], DynamicModule);
|
2265
|
+
return DynamicModule;
|
2266
|
+
};
|
2267
|
+
return CompilationService;
|
2268
|
+
}());
|
2269
|
+
CompilationService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: CompilationService, deps: [{ token: i0__namespace.Compiler }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
2270
|
+
CompilationService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: CompilationService });
|
2271
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: CompilationService, decorators: [{
|
2272
|
+
type: i0.Injectable
|
2273
|
+
}], ctorParameters: function () { return [{ type: i0__namespace.Compiler }]; } });
|
2274
|
+
|
2275
|
+
var RuntimeModule = /** @class */ (function () {
|
2276
|
+
function RuntimeModule() {
|
2277
|
+
}
|
2278
|
+
return RuntimeModule;
|
1875
2279
|
}());
|
1876
|
-
|
1877
|
-
|
1878
|
-
|
1879
|
-
|
2280
|
+
RuntimeModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: RuntimeModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
|
2281
|
+
RuntimeModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: RuntimeModule, imports: [i7.CommonModule, core.CoreModule] });
|
2282
|
+
RuntimeModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: RuntimeModule, providers: [
|
2283
|
+
dynamicdialog.DialogService,
|
2284
|
+
RuntimeService,
|
2285
|
+
RuntimeEditorService,
|
2286
|
+
{ provide: CMS_COMPILATION_SERVICE, useClass: CompilationService },
|
2287
|
+
], imports: [[i7.CommonModule, core.CoreModule]] });
|
2288
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: RuntimeModule, decorators: [{
|
1880
2289
|
type: i0.NgModule,
|
1881
2290
|
args: [{
|
1882
|
-
|
1883
|
-
|
1884
|
-
|
2291
|
+
imports: [i7.CommonModule, core.CoreModule],
|
2292
|
+
providers: [
|
2293
|
+
dynamicdialog.DialogService,
|
2294
|
+
RuntimeService,
|
2295
|
+
RuntimeEditorService,
|
2296
|
+
{ provide: CMS_COMPILATION_SERVICE, useClass: CompilationService },
|
2297
|
+
],
|
1885
2298
|
}]
|
1886
2299
|
}] });
|
1887
2300
|
|
1888
|
-
var
|
1889
|
-
function
|
2301
|
+
var LauncherModule = /** @class */ (function () {
|
2302
|
+
function LauncherModule() {
|
1890
2303
|
}
|
1891
|
-
return
|
2304
|
+
return LauncherModule;
|
1892
2305
|
}());
|
1893
|
-
|
1894
|
-
|
1895
|
-
|
1896
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.
|
2306
|
+
LauncherModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: LauncherModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
|
2307
|
+
LauncherModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: LauncherModule, imports: [i7.CommonModule, core.CoreModule, api.ApiModule, i2.SdkCoreModule, RuntimeModule, PreviewModule], exports: [PreviewModule] });
|
2308
|
+
LauncherModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: LauncherModule, providers: [IntegrationState, dynamicdialog.DialogService, ResourcesService], imports: [[i7.CommonModule, core.CoreModule, api.ApiModule, i2.SdkCoreModule, RuntimeModule, PreviewModule], PreviewModule] });
|
2309
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: LauncherModule, decorators: [{
|
1897
2310
|
type: i0.NgModule,
|
1898
2311
|
args: [{
|
1899
|
-
|
1900
|
-
|
1901
|
-
|
1902
|
-
exports: [PreviewComponent],
|
2312
|
+
imports: [i7.CommonModule, core.CoreModule, api.ApiModule, i2.SdkCoreModule, RuntimeModule, PreviewModule],
|
2313
|
+
providers: [IntegrationState, dynamicdialog.DialogService, ResourcesService],
|
2314
|
+
exports: [PreviewModule],
|
1903
2315
|
}]
|
1904
2316
|
}] });
|
1905
2317
|
|
1906
|
-
|
1907
|
-
|
1908
|
-
|
2318
|
+
var migrations = {
|
2319
|
+
2: function () {
|
2320
|
+
throw 'Migration from Legacy UI definition is not possible';
|
2321
|
+
},
|
2322
|
+
3: function (uiDef) {
|
2323
|
+
var _a;
|
2324
|
+
var children = (_a = uiDef.children) !== null && _a !== void 0 ? _a : [];
|
2325
|
+
return Object.assign(Object.assign({}, uiDef), { children: undefined, pages: children, version: 3 });
|
2326
|
+
},
|
2327
|
+
};
|
2328
|
+
|
2329
|
+
var MigrationsService = /** @class */ (function () {
|
2330
|
+
function MigrationsService(toastService) {
|
2331
|
+
this.toastService = toastService;
|
2332
|
+
}
|
2333
|
+
MigrationsService.prototype.migrateUIDefinition = function (uiDef) {
|
2334
|
+
var e_1, _a;
|
2335
|
+
var currentVersion = uiDef.version;
|
2336
|
+
var targetVersion = i2.UI_DEFINITION_VERSION;
|
2337
|
+
var migrateVersions = Object.keys(migrations)
|
2338
|
+
.reduce(function (acc, version) {
|
2339
|
+
var v = Number(version);
|
2340
|
+
if (v > currentVersion && v <= targetVersion) {
|
2341
|
+
acc.push(v);
|
2342
|
+
}
|
2343
|
+
return acc;
|
2344
|
+
}, [])
|
2345
|
+
.sort();
|
2346
|
+
try {
|
2347
|
+
var result = lodash.cloneDeep(uiDef);
|
2348
|
+
try {
|
2349
|
+
for (var migrateVersions_1 = __values(migrateVersions), migrateVersions_1_1 = migrateVersions_1.next(); !migrateVersions_1_1.done; migrateVersions_1_1 = migrateVersions_1.next()) {
|
2350
|
+
var version = migrateVersions_1_1.value;
|
2351
|
+
result = migrations[version](result);
|
2352
|
+
}
|
2353
|
+
}
|
2354
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
2355
|
+
finally {
|
2356
|
+
try {
|
2357
|
+
if (migrateVersions_1_1 && !migrateVersions_1_1.done && (_a = migrateVersions_1.return)) _a.call(migrateVersions_1);
|
2358
|
+
}
|
2359
|
+
finally { if (e_1) throw e_1.error; }
|
2360
|
+
}
|
2361
|
+
return result;
|
2362
|
+
}
|
2363
|
+
catch (e) {
|
2364
|
+
this.toastService.add({ summary: String(e), severity: i1.ToastType.error });
|
2365
|
+
return;
|
2366
|
+
}
|
1909
2367
|
};
|
1910
|
-
|
2368
|
+
return MigrationsService;
|
2369
|
+
}());
|
2370
|
+
MigrationsService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: MigrationsService, deps: [{ token: i1__namespace.ToastService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
2371
|
+
MigrationsService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: MigrationsService, providedIn: 'root' });
|
2372
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: MigrationsService, decorators: [{
|
2373
|
+
type: i0.Injectable,
|
2374
|
+
args: [{ providedIn: 'root' }]
|
2375
|
+
}], ctorParameters: function () { return [{ type: i1__namespace.ToastService }]; } });
|
1911
2376
|
|
1912
|
-
var
|
1913
|
-
function
|
2377
|
+
var MigrationsModule = /** @class */ (function () {
|
2378
|
+
function MigrationsModule() {
|
1914
2379
|
}
|
1915
|
-
return
|
2380
|
+
return MigrationsModule;
|
1916
2381
|
}());
|
1917
|
-
|
1918
|
-
|
1919
|
-
|
1920
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.
|
2382
|
+
MigrationsModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: MigrationsModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
|
2383
|
+
MigrationsModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: MigrationsModule });
|
2384
|
+
MigrationsModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: MigrationsModule, providers: [MigrationsService] });
|
2385
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: MigrationsModule, decorators: [{
|
1921
2386
|
type: i0.NgModule,
|
1922
2387
|
args: [{
|
1923
|
-
|
1924
|
-
providers: [LauncherService, IntegrationState, DynamicModuleService, dynamicdialog.DialogService],
|
2388
|
+
providers: [MigrationsService],
|
1925
2389
|
}]
|
1926
2390
|
}] });
|
1927
2391
|
|
@@ -1939,7 +2403,8 @@
|
|
1939
2403
|
exports.ElementsResolver = ElementsResolver;
|
1940
2404
|
exports.IntegrationState = IntegrationState;
|
1941
2405
|
exports.LauncherModule = LauncherModule;
|
1942
|
-
exports.
|
2406
|
+
exports.MigrationsModule = MigrationsModule;
|
2407
|
+
exports.MigrationsService = MigrationsService;
|
1943
2408
|
exports.NavigateBackAction = NavigateBackAction;
|
1944
2409
|
exports.NavigateToCatalogAction = NavigateToCatalogAction;
|
1945
2410
|
exports.OpenDocGenAction = OpenDocGenAction;
|
@@ -1947,8 +2412,10 @@
|
|
1947
2412
|
exports.PreviewModule = PreviewModule;
|
1948
2413
|
exports.RemoteApplyAction = RemoteApplyAction;
|
1949
2414
|
exports.RemoteCancelAction = RemoteCancelAction;
|
2415
|
+
exports.ResourcesService = ResourcesService;
|
2416
|
+
exports.RuntimeEditorService = RuntimeEditorService;
|
2417
|
+
exports.RuntimeModule = RuntimeModule;
|
1950
2418
|
exports.SHARED_ELEMENT_METADATA = SHARED_ELEMENT_METADATA;
|
1951
|
-
exports.SetDefaultMetrics = SetDefaultMetrics;
|
1952
2419
|
exports.SwitchObjectAction = SwitchObjectAction;
|
1953
2420
|
exports.TemplatesService = TemplatesService;
|
1954
2421
|
exports.UI_DEFINITION_METADATA = UI_DEFINITION_METADATA;
|
@@ -1959,15 +2426,19 @@
|
|
1959
2426
|
exports.extendElementMetadata = extendElementMetadata;
|
1960
2427
|
exports.extractElementMetadata = extractElementMetadata;
|
1961
2428
|
exports.findElementByModule = findElementByModule;
|
2429
|
+
exports.findElementByPath = findElementByPath;
|
1962
2430
|
exports.flattenElements = flattenElements;
|
1963
2431
|
exports.getAbsolutePath = getAbsolutePath;
|
1964
2432
|
exports.getElementConfig = getElementConfig;
|
2433
|
+
exports.getElementUniqueName = getElementUniqueName;
|
2434
|
+
exports.insertElement = insertElement;
|
1965
2435
|
exports.isSharedElement = isSharedElement;
|
1966
2436
|
exports.isValidScript = isValidScript;
|
1967
2437
|
exports.metadataToElement = metadataToElement;
|
1968
2438
|
exports.normalizeElementMetadata = normalizeElementMetadata;
|
1969
2439
|
exports.parseBoundPath = parseBoundPath;
|
1970
2440
|
exports.parsePath = parsePath;
|
2441
|
+
exports.removeElement = removeElement;
|
1971
2442
|
exports.stringifyElementMetadata = stringifyElementMetadata;
|
1972
2443
|
|
1973
2444
|
Object.defineProperty(exports, '__esModule', { value: true });
|