@veloceapps/sdk 7.0.0-2 → 7.0.0-3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1446,6 +1446,58 @@
1446
1446
  type: i0.Directive
1447
1447
  }], ctorParameters: function () { return [{ type: exports.ElementComponent }]; } });
1448
1448
 
1449
+ var RegionPlugin = /** @class */ (function () {
1450
+ function RegionPlugin(host) {
1451
+ var _this = this;
1452
+ this.host = host;
1453
+ this.destroy$ = new rxjs.Subject();
1454
+ this.metadata = this.host.injector.get(ELEMENT_METADATA);
1455
+ this.document = this.host.injector.get(i7.DOCUMENT);
1456
+ this.el = this.host.injector.get(i0.ElementRef);
1457
+ var runtimeEditorService = this.host.injector.get(RuntimeEditorService);
1458
+ runtimeEditorService.editorMode$
1459
+ .pipe(rxjs.tap(function (editMode) {
1460
+ var _a;
1461
+ _this.el.nativeElement.style.outline = editMode ? 'solid 1px #dce5ef' : '';
1462
+ if (editMode && !_this.metadata.children.length) {
1463
+ _this.addRegionName();
1464
+ }
1465
+ else {
1466
+ (_a = _this.regionNameEl) === null || _a === void 0 ? void 0 : _a.remove();
1467
+ }
1468
+ }), rxjs.takeUntil(this.destroy$))
1469
+ .subscribe();
1470
+ }
1471
+ RegionPlugin.prototype.ngOnDestroy = function () {
1472
+ this.destroy$.next();
1473
+ this.destroy$.complete();
1474
+ };
1475
+ RegionPlugin.prototype.addRegionName = function () {
1476
+ if (this.regionNameEl) {
1477
+ this.regionNameEl.remove();
1478
+ }
1479
+ this.regionNameEl = this.document.createElement('div');
1480
+ this.regionNameEl.innerHTML = this.metadata.name;
1481
+ lodash.merge(this.regionNameEl.style, {
1482
+ width: '100%',
1483
+ height: '100%',
1484
+ display: 'flex',
1485
+ justifyContent: 'center',
1486
+ alignItems: 'center',
1487
+ color: '#AEB5BD',
1488
+ pointerEvents: 'none',
1489
+ userSelect: 'none',
1490
+ });
1491
+ this.el.nativeElement.append(this.regionNameEl);
1492
+ };
1493
+ return RegionPlugin;
1494
+ }());
1495
+ RegionPlugin.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: RegionPlugin, deps: [{ token: exports.ElementComponent }], target: i0__namespace.ɵɵFactoryTarget.Directive });
1496
+ RegionPlugin.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.17", type: RegionPlugin, ngImport: i0__namespace });
1497
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: RegionPlugin, decorators: [{
1498
+ type: i0.Directive
1499
+ }], ctorParameters: function () { return [{ type: exports.ElementComponent }]; } });
1500
+
1449
1501
  var ScriptPlugin = /** @class */ (function () {
1450
1502
  function ScriptPlugin(host) {
1451
1503
  var _this = this;
@@ -1531,6 +1583,16 @@
1531
1583
  plugins: [IOPlugin, ScriptPlugin],
1532
1584
  suppressTemplate: true,
1533
1585
  },
1586
+ PAGE: {
1587
+ component: exports.ElementComponent,
1588
+ defaultTemplate: '<element-children></element-children>',
1589
+ plugins: [IOPlugin, ScriptPlugin],
1590
+ },
1591
+ REGION: {
1592
+ component: exports.ElementComponent,
1593
+ defaultTemplate: '<element-children></element-children>',
1594
+ plugins: [IOPlugin, ScriptPlugin, RegionPlugin],
1595
+ },
1534
1596
  };
1535
1597
 
1536
1598
  var EXPORTED_CLASS_REGEX = /export class (\S+)/;
@@ -1560,21 +1622,17 @@
1560
1622
  };
