@veloceapps/sdk 1.0.2 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/veloce-sdk-cms.umd.js +504 -326
- package/bundles/veloce-sdk-cms.umd.js.map +1 -1
- package/bundles/veloce-sdk-runtime.umd.js +146 -146
- package/bundles/veloce-sdk-runtime.umd.js.map +1 -1
- package/bundles/veloce-sdk.umd.js.map +1 -1
- package/cms/injection-tokens.d.ts +1 -0
- package/cms/plugins/script.plugin.d.ts +2 -0
- package/cms/services/dynamic-module.service.d.ts +4 -0
- package/cms/services/io-provider.service.d.ts +3 -0
- package/cms/services/launcher.service.d.ts +0 -2
- package/cms/types/common.types.d.ts +31 -11
- package/cms/utils/element.utils.d.ts +1 -0
- package/cms/utils/elements-resolver.d.ts +17 -0
- package/cms/utils/path.utils.d.ts +4 -0
- package/esm2015/cms/cms.elements.js +6 -2
- package/esm2015/cms/components/element-children/element-children.component.js +3 -3
- package/esm2015/cms/components/element-children/element-children.module.js +4 -4
- package/esm2015/cms/components/element-renderer/element-renderer.component.js +5 -5
- 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/preview.component.js +3 -3
- package/esm2015/cms/components/preview/preview.module.js +4 -4
- package/esm2015/cms/directives/custom-template.directive.js +3 -3
- package/esm2015/cms/injection-tokens.js +2 -1
- package/esm2015/cms/launcher.module.js +4 -4
- package/esm2015/cms/modules/configuration/configuration.module.js +4 -4
- package/esm2015/cms/modules/configuration/services/configuration.service.js +3 -3
- package/esm2015/cms/plugins/configuration.plugin.js +3 -3
- package/esm2015/cms/plugins/io.plugin.js +3 -3
- package/esm2015/cms/plugins/script.plugin.js +31 -24
- package/esm2015/cms/services/dynamic-module.service.js +15 -4
- package/esm2015/cms/services/element-context.service.js +3 -3
- package/esm2015/cms/services/io-provider.service.js +17 -17
- package/esm2015/cms/services/launcher.service.js +12 -49
- package/esm2015/cms/services/templates.service.js +3 -3
- package/esm2015/cms/types/common.types.js +1 -1
- package/esm2015/cms/utils/element.utils.js +22 -1
- package/esm2015/cms/utils/elements-resolver.js +88 -0
- package/esm2015/cms/utils/path.utils.js +52 -0
- package/esm2015/runtime/components/component-preview/component-preview.component.js +3 -3
- 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 +3 -3
- 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 +3 -3
- package/esm2015/runtime/services/context.service.js +3 -3
- package/esm2015/runtime/services/current-state.service.js +3 -3
- package/esm2015/runtime/services/flow.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/quote.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 +3 -3
- 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/fesm2015/veloce-sdk-cms.js +447 -302
- package/fesm2015/veloce-sdk-cms.js.map +1 -1
- package/fesm2015/veloce-sdk-runtime.js +146 -146
- package/fesm2015/veloce-sdk-runtime.js.map +1 -1
- package/fesm2015/veloce-sdk.js.map +1 -1
- package/package.json +4 -4
|
@@ -354,6 +354,7 @@
|
|
|
354
354
|
var DEFAULT_PLUGINS_TOKEN = new i0.InjectionToken('DEFAULT_PLUGINS_TOKEN');
|
|
355
355
|
var UI_DEFINITION_METADATA = new i0.InjectionToken('UI_DEFINITION_METADATA_TOKEN');
|
|
356
356
|
var ELEMENT_METADATA = new i0.InjectionToken('ELEMENT_METADATA_TOKEN');
|
|
357
|
+
var SHARED_ELEMENT_METADATA = new i0.InjectionToken('SHARED_ELEMENT_METADATA_TOKEN');
|
|
357
358
|
var ELEMENT_CONFIG = new i0.InjectionToken('ELEMENT_CONFIG_TOKEN');
|
|
358
359
|
|
|
359
360
|
var vlInjectionTokens = /*#__PURE__*/Object.freeze({
|
|
@@ -361,6 +362,7 @@
|
|
|
361
362
|
DEFAULT_PLUGINS_TOKEN: DEFAULT_PLUGINS_TOKEN,
|
|
362
363
|
UI_DEFINITION_METADATA: UI_DEFINITION_METADATA,
|
|
363
364
|
ELEMENT_METADATA: ELEMENT_METADATA,
|
|
365
|
+
SHARED_ELEMENT_METADATA: SHARED_ELEMENT_METADATA,
|
|
364
366
|
ELEMENT_CONFIG: ELEMENT_CONFIG
|
|
365
367
|
});
|
|
366
368
|
|
|
@@ -674,14 +676,118 @@
|
|
|
674
676
|
};
|
|
675
677
|
return ConfigurationService;
|
|
676
678
|
}());
|
|
677
|
-
ConfigurationService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.
|
|
678
|
-
ConfigurationService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.
|
|
679
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.
|
|
679
|
+
ConfigurationService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: ConfigurationService, deps: [{ token: i1__namespace.ConfigurationApiService }, { token: i2__namespace.ContextService }, { token: i1__namespace.ConfigurationApiService }, { token: i3__namespace.MessageService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
680
|
+
ConfigurationService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: ConfigurationService });
|
|
681
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: ConfigurationService, decorators: [{
|
|
680
682
|
type: i0.Injectable
|
|
681
683
|
}], ctorParameters: function () { return [{ type: i1__namespace.ConfigurationApiService }, { type: i2__namespace.ContextService }, { type: i1__namespace.ConfigurationApiService }, { type: i3__namespace.MessageService }]; } });
|
|
682
684
|
|
|
685
|
+
var parsePath = function (path) {
|
|
686
|
+
var _a, _b, _c, _d;
|
|
687
|
+
var segments = path.split('/');
|
|
688
|
+
var module;
|
|
689
|
+
var variable;
|
|
690
|
+
if ((_a = segments[0]) === null || _a === void 0 ? void 0 : _a.startsWith('@')) {
|
|
691
|
+
module = (_b = segments.shift()) === null || _b === void 0 ? void 0 : _b.substring(1);
|
|
692
|
+
}
|
|
693
|
+
if (((_c = segments[segments.length - 1]) === null || _c === void 0 ? void 0 : _c[0]) === ':') {
|
|
694
|
+
variable = (_d = segments.pop()) === null || _d === void 0 ? void 0 : _d.substring(1);
|
|
695
|
+
}
|
|
696
|
+
return {
|
|
697
|
+
segments: segments,
|
|
698
|
+
module: module,
|
|
699
|
+
variable: variable,
|
|
700
|
+
};
|
|
701
|
+
};
|
|
702
|
+
var findElementByModule = function (elements, module, elementName) {
|
|
703
|
+
var e_1, _e;
|
|
704
|
+
try {
|
|
705
|
+
for (var elements_1 = __values(elements), elements_1_1 = elements_1.next(); !elements_1_1.done; elements_1_1 = elements_1.next()) {
|
|
706
|
+
var el = elements_1_1.value;
|
|
707
|
+
if (el.module === module && el.name === elementName) {
|
|
708
|
+
return el;
|
|
709
|
+
}
|
|
710
|
+
var child = findElementByModule(el.children, module, elementName);
|
|
711
|
+
if (child) {
|
|
712
|
+
return child;
|
|
713
|
+
}
|
|
714
|
+
}
|
|
715
|
+
}
|
|
716
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
717
|
+
finally {
|
|
718
|
+
try {
|
|
719
|
+
if (elements_1_1 && !elements_1_1.done && (_e = elements_1.return)) _e.call(elements_1);
|
|
720
|
+
}
|
|
721
|
+
finally { if (e_1) throw e_1.error; }
|
|
722
|
+
}
|
|
723
|
+
return;
|
|
724
|
+
};
|
|
725
|
+
var getAbsolutePath = function (elements, subject, path) {
|
|
726
|
+
var _a, _b, _c, _d;
|
|
727
|
+
if (path.module) {
|
|
728
|
+
return (_a = findElementByModule(elements, path.module, path.segments[0])) === null || _a === void 0 ? void 0 : _a.path;
|
|
729
|
+
}
|
|
730
|
+
var subjectSegments = (_c = (_b = subject.path) === null || _b === void 0 ? void 0 : _b.split('/')) !== null && _c !== void 0 ? _c : [];
|
|
731
|
+
var isRelativePath = ((_d = path.segments[0]) === null || _d === void 0 ? void 0 : _d[0]) === '.';
|
|
732
|
+
if (!isRelativePath) {
|
|
733
|
+
return path.segments.join('/');
|
|
734
|
+
}
|
|
735
|
+
var segments = __spreadArray([], __read(path.segments));
|
|
736
|
+
while (segments.length) {
|
|
737
|
+
var segment = segments.shift();
|
|
738
|
+
if (segment === '..') {
|
|
739
|
+
subjectSegments.pop();
|
|
740
|
+
}
|
|
741
|
+
else if (segment) {
|
|
742
|
+
subjectSegments.push(segment);
|
|
743
|
+
}
|
|
744
|
+
}
|
|
745
|
+
return subjectSegments.join('/');
|
|
746
|
+
};
|
|
747
|
+
|
|
748
|
+
var DynamicModuleService = /** @class */ (function () {
|
|
749
|
+
function DynamicModuleService() {
|
|
750
|
+
this._elementsTree = [];
|
|
751
|
+
this._componentFactories = [];
|
|
752
|
+
}
|
|
753
|
+
Object.defineProperty(DynamicModuleService.prototype, "componentFactories", {
|
|
754
|
+
get: function () {
|
|
755
|
+
return this._componentFactories;
|
|
756
|
+
},
|
|
757
|
+
set: function (data) {
|
|
758
|
+
this._componentFactories = data;
|
|
759
|
+
},
|
|
760
|
+
enumerable: false,
|
|
761
|
+
configurable: true
|
|
762
|
+
});
|
|
763
|
+
DynamicModuleService.prototype.getComponentFactory = function (element) {
|
|
764
|
+
return this.componentFactories.find(function (f) { return f.componentType.path === element.path; });
|
|
765
|
+
};
|
|
766
|
+
Object.defineProperty(DynamicModuleService.prototype, "elementsTree", {
|
|
767
|
+
get: function () {
|
|
768
|
+
return this._elementsTree;
|
|
769
|
+
},
|
|
770
|
+
set: function (tree) {
|
|
771
|
+
this._elementsTree = tree;
|
|
772
|
+
},
|
|
773
|
+
enumerable: false,
|
|
774
|
+
configurable: true
|
|
775
|
+
});
|
|
776
|
+
DynamicModuleService.prototype.clear = function () {
|
|
777
|
+
this._elementsTree = [];
|
|
778
|
+
this.componentFactories = [];
|
|
779
|
+
};
|
|
780
|
+
return DynamicModuleService;
|
|
781
|
+
}());
|
|
782
|
+
DynamicModuleService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: DynamicModuleService, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
783
|
+
DynamicModuleService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: DynamicModuleService });
|
|
784
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: DynamicModuleService, decorators: [{
|
|
785
|
+
type: i0.Injectable
|
|
786
|
+
}] });
|
|
787
|
+
|
|
683
788
|
var IOProviderService = /** @class */ (function () {
|
|
684
|
-
function IOProviderService() {
|
|
789
|
+
function IOProviderService(dynamicModuleService) {
|
|
790
|
+
this.dynamicModuleService = dynamicModuleService;
|
|
685
791
|
this.inputs = {};
|
|
686
792
|
}
|
|
687
793
|
IOProviderService.prototype.connect = function (el, name, target) {
|
|
@@ -694,18 +800,15 @@
|
|
|
694
800
|
IOProviderService.prototype.resolveTarget = function (el, name, target) {
|
|
695
801
|
var _a, _b;
|
|
696
802
|
var isHost = !target;
|
|
697
|
-
if (
|
|
698
|
-
|
|
699
|
-
var finalName = optionalName !== null && optionalName !== void 0 ? optionalName : name;
|
|
700
|
-
return this.createSubjectSafe(path_1, finalName);
|
|
803
|
+
if (isHost) {
|
|
804
|
+
return this.createSubjectSafe((_a = el.path) !== null && _a !== void 0 ? _a : '', name);
|
|
701
805
|
}
|
|
702
|
-
var
|
|
703
|
-
var
|
|
704
|
-
var
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
return subject;
|
|
806
|
+
var elPath = parsePath(target);
|
|
807
|
+
var pathIsValue = elPath.segments.length === 1 && elPath.segments[0].startsWith('"') && elPath.segments[0].endsWith('"');
|
|
808
|
+
var finalName = (_b = elPath.variable) !== null && _b !== void 0 ? _b : name;
|
|
809
|
+
var value = pathIsValue ? new rxjs.BehaviorSubject(elPath.segments[0].slice(1, -1)) : undefined;
|
|
810
|
+
var absolutePath = !pathIsValue ? getAbsolutePath(this.dynamicModuleService.elementsTree, el, elPath) : el.path;
|
|
811
|
+
return this.createSubjectSafe(absolutePath !== null && absolutePath !== void 0 ? absolutePath : '', finalName, value);
|
|
709
812
|
};
|
|
710
813
|
IOProviderService.prototype.createSubjectSafe = function (path, name, subject) {
|
|
711
814
|
if (!this.inputs[path]) {
|
|
@@ -718,11 +821,11 @@
|
|
|
718
821
|
};
|
|
719
822
|
return IOProviderService;
|
|
720
823
|
}());
|
|
721
|
-
IOProviderService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.
|
|
722
|
-
IOProviderService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.
|
|
723
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.
|
|
824
|
+
IOProviderService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: IOProviderService, deps: [{ token: DynamicModuleService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
825
|
+
IOProviderService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: IOProviderService });
|
|
826
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: IOProviderService, decorators: [{
|
|
724
827
|
type: i0.Injectable
|
|
725
|
-
}] });
|
|
828
|
+
}], ctorParameters: function () { return [{ type: DynamicModuleService }]; } });
|
|
726
829
|
|
|
727
830
|
var TemplatesService = /** @class */ (function () {
|
|
728
831
|
function TemplatesService() {
|
|
@@ -736,9 +839,9 @@
|
|
|
736
839
|
};
|
|
737
840
|
return TemplatesService;
|
|
738
841
|
}());
|
|
739
|
-
TemplatesService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.
|
|
740
|
-
TemplatesService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.
|
|
741
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.
|
|
842
|
+
TemplatesService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: TemplatesService, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
843
|
+
TemplatesService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: TemplatesService });
|
|
844
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: TemplatesService, decorators: [{
|
|
742
845
|
type: i0.Injectable
|
|
743
846
|
}] });
|
|
744
847
|
|
|
@@ -757,6 +860,30 @@
|
|
|
757
860
|
var path = (parentPath ? parentPath + '/' : '') + elementMetadata.name;
|
|
758
861
|
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); }) });
|
|
759
862
|
};
|
|
863
|
+
var metadataToElement = function (metadata) {
|
|
864
|
+
var elMetadata = {
|
|
865
|
+
name: metadata.name,
|
|
866
|
+
type: metadata.type,
|
|
867
|
+
model: metadata.model,
|
|
868
|
+
module: metadata.module,
|
|
869
|
+
inputs: metadata.inputs,
|
|
870
|
+
outputs: metadata.outputs,
|
|
871
|
+
children: metadata.children.map(function (_b) {
|
|
872
|
+
var name = _b.name;
|
|
873
|
+
return name;
|
|
874
|
+
}),
|
|
875
|
+
};
|
|
876
|
+
var script = metadata.script &&
|
|
877
|
+
window.btoa(metadata.script.replace(EXPORTED_CLASS_REGEX, "@ElementDefinition(" + JSON.stringify(elMetadata) + ") export class Script "));
|
|
878
|
+
var template = metadata.template && window.btoa(metadata.template);
|
|
879
|
+
var styles = metadata.styles && window.btoa(metadata.styles);
|
|
880
|
+
return {
|
|
881
|
+
script: script,
|
|
882
|
+
template: template,
|
|
883
|
+
styles: styles,
|
|
884
|
+
children: metadata.children.map(function (meta) { return metadataToElement(meta); }),
|
|
885
|
+
};
|
|
886
|
+
};
|
|
760
887
|
var extractElementMetadata = function (script) {
|
|
761
888
|
var _a;
|
|
762
889
|
var metadataString = ((_a = METADATA_DECORATOR_REGEX.exec(script)) !== null && _a !== void 0 ? _a : [])[1];
|
|
@@ -776,6 +903,203 @@
|
|
|
776
903
|
return script.replace(metadataString, JSON.stringify(updated));
|
|
777
904
|
};
|
|
778
905
|
|
|
906
|
+
var ElementContextService = /** @class */ (function () {
|
|
907
|
+
function ElementContextService() {
|
|
908
|
+
}
|
|
909
|
+
return ElementContextService;
|
|
910
|
+
}());
|
|
911
|
+
ElementContextService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: ElementContextService, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
912
|
+
ElementContextService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: ElementContextService });
|
|
913
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: ElementContextService, decorators: [{
|
|
914
|
+
type: i0.Injectable
|
|
915
|
+
}] });
|
|
916
|
+
|
|
917
|
+
var ElementRendererComponent = /** @class */ (function () {
|
|
918
|
+
function ElementRendererComponent(parentInjector, dynamicModuleService, elementContext, ioProviderService, configurationService, elementRef, cdr) {
|
|
919
|
+
this.parentInjector = parentInjector;
|
|
920
|
+
this.dynamicModuleService = dynamicModuleService;
|
|
921
|
+
this.elementContext = elementContext;
|
|
922
|
+
this.ioProviderService = ioProviderService;
|
|
923
|
+
this.configurationService = configurationService;
|
|
924
|
+
this.elementRef = elementRef;
|
|
925
|
+
this.cdr = cdr;
|
|
926
|
+
this.refs = {};
|
|
927
|
+
this.destroy$ = new rxjs.Subject();
|
|
928
|
+
}
|
|
929
|
+
ElementRendererComponent.prototype.ngOnInit = function () {
|
|
930
|
+
this.elementContext.metadata = this.meta;
|
|
931
|
+
this.factory = this.dynamicModuleService.getComponentFactory(this.meta);
|
|
932
|
+
this.createComponents();
|
|
933
|
+
};
|
|
934
|
+
ElementRendererComponent.prototype.ngOnDestroy = function () {
|
|
935
|
+
this.destroyComponents();
|
|
936
|
+
this.destroy$.next();
|
|
937
|
+
this.destroy$.complete();
|
|
938
|
+
};
|
|
939
|
+
ElementRendererComponent.prototype.createComponents = function () {
|
|
940
|
+
var modelMeta = this.meta.model;
|
|
941
|
+
if (!modelMeta) {
|
|
942
|
+
this.refs[core.UUID.UUID()] = this.createComponent();
|
|
943
|
+
return;
|
|
944
|
+
}
|
|
945
|
+
if (modelMeta.lineItem) {
|
|
946
|
+
this.createFromLineItem(modelMeta.lineItem);
|
|
947
|
+
}
|
|
948
|
+
else if (modelMeta.path) {
|
|
949
|
+
this.createFromPath(modelMeta.path);
|
|
950
|
+
}
|
|
951
|
+
};
|
|
952
|
+
ElementRendererComponent.prototype.createFromPath = function (path) {
|
|
953
|
+
var _this = this;
|
|
954
|
+
var array$ = this.ioProviderService.connect(this.meta, 'children$', path);
|
|
955
|
+
array$ === null || array$ === void 0 ? void 0 : array$.pipe(rxjs.takeUntil(this.destroy$)).subscribe(function (children) {
|
|
956
|
+
if (!lodash.isArray(children)) {
|
|
957
|
+
return;
|
|
958
|
+
}
|
|
959
|
+
_this.processChildren(children);
|
|
960
|
+
});
|
|
961
|
+
};
|
|
962
|
+
ElementRendererComponent.prototype.createFromLineItem = function (path) {
|
|
963
|
+
var _this = this;
|
|
964
|
+
var _a, _b;
|
|
965
|
+
var parentComp = this.parentInjector.get(ElementRendererComponent, null);
|
|
966
|
+
var parentPath = (_a = parentComp === null || parentComp === void 0 ? void 0 : parentComp.meta.model) === null || _a === void 0 ? void 0 : _a.lineItem;
|
|
967
|
+
var pathBlocks = parseBoundPath(path).reverse();
|
|
968
|
+
var _c = (_b = pathBlocks[1]) !== null && _b !== void 0 ? _b : {}, property = _c.property, name = _c.name;
|
|
969
|
+
var finalPath = pathBlocks[0];
|
|
970
|
+
var children$ = this.getParentLineItem$(parentComp).pipe(rxjs.map(function (model) {
|
|
971
|
+
var _a;
|
|
972
|
+
if (property === 'ports' && !finalPath.property && parentPath !== path) {
|
|
973
|
+
return (_a = model.lineItems.filter(function (_c) {
|
|
974
|
+
var port = _c.port;
|
|
975
|
+
return port === name;
|
|
976
|
+
})) !== null && _a !== void 0 ? _a : [];
|
|
977
|
+
}
|
|
978
|
+
return [model];
|
|
979
|
+
}));
|
|
980
|
+
children$.pipe(rxjs.takeUntil(this.destroy$)).subscribe(function (children) {
|
|
981
|
+
_this.processChildren(children);
|
|
982
|
+
});
|
|
983
|
+
};
|
|
984
|
+
ElementRendererComponent.prototype.processChildren = function (children) {
|
|
985
|
+
var _this = this;
|
|
986
|
+
var refs = children.reduce(function (acc, data) {
|
|
987
|
+
var _c;
|
|
988
|
+
var _a;
|
|
989
|
+
var key = String((_a = data === null || data === void 0 ? void 0 : data.id) !== null && _a !== void 0 ? _a : core.UUID.UUID());
|
|
990
|
+
var ref = _this.refs[key] ? _this.updateComponent(key, data) : _this.createComponent(data);
|
|
991
|
+
return ref ? Object.assign(Object.assign({}, acc), (_c = {}, _c[key] = ref, _c)) : acc;
|
|
992
|
+
}, {});
|
|
993
|
+
var existingKeys = Object.keys(this.refs);
|
|
994
|
+
var newKeys = Object.keys(refs);
|
|
995
|
+
lodash.pull.apply(void 0, __spreadArray([existingKeys], __read(newKeys))).forEach(function (key) {
|
|
996
|
+
_this.destroyComponent(key);
|
|
997
|
+
});
|
|
998
|
+
this.refs = refs;
|
|
999
|
+
this.cdr.detectChanges();
|
|
1000
|
+
};
|
|
1001
|
+
ElementRendererComponent.prototype.getParentLineItem$ = function (parentComp) {
|
|
1002
|
+
var _this = this;
|
|
1003
|
+
var _a;
|
|
1004
|
+
var parentRefs = Object.values((_a = parentComp === null || parentComp === void 0 ? void 0 : parentComp.refs) !== null && _a !== void 0 ? _a : {});
|
|
1005
|
+
var parentRef = parentRefs.find(function (ref) { var _a; return (_a = ref === null || ref === void 0 ? void 0 : ref.location.nativeElement) === null || _a === void 0 ? void 0 : _a.contains(_this.elementRef.nativeElement); });
|
|
1006
|
+
var parentModel$ = parentRef === null || parentRef === void 0 ? void 0 : parentRef.instance.model$;
|
|
1007
|
+
return parentModel$ !== null && parentModel$ !== void 0 ? parentModel$ : this.configurationService.get();
|
|
1008
|
+
};
|
|
1009
|
+
ElementRendererComponent.prototype.createComponent = function (data) {
|
|
1010
|
+
var _a, _b;
|
|
1011
|
+
if (!this.factory) {
|
|
1012
|
+
return;
|
|
1013
|
+
}
|
|
1014
|
+
var componentRef = (_a = this.el) === null || _a === void 0 ? void 0 : _a.createComponent(this.factory);
|
|
1015
|
+
if (componentRef) {
|
|
1016
|
+
componentRef.location.nativeElement.setAttribute('name', this.meta.name);
|
|
1017
|
+
componentRef.location.nativeElement.setAttribute('path', this.meta.path);
|
|
1018
|
+
(_b = componentRef.instance) === null || _b === void 0 ? void 0 : _b.model$.next(data);
|
|
1019
|
+
}
|
|
1020
|
+
return componentRef;
|
|
1021
|
+
};
|
|
1022
|
+
ElementRendererComponent.prototype.updateComponent = function (key, data) {
|
|
1023
|
+
var ref = this.refs[key];
|
|
1024
|
+
ref === null || ref === void 0 ? void 0 : ref.instance.model$.next(data);
|
|
1025
|
+
return ref;
|
|
1026
|
+
};
|
|
1027
|
+
ElementRendererComponent.prototype.destroyComponent = function (key) {
|
|
1028
|
+
var _a;
|
|
1029
|
+
(_a = this.refs[key]) === null || _a === void 0 ? void 0 : _a.destroy();
|
|
1030
|
+
delete this.refs[key];
|
|
1031
|
+
};
|
|
1032
|
+
ElementRendererComponent.prototype.destroyComponents = function () {
|
|
1033
|
+
Object.values(this.refs).forEach(function (ref) { return ref === null || ref === void 0 ? void 0 : ref.destroy(); });
|
|
1034
|
+
this.refs = {};
|
|
1035
|
+
};
|
|
1036
|
+
return ElementRendererComponent;
|
|
1037
|
+
}());
|
|
1038
|
+
ElementRendererComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: ElementRendererComponent, deps: [{ token: i0__namespace.Injector, skipSelf: true }, { token: DynamicModuleService }, { token: ElementContextService }, { token: IOProviderService }, { token: ConfigurationService }, { token: i0__namespace.ElementRef }, { token: i0__namespace.ChangeDetectorRef }], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
1039
|
+
ElementRendererComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", 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 });
|
|
1040
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: ElementRendererComponent, decorators: [{
|
|
1041
|
+
type: i0.Component,
|
|
1042
|
+
args: [{
|
|
1043
|
+
selector: 'vl-cms-element-renderer',
|
|
1044
|
+
templateUrl: './element-renderer.component.html',
|
|
1045
|
+
styleUrls: ['./element-renderer.component.scss'],
|
|
1046
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush,
|
|
1047
|
+
providers: [ElementContextService],
|
|
1048
|
+
}]
|
|
1049
|
+
}], ctorParameters: function () {
|
|
1050
|
+
return [{ type: i0__namespace.Injector, decorators: [{
|
|
1051
|
+
type: i0.SkipSelf
|
|
1052
|
+
}] }, { type: DynamicModuleService }, { type: ElementContextService }, { type: IOProviderService }, { type: ConfigurationService }, { type: i0__namespace.ElementRef }, { type: i0__namespace.ChangeDetectorRef }];
|
|
1053
|
+
}, propDecorators: { el: [{
|
|
1054
|
+
type: i0.ViewChild,
|
|
1055
|
+
args: ['el', { read: i0.ViewContainerRef, static: true }]
|
|
1056
|
+
}], meta: [{
|
|
1057
|
+
type: i0.Input
|
|
1058
|
+
}] } });
|
|
1059
|
+
|
|
1060
|
+
var ElementChildrenComponent = /** @class */ (function () {
|
|
1061
|
+
function ElementChildrenComponent(elementContext) {
|
|
1062
|
+
this.elementContext = elementContext;
|
|
1063
|
+
this.metadata = this.elementContext.metadata;
|
|
1064
|
+
}
|
|
1065
|
+
return ElementChildrenComponent;
|
|
1066
|
+
}());
|
|
1067
|
+
ElementChildrenComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: ElementChildrenComponent, deps: [{ token: ElementContextService }], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
1068
|
+
ElementChildrenComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: ElementChildrenComponent, selector: "element-children", ngImport: i0__namespace, template: "<ng-container *ngIf=\"metadata?.children.length\">\n <ng-container *ngFor=\"let child of metadata.children\">\n <vl-cms-element-renderer [meta]=\"child\"></vl-cms-element-renderer>\n </ng-container>\n</ng-container>\n", styles: [":host{display:contents}\n"], components: [{ type: ElementRendererComponent, selector: "vl-cms-element-renderer", inputs: ["meta"] }], changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
|
|
1069
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: ElementChildrenComponent, decorators: [{
|
|
1070
|
+
type: i0.Component,
|
|
1071
|
+
args: [{
|
|
1072
|
+
// eslint-disable-next-line @angular-eslint/component-selector
|
|
1073
|
+
selector: 'element-children',
|
|
1074
|
+
templateUrl: 'element-children.component.html',
|
|
1075
|
+
styleUrls: ['./element-children.component.scss'],
|
|
1076
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush,
|
|
1077
|
+
}]
|
|
1078
|
+
}], ctorParameters: function () { return [{ type: ElementContextService }]; } });
|
|
1079
|
+
|
|
1080
|
+
// eslint-disable-next-line @angular-eslint/directive-selector
|
|
1081
|
+
var CustomTemplateDirective = /** @class */ (function () {
|
|
1082
|
+
function CustomTemplateDirective(templateRef, templatesService) {
|
|
1083
|
+
this.templateRef = templateRef;
|
|
1084
|
+
this.templatesService = templatesService;
|
|
1085
|
+
}
|
|
1086
|
+
CustomTemplateDirective.prototype.ngAfterViewInit = function () {
|
|
1087
|
+
if (!this.customTemplate) {
|
|
1088
|
+
return;
|
|
1089
|
+
}
|
|
1090
|
+
this.templatesService.register(this.customTemplate, this.templateRef);
|
|
1091
|
+
};
|
|
1092
|
+
return CustomTemplateDirective;
|
|
1093
|
+
}());
|
|
1094
|
+
CustomTemplateDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: CustomTemplateDirective, deps: [{ token: i0__namespace.TemplateRef }, { token: TemplatesService }], target: i0__namespace.ɵɵFactoryTarget.Directive });
|
|
1095
|
+
CustomTemplateDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: CustomTemplateDirective, selector: "[customTemplate]", inputs: { customTemplate: "customTemplate" }, ngImport: i0__namespace });
|
|
1096
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: CustomTemplateDirective, decorators: [{
|
|
1097
|
+
type: i0.Directive,
|
|
1098
|
+
args: [{ selector: '[customTemplate]' }]
|
|
1099
|
+
}], ctorParameters: function () { return [{ type: i0__namespace.TemplateRef }, { type: TemplatesService }]; }, propDecorators: { customTemplate: [{
|
|
1100
|
+
type: i0.Input
|
|
1101
|
+
}] } });
|
|
1102
|
+
|
|
779
1103
|
var ConfigurationPlugin = /** @class */ (function () {
|
|
780
1104
|
function ConfigurationPlugin(host) {
|
|
781
1105
|
this.host = host;
|
|
@@ -878,9 +1202,9 @@
|
|
|
878
1202
|
});
|
|
879
1203
|
return ConfigurationPlugin;
|
|
880
1204
|
}());
|
|
881
|
-
ConfigurationPlugin.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.
|
|
882
|
-
ConfigurationPlugin.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.
|
|
883
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.
|
|
1205
|
+
ConfigurationPlugin.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: ConfigurationPlugin, deps: "invalid", target: i0__namespace.ɵɵFactoryTarget.Directive });
|
|
1206
|
+
ConfigurationPlugin.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: ConfigurationPlugin, ngImport: i0__namespace });
|
|
1207
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: ConfigurationPlugin, decorators: [{
|
|
884
1208
|
type: i0.Directive
|
|
885
1209
|
}], ctorParameters: function () { return [{ type: undefined }]; } });
|
|
886
1210
|
|
|
@@ -893,6 +1217,7 @@
|
|
|
893
1217
|
var vlCmsUtils = /*#__PURE__*/Object.freeze({
|
|
894
1218
|
__proto__: null,
|
|
895
1219
|
elementToMetadata: elementToMetadata,
|
|
1220
|
+
metadataToElement: metadataToElement,
|
|
896
1221
|
extractElementMetadata: extractElementMetadata,
|
|
897
1222
|
extendElementMetadata: extendElementMetadata,
|
|
898
1223
|
parseBoundPath: parseBoundPath,
|
|
@@ -925,34 +1250,41 @@
|
|
|
925
1250
|
var ScriptPlugin = /** @class */ (function () {
|
|
926
1251
|
function ScriptPlugin(host) {
|
|
927
1252
|
this.host = host;
|
|
928
|
-
|
|
1253
|
+
this.document = this.host.injector.get(i6.DOCUMENT);
|
|
929
1254
|
var elementMetadata = this.host.injector.get(ELEMENT_METADATA);
|
|
1255
|
+
var sharedElementMetadata = this.host.injector.get(SHARED_ELEMENT_METADATA);
|
|
1256
|
+
if (sharedElementMetadata === null || sharedElementMetadata === void 0 ? void 0 : sharedElementMetadata.script) {
|
|
1257
|
+
this.addScript(sharedElementMetadata.script);
|
|
1258
|
+
}
|
|
930
1259
|
if (elementMetadata.script) {
|
|
931
|
-
|
|
932
|
-
var script = document.createElement('script');
|
|
933
|
-
script.type = "text/javascript";
|
|
934
|
-
var scriptContent = normalizeImports(elementMetadata.script);
|
|
935
|
-
var classMatch = /export class (\S+)/.exec(scriptContent);
|
|
936
|
-
var className = classMatch === null || classMatch === void 0 ? void 0 : classMatch[1];
|
|
937
|
-
if (!classMatch || !className) {
|
|
938
|
-
console.error("Script doesn't have exported class");
|
|
939
|
-
return;
|
|
940
|
-
}
|
|
941
|
-
scriptContent = scriptContent.replace(classMatch[0], "class " + className);
|
|
942
|
-
script.text = "var " + id + " = function(vendor) {" + scriptContent + "\n return " + className + "; };";
|
|
943
|
-
document.body.appendChild(script);
|
|
944
|
-
var ScriptClass = window[id](vendorMap);
|
|
945
|
-
if (ScriptClass instanceof Object) {
|
|
946
|
-
this.host.registerPlugin(new ScriptClass(this.host));
|
|
947
|
-
}
|
|
948
|
-
document.body.removeChild(script);
|
|
1260
|
+
this.addScript(elementMetadata.script);
|
|
949
1261
|
}
|
|
950
1262
|
}
|
|
1263
|
+
ScriptPlugin.prototype.addScript = function (scriptStr) {
|
|
1264
|
+
var id = btoa(core.UUID.UUID());
|
|
1265
|
+
var script = this.document.createElement('script');
|
|
1266
|
+
script.type = "text/javascript";
|
|
1267
|
+
var scriptContent = normalizeImports(scriptStr);
|
|
1268
|
+
var classMatch = /export class (\S+)/.exec(scriptContent);
|
|
1269
|
+
var className = classMatch === null || classMatch === void 0 ? void 0 : classMatch[1];
|
|
1270
|
+
if (!classMatch || !className) {
|
|
1271
|
+
console.error("Script doesn't have exported class");
|
|
1272
|
+
return;
|
|
1273
|
+
}
|
|
1274
|
+
scriptContent = scriptContent.replace(classMatch[0], "class " + className);
|
|
1275
|
+
script.text = "var " + id + " = function(vendor) {" + scriptContent + "\n return " + className + "; };";
|
|
1276
|
+
this.document.body.appendChild(script);
|
|
1277
|
+
var ScriptClass = window[id](vendorMap);
|
|
1278
|
+
if (ScriptClass instanceof Object) {
|
|
1279
|
+
this.host.registerPlugin(new ScriptClass(this.host));
|
|
1280
|
+
}
|
|
1281
|
+
this.document.body.removeChild(script);
|
|
1282
|
+
};
|
|
951
1283
|
return ScriptPlugin;
|
|
952
1284
|
}());
|
|
953
|
-
ScriptPlugin.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.
|
|
954
|
-
ScriptPlugin.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.
|
|
955
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.
|
|
1285
|
+
ScriptPlugin.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: ScriptPlugin, deps: [{ token: exports.ElementComponent }], target: i0__namespace.ɵɵFactoryTarget.Directive });
|
|
1286
|
+
ScriptPlugin.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: ScriptPlugin, ngImport: i0__namespace });
|
|
1287
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: ScriptPlugin, decorators: [{
|
|
956
1288
|
type: i0.Directive
|
|
957
1289
|
}], ctorParameters: function () { return [{ type: exports.ElementComponent }]; } });
|
|
958
1290
|
|
|
@@ -991,9 +1323,9 @@
|
|
|
991
1323
|
}
|
|
992
1324
|
return IOPlugin;
|
|
993
1325
|
}());
|
|
994
|
-
IOPlugin.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.
|
|
995
|
-
IOPlugin.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.
|
|
996
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.
|
|
1326
|
+
IOPlugin.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: IOPlugin, deps: [{ token: exports.ElementComponent }], target: i0__namespace.ɵɵFactoryTarget.Directive });
|
|
1327
|
+
IOPlugin.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: IOPlugin, ngImport: i0__namespace });
|
|
1328
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: IOPlugin, decorators: [{
|
|
997
1329
|
type: i0.Directive
|
|
998
1330
|
}], ctorParameters: function () { return [{ type: exports.ElementComponent }]; } });
|
|
999
1331
|
|
|
@@ -1005,235 +1337,119 @@
|
|
|
1005
1337
|
CONTAINER: {
|
|
1006
1338
|
component: exports.ElementComponent,
|
|
1007
1339
|
template: '<element-children></element-children>',
|
|
1008
|
-
plugins: [],
|
|
1340
|
+
plugins: [IOPlugin],
|
|
1009
1341
|
},
|
|
1010
1342
|
SERVICE: {
|
|
1011
1343
|
component: exports.ElementComponent,
|
|
1012
1344
|
plugins: [IOPlugin],
|
|
1013
1345
|
},
|
|
1346
|
+
REFERENCE: {
|
|
1347
|
+
component: exports.ElementComponent,
|
|
1348
|
+
plugins: [IOPlugin],
|
|
1349
|
+
},
|
|
1014
1350
|
};
|
|
1015
1351
|
|
|
1016
|
-
var
|
|
1017
|
-
function
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
},
|
|
1035
|
-
set: function (data) {
|
|
1036
|
-
this._componentFactories = data;
|
|
1037
|
-
},
|
|
1038
|
-
enumerable: false,
|
|
1039
|
-
configurable: true
|
|
1040
|
-
});
|
|
1041
|
-
DynamicModuleService.prototype.getComponentFactory = function (element) {
|
|
1042
|
-
return this.componentFactories.find(function (f) { return f.componentType.path === element.path; });
|
|
1043
|
-
};
|
|
1044
|
-
return DynamicModuleService;
|
|
1045
|
-
}());
|
|
1046
|
-
DynamicModuleService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: DynamicModuleService, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
1047
|
-
DynamicModuleService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: DynamicModuleService });
|
|
1048
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: DynamicModuleService, decorators: [{
|
|
1049
|
-
type: i0.Injectable
|
|
1050
|
-
}] });
|
|
1051
|
-
|
|
1052
|
-
var ElementRendererComponent = /** @class */ (function () {
|
|
1053
|
-
function ElementRendererComponent(parentInjector, dynamicModuleService, elementContext, ioProviderService, configurationService, elementRef, cdr) {
|
|
1054
|
-
this.parentInjector = parentInjector;
|
|
1055
|
-
this.dynamicModuleService = dynamicModuleService;
|
|
1056
|
-
this.elementContext = elementContext;
|
|
1057
|
-
this.ioProviderService = ioProviderService;
|
|
1058
|
-
this.configurationService = configurationService;
|
|
1059
|
-
this.elementRef = elementRef;
|
|
1060
|
-
this.cdr = cdr;
|
|
1061
|
-
this.refs = {};
|
|
1062
|
-
this.destroy$ = new rxjs.Subject();
|
|
1063
|
-
}
|
|
1064
|
-
ElementRendererComponent.prototype.ngOnInit = function () {
|
|
1065
|
-
this.elementContext.metadata = this.meta;
|
|
1066
|
-
this.factory = this.dynamicModuleService.getComponentFactory(this.meta);
|
|
1067
|
-
this.createComponents();
|
|
1068
|
-
};
|
|
1069
|
-
ElementRendererComponent.prototype.ngOnDestroy = function () {
|
|
1070
|
-
this.destroyComponents();
|
|
1071
|
-
this.destroy$.next();
|
|
1072
|
-
this.destroy$.complete();
|
|
1073
|
-
};
|
|
1074
|
-
ElementRendererComponent.prototype.createComponents = function () {
|
|
1075
|
-
var modelMeta = this.meta.model;
|
|
1076
|
-
if (!modelMeta) {
|
|
1077
|
-
this.refs[core.UUID.UUID()] = this.createComponent();
|
|
1078
|
-
return;
|
|
1352
|
+
var ElementsResolver = /** @class */ (function () {
|
|
1353
|
+
function ElementsResolver(uiDef, elements) {
|
|
1354
|
+
var e_1, _b;
|
|
1355
|
+
this.uiDef = uiDef;
|
|
1356
|
+
this.renderableElements = [];
|
|
1357
|
+
this.sharedElements = [];
|
|
1358
|
+
this.elements = this.transpileScripts(elements);
|
|
1359
|
+
var flatElements = this.flattenElements(this.elements);
|
|
1360
|
+
try {
|
|
1361
|
+
for (var flatElements_1 = __values(flatElements), flatElements_1_1 = flatElements_1.next(); !flatElements_1_1.done; flatElements_1_1 = flatElements_1.next()) {
|
|
1362
|
+
var el = flatElements_1_1.value;
|
|
1363
|
+
if (this.isSharedElement(el)) {
|
|
1364
|
+
this.sharedElements.push(el);
|
|
1365
|
+
}
|
|
1366
|
+
else {
|
|
1367
|
+
this.renderableElements.push(el);
|
|
1368
|
+
}
|
|
1369
|
+
}
|
|
1079
1370
|
}
|
|
1080
|
-
|
|
1081
|
-
|
|
1371
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
1372
|
+
finally {
|
|
1373
|
+
try {
|
|
1374
|
+
if (flatElements_1_1 && !flatElements_1_1.done && (_b = flatElements_1.return)) _b.call(flatElements_1);
|
|
1375
|
+
}
|
|
1376
|
+
finally { if (e_1) throw e_1.error; }
|
|
1082
1377
|
}
|
|
1083
|
-
|
|
1084
|
-
|
|
1378
|
+
}
|
|
1379
|
+
ElementsResolver.prototype.transpile = function (el) {
|
|
1380
|
+
var _a;
|
|
1381
|
+
if (!el.script) {
|
|
1382
|
+
return;
|
|
1085
1383
|
}
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
array$ === null || array$ === void 0 ? void 0 : array$.pipe(rxjs.takeUntil(this.destroy$)).subscribe(function (children) {
|
|
1091
|
-
if (!lodash.isArray(children)) {
|
|
1092
|
-
return;
|
|
1093
|
-
}
|
|
1094
|
-
_this.processChildren(children);
|
|
1384
|
+
var transformed = standalone.transform(el.script, {
|
|
1385
|
+
filename: el.name + '.ts',
|
|
1386
|
+
presets: ['typescript'],
|
|
1387
|
+
sourceMaps: 'inline',
|
|
1095
1388
|
});
|
|
1389
|
+
return (_a = transformed.code) !== null && _a !== void 0 ? _a : undefined;
|
|
1096
1390
|
};
|
|
1097
|
-
|
|
1391
|
+
ElementsResolver.prototype.transpileScripts = function (elements) {
|
|
1098
1392
|
var _this = this;
|
|
1099
|
-
|
|
1100
|
-
var parentComp = this.parentInjector.get(ElementRendererComponent, null);
|
|
1101
|
-
var parentPath = (_a = parentComp === null || parentComp === void 0 ? void 0 : parentComp.meta.model) === null || _a === void 0 ? void 0 : _a.lineItem;
|
|
1102
|
-
var pathBlocks = parseBoundPath(path).reverse();
|
|
1103
|
-
var _c = (_b = pathBlocks[1]) !== null && _b !== void 0 ? _b : {}, property = _c.property, name = _c.name;
|
|
1104
|
-
var finalPath = pathBlocks[0];
|
|
1105
|
-
var children$ = this.getParentLineItem$(parentComp).pipe(rxjs.map(function (model) {
|
|
1106
|
-
var _a;
|
|
1107
|
-
if (property === 'ports' && !finalPath.property && parentPath !== path) {
|
|
1108
|
-
return (_a = model.lineItems.filter(function (_c) {
|
|
1109
|
-
var port = _c.port;
|
|
1110
|
-
return port === name;
|
|
1111
|
-
})) !== null && _a !== void 0 ? _a : [];
|
|
1112
|
-
}
|
|
1113
|
-
return [model];
|
|
1114
|
-
}));
|
|
1115
|
-
children$.pipe(rxjs.takeUntil(this.destroy$)).subscribe(function (children) {
|
|
1116
|
-
_this.processChildren(children);
|
|
1117
|
-
});
|
|
1393
|
+
return elements.map(function (el) { return (Object.assign(Object.assign({}, el), { script: _this.transpile(el), children: _this.transpileScripts(el.children) })); });
|
|
1118
1394
|
};
|
|
1119
|
-
|
|
1395
|
+
ElementsResolver.prototype.flattenElements = function (elements) {
|
|
1120
1396
|
var _this = this;
|
|
1121
|
-
|
|
1122
|
-
var _c;
|
|
1123
|
-
var _a;
|
|
1124
|
-
var key = String((_a = data === null || data === void 0 ? void 0 : data.id) !== null && _a !== void 0 ? _a : core.UUID.UUID());
|
|
1125
|
-
var ref = _this.refs[key] ? _this.updateComponent(key, data) : _this.createComponent(data);
|
|
1126
|
-
return ref ? Object.assign(Object.assign({}, acc), (_c = {}, _c[key] = ref, _c)) : acc;
|
|
1127
|
-
}, {});
|
|
1128
|
-
var existingKeys = Object.keys(this.refs);
|
|
1129
|
-
var newKeys = Object.keys(refs);
|
|
1130
|
-
lodash.pull.apply(void 0, __spreadArray([existingKeys], __read(newKeys))).forEach(function (key) {
|
|
1131
|
-
_this.destroyComponent(key);
|
|
1132
|
-
});
|
|
1133
|
-
this.refs = refs;
|
|
1134
|
-
this.cdr.markForCheck();
|
|
1397
|
+
return lodash.flatten(elements.map(function (el) { return __spreadArray([el], __read(_this.flattenElements(el.children))); }));
|
|
1135
1398
|
};
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
var _a;
|
|
1139
|
-
var parentRefs = Object.values((_a = parentComp === null || parentComp === void 0 ? void 0 : parentComp.refs) !== null && _a !== void 0 ? _a : {});
|
|
1140
|
-
var parentRef = parentRefs.find(function (ref) { var _a; return (_a = ref === null || ref === void 0 ? void 0 : ref.location.nativeElement) === null || _a === void 0 ? void 0 : _a.contains(_this.elementRef.nativeElement); });
|
|
1141
|
-
var parentModel$ = parentRef === null || parentRef === void 0 ? void 0 : parentRef.instance.model$;
|
|
1142
|
-
return parentModel$ !== null && parentModel$ !== void 0 ? parentModel$ : this.configurationService.get();
|
|
1399
|
+
ElementsResolver.prototype.isSharedElement = function (el) {
|
|
1400
|
+
return Boolean(el.reference) && el.type !== 'REFERENCE';
|
|
1143
1401
|
};
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
if (!this.factory) {
|
|
1402
|
+
ElementsResolver.prototype.getSharedElement = function (element) {
|
|
1403
|
+
if (element.type !== 'REFERENCE') {
|
|
1147
1404
|
return;
|
|
1148
1405
|
}
|
|
1149
|
-
|
|
1150
|
-
if (componentRef) {
|
|
1151
|
-
componentRef.location.nativeElement.setAttribute('name', this.meta.name);
|
|
1152
|
-
componentRef.location.nativeElement.setAttribute('path', this.meta.path);
|
|
1153
|
-
(_b = componentRef.instance) === null || _b === void 0 ? void 0 : _b.model$.next(data);
|
|
1154
|
-
}
|
|
1155
|
-
return componentRef;
|
|
1406
|
+
return this.sharedElements.find(function (el) { return element.reference === el.name; });
|
|
1156
1407
|
};
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
};
|
|
1167
|
-
ElementRendererComponent.prototype.destroyComponents = function () {
|
|
1168
|
-
Object.values(this.refs).forEach(function (ref) { return ref === null || ref === void 0 ? void 0 : ref.destroy(); });
|
|
1169
|
-
this.refs = {};
|
|
1408
|
+
ElementsResolver.prototype.processElementMetadata = function (element, sharedElement) {
|
|
1409
|
+
if (element.type === 'REFERENCE') {
|
|
1410
|
+
if (!sharedElement) {
|
|
1411
|
+
console.warn("Shared element \"" + element.reference + "\" not found");
|
|
1412
|
+
return;
|
|
1413
|
+
}
|
|
1414
|
+
return Object.assign(Object.assign({}, element), { type: sharedElement.type, template: sharedElement.template, styles: sharedElement.styles, inputs: Object.assign(Object.assign({}, sharedElement.inputs), element.inputs), outputs: Object.assign(Object.assign({}, sharedElement.outputs), element.outputs) });
|
|
1415
|
+
}
|
|
1416
|
+
return element;
|
|
1170
1417
|
};
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ElementRendererComponent, decorators: [{
|
|
1176
|
-
type: i0.Component,
|
|
1177
|
-
args: [{
|
|
1178
|
-
selector: 'vl-cms-element-renderer',
|
|
1179
|
-
templateUrl: './element-renderer.component.html',
|
|
1180
|
-
styleUrls: ['./element-renderer.component.scss'],
|
|
1181
|
-
changeDetection: i0.ChangeDetectionStrategy.OnPush,
|
|
1182
|
-
providers: [ElementContextService],
|
|
1183
|
-
}]
|
|
1184
|
-
}], ctorParameters: function () {
|
|
1185
|
-
return [{ type: i0__namespace.Injector, decorators: [{
|
|
1186
|
-
type: i0.SkipSelf
|
|
1187
|
-
}] }, { type: DynamicModuleService }, { type: ElementContextService }, { type: IOProviderService }, { type: ConfigurationService }, { type: i0__namespace.ElementRef }, { type: i0__namespace.ChangeDetectorRef }];
|
|
1188
|
-
}, propDecorators: { el: [{
|
|
1189
|
-
type: i0.ViewChild,
|
|
1190
|
-
args: ['el', { read: i0.ViewContainerRef, static: true }]
|
|
1191
|
-
}], meta: [{
|
|
1192
|
-
type: i0.Input
|
|
1193
|
-
}] } });
|
|
1194
|
-
|
|
1195
|
-
var ElementChildrenComponent = /** @class */ (function () {
|
|
1196
|
-
function ElementChildrenComponent(elementContext) {
|
|
1197
|
-
this.elementContext = elementContext;
|
|
1198
|
-
this.metadata = this.elementContext.metadata;
|
|
1199
|
-
}
|
|
1200
|
-
return ElementChildrenComponent;
|
|
1201
|
-
}());
|
|
1202
|
-
ElementChildrenComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ElementChildrenComponent, deps: [{ token: ElementContextService }], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
1203
|
-
ElementChildrenComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: ElementChildrenComponent, selector: "element-children", ngImport: i0__namespace, template: "<ng-container *ngIf=\"metadata?.children.length\">\n <ng-container *ngFor=\"let child of metadata.children\">\n <vl-cms-element-renderer [meta]=\"child\"></vl-cms-element-renderer>\n </ng-container>\n</ng-container>\n", styles: [":host{display:contents}\n"], components: [{ type: ElementRendererComponent, selector: "vl-cms-element-renderer", inputs: ["meta"] }], changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
|
|
1204
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ElementChildrenComponent, decorators: [{
|
|
1205
|
-
type: i0.Component,
|
|
1206
|
-
args: [{
|
|
1207
|
-
// eslint-disable-next-line @angular-eslint/component-selector
|
|
1208
|
-
selector: 'element-children',
|
|
1209
|
-
templateUrl: 'element-children.component.html',
|
|
1210
|
-
styleUrls: ['./element-children.component.scss'],
|
|
1211
|
-
changeDetection: i0.ChangeDetectionStrategy.OnPush,
|
|
1212
|
-
}]
|
|
1213
|
-
}], ctorParameters: function () { return [{ type: ElementContextService }]; } });
|
|
1214
|
-
|
|
1215
|
-
// eslint-disable-next-line @angular-eslint/directive-selector
|
|
1216
|
-
var CustomTemplateDirective = /** @class */ (function () {
|
|
1217
|
-
function CustomTemplateDirective(templateRef, templatesService) {
|
|
1218
|
-
this.templateRef = templateRef;
|
|
1219
|
-
this.templatesService = templatesService;
|
|
1220
|
-
}
|
|
1221
|
-
CustomTemplateDirective.prototype.ngAfterViewInit = function () {
|
|
1222
|
-
if (!this.customTemplate) {
|
|
1418
|
+
ElementsResolver.prototype.resolveElement = function (sourceElement) {
|
|
1419
|
+
var sharedElement = this.getSharedElement(sourceElement);
|
|
1420
|
+
var element = this.processElementMetadata(sourceElement, sharedElement);
|
|
1421
|
+
if (!element) {
|
|
1223
1422
|
return;
|
|
1224
1423
|
}
|
|
1225
|
-
|
|
1424
|
+
var config = CONFIG[element.type];
|
|
1425
|
+
var defaultPlugins = DEFAULT_PLUGINS[this.uiDef.type];
|
|
1426
|
+
if (!config) {
|
|
1427
|
+
console.warn("Unknown element type \"" + element.type + "\"");
|
|
1428
|
+
return;
|
|
1429
|
+
}
|
|
1430
|
+
var component = Object.assign(Object.assign({ selector: 'vl-element', template: element.template || config.template || '' }, (element.styles ? { styles: [element.styles] } : {})), { providers: [
|
|
1431
|
+
{ provide: DEFAULT_PLUGINS_TOKEN, useValue: defaultPlugins },
|
|
1432
|
+
{ provide: UI_DEFINITION_METADATA, useValue: this.uiDef },
|
|
1433
|
+
{ provide: ELEMENT_METADATA, useValue: element },
|
|
1434
|
+
{ provide: SHARED_ELEMENT_METADATA, useValue: sharedElement },
|
|
1435
|
+
{ provide: ELEMENT_CONFIG, useValue: config },
|
|
1436
|
+
] });
|
|
1437
|
+
var cmp = i0.Component(component)(/** @class */ (function (_super) {
|
|
1438
|
+
__extends(C, _super);
|
|
1439
|
+
function C() {
|
|
1440
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
1441
|
+
}
|
|
1442
|
+
return C;
|
|
1443
|
+
}(config.component)));
|
|
1444
|
+
lodash.set(cmp, 'path', element.path);
|
|
1445
|
+
return cmp;
|
|
1226
1446
|
};
|
|
1227
|
-
|
|
1447
|
+
ElementsResolver.prototype.getNgComponents = function () {
|
|
1448
|
+
var _this = this;
|
|
1449
|
+
return this.renderableElements.map(function (el) { return _this.resolveElement(el); }).filter(Boolean);
|
|
1450
|
+
};
|
|
1451
|
+
return ElementsResolver;
|
|
1228
1452
|
}());
|
|
1229
|
-
CustomTemplateDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: CustomTemplateDirective, deps: [{ token: i0__namespace.TemplateRef }, { token: TemplatesService }], target: i0__namespace.ɵɵFactoryTarget.Directive });
|
|
1230
|
-
CustomTemplateDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.15", type: CustomTemplateDirective, selector: "[customTemplate]", inputs: { customTemplate: "customTemplate" }, ngImport: i0__namespace });
|
|
1231
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: CustomTemplateDirective, decorators: [{
|
|
1232
|
-
type: i0.Directive,
|
|
1233
|
-
args: [{ selector: '[customTemplate]' }]
|
|
1234
|
-
}], ctorParameters: function () { return [{ type: i0__namespace.TemplateRef }, { type: TemplatesService }]; }, propDecorators: { customTemplate: [{
|
|
1235
|
-
type: i0.Input
|
|
1236
|
-
}] } });
|
|
1237
1453
|
|
|
1238
1454
|
var LauncherService = /** @class */ (function () {
|
|
1239
1455
|
function LauncherService(compiler, dynamicModuleService) {
|
|
@@ -1242,8 +1458,7 @@
|
|
|
1242
1458
|
}
|
|
1243
1459
|
LauncherService.prototype.compileModule = function (elements, uiDefs) {
|
|
1244
1460
|
var _this = this;
|
|
1245
|
-
|
|
1246
|
-
this.module = this.getModule(transformedElements, uiDefs);
|
|
1461
|
+
this.module = this.getModule(elements, uiDefs);
|
|
1247
1462
|
return rxjs.from(this.compiler.compileModuleAndAllComponentsAsync(this.module)).pipe(rxjs.tap(function (m) {
|
|
1248
1463
|
_this.dynamicModuleService.componentFactories = m.componentFactories;
|
|
1249
1464
|
_this.moduleInstance = m;
|
|
@@ -1251,7 +1466,7 @@
|
|
|
1251
1466
|
};
|
|
1252
1467
|
LauncherService.prototype.destroy = function () {
|
|
1253
1468
|
if (this.moduleInstance) {
|
|
1254
|
-
this.dynamicModuleService.
|
|
1469
|
+
this.dynamicModuleService.clear();
|
|
1255
1470
|
this.moduleInstance = undefined;
|
|
1256
1471
|
}
|
|
1257
1472
|
if (this.module) {
|
|
@@ -1259,32 +1474,10 @@
|
|
|
1259
1474
|
this.module = undefined;
|
|
1260
1475
|
}
|
|
1261
1476
|
};
|
|
1262
|
-
LauncherService.prototype.
|
|
1263
|
-
var config = CONFIG[element.type];
|
|
1264
|
-
var defaultPlugins = DEFAULT_PLUGINS[uiDefs.type];
|
|
1265
|
-
if (!config) {
|
|
1266
|
-
console.warn("Unknown element type \"" + element.type + "\"");
|
|
1267
|
-
return;
|
|
1268
|
-
}
|
|
1269
|
-
var cmp = i0.Component(Object.assign(Object.assign({ selector: 'vl-element', template: element.template || config.template || '' }, (element.styles ? { styles: [element.styles] } : {})), { providers: [
|
|
1270
|
-
{ provide: DEFAULT_PLUGINS_TOKEN, useValue: defaultPlugins },
|
|
1271
|
-
{ provide: UI_DEFINITION_METADATA, useValue: uiDefs },
|
|
1272
|
-
{ provide: ELEMENT_METADATA, useValue: element },
|
|
1273
|
-
{ provide: ELEMENT_CONFIG, useValue: config },
|
|
1274
|
-
] }))(/** @class */ (function (_super) {
|
|
1275
|
-
__extends(C, _super);
|
|
1276
|
-
function C() {
|
|
1277
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
1278
|
-
}
|
|
1279
|
-
return C;
|
|
1280
|
-
}(config.component)));
|
|
1281
|
-
lodash.set(cmp, 'path', element.path);
|
|
1282
|
-
return cmp;
|
|
1283
|
-
};
|
|
1284
|
-
LauncherService.prototype.getModule = function (elements, uiDefs) {
|
|
1285
|
-
var _this = this;
|
|
1477
|
+
LauncherService.prototype.getModule = function (elements, uiDef) {
|
|
1286
1478
|
var staticComponents = [ElementChildrenComponent, ElementRendererComponent, CustomTemplateDirective];
|
|
1287
|
-
var
|
|
1479
|
+
var elementsResolver = new ElementsResolver(uiDef, elements);
|
|
1480
|
+
this.dynamicModuleService.elementsTree = elementsResolver.elements;
|
|
1288
1481
|
var DynamicModule = /** @class */ (function () {
|
|
1289
1482
|
function DynamicModule() {
|
|
1290
1483
|
}
|
|
@@ -1293,34 +1486,17 @@
|
|
|
1293
1486
|
DynamicModule = __decorate([
|
|
1294
1487
|
i0.NgModule({
|
|
1295
1488
|
imports: [i6.CommonModule, angularForms.ReactiveFormsModule],
|
|
1296
|
-
declarations: __spreadArray(__spreadArray([], __read(staticComponents)), __read(
|
|
1489
|
+
declarations: __spreadArray(__spreadArray([], __read(staticComponents)), __read(elementsResolver.getNgComponents())),
|
|
1297
1490
|
jit: true,
|
|
1298
1491
|
})
|
|
1299
1492
|
], DynamicModule);
|
|
1300
1493
|
return DynamicModule;
|
|
1301
1494
|
};
|
|
1302
|
-
LauncherService.prototype.transformElements = function (elements) {
|
|
1303
|
-
var _this = this;
|
|
1304
|
-
return lodash.flatten(elements.map(function (el) {
|
|
1305
|
-
var _a;
|
|
1306
|
-
var children = _this.transformElements(el.children);
|
|
1307
|
-
if (!el.script) {
|
|
1308
|
-
return __spreadArray([el], __read(children));
|
|
1309
|
-
}
|
|
1310
|
-
var transformed = standalone.transform(el.script, {
|
|
1311
|
-
filename: el.name + '.ts',
|
|
1312
|
-
presets: ['typescript'],
|
|
1313
|
-
sourceMaps: 'inline',
|
|
1314
|
-
});
|
|
1315
|
-
var script = (_a = transformed.code) !== null && _a !== void 0 ? _a : undefined;
|
|
1316
|
-
return __spreadArray([Object.assign(Object.assign({}, el), { script: script })], __read(children));
|
|
1317
|
-
}));
|
|
1318
|
-
};
|
|
1319
1495
|
return LauncherService;
|
|
1320
1496
|
}());
|
|
1321
|
-
LauncherService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.
|
|
1322
|
-
LauncherService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.
|
|
1323
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.
|
|
1497
|
+
LauncherService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: LauncherService, deps: [{ token: i0__namespace.Compiler }, { token: DynamicModuleService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
1498
|
+
LauncherService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: LauncherService });
|
|
1499
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: LauncherService, decorators: [{
|
|
1324
1500
|
type: i0.Injectable
|
|
1325
1501
|
}], ctorParameters: function () { return [{ type: i0__namespace.Compiler }, { type: DynamicModuleService }]; } });
|
|
1326
1502
|
|
|
@@ -1370,9 +1546,9 @@
|
|
|
1370
1546
|
};
|
|
1371
1547
|
return PreviewComponent;
|
|
1372
1548
|
}());
|
|
1373
|
-
PreviewComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.
|
|
1374
|
-
PreviewComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.
|
|
1375
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.
|
|
1549
|
+
PreviewComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: PreviewComponent, deps: [{ token: LauncherService }, { token: ConfigurationService }, { token: i3__namespace.MessageService }], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
1550
|
+
PreviewComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: PreviewComponent, selector: "vl-cms-preview", inputs: { modelId: "modelId", uiDefinition: "uiDefinition" }, providers: [IOProviderService, ConfigurationService, 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: i4__namespace.LoaderComponent, selector: "vl-loader", inputs: ["label"] }, { type: ElementRendererComponent, selector: "vl-cms-element-renderer", inputs: ["meta"] }], directives: [{ type: i6__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i6__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], pipes: { "async": i6__namespace.AsyncPipe }, changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
|
|
1551
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: PreviewComponent, decorators: [{
|
|
1376
1552
|
type: i0.Component,
|
|
1377
1553
|
args: [{
|
|
1378
1554
|
selector: 'vl-cms-preview',
|
|
@@ -1392,10 +1568,10 @@
|
|
|
1392
1568
|
}
|
|
1393
1569
|
return ElementRendererModule;
|
|
1394
1570
|
}());
|
|
1395
|
-
ElementRendererModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.
|
|
1396
|
-
ElementRendererModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.
|
|
1397
|
-
ElementRendererModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.
|
|
1398
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.
|
|
1571
|
+
ElementRendererModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: ElementRendererModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
|
|
1572
|
+
ElementRendererModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: ElementRendererModule, declarations: [ElementRendererComponent], exports: [ElementRendererComponent] });
|
|
1573
|
+
ElementRendererModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: ElementRendererModule });
|
|
1574
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: ElementRendererModule, decorators: [{
|
|
1399
1575
|
type: i0.NgModule,
|
|
1400
1576
|
args: [{
|
|
1401
1577
|
declarations: [ElementRendererComponent],
|
|
@@ -1408,10 +1584,10 @@
|
|
|
1408
1584
|
}
|
|
1409
1585
|
return ElementChildrenModule;
|
|
1410
1586
|
}());
|
|
1411
|
-
ElementChildrenModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.
|
|
1412
|
-
ElementChildrenModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.
|
|
1413
|
-
ElementChildrenModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.
|
|
1414
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.
|
|
1587
|
+
ElementChildrenModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: ElementChildrenModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
|
|
1588
|
+
ElementChildrenModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: ElementChildrenModule, declarations: [ElementChildrenComponent], imports: [ElementRendererModule], exports: [ElementChildrenComponent] });
|
|
1589
|
+
ElementChildrenModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: ElementChildrenModule, imports: [[ElementRendererModule]] });
|
|
1590
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: ElementChildrenModule, decorators: [{
|
|
1415
1591
|
type: i0.NgModule,
|
|
1416
1592
|
args: [{
|
|
1417
1593
|
declarations: [ElementChildrenComponent],
|
|
@@ -1425,10 +1601,10 @@
|
|
|
1425
1601
|
}
|
|
1426
1602
|
return PreviewModule;
|
|
1427
1603
|
}());
|
|
1428
|
-
PreviewModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.
|
|
1429
|
-
PreviewModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.
|
|
1430
|
-
PreviewModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.
|
|
1431
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.
|
|
1604
|
+
PreviewModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: PreviewModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
|
|
1605
|
+
PreviewModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: PreviewModule, declarations: [PreviewComponent], imports: [i6.CommonModule, i4.LoaderModule, ElementRendererModule, ElementChildrenModule], exports: [PreviewComponent] });
|
|
1606
|
+
PreviewModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: PreviewModule, imports: [[i6.CommonModule, i4.LoaderModule, ElementRendererModule, ElementChildrenModule]] });
|
|
1607
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: PreviewModule, decorators: [{
|
|
1432
1608
|
type: i0.NgModule,
|
|
1433
1609
|
args: [{
|
|
1434
1610
|
declarations: [PreviewComponent],
|
|
@@ -1448,10 +1624,10 @@
|
|
|
1448
1624
|
}
|
|
1449
1625
|
return ConfigurationModule;
|
|
1450
1626
|
}());
|
|
1451
|
-
ConfigurationModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.
|
|
1452
|
-
ConfigurationModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.
|
|
1453
|
-
ConfigurationModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.
|
|
1454
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.
|
|
1627
|
+
ConfigurationModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: ConfigurationModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
|
|
1628
|
+
ConfigurationModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: ConfigurationModule });
|
|
1629
|
+
ConfigurationModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: ConfigurationModule, providers: [i2.ContextService, i1.ContextApiService, i1.ProductModelApiService, i1.ConfigurationApiService] });
|
|
1630
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: ConfigurationModule, decorators: [{
|
|
1455
1631
|
type: i0.NgModule,
|
|
1456
1632
|
args: [{
|
|
1457
1633
|
providers: [i2.ContextService, i1.ContextApiService, i1.ProductModelApiService, i1.ConfigurationApiService],
|
|
@@ -1463,10 +1639,10 @@
|
|
|
1463
1639
|
}
|
|
1464
1640
|
return LauncherModule;
|
|
1465
1641
|
}());
|
|
1466
|
-
LauncherModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.
|
|
1467
|
-
LauncherModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.
|
|
1468
|
-
LauncherModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.
|
|
1469
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.
|
|
1642
|
+
LauncherModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: LauncherModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
|
|
1643
|
+
LauncherModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: LauncherModule, imports: [i6.CommonModule, core.CoreModule, ConfigurationModule] });
|
|
1644
|
+
LauncherModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: LauncherModule, providers: [LauncherService, DynamicModuleService], imports: [[i6.CommonModule, core.CoreModule, ConfigurationModule]] });
|
|
1645
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: LauncherModule, decorators: [{
|
|
1470
1646
|
type: i0.NgModule,
|
|
1471
1647
|
args: [{
|
|
1472
1648
|
imports: [i6.CommonModule, core.CoreModule, ConfigurationModule],
|
|
@@ -1488,6 +1664,7 @@
|
|
|
1488
1664
|
exports.LineItemWorker = LineItemWorker;
|
|
1489
1665
|
exports.PreviewComponent = PreviewComponent;
|
|
1490
1666
|
exports.PreviewModule = PreviewModule;
|
|
1667
|
+
exports.SHARED_ELEMENT_METADATA = SHARED_ELEMENT_METADATA;
|
|
1491
1668
|
exports.TemplatesService = TemplatesService;
|
|
1492
1669
|
exports.UI_DEFINITION_METADATA = UI_DEFINITION_METADATA;
|
|
1493
1670
|
exports.elementToMetadata = elementToMetadata;
|
|
@@ -1501,6 +1678,7 @@
|
|
|
1501
1678
|
exports.getRecommendedPrices = getRecommendedPrices;
|
|
1502
1679
|
exports.insertLineItem = insertLineItem;
|
|
1503
1680
|
exports.mapAttributes = mapAttributes;
|
|
1681
|
+
exports.metadataToElement = metadataToElement;
|
|
1504
1682
|
exports.parseBoundPath = parseBoundPath;
|
|
1505
1683
|
exports.patchAttributes = patchAttributes;
|
|
1506
1684
|
exports.removeLineItem = removeLineItem;
|