@veloceapps/sdk 6.0.0-6 → 6.0.0-61
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/bundles/veloceapps-sdk-cms.umd.js +1248 -830
- package/bundles/veloceapps-sdk-cms.umd.js.map +1 -1
- package/bundles/veloceapps-sdk-core.umd.js +803 -696
- package/bundles/veloceapps-sdk-core.umd.js.map +1 -1
- package/bundles/veloceapps-sdk-runtime.umd.js +209 -142
- package/bundles/veloceapps-sdk-runtime.umd.js.map +1 -1
- package/bundles/veloceapps-sdk.umd.js +371 -299
- 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 +0 -1
- package/cms/services/io-provider.service.d.ts +3 -3
- 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/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 +40 -26
- 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/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 +2 -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 +10 -9
- 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 +1 -2
- package/esm2015/cms/services/integration.state.js +3 -3
- package/esm2015/cms/services/io-provider.service.js +9 -9
- 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/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 +21 -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 +27 -24
- 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 +10 -9
- package/esm2015/core/modules/flow-configuration/services/flow-update.service.js +3 -3
- package/esm2015/core/services/context.service.js +3 -3
- 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 +27 -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 +4 -4
- 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 +3 -3
- package/esm2015/src/components/dialog/dialog.module.js +4 -4
- 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 +20 -12
- 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 +4 -4
- 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 +3 -3
- package/esm2015/src/guards/root.guard.js +3 -3
- package/esm2015/src/pages/catalog/catalog.component.js +3 -3
- 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 +3 -3
- 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 +8 -8
- package/esm2015/src/services/doc-gen.service.js +3 -3
- package/esm2015/src/services/flow-dialog.service.js +3 -3
- package/esm2015/src/services/flow-router.service.js +3 -3
- package/esm2015/src/services/flow.service.js +3 -3
- package/esm2015/src/utils/flow.utils.js +3 -3
- package/fesm2015/veloceapps-sdk-cms.js +1041 -737
- package/fesm2015/veloceapps-sdk-cms.js.map +1 -1
- package/fesm2015/veloceapps-sdk-core.js +554 -521
- package/fesm2015/veloceapps-sdk-core.js.map +1 -1
- package/fesm2015/veloceapps-sdk-runtime.js +138 -138
- package/fesm2015/veloceapps-sdk-runtime.js.map +1 -1
- package/fesm2015/veloceapps-sdk.js +256 -252
- 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/header/header.component.d.ts +4 -2
- package/src/components/header/metrics/metrics.component.d.ts +15 -6
- package/src/components/header/metrics/metrics.definitions.d.ts +0 -3
- package/src/pages/product/product.component.d.ts +0 -1
- 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,73 @@
|
|
|
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
|
-
var _this = this;
|
|
728
|
-
this.host = host;
|
|
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);
|
|
753
|
-
}
|
|
754
|
-
ScriptPlugin.prototype.addScript = function (metadata) {
|
|
755
|
-
var _a;
|
|
756
|
-
if (!(metadata === null || metadata === void 0 ? void 0 : metadata.script)) {
|
|
757
|
-
return;
|
|
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;
|
|
768
|
-
}
|
|
769
|
-
scriptContent = scriptContent.replace(classMatch[0], "class " + className);
|
|
770
|
-
script.text = "var " + id + " = function(vendor) {" + scriptContent + "\n return " + className + "; };";
|
|
771
|
-
this.document.body.appendChild(script);
|
|
772
|
-
var ScriptClass = window[id](this.vendorMap);
|
|
773
|
-
if (ScriptClass instanceof Object) {
|
|
774
|
-
this.host.registerPlugin(new ScriptClass(this.host));
|
|
775
|
-
}
|
|
776
|
-
this.document.body.removeChild(script);
|
|
777
|
-
};
|
|
778
|
-
return ScriptPlugin;
|
|
779
|
-
}());
|
|
780
|
-
ScriptPlugin.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ScriptPlugin, deps: [{ token: exports.ElementComponent }], target: i0__namespace.ɵɵFactoryTarget.Directive });
|
|
781
|
-
ScriptPlugin.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.15", type: ScriptPlugin, ngImport: i0__namespace });
|
|
782
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ScriptPlugin, decorators: [{
|
|
783
|
-
type: i0.Directive
|
|
784
|
-
}], ctorParameters: function () { return [{ type: exports.ElementComponent }]; } });
|
|
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
|
-
}
|
|
979
|
-
|
|
980
|
-
var ElementContextService = /** @class */ (function () {
|
|
981
|
-
function ElementContextService() {
|
|
914
|
+
var ElementContextService = /** @class */ (function () {
|
|
915
|
+
function ElementContextService() {
|
|
982
916
|
}
|
|
983
917
|
return ElementContextService;
|
|
984
918
|
}());
|
|
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.
|
|
919
|
+
ElementContextService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ElementContextService, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
920
|
+
ElementContextService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ElementContextService });
|
|
921
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ElementContextService, decorators: [{
|
|
988
922
|
type: i0.Injectable
|
|
989
923
|
}] });
|
|
990
924
|
|
|
991
925
|
var ElementRendererComponent = /** @class */ (function () {
|
|
992
|
-
function ElementRendererComponent(parentInjector,
|
|
926
|
+
function ElementRendererComponent(parentInjector, runtimeService, elementContext, ioProviderService, configurationService, elementRef, cdr) {
|
|
993
927
|
this.parentInjector = parentInjector;
|
|
994
|
-
this.
|
|
928
|
+
this.runtimeService = runtimeService;
|
|
995
929
|
this.elementContext = elementContext;
|
|
996
930
|
this.ioProviderService = ioProviderService;
|
|
997
931
|
this.configurationService = configurationService;
|
|
@@ -1002,7 +936,7 @@
|
|
|
1002
936
|
}
|
|
1003
937
|
ElementRendererComponent.prototype.ngOnInit = function () {
|
|
1004
938
|
this.elementContext.metadata = this.meta;
|
|
1005
|
-
this.factory = this.
|
|
939
|
+
this.factory = this.meta.path ? this.runtimeService.componentFactories[this.meta.path] : undefined;
|
|
1006
940
|
this.createComponents();
|
|
1007
941
|
};
|
|
1008
942
|
ElementRendererComponent.prototype.ngOnDestroy = function () {
|
|
@@ -1135,9 +1069,9 @@
|
|
|
1135
1069
|
};
|
|
1136
1070
|
return ElementRendererComponent;
|
|
1137
1071
|
}());
|
|
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.
|
|
1072
|
+
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 });
|
|
1073
|
+
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 });
|
|
1074
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ElementRendererComponent, decorators: [{
|
|
1141
1075
|
type: i0.Component,
|
|
1142
1076
|
args: [{
|
|
1143
1077
|
selector: 'vl-cms-element-renderer',
|
|
@@ -1149,7 +1083,7 @@
|
|
|
1149
1083
|
}], ctorParameters: function () {
|
|
1150
1084
|
return [{ type: i0__namespace.Injector, decorators: [{
|
|
1151
1085
|
type: i0.SkipSelf
|
|
1152
|
-
}] }, { type:
|
|
1086
|
+
}] }, { type: RuntimeService }, { type: ElementContextService }, { type: IOProviderService }, { type: i2__namespace.ConfigurationService }, { type: i0__namespace.ElementRef }, { type: i0__namespace.ChangeDetectorRef }];
|
|
1153
1087
|
}, propDecorators: { el: [{
|
|
1154
1088
|
type: i0.ViewChild,
|
|
1155
1089
|
args: ['el', { read: i0.ViewContainerRef, static: true }]
|
|
@@ -1157,204 +1091,566 @@
|
|
|
1157
1091
|
type: i0.Input
|
|
1158
1092
|
}] } });
|
|
1159
1093
|
|
|
1160
|
-
var
|
|
1161
|
-
function
|
|
1162
|
-
|
|
1163
|
-
this.
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
selector: 'element-children',
|
|
1174
|
-
templateUrl: 'element-children.component.html',
|
|
1175
|
-
styleUrls: ['./element-children.component.scss'],
|
|
1176
|
-
changeDetection: i0.ChangeDetectionStrategy.OnPush,
|
|
1177
|
-
}]
|
|
1178
|
-
}], ctorParameters: function () { return [{ type: ElementContextService }]; } });
|
|
1179
|
-
|
|
1180
|
-
// eslint-disable-next-line @angular-eslint/directive-selector
|
|
1181
|
-
var CustomTemplateDirective = /** @class */ (function () {
|
|
1182
|
-
function CustomTemplateDirective(templateRef, templatesService) {
|
|
1183
|
-
this.templateRef = templateRef;
|
|
1184
|
-
this.templatesService = templatesService;
|
|
1094
|
+
var PreviewComponent = /** @class */ (function () {
|
|
1095
|
+
function PreviewComponent(runtimeService, configurationService, messageService, configurationRuntimeService, integrationState, cdr) {
|
|
1096
|
+
var _this = this;
|
|
1097
|
+
this.runtimeService = runtimeService;
|
|
1098
|
+
this.configurationService = configurationService;
|
|
1099
|
+
this.messageService = messageService;
|
|
1100
|
+
this.configurationRuntimeService = configurationRuntimeService;
|
|
1101
|
+
this.integrationState = integrationState;
|
|
1102
|
+
this.cdr = cdr;
|
|
1103
|
+
this.state$ = new rxjs.BehaviorSubject({ loading: true, failure: false });
|
|
1104
|
+
this.elements = [];
|
|
1105
|
+
this.destroy$ = new rxjs.Subject();
|
|
1106
|
+
this.runtimeService.updated$.pipe(rxjs.takeUntil(this.destroy$)).subscribe(function () { return _this.cdr.detectChanges(); });
|
|
1185
1107
|
}
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1108
|
+
PreviewComponent.prototype.ngOnInit = function () {
|
|
1109
|
+
var _a;
|
|
1110
|
+
if (!((_a = this.config) === null || _a === void 0 ? void 0 : _a.suppressClearState)) {
|
|
1111
|
+
this.integrationState.clear();
|
|
1189
1112
|
}
|
|
1190
|
-
this.
|
|
1113
|
+
this.startPreview();
|
|
1191
1114
|
};
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1115
|
+
PreviewComponent.prototype.ngOnDestroy = function () {
|
|
1116
|
+
this.destroy$.next();
|
|
1117
|
+
this.destroy$.complete();
|
|
1118
|
+
this.configurationService.reset();
|
|
1119
|
+
this.runtimeService.clear();
|
|
1120
|
+
};
|
|
1121
|
+
PreviewComponent.prototype.initializeConfiguration$ = function () {
|
|
1122
|
+
var _this = this;
|
|
1123
|
+
var isAlreadyInitialized = this.configurationRuntimeService.isInitialized;
|
|
1124
|
+
if (!this.uiDefinition || this.uiDefinition.type !== 'CONFIGURATION' || isAlreadyInitialized) {
|
|
1125
|
+
return rxjs.of({});
|
|
1126
|
+
}
|
|
1127
|
+
if (!this.modelId) {
|
|
1128
|
+
console.warn("No modelId is given for uiDefinition with '" + this.uiDefinition.type + "' type");
|
|
1129
|
+
return rxjs.of({});
|
|
1130
|
+
}
|
|
1131
|
+
// If still not initialized - init configuration in Test mode
|
|
1132
|
+
return this.configurationRuntimeService
|
|
1133
|
+
.initTestMode(this.modelId, this.uiDefinition)
|
|
1134
|
+
.pipe(rxjs.switchMap(function () { return _this.configurationService.configure(); }));
|
|
1135
|
+
};
|
|
1136
|
+
PreviewComponent.prototype.startPreview = function () {
|
|
1137
|
+
var _this = this;
|
|
1138
|
+
if (!this.uiDefinition) {
|
|
1213
1139
|
return;
|
|
1214
1140
|
}
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
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];
|
|
1141
|
+
rxjs.forkJoin([this.runtimeService.initialize$(this.uiDefinition, this.config), this.initializeConfiguration$()])
|
|
1142
|
+
.pipe(rxjs.tap(function (_c) {
|
|
1143
|
+
var _d = __read(_c, 1), elements = _d[0];
|
|
1144
|
+
_this.elements = elements;
|
|
1145
|
+
_this.state$.next({ loading: false, failure: false });
|
|
1146
|
+
}), rxjs.catchError(function (error) {
|
|
1147
|
+
var _a, _b;
|
|
1148
|
+
console.error(error);
|
|
1149
|
+
if (!((_b = (_a = _this.uiDefinition) === null || _a === void 0 ? void 0 : _a.properties) === null || _b === void 0 ? void 0 : _b.suppressToastMessages)) {
|
|
1150
|
+
_this.messageService.add({ severity: 'error', summary: error });
|
|
1247
1151
|
}
|
|
1152
|
+
_this.state$.next({ loading: false, failure: true });
|
|
1153
|
+
return rxjs.of();
|
|
1154
|
+
}), rxjs.takeUntil(this.destroy$))
|
|
1155
|
+
.subscribe();
|
|
1156
|
+
};
|
|
1157
|
+
return PreviewComponent;
|
|
1158
|
+
}());
|
|
1159
|
+
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 });
|
|
1160
|
+
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 });
|
|
1161
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: PreviewComponent, decorators: [{
|
|
1162
|
+
type: i0.Component,
|
|
1163
|
+
args: [{
|
|
1164
|
+
selector: 'vl-cms-preview',
|
|
1165
|
+
templateUrl: './preview.component.html',
|
|
1166
|
+
styleUrls: ['./preview.component.scss'],
|
|
1167
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush,
|
|
1168
|
+
providers: [IOProviderService, TemplatesService],
|
|
1169
|
+
// use shadow DOM to prevent UI from being affected by global styles
|
|
1170
|
+
encapsulation: i0.ViewEncapsulation.ShadowDom,
|
|
1171
|
+
}]
|
|
1172
|
+
}], 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: [{
|
|
1173
|
+
type: i0.Input
|
|
1174
|
+
}], uiDefinition: [{
|
|
1175
|
+
type: i0.Input
|
|
1176
|
+
}], config: [{
|
|
1177
|
+
type: i0.Input
|
|
1178
|
+
}] } });
|
|
1179
|
+
|
|
1180
|
+
var RuntimeEditorService = /** @class */ (function () {
|
|
1181
|
+
function RuntimeEditorService(runtimeService) {
|
|
1182
|
+
var _this = this;
|
|
1183
|
+
this.runtimeService = runtimeService;
|
|
1184
|
+
this.editorModeSubj$ = new rxjs.BehaviorSubject(false);
|
|
1185
|
+
this.dragMode$ = new rxjs.BehaviorSubject(false);
|
|
1186
|
+
this.elementDropped$ = new rxjs.ReplaySubject();
|
|
1187
|
+
this.elementDeleted$ = new rxjs.ReplaySubject();
|
|
1188
|
+
this.editorMode$ = this.editorModeSubj$.asObservable();
|
|
1189
|
+
this.runtimeService.isInitialized$.subscribe(function () { var _a; return _this.editorModeSubj$.next(Boolean((_a = _this.runtimeService.config) === null || _a === void 0 ? void 0 : _a.uiBuilderMode)); });
|
|
1190
|
+
}
|
|
1191
|
+
RuntimeEditorService.prototype.applyPatch$ = function (patch) {
|
|
1192
|
+
return this.runtimeService.applyPatch$(patch);
|
|
1193
|
+
};
|
|
1194
|
+
RuntimeEditorService.prototype.toggleEditorMode = function () {
|
|
1195
|
+
this.editorModeSubj$.next(!this.editorModeSubj$.value);
|
|
1196
|
+
};
|
|
1197
|
+
return RuntimeEditorService;
|
|
1198
|
+
}());
|
|
1199
|
+
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 });
|
|
1200
|
+
RuntimeEditorService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: RuntimeEditorService });
|
|
1201
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: RuntimeEditorService, decorators: [{
|
|
1202
|
+
type: i0.Injectable
|
|
1203
|
+
}], ctorParameters: function () { return [{ type: RuntimeService }]; } });
|
|
1204
|
+
|
|
1205
|
+
var ElementDropHandleComponent = /** @class */ (function () {
|
|
1206
|
+
function ElementDropHandleComponent(runtimeService) {
|
|
1207
|
+
this.runtimeService = runtimeService;
|
|
1208
|
+
}
|
|
1209
|
+
ElementDropHandleComponent.prototype.handleDrop = function (e) {
|
|
1210
|
+
this.runtimeService.elementDropped$.next({
|
|
1211
|
+
element: e.data,
|
|
1212
|
+
index: this.index,
|
|
1213
|
+
path: this.parentPath,
|
|
1248
1214
|
});
|
|
1249
|
-
}
|
|
1215
|
+
};
|
|
1216
|
+
return ElementDropHandleComponent;
|
|
1217
|
+
}());
|
|
1218
|
+
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 });
|
|
1219
|
+
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 });
|
|
1220
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ElementDropHandleComponent, decorators: [{
|
|
1221
|
+
type: i0.Component,
|
|
1222
|
+
args: [{
|
|
1223
|
+
selector: 'vl-element-drop-handle',
|
|
1224
|
+
templateUrl: './element-drop-handle.component.html',
|
|
1225
|
+
styleUrls: ['./element-drop-handle.component.scss'],
|
|
1226
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush,
|
|
1227
|
+
}]
|
|
1228
|
+
}], ctorParameters: function () { return [{ type: RuntimeEditorService }]; }, propDecorators: { index: [{
|
|
1229
|
+
type: i0.Input
|
|
1230
|
+
}], parentPath: [{
|
|
1231
|
+
type: i0.Input
|
|
1232
|
+
}] } });
|
|
1233
|
+
|
|
1234
|
+
var ElementDropHandleModule = /** @class */ (function () {
|
|
1235
|
+
function ElementDropHandleModule() {
|
|
1236
|
+
}
|
|
1237
|
+
return ElementDropHandleModule;
|
|
1238
|
+
}());
|
|
1239
|
+
ElementDropHandleModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ElementDropHandleModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
|
|
1240
|
+
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] });
|
|
1241
|
+
ElementDropHandleModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ElementDropHandleModule, imports: [[i7.CommonModule, i2$1.DndModule]] });
|
|
1242
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ElementDropHandleModule, decorators: [{
|
|
1243
|
+
type: i0.NgModule,
|
|
1244
|
+
args: [{
|
|
1245
|
+
declarations: [ElementDropHandleComponent],
|
|
1246
|
+
imports: [i7.CommonModule, i2$1.DndModule],
|
|
1247
|
+
exports: [ElementDropHandleComponent],
|
|
1248
|
+
}]
|
|
1249
|
+
}] });
|
|
1250
|
+
|
|
1251
|
+
var ElementRendererModule = /** @class */ (function () {
|
|
1252
|
+
function ElementRendererModule() {
|
|
1253
|
+
}
|
|
1254
|
+
return ElementRendererModule;
|
|
1255
|
+
}());
|
|
1256
|
+
ElementRendererModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ElementRendererModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
|
|
1257
|
+
ElementRendererModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ElementRendererModule, declarations: [ElementRendererComponent], exports: [ElementRendererComponent] });
|
|
1258
|
+
ElementRendererModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ElementRendererModule });
|
|
1259
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ElementRendererModule, decorators: [{
|
|
1260
|
+
type: i0.NgModule,
|
|
1261
|
+
args: [{
|
|
1262
|
+
declarations: [ElementRendererComponent],
|
|
1263
|
+
exports: [ElementRendererComponent],
|
|
1264
|
+
}]
|
|
1265
|
+
}] });
|
|
1266
|
+
|
|
1267
|
+
var ElementChildrenComponent = /** @class */ (function () {
|
|
1268
|
+
function ElementChildrenComponent(elementContext, runtimeService, runtimeEditorService, cdr) {
|
|
1269
|
+
var _this = this;
|
|
1270
|
+
var _a, _b;
|
|
1271
|
+
this.elementContext = elementContext;
|
|
1272
|
+
this.runtimeService = runtimeService;
|
|
1273
|
+
this.runtimeEditorService = runtimeEditorService;
|
|
1274
|
+
this.cdr = cdr;
|
|
1275
|
+
this.destroyed$ = new rxjs.Subject();
|
|
1276
|
+
var path = (_b = (_a = this.elementContext) === null || _a === void 0 ? void 0 : _a.metadata) === null || _b === void 0 ? void 0 : _b.path;
|
|
1277
|
+
this.metadata$ = path ? this.runtimeService.getCompiledElement$(path) : rxjs.of(undefined);
|
|
1278
|
+
this.dragMode$ = rxjs.combineLatest([this.runtimeEditorService.editorMode$, this.runtimeEditorService.dragMode$]).pipe(rxjs.map(function (flags) { return flags.every(Boolean); }));
|
|
1279
|
+
this.runtimeService.updated$.pipe(rxjs.takeUntil(this.destroyed$)).subscribe(function () { return _this.cdr.detectChanges(); });
|
|
1280
|
+
}
|
|
1281
|
+
ElementChildrenComponent.prototype.ngOnDestroy = function () {
|
|
1282
|
+
this.destroyed$.next();
|
|
1283
|
+
this.destroyed$.complete();
|
|
1284
|
+
};
|
|
1285
|
+
return ElementChildrenComponent;
|
|
1286
|
+
}());
|
|
1287
|
+
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 });
|
|
1288
|
+
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 });
|
|
1289
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ElementChildrenComponent, decorators: [{
|
|
1290
|
+
type: i0.Component,
|
|
1291
|
+
args: [{
|
|
1292
|
+
// eslint-disable-next-line @angular-eslint/component-selector
|
|
1293
|
+
selector: 'element-children',
|
|
1294
|
+
templateUrl: 'element-children.component.html',
|
|
1295
|
+
styleUrls: ['./element-children.component.scss'],
|
|
1296
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush,
|
|
1297
|
+
}]
|
|
1298
|
+
}], ctorParameters: function () { return [{ type: ElementContextService }, { type: RuntimeService }, { type: RuntimeEditorService }, { type: i0__namespace.ChangeDetectorRef }]; } });
|
|
1299
|
+
|
|
1300
|
+
var ElementChildrenModule = /** @class */ (function () {
|
|
1301
|
+
function ElementChildrenModule() {
|
|
1302
|
+
}
|
|
1303
|
+
return ElementChildrenModule;
|
|
1304
|
+
}());
|
|
1305
|
+
ElementChildrenModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ElementChildrenModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
|
|
1306
|
+
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] });
|
|
1307
|
+
ElementChildrenModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ElementChildrenModule, imports: [[i1.LetDirectiveModule, ElementRendererModule, ElementDropHandleModule]] });
|
|
1308
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ElementChildrenModule, decorators: [{
|
|
1309
|
+
type: i0.NgModule,
|
|
1310
|
+
args: [{
|
|
1311
|
+
declarations: [ElementChildrenComponent],
|
|
1312
|
+
imports: [i1.LetDirectiveModule, ElementRendererModule, ElementDropHandleModule],
|
|
1313
|
+
exports: [ElementChildrenComponent],
|
|
1314
|
+
}]
|
|
1315
|
+
}] });
|
|
1316
|
+
|
|
1317
|
+
var PreviewModule = /** @class */ (function () {
|
|
1318
|
+
function PreviewModule() {
|
|
1319
|
+
}
|
|
1320
|
+
return PreviewModule;
|
|
1321
|
+
}());
|
|
1322
|
+
PreviewModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: PreviewModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
|
|
1323
|
+
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] });
|
|
1324
|
+
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]] });
|
|
1325
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: PreviewModule, decorators: [{
|
|
1326
|
+
type: i0.NgModule,
|
|
1327
|
+
args: [{
|
|
1328
|
+
declarations: [PreviewComponent],
|
|
1329
|
+
imports: [i7.CommonModule, i1.LoaderModule, ElementRendererModule, ElementChildrenModule, ElementDropHandleModule],
|
|
1330
|
+
providers: [IntegrationState],
|
|
1331
|
+
exports: [PreviewComponent],
|
|
1332
|
+
}]
|
|
1333
|
+
}] });
|
|
1334
|
+
|
|
1335
|
+
function ElementDefinition(definition) {
|
|
1336
|
+
return function (constructor) {
|
|
1337
|
+
return constructor;
|
|
1338
|
+
};
|
|
1250
1339
|
}
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1340
|
+
|
|
1341
|
+
// eslint-disable-next-line @angular-eslint/directive-selector
|
|
1342
|
+
var CustomTemplateDirective = /** @class */ (function () {
|
|
1343
|
+
function CustomTemplateDirective(templateRef, templatesService) {
|
|
1344
|
+
this.templateRef = templateRef;
|
|
1345
|
+
this.templatesService = templatesService;
|
|
1346
|
+
}
|
|
1347
|
+
CustomTemplateDirective.prototype.ngAfterViewInit = function () {
|
|
1348
|
+
if (!this.customTemplate) {
|
|
1349
|
+
return;
|
|
1350
|
+
}
|
|
1351
|
+
this.templatesService.register(this.customTemplate, this.templateRef);
|
|
1352
|
+
};
|
|
1353
|
+
return CustomTemplateDirective;
|
|
1354
|
+
}());
|
|
1355
|
+
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 });
|
|
1356
|
+
CustomTemplateDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.17", type: CustomTemplateDirective, selector: "[customTemplate]", inputs: { customTemplate: "customTemplate" }, ngImport: i0__namespace });
|
|
1357
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: CustomTemplateDirective, decorators: [{
|
|
1358
|
+
type: i0.Directive,
|
|
1359
|
+
args: [{ selector: '[customTemplate]' }]
|
|
1360
|
+
}], ctorParameters: function () { return [{ type: i0__namespace.TemplateRef }, { type: TemplatesService }]; }, propDecorators: { customTemplate: [{
|
|
1361
|
+
type: i0.Input
|
|
1362
|
+
}] } });
|
|
1363
|
+
|
|
1364
|
+
var IOPlugin = /** @class */ (function () {
|
|
1365
|
+
function IOPlugin(host) {
|
|
1366
|
+
var _this = this;
|
|
1367
|
+
var _a, _b;
|
|
1368
|
+
this.host = host;
|
|
1369
|
+
var elementMetadata = this.host.injector.get(ELEMENT_METADATA);
|
|
1370
|
+
var inputProvider = this.host.injector.get(IOProviderService);
|
|
1371
|
+
var inputs = Object.entries((_a = elementMetadata.inputs) !== null && _a !== void 0 ? _a : {});
|
|
1372
|
+
var outputs = Object.entries((_b = elementMetadata.outputs) !== null && _b !== void 0 ? _b : {});
|
|
1373
|
+
inputs.forEach(function (_c) {
|
|
1374
|
+
var _d = __read(_c, 2), key = _d[0], path = _d[1];
|
|
1375
|
+
var _a;
|
|
1376
|
+
if (path && typeof path !== 'string') {
|
|
1377
|
+
console.error("The value of '" + key + "' input should be a string");
|
|
1260
1378
|
}
|
|
1379
|
+
if (((_a = elementMetadata.outputs) === null || _a === void 0 ? void 0 : _a[key]) !== undefined) {
|
|
1380
|
+
console.warn("'" + key + "' appears both in inputs and outputs. To prevent inconsistent behavior please keep them unique ");
|
|
1381
|
+
}
|
|
1382
|
+
_this.host[key] = inputProvider.connect(elementMetadata, key, path);
|
|
1261
1383
|
});
|
|
1384
|
+
outputs.forEach(function (_c) {
|
|
1385
|
+
var _d = __read(_c, 2), key = _d[0], path = _d[1];
|
|
1386
|
+
if (path && typeof path !== 'string') {
|
|
1387
|
+
console.error("The value of '" + key + "' output should be a string");
|
|
1388
|
+
}
|
|
1389
|
+
_this.host[key] = inputProvider.provide(elementMetadata, key, path);
|
|
1390
|
+
});
|
|
1391
|
+
}
|
|
1392
|
+
return IOPlugin;
|
|
1393
|
+
}());
|
|
1394
|
+
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 });
|
|
1395
|
+
IOPlugin.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.17", type: IOPlugin, ngImport: i0__namespace });
|
|
1396
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: IOPlugin, decorators: [{
|
|
1397
|
+
type: i0.Directive
|
|
1398
|
+
}], ctorParameters: function () { return [{ type: exports.ElementComponent }]; } });
|
|
1399
|
+
|
|
1400
|
+
var ScriptPlugin = /** @class */ (function () {
|
|
1401
|
+
function ScriptPlugin(host) {
|
|
1402
|
+
var _this = this;
|
|
1403
|
+
this.host = host;
|
|
1404
|
+
this.normalizeImports = function (script, elementPath) {
|
|
1405
|
+
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');
|
|
1406
|
+
var result = script.replace(regexp, function (match, g1, g2, src) {
|
|
1407
|
+
var imports = g1
|
|
1408
|
+
.trim()
|
|
1409
|
+
.slice(1, -1)
|
|
1410
|
+
.split(',')
|
|
1411
|
+
.map(function (item) { return item.trim(); });
|
|
1412
|
+
imports.forEach(function (item) {
|
|
1413
|
+
var _a;
|
|
1414
|
+
if (!((_a = _this.vendorMap[src]) === null || _a === void 0 ? void 0 : _a[item])) {
|
|
1415
|
+
throw new Error("Failed to import " + item + " from '" + src + "' in " + elementPath + "/script.ts");
|
|
1416
|
+
}
|
|
1417
|
+
});
|
|
1418
|
+
return "const " + g1 + " = vendor['" + src + "'];";
|
|
1419
|
+
});
|
|
1420
|
+
return result;
|
|
1421
|
+
};
|
|
1422
|
+
this.document = this.host.injector.get(i7.DOCUMENT);
|
|
1423
|
+
this.vendorMap = this.host.injector.get(VENDOR_MAP);
|
|
1424
|
+
var elementMetadata = this.host.injector.get(ELEMENT_METADATA);
|
|
1425
|
+
var sharedElementMetadata = this.host.injector.get(SHARED_ELEMENT_METADATA);
|
|
1426
|
+
this.addScript(sharedElementMetadata);
|
|
1427
|
+
this.addScript(elementMetadata);
|
|
1428
|
+
}
|
|
1429
|
+
ScriptPlugin.prototype.addScript = function (metadata) {
|
|
1430
|
+
var _a;
|
|
1431
|
+
if (!(metadata === null || metadata === void 0 ? void 0 : metadata.script)) {
|
|
1432
|
+
return;
|
|
1433
|
+
}
|
|
1434
|
+
var id = btoa(core.UUID.UUID());
|
|
1435
|
+
var script = this.document.createElement('script');
|
|
1436
|
+
script.type = "text/javascript";
|
|
1437
|
+
var scriptContent = this.normalizeImports(metadata.script, (_a = metadata.path) !== null && _a !== void 0 ? _a : metadata.name);
|
|
1438
|
+
var classMatch = /export class (\S+)/.exec(scriptContent);
|
|
1439
|
+
var className = classMatch === null || classMatch === void 0 ? void 0 : classMatch[1];
|
|
1440
|
+
if (!classMatch || !className) {
|
|
1441
|
+
console.error("Script doesn't have exported class");
|
|
1442
|
+
return;
|
|
1443
|
+
}
|
|
1444
|
+
scriptContent = scriptContent.replace(classMatch[0], "class " + className);
|
|
1445
|
+
script.text = "var " + id + " = function(vendor) {" + scriptContent + "\n return " + className + "; };";
|
|
1446
|
+
this.document.body.appendChild(script);
|
|
1447
|
+
var ScriptClass = window[id](this.vendorMap);
|
|
1448
|
+
if (ScriptClass instanceof Object) {
|
|
1449
|
+
this.host.registerPlugin(new ScriptClass(this.host));
|
|
1450
|
+
}
|
|
1451
|
+
this.document.body.removeChild(script);
|
|
1452
|
+
};
|
|
1453
|
+
return ScriptPlugin;
|
|
1454
|
+
}());
|
|
1455
|
+
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 });
|
|
1456
|
+
ScriptPlugin.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.17", type: ScriptPlugin, ngImport: i0__namespace });
|
|
1457
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ScriptPlugin, decorators: [{
|
|
1458
|
+
type: i0.Directive
|
|
1459
|
+
}], ctorParameters: function () { return [{ type: exports.ElementComponent }]; } });
|
|
1460
|
+
|
|
1461
|
+
/*
|
|
1462
|
+
* ScriptPlugin must always be the last plugin in the list to make sure user code is running after all pre-initializers.
|
|
1463
|
+
*/
|
|
1464
|
+
var CONFIG = {
|
|
1465
|
+
CUSTOM: {
|
|
1466
|
+
component: exports.ElementComponent,
|
|
1467
|
+
plugins: [IOPlugin, ScriptPlugin],
|
|
1468
|
+
},
|
|
1469
|
+
CONTAINER: {
|
|
1470
|
+
component: exports.ElementComponent,
|
|
1471
|
+
defaultTemplate: '<element-children></element-children>',
|
|
1472
|
+
plugins: [ScriptPlugin],
|
|
1473
|
+
},
|
|
1474
|
+
SERVICE: {
|
|
1475
|
+
component: exports.ElementComponent,
|
|
1476
|
+
plugins: [IOPlugin, ScriptPlugin],
|
|
1477
|
+
suppressTemplate: true,
|
|
1478
|
+
suppressStyles: true,
|
|
1479
|
+
},
|
|
1480
|
+
REFERENCE: {
|
|
1481
|
+
component: exports.ElementComponent,
|
|
1482
|
+
plugins: [IOPlugin, ScriptPlugin],
|
|
1483
|
+
suppressTemplate: true,
|
|
1484
|
+
},
|
|
1485
|
+
};
|
|
1486
|
+
|
|
1487
|
+
var EXPORTED_CLASS_REGEX = /export class (\S+)/;
|
|
1488
|
+
var METADATA_DECORATOR_REGEX = /@ElementDefinition\(([\s\S]+)\)(\n|\r\n|.)*export class/g;
|
|
1489
|
+
var UiBuildError = /** @class */ (function (_super) {
|
|
1490
|
+
__extends(UiBuildError, _super);
|
|
1491
|
+
function UiBuildError(message, affectedMetadata) {
|
|
1492
|
+
var _this = _super.call(this, message) || this;
|
|
1493
|
+
_this.name = _this.constructor.name;
|
|
1494
|
+
_this.affectedMetadata = affectedMetadata;
|
|
1495
|
+
return _this;
|
|
1496
|
+
}
|
|
1497
|
+
return UiBuildError;
|
|
1498
|
+
}(Error));
|
|
1499
|
+
var elementToMetadata = function (el, parentPath) {
|
|
1500
|
+
var _a;
|
|
1501
|
+
var script = el.script && window.atob(el.script);
|
|
1502
|
+
var template = el.template && window.atob(el.template);
|
|
1503
|
+
var styles = el.styles && window.atob(el.styles);
|
|
1504
|
+
var exportedClassName = script && ((_a = EXPORTED_CLASS_REGEX.exec(script)) !== null && _a !== void 0 ? _a : [])[1];
|
|
1505
|
+
if (!exportedClassName) {
|
|
1506
|
+
throw new Error("Script doesn't have exported class");
|
|
1507
|
+
}
|
|
1508
|
+
var elementMetadata = extractElementMetadata(script || '');
|
|
1509
|
+
var path = (parentPath ? parentPath + '/' : '') + elementMetadata.name;
|
|
1510
|
+
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); }) });
|
|
1511
|
+
};
|
|
1512
|
+
var metadataToElement = function (metadata, recursive) {
|
|
1513
|
+
if (recursive === void 0) { recursive = true; }
|
|
1514
|
+
var elMetadata = {
|
|
1515
|
+
name: metadata.name,
|
|
1516
|
+
isShared: metadata.isShared,
|
|
1517
|
+
type: metadata.type,
|
|
1518
|
+
model: metadata.model,
|
|
1519
|
+
module: metadata.module,
|
|
1520
|
+
reference: metadata.reference,
|
|
1521
|
+
inputs: metadata.inputs,
|
|
1522
|
+
outputs: metadata.outputs,
|
|
1523
|
+
children: metadata.children.map(function (_e) {
|
|
1524
|
+
var name = _e.name;
|
|
1525
|
+
return name;
|
|
1526
|
+
}),
|
|
1527
|
+
configuredStyles: metadata.configuredStyles,
|
|
1528
|
+
};
|
|
1529
|
+
var normalizedElMetadata = normalizeElementMetadata(elMetadata);
|
|
1530
|
+
if (!metadata.script || !EXPORTED_CLASS_REGEX.test(metadata.script)) {
|
|
1531
|
+
throw new UiBuildError("'" + metadata.name + "' component script is missing an exported class", metadata);
|
|
1532
|
+
}
|
|
1533
|
+
var script = metadata.script &&
|
|
1534
|
+
window.btoa(metadata.script.replace(EXPORTED_CLASS_REGEX, "@ElementDefinition(" + stringifyElementMetadata(normalizedElMetadata) + ")\nexport class Script"));
|
|
1535
|
+
var template = metadata.template && window.btoa(metadata.template);
|
|
1536
|
+
var styles = metadata.styles && window.btoa(metadata.styles);
|
|
1537
|
+
return {
|
|
1538
|
+
script: script,
|
|
1539
|
+
template: template,
|
|
1540
|
+
styles: styles,
|
|
1541
|
+
children: recursive ? metadata.children.map(function (meta) { return metadataToElement(meta); }) : [],
|
|
1542
|
+
};
|
|
1543
|
+
};
|
|
1544
|
+
var normalizeElementMetadata = function (elementMetadata) {
|
|
1545
|
+
var _a, _b, _c, _d;
|
|
1546
|
+
var metadata = Object.assign({}, elementMetadata);
|
|
1547
|
+
// model
|
|
1548
|
+
var _e = (_a = metadata.model) !== null && _a !== void 0 ? _a : {}, lineItem = _e.lineItem, path = _e.path;
|
|
1549
|
+
var model = lineItem ? { lineItem: lineItem } : path ? { path: path } : undefined;
|
|
1550
|
+
if (model) {
|
|
1551
|
+
metadata.model = model;
|
|
1552
|
+
}
|
|
1553
|
+
else {
|
|
1554
|
+
delete metadata.model;
|
|
1555
|
+
}
|
|
1556
|
+
// module
|
|
1557
|
+
if (!metadata.module) {
|
|
1558
|
+
delete metadata.module;
|
|
1559
|
+
}
|
|
1560
|
+
// reference
|
|
1561
|
+
if (!metadata.reference) {
|
|
1562
|
+
delete metadata.reference;
|
|
1563
|
+
}
|
|
1564
|
+
// inputs
|
|
1565
|
+
var inputs = Object.entries((_b = metadata.inputs) !== null && _b !== void 0 ? _b : {}).reduce(function (acc, _e) {
|
|
1566
|
+
var _f;
|
|
1567
|
+
var _g = __read(_e, 2), key = _g[0], value = _g[1];
|
|
1568
|
+
return Object.assign(Object.assign({}, acc), (_f = {}, _f[key] = value || null, _f));
|
|
1569
|
+
}, {});
|
|
1570
|
+
if (inputs && Object.keys(inputs).length > 0) {
|
|
1571
|
+
metadata.inputs = inputs;
|
|
1572
|
+
}
|
|
1573
|
+
else {
|
|
1574
|
+
delete metadata.inputs;
|
|
1575
|
+
}
|
|
1576
|
+
// outputs
|
|
1577
|
+
var outputs = Object.entries((_c = metadata.outputs) !== null && _c !== void 0 ? _c : {}).reduce(function (acc, _e) {
|
|
1578
|
+
var _f;
|
|
1579
|
+
var _g = __read(_e, 2), key = _g[0], value = _g[1];
|
|
1580
|
+
return Object.assign(Object.assign({}, acc), (_f = {}, _f[key] = value || null, _f));
|
|
1581
|
+
}, {});
|
|
1582
|
+
if (outputs && Object.keys(outputs).length > 0) {
|
|
1583
|
+
metadata.outputs = outputs;
|
|
1584
|
+
}
|
|
1585
|
+
else {
|
|
1586
|
+
delete metadata.outputs;
|
|
1587
|
+
}
|
|
1588
|
+
// children
|
|
1589
|
+
if (!((_d = metadata.children) === null || _d === void 0 ? void 0 : _d.length)) {
|
|
1590
|
+
delete metadata.children;
|
|
1591
|
+
}
|
|
1592
|
+
// isShared
|
|
1593
|
+
if (!metadata.isShared) {
|
|
1594
|
+
delete metadata.isShared;
|
|
1595
|
+
}
|
|
1596
|
+
// configuredStyles
|
|
1597
|
+
if (!metadata.configuredStyles) {
|
|
1598
|
+
delete metadata.configuredStyles;
|
|
1599
|
+
}
|
|
1600
|
+
return metadata;
|
|
1601
|
+
};
|
|
1602
|
+
var extractElementMetadata = function (script) {
|
|
1603
|
+
var _a;
|
|
1604
|
+
var metadataString = ((_a = METADATA_DECORATOR_REGEX.exec(script)) !== null && _a !== void 0 ? _a : [])[1];
|
|
1605
|
+
// need to reset regex last index to prevent null result for next execution
|
|
1606
|
+
METADATA_DECORATOR_REGEX.lastIndex = 0;
|
|
1607
|
+
return new Function("return " + metadataString)();
|
|
1608
|
+
};
|
|
1609
|
+
var extendElementMetadata = function (script, extend) {
|
|
1610
|
+
var _a;
|
|
1611
|
+
var metadataString = ((_a = METADATA_DECORATOR_REGEX.exec(script)) !== null && _a !== void 0 ? _a : [])[1];
|
|
1612
|
+
// need to reset regex last index to prevent null result for next execution
|
|
1613
|
+
METADATA_DECORATOR_REGEX.lastIndex = 0;
|
|
1614
|
+
if (!metadataString) {
|
|
1615
|
+
return script;
|
|
1616
|
+
}
|
|
1617
|
+
var updated = Object.assign(Object.assign({}, new Function("return " + metadataString)()), extend);
|
|
1618
|
+
return script.replace(metadataString, stringifyElementMetadata(updated));
|
|
1619
|
+
};
|
|
1620
|
+
var getElementConfig = function (type) {
|
|
1621
|
+
return CONFIG[type];
|
|
1622
|
+
};
|
|
1623
|
+
var doesElementSupportIO = function (type) {
|
|
1624
|
+
var _a, _b;
|
|
1625
|
+
return (_b = (_a = getElementConfig(type).plugins) === null || _a === void 0 ? void 0 : _a.includes(IOPlugin)) !== null && _b !== void 0 ? _b : false;
|
|
1626
|
+
};
|
|
1627
|
+
function stringifyElementMetadata(elementMetadata) {
|
|
1628
|
+
var cleaned = JSON.stringify(elementMetadata, null, 2);
|
|
1629
|
+
return cleaned.replace(/^[\t ]*"[^:\n\r]+(?<!\\)":/gm, function (match) {
|
|
1630
|
+
return match.replace(/"/g, '');
|
|
1262
1631
|
});
|
|
1263
1632
|
}
|
|
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;
|
|
1633
|
+
var isValidScript = function (script) {
|
|
1634
|
+
var _a;
|
|
1635
|
+
if (!script) {
|
|
1636
|
+
return false;
|
|
1275
1637
|
}
|
|
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() {
|
|
1638
|
+
var exportedClassName = script && ((_a = EXPORTED_CLASS_REGEX.exec(script)) !== null && _a !== void 0 ? _a : [])[1];
|
|
1639
|
+
if (!exportedClassName) {
|
|
1640
|
+
return false;
|
|
1344
1641
|
}
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
}] });
|
|
1642
|
+
var meta = extractElementMetadata(script);
|
|
1643
|
+
if (!meta.name || !meta.type) {
|
|
1644
|
+
return false;
|
|
1645
|
+
}
|
|
1646
|
+
return true;
|
|
1647
|
+
};
|
|
1648
|
+
function flattenElements(elements) {
|
|
1649
|
+
return lodash.flatten(elements.map(function (el) { return __spreadArray([el], __read(flattenElements(el.children))); }));
|
|
1650
|
+
}
|
|
1651
|
+
function isSharedElement(el) {
|
|
1652
|
+
return Boolean(el.isShared) && el.type !== 'REFERENCE';
|
|
1653
|
+
}
|
|
1358
1654
|
|
|
1359
1655
|
var ConfigurationPlugin = /** @class */ (function () {
|
|
1360
1656
|
function ConfigurationPlugin(host) {
|
|
@@ -1399,7 +1695,15 @@
|
|
|
1399
1695
|
}
|
|
1400
1696
|
_this.configurationService.patch(new i2.LineItemWorker(rootLineItem).remove(_this.modelSnapshot.id).li);
|
|
1401
1697
|
};
|
|
1698
|
+
var updateQty = function (qty) {
|
|
1699
|
+
var rootLineItem = _this.configurationService.getSnapshot();
|
|
1700
|
+
if (!rootLineItem || !_this.modelSnapshot) {
|
|
1701
|
+
return;
|
|
1702
|
+
}
|
|
1703
|
+
_this.configurationService.patch(new i2.LineItemWorker(rootLineItem).replace(Object.assign(Object.assign({}, _this.modelSnapshot), { qty: qty })).li);
|
|
1704
|
+
};
|
|
1402
1705
|
this.typeHost.remove = remove;
|
|
1706
|
+
this.typeHost.updateQty = updateQty;
|
|
1403
1707
|
};
|
|
1404
1708
|
ConfigurationPlugin.prototype.registerPort = function (name) {
|
|
1405
1709
|
var _this = this;
|
|
@@ -1460,9 +1764,9 @@
|
|
|
1460
1764
|
});
|
|
1461
1765
|
return ConfigurationPlugin;
|
|
1462
1766
|
}());
|
|
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.
|
|
1767
|
+
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 });
|
|
1768
|
+
ConfigurationPlugin.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.17", type: ConfigurationPlugin, ngImport: i0__namespace });
|
|
1769
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ConfigurationPlugin, decorators: [{
|
|
1466
1770
|
type: i0.Directive
|
|
1467
1771
|
}], ctorParameters: function () { return [{ type: undefined }]; } });
|
|
1468
1772
|
|
|
@@ -1471,55 +1775,13 @@
|
|
|
1471
1775
|
DEFAULT: [],
|
|
1472
1776
|
};
|
|
1473
1777
|
|
|
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
1778
|
var VELOCE_LIBS = {
|
|
1521
|
-
'@veloceapps/
|
|
1522
|
-
|
|
1779
|
+
'@veloceapps/core': {
|
|
1780
|
+
isDefined: core.isDefined,
|
|
1781
|
+
},
|
|
1782
|
+
'@veloceapps/components': {
|
|
1783
|
+
ToastService: i1.ToastService,
|
|
1784
|
+
},
|
|
1523
1785
|
'@veloceapps/api': {
|
|
1524
1786
|
SalesforceApiService: api.SalesforceApiService,
|
|
1525
1787
|
QuoteApiService: api.QuoteApiService,
|
|
@@ -1530,7 +1792,11 @@
|
|
|
1530
1792
|
DeltaApiService: api.DeltaApiService,
|
|
1531
1793
|
PicklistsApiService: api.PicklistsApiService,
|
|
1532
1794
|
PriceApiService: api.PriceApiService,
|
|
1795
|
+
ShoppingCartSettingsApiService: api.ShoppingCartSettingsApiService,
|
|
1796
|
+
ConfigurationSettingsApiService: api.ConfigurationSettingsApiService,
|
|
1533
1797
|
},
|
|
1798
|
+
'@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),
|
|
1799
|
+
'@veloceapps/sdk/cms': Object.assign(Object.assign(Object.assign({}, cmsInjectionTokens), cmsActions), { TemplatesService: TemplatesService, IntegrationState: IntegrationState }),
|
|
1534
1800
|
};
|
|
1535
1801
|
var VELOCE_LIBS_BACKWARDS_COMPATIBLE = Object.entries(VELOCE_LIBS).reduce(function (trunk, _a) {
|
|
1536
1802
|
var _b;
|
|
@@ -1540,19 +1806,32 @@
|
|
|
1540
1806
|
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 });
|
|
1541
1807
|
|
|
1542
1808
|
var ElementsResolver = /** @class */ (function () {
|
|
1543
|
-
function ElementsResolver(uiDef, elements) {
|
|
1809
|
+
function ElementsResolver(uiDef, elements, sharedElements) {
|
|
1544
1810
|
var _this = this;
|
|
1811
|
+
if (sharedElements === void 0) { sharedElements = []; }
|
|
1545
1812
|
this.uiDef = uiDef;
|
|
1546
1813
|
this.renderableElements = [];
|
|
1547
1814
|
this.sharedElements = [];
|
|
1548
1815
|
var transpiledElements = this.transpileScripts(elements);
|
|
1549
|
-
|
|
1550
|
-
this.
|
|
1816
|
+
var transpiledSharedElements = this.transpileScripts(sharedElements);
|
|
1817
|
+
this.sharedElements = this.flattenElements(transpiledElements)
|
|
1818
|
+
.filter(function (el) { return _this.isSharedElement(el); })
|
|
1819
|
+
.concat(transpiledSharedElements);
|
|
1820
|
+
this.elements = transpiledElements.map(function (el) { return _this.processElementMetadata(el); }).filter(core.isDefined);
|
|
1551
1821
|
this.renderableElements = this.getRenderableElements(this.elements);
|
|
1552
1822
|
}
|
|
1823
|
+
ElementsResolver.prototype.addElement = function (element) {
|
|
1824
|
+
var _this = this;
|
|
1825
|
+
if (element.isShared) {
|
|
1826
|
+
return;
|
|
1827
|
+
}
|
|
1828
|
+
var transpiledElements = this.transpileScripts([element]);
|
|
1829
|
+
this.elements = transpiledElements.map(function (el) { return _this.processElementMetadata(el); }).filter(core.isDefined);
|
|
1830
|
+
this.renderableElements = this.getRenderableElements(this.elements);
|
|
1831
|
+
};
|
|
1553
1832
|
ElementsResolver.prototype.getNgComponents = function () {
|
|
1554
1833
|
var _this = this;
|
|
1555
|
-
return this.renderableElements.map(function (el) { return _this.resolveElement(el); }).filter(
|
|
1834
|
+
return this.renderableElements.map(function (el) { return _this.resolveElement(el); }).filter(core.isDefined);
|
|
1556
1835
|
};
|
|
1557
1836
|
ElementsResolver.prototype.transpile = function (el) {
|
|
1558
1837
|
var _a;
|
|
@@ -1634,9 +1913,7 @@
|
|
|
1634
1913
|
}
|
|
1635
1914
|
finalElement.template = this.resolveElementTemplate(finalElement);
|
|
1636
1915
|
finalElement.styles = this.resolveElementStyles(finalElement);
|
|
1637
|
-
return Object.assign(Object.assign({}, finalElement), { children: finalElement.children
|
|
1638
|
-
.map(function (child) { return _this.processElementMetadata(child); })
|
|
1639
|
-
.filter(Boolean) });
|
|
1916
|
+
return Object.assign(Object.assign({}, finalElement), { children: finalElement.children.map(function (child) { return _this.processElementMetadata(child); }).filter(core.isDefined) });
|
|
1640
1917
|
};
|
|
1641
1918
|
ElementsResolver.prototype.getSharedChildren = function (children, parentPath) {
|
|
1642
1919
|
var _this = this;
|
|
@@ -1671,256 +1948,391 @@
|
|
|
1671
1948
|
function C() {
|
|
1672
1949
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
1673
1950
|
}
|
|
1674
|
-
return C;
|
|
1675
|
-
}(config.component)));
|
|
1676
|
-
lodash.set(cmp, 'path', element.path);
|
|
1677
|
-
return cmp;
|
|
1678
|
-
};
|
|
1679
|
-
ElementsResolver.prototype.getElementStyles = function (element) {
|
|
1680
|
-
var result = '';
|
|
1681
|
-
var configuredStyles = this.convertInlineStylesToCSS(element.configuredStyles);
|
|
1682
|
-
if (configuredStyles) {
|
|
1683
|
-
// order is important: styles written by user in CSS code should has higher priority
|
|
1684
|
-
result += configuredStyles;
|
|
1685
|
-
}
|
|
1686
|
-
if (element.styles) {
|
|
1687
|
-
result += element.styles;
|
|
1688
|
-
}
|
|
1689
|
-
return result || undefined;
|
|
1690
|
-
};
|
|
1691
|
-
ElementsResolver.prototype.convertInlineStylesToCSS = function (styles) {
|
|
1692
|
-
if (!styles) {
|
|
1693
|
-
return '';
|
|
1694
|
-
}
|
|
1695
|
-
var entries = Object.entries(styles);
|
|
1696
|
-
var result = ':host {\n';
|
|
1697
|
-
entries.forEach(function (_c) {
|
|
1698
|
-
var _d = __read(_c, 2), style = _d[0], value = _d[1];
|
|
1699
|
-
result += " " + lodash.kebabCase(style) + ":" + value + ";\n";
|
|
1951
|
+
return C;
|
|
1952
|
+
}(config.component)));
|
|
1953
|
+
lodash.set(cmp, 'path', element.path);
|
|
1954
|
+
return cmp;
|
|
1955
|
+
};
|
|
1956
|
+
ElementsResolver.prototype.getElementStyles = function (element) {
|
|
1957
|
+
var result = '';
|
|
1958
|
+
var configuredStyles = this.convertInlineStylesToCSS(element.configuredStyles);
|
|
1959
|
+
if (configuredStyles) {
|
|
1960
|
+
// order is important: styles written by user in CSS code should has higher priority
|
|
1961
|
+
result += configuredStyles;
|
|
1962
|
+
}
|
|
1963
|
+
if (element.styles) {
|
|
1964
|
+
result += element.styles;
|
|
1965
|
+
}
|
|
1966
|
+
return result || undefined;
|
|
1967
|
+
};
|
|
1968
|
+
ElementsResolver.prototype.convertInlineStylesToCSS = function (styles) {
|
|
1969
|
+
if (!styles) {
|
|
1970
|
+
return '';
|
|
1971
|
+
}
|
|
1972
|
+
var entries = Object.entries(styles);
|
|
1973
|
+
var result = ':host {\n';
|
|
1974
|
+
entries.forEach(function (_c) {
|
|
1975
|
+
var _d = __read(_c, 2), style = _d[0], value = _d[1];
|
|
1976
|
+
result += " " + lodash.kebabCase(style) + ":" + value + ";\n";
|
|
1977
|
+
});
|
|
1978
|
+
result += '}\n';
|
|
1979
|
+
return result;
|
|
1980
|
+
};
|
|
1981
|
+
return ElementsResolver;
|
|
1982
|
+
}());
|
|
1983
|
+
|
|
1984
|
+
var defaultOptions = {
|
|
1985
|
+
suppressLoading: false,
|
|
1986
|
+
loadingLabel: 'LOADING',
|
|
1987
|
+
};
|
|
1988
|
+
|
|
1989
|
+
var moduleMap = {};
|
|
1990
|
+
function loadRemoteEntry(remoteEntry) {
|
|
1991
|
+
return new Promise(function (resolve, reject) {
|
|
1992
|
+
if (moduleMap[remoteEntry]) {
|
|
1993
|
+
resolve();
|
|
1994
|
+
return;
|
|
1995
|
+
}
|
|
1996
|
+
var script = document.createElement('script');
|
|
1997
|
+
script.src = remoteEntry;
|
|
1998
|
+
script.onerror = reject;
|
|
1999
|
+
script.onload = function () {
|
|
2000
|
+
moduleMap[remoteEntry] = true;
|
|
2001
|
+
resolve(); // window is the global namespace
|
|
2002
|
+
};
|
|
2003
|
+
document.body.append(script);
|
|
2004
|
+
});
|
|
2005
|
+
}
|
|
2006
|
+
function lookupExposedModule(remoteName, exposedModule) {
|
|
2007
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
2008
|
+
var container, factory, Module;
|
|
2009
|
+
return __generator(this, function (_a) {
|
|
2010
|
+
switch (_a.label) {
|
|
2011
|
+
case 0:
|
|
2012
|
+
// Initializes the share scope. This fills it with known provided modules from this build and all remotes
|
|
2013
|
+
return [4 /*yield*/, __webpack_init_sharing__('default')];
|
|
2014
|
+
case 1:
|
|
2015
|
+
// Initializes the share scope. This fills it with known provided modules from this build and all remotes
|
|
2016
|
+
_a.sent();
|
|
2017
|
+
container = window[remoteName];
|
|
2018
|
+
// Initialize the container, it may provide shared modules
|
|
2019
|
+
return [4 /*yield*/, container.init(__webpack_share_scopes__.default)];
|
|
2020
|
+
case 2:
|
|
2021
|
+
// Initialize the container, it may provide shared modules
|
|
2022
|
+
_a.sent();
|
|
2023
|
+
return [4 /*yield*/, container.get(exposedModule)];
|
|
2024
|
+
case 3:
|
|
2025
|
+
factory = _a.sent();
|
|
2026
|
+
Module = factory();
|
|
2027
|
+
return [2 /*return*/, Module];
|
|
2028
|
+
}
|
|
1700
2029
|
});
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
return
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
LauncherService.prototype.compileModule = function (uiDef, elements) {
|
|
1713
|
-
var _this = this;
|
|
1714
|
-
var elementsResolver = new ElementsResolver(uiDef, elements);
|
|
1715
|
-
this.dynamicModuleService.elementsTree = elementsResolver.elements;
|
|
1716
|
-
this.module = this.getModule(elementsResolver.getNgComponents());
|
|
1717
|
-
return rxjs.from(this.compiler.compileModuleAndAllComponentsAsync(this.module)).pipe(rxjs.tap(function (m) {
|
|
1718
|
-
_this.dynamicModuleService.componentFactories = m.componentFactories;
|
|
1719
|
-
_this.moduleInstance = m;
|
|
1720
|
-
}), rxjs.map(function (m) { return ({ module: m, elements: elementsResolver.elements }); }));
|
|
1721
|
-
};
|
|
1722
|
-
LauncherService.prototype.destroy = function () {
|
|
1723
|
-
if (this.moduleInstance) {
|
|
1724
|
-
this.dynamicModuleService.clear();
|
|
1725
|
-
this.moduleInstance = undefined;
|
|
1726
|
-
}
|
|
1727
|
-
if (this.module) {
|
|
1728
|
-
this.compiler.clearCacheFor(this.module);
|
|
1729
|
-
this.module = undefined;
|
|
1730
|
-
}
|
|
1731
|
-
};
|
|
1732
|
-
LauncherService.prototype.getModule = function (components) {
|
|
1733
|
-
var staticComponents = [ElementChildrenComponent, ElementRendererComponent, CustomTemplateDirective];
|
|
1734
|
-
var DynamicModule = /** @class */ (function () {
|
|
1735
|
-
function DynamicModule() {
|
|
2030
|
+
});
|
|
2031
|
+
}
|
|
2032
|
+
function loadRemoteModule(remoteEntry, remoteName, exposedModule) {
|
|
2033
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
2034
|
+
return __generator(this, function (_a) {
|
|
2035
|
+
switch (_a.label) {
|
|
2036
|
+
case 0: return [4 /*yield*/, loadRemoteEntry(remoteEntry)];
|
|
2037
|
+
case 1:
|
|
2038
|
+
_a.sent();
|
|
2039
|
+
return [4 /*yield*/, lookupExposedModule(remoteName, exposedModule)];
|
|
2040
|
+
case 2: return [2 /*return*/, _a.sent()];
|
|
1736
2041
|
}
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
i0.NgModule({
|
|
1741
|
-
imports: [i7.CommonModule, angularForms.FormsModule, angularForms.ReactiveFormsModule, FederatedModule, dragDrop.DragDropModule, scrolling.ScrollingModule],
|
|
1742
|
-
declarations: __spreadArray(__spreadArray([], __read(staticComponents)), __read(components)),
|
|
1743
|
-
jit: true,
|
|
1744
|
-
})
|
|
1745
|
-
], DynamicModule);
|
|
1746
|
-
return DynamicModule;
|
|
1747
|
-
};
|
|
1748
|
-
return LauncherService;
|
|
1749
|
-
}());
|
|
1750
|
-
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 });
|
|
1751
|
-
LauncherService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: LauncherService });
|
|
1752
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: LauncherService, decorators: [{
|
|
1753
|
-
type: i0.Injectable
|
|
1754
|
-
}], ctorParameters: function () { return [{ type: i0__namespace.Compiler }, { type: DynamicModuleService }]; } });
|
|
2042
|
+
});
|
|
2043
|
+
});
|
|
2044
|
+
}
|
|
1755
2045
|
|
|
1756
|
-
var
|
|
1757
|
-
function
|
|
1758
|
-
this.
|
|
1759
|
-
this.
|
|
1760
|
-
this.
|
|
1761
|
-
this.
|
|
1762
|
-
this.
|
|
1763
|
-
|
|
1764
|
-
this.
|
|
1765
|
-
this.
|
|
1766
|
-
this.destroy$ = new rxjs.Subject();
|
|
2046
|
+
var FederatedComponent = /** @class */ (function () {
|
|
2047
|
+
function FederatedComponent(injector, compiler, appRef, renderer) {
|
|
2048
|
+
this.injector = injector;
|
|
2049
|
+
this.compiler = compiler;
|
|
2050
|
+
this.appRef = appRef;
|
|
2051
|
+
this.renderer = renderer;
|
|
2052
|
+
this.isLoading$ = new rxjs.BehaviorSubject(false);
|
|
2053
|
+
// configs
|
|
2054
|
+
this.suppressLoading = defaultOptions.suppressLoading;
|
|
2055
|
+
this.loadingLabel = defaultOptions.loadingLabel;
|
|
1767
2056
|
}
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
this.startPreview();
|
|
1773
|
-
};
|
|
1774
|
-
PreviewComponent.prototype.ngOnDestroy = function () {
|
|
1775
|
-
this.destroy$.next();
|
|
1776
|
-
this.destroy$.complete();
|
|
1777
|
-
this.configurationService.reset();
|
|
1778
|
-
};
|
|
1779
|
-
PreviewComponent.prototype.initializeConfiguration$ = function () {
|
|
1780
|
-
var _this = this;
|
|
1781
|
-
var isAlreadyInitialized = this.runtimeService.isInitialized;
|
|
1782
|
-
if (!this.uiDefinition || this.uiDefinition.type !== 'CONFIGURATION' || isAlreadyInitialized) {
|
|
1783
|
-
return rxjs.of({});
|
|
2057
|
+
FederatedComponent.prototype.ngOnChanges = function (changes) {
|
|
2058
|
+
var _a, _b, _c, _d;
|
|
2059
|
+
if (changes.data && this.instance) {
|
|
2060
|
+
this.instance.data = this.data;
|
|
1784
2061
|
}
|
|
1785
|
-
if (
|
|
1786
|
-
|
|
1787
|
-
|
|
2062
|
+
if (changes.options) {
|
|
2063
|
+
this.suppressLoading = (_b = (_a = this.options) === null || _a === void 0 ? void 0 : _a.suppressLoading) !== null && _b !== void 0 ? _b : defaultOptions.suppressLoading;
|
|
2064
|
+
this.loadingLabel = (_d = (_c = this.options) === null || _c === void 0 ? void 0 : _c.loadingLabel) !== null && _d !== void 0 ? _d : defaultOptions.loadingLabel;
|
|
1788
2065
|
}
|
|
1789
|
-
// If still not initialized - init configuration in Test mode
|
|
1790
|
-
return this.runtimeService
|
|
1791
|
-
.initTestMode(this.modelId, this.uiDefinition)
|
|
1792
|
-
.pipe(rxjs.switchMap(function () { return _this.configurationService.configure(); }));
|
|
1793
2066
|
};
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
try {
|
|
1797
|
-
return elements.map(function (element) { return elementToMetadata(element); });
|
|
1798
|
-
}
|
|
1799
|
-
catch (e) {
|
|
1800
|
-
console.error(e);
|
|
1801
|
-
if (!((_b = (_a = this.uiDefinition) === null || _a === void 0 ? void 0 : _a.properties) === null || _b === void 0 ? void 0 : _b.suppressToastMessages)) {
|
|
1802
|
-
this.messageService.add({ severity: 'error', summary: String(e) });
|
|
1803
|
-
}
|
|
1804
|
-
return [];
|
|
1805
|
-
}
|
|
2067
|
+
FederatedComponent.prototype.ngOnInit = function () {
|
|
2068
|
+
this.isLoading$.next(true);
|
|
1806
2069
|
};
|
|
1807
|
-
|
|
2070
|
+
FederatedComponent.prototype.ngAfterViewInit = function () {
|
|
1808
2071
|
var _this = this;
|
|
1809
|
-
|
|
2072
|
+
var _a, _b, _c, _d, _e, _f;
|
|
2073
|
+
var remoteEntry = (_b = (_a = this.options) === null || _a === void 0 ? void 0 : _a.remoteEntry) !== null && _b !== void 0 ? _b : this.remoteEntry;
|
|
2074
|
+
var remoteName = (_d = (_c = this.options) === null || _c === void 0 ? void 0 : _c.remoteName) !== null && _d !== void 0 ? _d : this.remoteName;
|
|
2075
|
+
var exposedModule = (_f = (_e = this.options) === null || _e === void 0 ? void 0 : _e.exposedModule) !== null && _f !== void 0 ? _f : this.exposedModule;
|
|
2076
|
+
if (!remoteEntry || !remoteName || !exposedModule) {
|
|
1810
2077
|
return;
|
|
1811
2078
|
}
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
_this.
|
|
1825
|
-
}
|
|
1826
|
-
|
|
1827
|
-
return rxjs.of();
|
|
1828
|
-
}), rxjs.takeUntil(this.destroy$))
|
|
1829
|
-
.subscribe();
|
|
2079
|
+
loadRemoteModule(remoteEntry, remoteName, exposedModule).then(function (federated) {
|
|
2080
|
+
_this.compiler.compileModuleAsync(federated[exposedModule]).then(function (moduleFactory) {
|
|
2081
|
+
var _a, _b, _c;
|
|
2082
|
+
var rootModuleRef = moduleFactory.create(_this.injector);
|
|
2083
|
+
var rootComponentFactory = rootModuleRef.componentFactoryResolver.resolveComponentFactory(federated[exposedModule].rootComponent);
|
|
2084
|
+
var node = document.createElement('div');
|
|
2085
|
+
var _g = rootComponentFactory.create(_this.injector, [], node), instance = _g.instance, hostView = _g.hostView;
|
|
2086
|
+
_this.instance = instance;
|
|
2087
|
+
_this.instance.data = _this.data;
|
|
2088
|
+
_this.renderer.appendChild((_a = _this.moduleHostRef) === null || _a === void 0 ? void 0 : _a.nativeElement, node);
|
|
2089
|
+
_this.appRef.attachView(hostView);
|
|
2090
|
+
(_c = (_b = _this.options) === null || _b === void 0 ? void 0 : _b.onReady) === null || _c === void 0 ? void 0 : _c.call(_b);
|
|
2091
|
+
_this.isLoading$.next(false);
|
|
2092
|
+
});
|
|
2093
|
+
});
|
|
1830
2094
|
};
|
|
1831
|
-
return
|
|
2095
|
+
return FederatedComponent;
|
|
1832
2096
|
}());
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.
|
|
2097
|
+
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 });
|
|
2098
|
+
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 });
|
|
2099
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: FederatedComponent, decorators: [{
|
|
1836
2100
|
type: i0.Component,
|
|
1837
2101
|
args: [{
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
2102
|
+
// eslint-disable-next-line @angular-eslint/component-selector
|
|
2103
|
+
selector: 'veloce-host-federated',
|
|
2104
|
+
templateUrl: './federated.component.html',
|
|
2105
|
+
styleUrls: ['./federated.component.scss'],
|
|
1841
2106
|
changeDetection: i0.ChangeDetectionStrategy.OnPush,
|
|
1842
|
-
providers: [IOProviderService, TemplatesService],
|
|
1843
|
-
// use shadow DOM to prevent UI from being affected by global styles
|
|
1844
|
-
encapsulation: i0.ViewEncapsulation.ShadowDom,
|
|
1845
2107
|
}]
|
|
1846
|
-
}], ctorParameters: function () { return [{ type:
|
|
2108
|
+
}], ctorParameters: function () { return [{ type: i0__namespace.Injector }, { type: i0__namespace.Compiler }, { type: i0__namespace.ApplicationRef }, { type: i0__namespace.Renderer2 }]; }, propDecorators: { moduleHostRef: [{
|
|
2109
|
+
type: i0.ViewChild,
|
|
2110
|
+
args: ['moduleHost', { static: false }]
|
|
2111
|
+
}], remoteEntry: [{
|
|
1847
2112
|
type: i0.Input
|
|
1848
|
-
}],
|
|
2113
|
+
}], remoteName: [{
|
|
2114
|
+
type: i0.Input
|
|
2115
|
+
}], exposedModule: [{
|
|
1849
2116
|
type: i0.Input
|
|
1850
|
-
}],
|
|
2117
|
+
}], data: [{
|
|
2118
|
+
type: i0.Input
|
|
2119
|
+
}], options: [{
|
|
1851
2120
|
type: i0.Input
|
|
1852
2121
|
}] } });
|
|
1853
2122
|
|
|
1854
|
-
var
|
|
1855
|
-
function
|
|
2123
|
+
var FederatedModule = /** @class */ (function () {
|
|
2124
|
+
function FederatedModule() {
|
|
1856
2125
|
}
|
|
1857
|
-
return
|
|
2126
|
+
return FederatedModule;
|
|
1858
2127
|
}());
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.
|
|
2128
|
+
FederatedModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: FederatedModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
|
|
2129
|
+
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] });
|
|
2130
|
+
FederatedModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: FederatedModule, imports: [[i7.CommonModule, i1.LoaderModule]] });
|
|
2131
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: FederatedModule, decorators: [{
|
|
1863
2132
|
type: i0.NgModule,
|
|
1864
2133
|
args: [{
|
|
1865
|
-
declarations: [
|
|
1866
|
-
|
|
2134
|
+
declarations: [FederatedComponent],
|
|
2135
|
+
imports: [i7.CommonModule, i1.LoaderModule],
|
|
2136
|
+
exports: [FederatedComponent],
|
|
1867
2137
|
}]
|
|
1868
2138
|
}] });
|
|
1869
2139
|
|
|
1870
|
-
var
|
|
1871
|
-
function
|
|
2140
|
+
var CompilationService = /** @class */ (function () {
|
|
2141
|
+
function CompilationService(compiler) {
|
|
2142
|
+
this.compiler = compiler;
|
|
1872
2143
|
}
|
|
1873
|
-
|
|
2144
|
+
CompilationService.prototype.compileUIDefinition$ = function (uiDefinition) {
|
|
2145
|
+
var _this = this;
|
|
2146
|
+
return rxjs.of([]).pipe(rxjs.switchMap(function () {
|
|
2147
|
+
var children = uiDefinition.children, pages = uiDefinition.pages, components = uiDefinition.components, uiDefinitionMeta = __rest(uiDefinition, ["children", "pages", "components"]);
|
|
2148
|
+
_this.uiDefinitionMeta = uiDefinitionMeta;
|
|
2149
|
+
var elements = __spreadArray(__spreadArray([], __read((children !== null && children !== void 0 ? children : []))), __read((pages !== null && pages !== void 0 ? pages : [])));
|
|
2150
|
+
var sharedElements = components !== null && components !== void 0 ? components : [];
|
|
2151
|
+
var metadata = elements.map(function (element) { return elementToMetadata(element); });
|
|
2152
|
+
var sharedMetadata = sharedElements.map(function (element) { return elementToMetadata(element); });
|
|
2153
|
+
_this.elementsResolver = new ElementsResolver(uiDefinition, metadata, sharedMetadata);
|
|
2154
|
+
var module = _this.getModule(_this.elementsResolver.getNgComponents());
|
|
2155
|
+
return rxjs.combineLatest([
|
|
2156
|
+
rxjs.from(_this.compiler.compileModuleAndAllComponentsAsync(module)),
|
|
2157
|
+
rxjs.of(_this.elementsResolver),
|
|
2158
|
+
]);
|
|
2159
|
+
}), rxjs.map(function (_b) {
|
|
2160
|
+
var _c = __read(_b, 2), module = _c[0], elementsResolver = _c[1];
|
|
2161
|
+
return ({ module: module, elements: elementsResolver.elements });
|
|
2162
|
+
}));
|
|
2163
|
+
};
|
|
2164
|
+
CompilationService.prototype.compileElement$ = function (element) {
|
|
2165
|
+
var _this = this;
|
|
2166
|
+
if (!this.uiDefinitionMeta) {
|
|
2167
|
+
throw 'No UI Definition context';
|
|
2168
|
+
}
|
|
2169
|
+
return rxjs.of(this.uiDefinitionMeta).pipe(rxjs.switchMap(function (uiDefinition) {
|
|
2170
|
+
var _a;
|
|
2171
|
+
var elementsResolver = (_a = _this.elementsResolver) !== null && _a !== void 0 ? _a : new ElementsResolver(uiDefinition, []);
|
|
2172
|
+
elementsResolver.addElement(element);
|
|
2173
|
+
var module = _this.getModule(elementsResolver.getNgComponents());
|
|
2174
|
+
return rxjs.combineLatest([rxjs.from(_this.compiler.compileModuleAndAllComponentsAsync(module)), rxjs.of(elementsResolver)]);
|
|
2175
|
+
}), rxjs.map(function (_b) {
|
|
2176
|
+
var _c = __read(_b, 2), module = _c[0], elementsResolver = _c[1];
|
|
2177
|
+
return ({ module: module, elements: elementsResolver.elements });
|
|
2178
|
+
}));
|
|
2179
|
+
};
|
|
2180
|
+
CompilationService.prototype.clearModuleCache = function (modules) {
|
|
2181
|
+
var _this = this;
|
|
2182
|
+
modules.forEach(function (module) { return _this.compiler.clearCacheFor(module); });
|
|
2183
|
+
this.uiDefinitionMeta = undefined;
|
|
2184
|
+
};
|
|
2185
|
+
CompilationService.prototype.getModule = function (components) {
|
|
2186
|
+
var staticComponents = [
|
|
2187
|
+
ElementChildrenComponent,
|
|
2188
|
+
ElementRendererComponent,
|
|
2189
|
+
ElementDropHandleComponent,
|
|
2190
|
+
CustomTemplateDirective,
|
|
2191
|
+
];
|
|
2192
|
+
var DynamicModule = /** @class */ (function () {
|
|
2193
|
+
function DynamicModule() {
|
|
2194
|
+
}
|
|
2195
|
+
return DynamicModule;
|
|
2196
|
+
}());
|
|
2197
|
+
DynamicModule = __decorate([
|
|
2198
|
+
i0.NgModule({
|
|
2199
|
+
imports: [
|
|
2200
|
+
i7.CommonModule,
|
|
2201
|
+
angularForms.FormsModule,
|
|
2202
|
+
angularForms.ReactiveFormsModule,
|
|
2203
|
+
FederatedModule,
|
|
2204
|
+
dragDrop.DragDropModule,
|
|
2205
|
+
i2$1.DndModule,
|
|
2206
|
+
scrolling.ScrollingModule,
|
|
2207
|
+
],
|
|
2208
|
+
declarations: __spreadArray(__spreadArray([], __read(staticComponents)), __read(components)),
|
|
2209
|
+
jit: true,
|
|
2210
|
+
})
|
|
2211
|
+
], DynamicModule);
|
|
2212
|
+
return DynamicModule;
|
|
2213
|
+
};
|
|
2214
|
+
return CompilationService;
|
|
2215
|
+
}());
|
|
2216
|
+
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 });
|
|
2217
|
+
CompilationService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: CompilationService });
|
|
2218
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: CompilationService, decorators: [{
|
|
2219
|
+
type: i0.Injectable
|
|
2220
|
+
}], ctorParameters: function () { return [{ type: i0__namespace.Compiler }]; } });
|
|
2221
|
+
|
|
2222
|
+
var RuntimeModule = /** @class */ (function () {
|
|
2223
|
+
function RuntimeModule() {
|
|
2224
|
+
}
|
|
2225
|
+
return RuntimeModule;
|
|
1874
2226
|
}());
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
2227
|
+
RuntimeModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: RuntimeModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
|
|
2228
|
+
RuntimeModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: RuntimeModule, imports: [i7.CommonModule, core.CoreModule] });
|
|
2229
|
+
RuntimeModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: RuntimeModule, providers: [
|
|
2230
|
+
dynamicdialog.DialogService,
|
|
2231
|
+
RuntimeService,
|
|
2232
|
+
RuntimeEditorService,
|
|
2233
|
+
{ provide: CMS_COMPILATION_SERVICE, useClass: CompilationService },
|
|
2234
|
+
], imports: [[i7.CommonModule, core.CoreModule]] });
|
|
2235
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: RuntimeModule, decorators: [{
|
|
1879
2236
|
type: i0.NgModule,
|
|
1880
2237
|
args: [{
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
2238
|
+
imports: [i7.CommonModule, core.CoreModule],
|
|
2239
|
+
providers: [
|
|
2240
|
+
dynamicdialog.DialogService,
|
|
2241
|
+
RuntimeService,
|
|
2242
|
+
RuntimeEditorService,
|
|
2243
|
+
{ provide: CMS_COMPILATION_SERVICE, useClass: CompilationService },
|
|
2244
|
+
],
|
|
1884
2245
|
}]
|
|
1885
2246
|
}] });
|
|
1886
2247
|
|
|
1887
|
-
var
|
|
1888
|
-
function
|
|
2248
|
+
var LauncherModule = /** @class */ (function () {
|
|
2249
|
+
function LauncherModule() {
|
|
1889
2250
|
}
|
|
1890
|
-
return
|
|
2251
|
+
return LauncherModule;
|
|
1891
2252
|
}());
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.
|
|
2253
|
+
LauncherModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: LauncherModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
|
|
2254
|
+
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] });
|
|
2255
|
+
LauncherModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: LauncherModule, providers: [IntegrationState, dynamicdialog.DialogService], imports: [[i7.CommonModule, core.CoreModule, api.ApiModule, i2.SdkCoreModule, RuntimeModule, PreviewModule], PreviewModule] });
|
|
2256
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: LauncherModule, decorators: [{
|
|
1896
2257
|
type: i0.NgModule,
|
|
1897
2258
|
args: [{
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
exports: [PreviewComponent],
|
|
2259
|
+
imports: [i7.CommonModule, core.CoreModule, api.ApiModule, i2.SdkCoreModule, RuntimeModule, PreviewModule],
|
|
2260
|
+
providers: [IntegrationState, dynamicdialog.DialogService],
|
|
2261
|
+
exports: [PreviewModule],
|
|
1902
2262
|
}]
|
|
1903
2263
|
}] });
|
|
1904
2264
|
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
2265
|
+
var migrations = {
|
|
2266
|
+
2: function () {
|
|
2267
|
+
throw 'Migration from Legacy UI definition is not possible';
|
|
2268
|
+
},
|
|
2269
|
+
3: function (uiDef) {
|
|
2270
|
+
var _a;
|
|
2271
|
+
var children = (_a = uiDef.children) !== null && _a !== void 0 ? _a : [];
|
|
2272
|
+
return Object.assign(Object.assign({}, uiDef), { children: undefined, pages: children, version: 3 });
|
|
2273
|
+
},
|
|
2274
|
+
};
|
|
2275
|
+
|
|
2276
|
+
var MigrationsService = /** @class */ (function () {
|
|
2277
|
+
function MigrationsService(toastService) {
|
|
2278
|
+
this.toastService = toastService;
|
|
2279
|
+
}
|
|
2280
|
+
MigrationsService.prototype.migrateUIDefinition = function (uiDef) {
|
|
2281
|
+
var e_1, _a;
|
|
2282
|
+
var currentVersion = uiDef.version;
|
|
2283
|
+
var targetVersion = i2.UI_DEFINITION_VERSION;
|
|
2284
|
+
var migrateVersions = Object.keys(migrations)
|
|
2285
|
+
.reduce(function (acc, version) {
|
|
2286
|
+
var v = Number(version);
|
|
2287
|
+
if (v > currentVersion && v <= targetVersion) {
|
|
2288
|
+
acc.push(v);
|
|
2289
|
+
}
|
|
2290
|
+
return acc;
|
|
2291
|
+
}, [])
|
|
2292
|
+
.sort();
|
|
2293
|
+
try {
|
|
2294
|
+
var result = lodash.cloneDeep(uiDef);
|
|
2295
|
+
try {
|
|
2296
|
+
for (var migrateVersions_1 = __values(migrateVersions), migrateVersions_1_1 = migrateVersions_1.next(); !migrateVersions_1_1.done; migrateVersions_1_1 = migrateVersions_1.next()) {
|
|
2297
|
+
var version = migrateVersions_1_1.value;
|
|
2298
|
+
result = migrations[version](result);
|
|
2299
|
+
}
|
|
2300
|
+
}
|
|
2301
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
2302
|
+
finally {
|
|
2303
|
+
try {
|
|
2304
|
+
if (migrateVersions_1_1 && !migrateVersions_1_1.done && (_a = migrateVersions_1.return)) _a.call(migrateVersions_1);
|
|
2305
|
+
}
|
|
2306
|
+
finally { if (e_1) throw e_1.error; }
|
|
2307
|
+
}
|
|
2308
|
+
return result;
|
|
2309
|
+
}
|
|
2310
|
+
catch (e) {
|
|
2311
|
+
this.toastService.add({ summary: String(e), severity: i1.ToastType.error });
|
|
2312
|
+
return;
|
|
2313
|
+
}
|
|
1908
2314
|
};
|
|
1909
|
-
|
|
2315
|
+
return MigrationsService;
|
|
2316
|
+
}());
|
|
2317
|
+
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 });
|
|
2318
|
+
MigrationsService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: MigrationsService, providedIn: 'root' });
|
|
2319
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: MigrationsService, decorators: [{
|
|
2320
|
+
type: i0.Injectable,
|
|
2321
|
+
args: [{ providedIn: 'root' }]
|
|
2322
|
+
}], ctorParameters: function () { return [{ type: i1__namespace.ToastService }]; } });
|
|
1910
2323
|
|
|
1911
|
-
var
|
|
1912
|
-
function
|
|
2324
|
+
var MigrationsModule = /** @class */ (function () {
|
|
2325
|
+
function MigrationsModule() {
|
|
1913
2326
|
}
|
|
1914
|
-
return
|
|
2327
|
+
return MigrationsModule;
|
|
1915
2328
|
}());
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.
|
|
2329
|
+
MigrationsModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: MigrationsModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
|
|
2330
|
+
MigrationsModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: MigrationsModule });
|
|
2331
|
+
MigrationsModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: MigrationsModule, providers: [MigrationsService] });
|
|
2332
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: MigrationsModule, decorators: [{
|
|
1920
2333
|
type: i0.NgModule,
|
|
1921
2334
|
args: [{
|
|
1922
|
-
|
|
1923
|
-
providers: [LauncherService, IntegrationState, DynamicModuleService, dynamicdialog.DialogService],
|
|
2335
|
+
providers: [MigrationsService],
|
|
1924
2336
|
}]
|
|
1925
2337
|
}] });
|
|
1926
2338
|
|
|
@@ -1938,7 +2350,8 @@
|
|
|
1938
2350
|
exports.ElementsResolver = ElementsResolver;
|
|
1939
2351
|
exports.IntegrationState = IntegrationState;
|
|
1940
2352
|
exports.LauncherModule = LauncherModule;
|
|
1941
|
-
exports.
|
|
2353
|
+
exports.MigrationsModule = MigrationsModule;
|
|
2354
|
+
exports.MigrationsService = MigrationsService;
|
|
1942
2355
|
exports.NavigateBackAction = NavigateBackAction;
|
|
1943
2356
|
exports.NavigateToCatalogAction = NavigateToCatalogAction;
|
|
1944
2357
|
exports.OpenDocGenAction = OpenDocGenAction;
|
|
@@ -1946,8 +2359,9 @@
|
|
|
1946
2359
|
exports.PreviewModule = PreviewModule;
|
|
1947
2360
|
exports.RemoteApplyAction = RemoteApplyAction;
|
|
1948
2361
|
exports.RemoteCancelAction = RemoteCancelAction;
|
|
2362
|
+
exports.RuntimeEditorService = RuntimeEditorService;
|
|
2363
|
+
exports.RuntimeModule = RuntimeModule;
|
|
1949
2364
|
exports.SHARED_ELEMENT_METADATA = SHARED_ELEMENT_METADATA;
|
|
1950
|
-
exports.SetDefaultMetrics = SetDefaultMetrics;
|
|
1951
2365
|
exports.SwitchObjectAction = SwitchObjectAction;
|
|
1952
2366
|
exports.TemplatesService = TemplatesService;
|
|
1953
2367
|
exports.UI_DEFINITION_METADATA = UI_DEFINITION_METADATA;
|
|
@@ -1958,15 +2372,19 @@
|
|
|
1958
2372
|
exports.extendElementMetadata = extendElementMetadata;
|
|
1959
2373
|
exports.extractElementMetadata = extractElementMetadata;
|
|
1960
2374
|
exports.findElementByModule = findElementByModule;
|
|
2375
|
+
exports.findElementByPath = findElementByPath;
|
|
1961
2376
|
exports.flattenElements = flattenElements;
|
|
1962
2377
|
exports.getAbsolutePath = getAbsolutePath;
|
|
1963
2378
|
exports.getElementConfig = getElementConfig;
|
|
2379
|
+
exports.getElementUniqueName = getElementUniqueName;
|
|
2380
|
+
exports.insertElement = insertElement;
|
|
1964
2381
|
exports.isSharedElement = isSharedElement;
|
|
1965
2382
|
exports.isValidScript = isValidScript;
|
|
1966
2383
|
exports.metadataToElement = metadataToElement;
|
|
1967
2384
|
exports.normalizeElementMetadata = normalizeElementMetadata;
|
|
1968
2385
|
exports.parseBoundPath = parseBoundPath;
|
|
1969
2386
|
exports.parsePath = parsePath;
|
|
2387
|
+
exports.removeElement = removeElement;
|
|
1970
2388
|
exports.stringifyElementMetadata = stringifyElementMetadata;
|
|
1971
2389
|
|
|
1972
2390
|
Object.defineProperty(exports, '__esModule', { value: true });
|