1561
1623
  var metadataToElement = function (metadata, recursive) {
1562
1624
  if (recursive === void 0) { recursive = true; }
1563
- var elMetadata = {
1564
- name: metadata.name,
1565
- isShared: metadata.isShared,
1566
- type: metadata.type,
1567
- model: metadata.model,
1568
- module: metadata.module,
1569
- reference: metadata.reference,
1570
- inputs: metadata.inputs,
1571
- outputs: metadata.outputs,
1572
- children: metadata.children.map(function (_e) {
1625
+ var cleanMetadata = lodash.omit(metadata, [
1626
+ 'path',
1627
+ 'template',
1628
+ 'styles',
1629
+ 'script',
1630
+ 'metadata',
1631
+ ]);
1632
+ var elMetadata = Object.assign(Object.assign({}, cleanMetadata), { children: metadata.children.map(function (_e) {
1573
1633
  var name = _e.name;
1574
1634
  return name;
1575
- }),
1576
- configuredStyles: metadata.configuredStyles,
1577
- };
1635
+ }) });
1578
1636
  var normalizedElMetadata = normalizeElementMetadata(elMetadata);
1579
1637
  if (!metadata.script || !EXPORTED_CLASS_REGEX.test(metadata.script)) {
1580
1638
  throw new UiBuildError("'" + metadata.name + "' component script is missing an exported class", metadata);
@@ -1824,6 +1882,27 @@
1824
1882
  DEFAULT: [],
1825
1883
  };
1826
1884
 
1885
+ var LAYOUT = {
1886
+ LAYOUT_1: {
1887
+ styles: "\n/* start of LAYOUT_1 styles */\n:host {\n height: 100%;\n display: grid;\n grid:\n \"header\" auto\n \"main\" 1fr\n \"footer\" auto\n / 1fr;\n gap: 10px;\n padding: 10px;\n}\n\n:host ::ng-deep element-children > vl-cms-element-renderer {\n &:nth-child(1) > vl-element {\n min-height: 80px;\n grid-area: header;\n }\n\n &:nth-child(2) > vl-element {\n grid-area: main;\n }\n\n &:nth-child(3) > vl-element {\n min-height: 80px;\n grid-area: footer;\n }\n}\n/* end of LAYOUT_1 styles */\n",
1888
+ },
1889
+ LAYOUT_2: {
1890
+ styles: "\n/* start of LAYOUT_2 styles */\n:host {\n height: 100%;\n display: grid;\n grid:\n \"header header\" auto\n \"left right\" 1fr\n \"footer footer\" auto\n / 1fr 1fr;\n gap: 10px;\n padding: 10px;\n}\n\n:host ::ng-deep element-children > vl-cms-element-renderer {\n &:nth-child(1) > vl-element {\n min-height: 80px;\n grid-area: header;\n }\n\n &:nth-child(2) > vl-element {\n grid-area: left;\n }\n\n &:nth-child(3) > vl-element {\n grid-area: right;\n }\n\n &:nth-child(4) > vl-element {\n min-height: 80px;\n grid-area: footer;\n }\n}\n/* end of LAYOUT_2 styles */\n",
1891
+ },
1892
+ LAYOUT_3: {
1893
+ styles: "\n/* start of LAYOUT_3 styles */\n:host {\n height: 100%;\n display: grid;\n grid:\n \"main\" 1fr\n \"footer\" auto\n / 1fr;\n gap: 10px;\n padding: 10px;\n}\n\n:host ::ng-deep element-children > vl-cms-element-renderer {\n &:nth-child(1) > vl-element {\n grid-area: main;\n }\n\n &:nth-child(2) > vl-element {\n min-height: 80px;\n grid-area: footer;\n }\n}\n/* end of LAYOUT_3 styles */\n",
1894
+ },
1895
+ LAYOUT_4: {
1896
+ styles: "\n/* start of LAYOUT_4 styles */\n:host {\n height: 100%;\n display: grid;\n grid:\n \"left right\" 1fr\n \"footer footer\" auto\n / auto auto;\n gap: 10px;\n padding: 10px;\n}\n\n:host ::ng-deep element-children > vl-cms-element-renderer {\n &:nth-child(1) > vl-element {\n grid-area: left;\n }\n\n &:nth-child(2) > vl-element {\n grid-area: right;\n }\n\n &:nth-child(3) > vl-element {\n min-height: 80px;\n grid-area: footer;\n }\n}\n/* end of LAYOUT_4 styles */\n",
1897
+ },
1898
+ LAYOUT_5: {
1899
+ styles: "\n/* start of LAYOUT_5 styles */\n:host {\n height: 100%;\n display: grid;\n grid:\n \"header\" auto\n \"main\" 1fr\n / 1fr;\n gap: 10px;\n padding: 10px;\n}\n\n:host ::ng-deep element-children > vl-cms-element-renderer {\n &:nth-child(1) > vl-element {\n min-height: 80px;\n grid-area: header;\n }\n\n &:nth-child(2) > vl-element {\n grid-area: main;\n }\n}\n/* end of LAYOUT_5 styles */\n",
1900
+ },
1901
+ LAYOUT_6: {
1902
+ styles: "\n/* start of LAYOUT_6 styles */\n:host {\n height: 100%;\n display: grid;\n grid:\n \"main\" 1fr\n / 1fr;\n gap: 10px;\n padding: 10px;\n}\n\n:host ::ng-deep element-children > vl-cms-element-renderer {\n &:nth-child(1) > vl-element {\n grid-area: main;\n }\n}\n/* end of LAYOUT_6 styles */\n",
1903
+ },
1904
+ };
1905
+
1827
1906
  var VELOCE_LIBS = {
1828
1907
  '@veloceapps/core': {
1829
1908
  isDefined: core.isDefined,
@@ -1946,7 +2025,12 @@
1946
2025
  ElementsResolver.prototype.resolveElementStyles = function (element) {
1947
2026
  var _a;
1948
2027
  var config = CONFIG[element.type];
1949
- return !config.suppressStyles ? (_a = element.styles) !== null && _a !== void 0 ? _a : '' : '';
2028
+ var styles = !config.suppressStyles ? (_a = element.styles) !== null && _a !== void 0 ? _a : '' : '';
2029
+ var layout = element.layout && LAYOUT[element.layout];
2030
+ if (layout === null || layout === void 0 ? void 0 : layout.styles) {
2031
+ styles += layout.styles;
2032
+ }
2033
+ return styles;
1950
2034
  };
1951
2035
  ElementsResolver.prototype.processElementMetadata = function (sourceElement) {
1952
2036
  var _this = this;