@siemens/ix-angular 1.2.0 → 1.3.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,8 @@
1
- import { closeModal, dismissModal, modal, toast } from '@siemens/ix';
1
+ import { closeModal, dismissModal, modal, themeSwitcher, toast } from '@siemens/ix';
2
2
  export * from '@siemens/ix';
3
3
  import { __decorate } from 'tslib';
4
4
  import * as i0 from '@angular/core';
5
- import { Component, ChangeDetectionStrategy, Directive, Input, Injectable, APP_INITIALIZER, NgZone, NgModule } from '@angular/core';
5
+ import { Component, ChangeDetectionStrategy, Directive, Input, Type, Injector, Injectable, EventEmitter, Output, APP_INITIALIZER, NgZone, NgModule } from '@angular/core';
6
6
  import { fromEvent } from 'rxjs';
7
7
  import { DOCUMENT } from '@angular/common';
8
8
  import { applyPolyfills, defineCustomElements } from '@siemens/ix/loader';
@@ -454,6 +454,30 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
454
454
  inputs: ['adjustDropdownWidthToReferenceWidth', 'adjustDropdownWidthToReferenceWith', 'anchor', 'closeBehavior', 'header', 'placement', 'positioningStrategy', 'show', 'trigger']
455
455
  }]
456
456
  }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: i0.ElementRef }, { type: i0.NgZone }]; } });
457
+ let IxDropdownButton = class IxDropdownButton {
458
+ constructor(c, r, z) {
459
+ this.z = z;
460
+ c.detach();
461
+ this.el = r.nativeElement;
462
+ }
463
+ };
464
+ /** @nocollapse */ IxDropdownButton.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: IxDropdownButton, deps: [{ token: i0.ChangeDetectorRef }, { token: i0.ElementRef }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component });
465
+ /** @nocollapse */ IxDropdownButton.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: IxDropdownButton, selector: "ix-dropdown-button", inputs: { active: "active", disabled: "disabled", ghost: "ghost", icon: "icon", label: "label", outline: "outline", variant: "variant" }, ngImport: i0, template: '<ng-content></ng-content>', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
466
+ IxDropdownButton = __decorate([
467
+ ProxyCmp({
468
+ defineCustomElementFn: undefined,
469
+ inputs: ['active', 'disabled', 'ghost', 'icon', 'label', 'outline', 'variant']
470
+ })
471
+ ], IxDropdownButton);
472
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: IxDropdownButton, decorators: [{
473
+ type: Component,
474
+ args: [{
475
+ selector: 'ix-dropdown-button',
476
+ changeDetection: ChangeDetectionStrategy.OnPush,
477
+ template: '<ng-content></ng-content>',
478
+ inputs: ['active', 'disabled', 'ghost', 'icon', 'label', 'outline', 'variant']
479
+ }]
480
+ }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: i0.ElementRef }, { type: i0.NgZone }]; } });
457
481
  let IxDropdownItem = class IxDropdownItem {
458
482
  constructor(c, r, z) {
459
483
  this.z = z;
@@ -1243,12 +1267,11 @@ let IxSelectItem = class IxSelectItem {
1243
1267
  }
1244
1268
  };
1245
1269
  /** @nocollapse */ IxSelectItem.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: IxSelectItem, deps: [{ token: i0.ChangeDetectorRef }, { token: i0.ElementRef }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component });
1246
- /** @nocollapse */ IxSelectItem.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: IxSelectItem, selector: "ix-select-item", inputs: { hover: "hover", label: "label", selected: "selected", value: "value" }, ngImport: i0, template: '<ng-content></ng-content>', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
1270
+ /** @nocollapse */ IxSelectItem.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: IxSelectItem, selector: "ix-select-item", inputs: { label: "label", selected: "selected", value: "value" }, ngImport: i0, template: '<ng-content></ng-content>', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
1247
1271
  IxSelectItem = __decorate([
1248
1272
  ProxyCmp({
1249
1273
  defineCustomElementFn: undefined,
1250
- inputs: ['hover', 'label', 'selected', 'value'],
1251
- methods: ['onItemClick']
1274
+ inputs: ['label', 'selected', 'value']
1252
1275
  })
1253
1276
  ], IxSelectItem);
1254
1277
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: IxSelectItem, decorators: [{
@@ -1257,7 +1280,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
1257
1280
  selector: 'ix-select-item',
1258
1281
  changeDetection: ChangeDetectionStrategy.OnPush,
1259
1282
  template: '<ng-content></ng-content>',
1260
- inputs: ['hover', 'label', 'selected', 'value']
1283
+ inputs: ['label', 'selected', 'value']
1261
1284
  }]
1262
1285
  }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: i0.ElementRef }, { type: i0.NgZone }]; } });
1263
1286
  let IxSpinner = class IxSpinner {
@@ -1659,6 +1682,44 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
1659
1682
  type: Input
1660
1683
  }] } });
1661
1684
 
1685
+ /*
1686
+ * SPDX-FileCopyrightText: 2022 Siemens AG
1687
+ *
1688
+ * SPDX-License-Identifier: MIT
1689
+ *
1690
+ * This source code is licensed under the MIT license found in the
1691
+ * LICENSE file in the root directory of this source tree.
1692
+ */
1693
+ class IxActiveModal {
1694
+ constructor(modalData) {
1695
+ this.modalData = modalData;
1696
+ }
1697
+ get data() {
1698
+ return this.modalData;
1699
+ }
1700
+ /**
1701
+ * Close the active modal
1702
+ *
1703
+ * @param reason
1704
+ */
1705
+ close(reason) {
1706
+ closeModal(this.modalElement, reason);
1707
+ }
1708
+ /**
1709
+ * Dismiss the active modal
1710
+ *
1711
+ * @param reason
1712
+ */
1713
+ dismiss(reason) {
1714
+ dismissModal(this.modalElement, reason);
1715
+ }
1716
+ }
1717
+ class InternalIxActiveModal extends IxActiveModal {
1718
+ setModalElement(element) {
1719
+ this.modalElement = element;
1720
+ }
1721
+ }
1722
+
1662
1723
  /*
1663
1724
  * SPDX-FileCopyrightText: 2022 Siemens AG
1664
1725
  *
@@ -1668,16 +1729,49 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
1668
1729
  * LICENSE file in the root directory of this source tree.
1669
1730
  */
1670
1731
  class ModalService {
1671
- constructor() { }
1732
+ constructor(appRef, componentFactoryResolver, injector) {
1733
+ this.appRef = appRef;
1734
+ this.componentFactoryResolver = componentFactoryResolver;
1735
+ this.injector = injector;
1736
+ }
1672
1737
  async open(config) {
1673
1738
  const context = {
1674
1739
  close: null,
1675
1740
  dismiss: null,
1676
1741
  data: config.data,
1677
1742
  };
1743
+ if (config.content instanceof Type) {
1744
+ return this.createContentByComponentType(config, context);
1745
+ }
1746
+ const modalInstance = await this.createContentByTemplateRef(config, context);
1747
+ return modalInstance;
1748
+ }
1749
+ async createContentByComponentType(config, context) {
1750
+ const activeModal = new InternalIxActiveModal(context.data);
1751
+ const modalFactory = this.componentFactoryResolver.resolveComponentFactory(config.content);
1752
+ const modalInjector = Injector.create({
1753
+ providers: [
1754
+ {
1755
+ provide: IxActiveModal,
1756
+ useValue: activeModal,
1757
+ },
1758
+ ],
1759
+ parent: this.injector,
1760
+ });
1761
+ const instance = modalFactory.create(modalInjector);
1762
+ this.appRef.attachView(instance.hostView);
1763
+ const embeddedView = instance.hostView;
1764
+ const modalInstance = await this.createModalInstance(context, embeddedView, config);
1765
+ activeModal.setModalElement(modalInstance.htmlElement);
1766
+ return modalInstance;
1767
+ }
1768
+ async createContentByTemplateRef(config, context) {
1678
1769
  const embeddedView = config.content.createEmbeddedView({
1679
1770
  $implicit: context,
1680
1771
  });
1772
+ return await this.createModalInstance(context, embeddedView, config);
1773
+ }
1774
+ async createModalInstance(context, embeddedView, config) {
1681
1775
  const node = embeddedView.rootNodes[0];
1682
1776
  context.close = (result) => {
1683
1777
  closeModal(node, result);
@@ -1700,14 +1794,14 @@ class ModalService {
1700
1794
  return modalInstance;
1701
1795
  }
1702
1796
  }
1703
- /** @nocollapse */ ModalService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: ModalService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1797
+ /** @nocollapse */ ModalService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: ModalService, deps: [{ token: i0.ApplicationRef }, { token: i0.ComponentFactoryResolver }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable });
1704
1798
  /** @nocollapse */ ModalService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: ModalService, providedIn: 'root' });
1705
1799
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: ModalService, decorators: [{
1706
1800
  type: Injectable,
1707
1801
  args: [{
1708
1802
  providedIn: 'root',
1709
1803
  }]
1710
- }], ctorParameters: function () { return []; } });
1804
+ }], ctorParameters: function () { return [{ type: i0.ApplicationRef }, { type: i0.ComponentFactoryResolver }, { type: i0.Injector }]; } });
1711
1805
 
1712
1806
  /*
1713
1807
  * SPDX-FileCopyrightText: 2022 Siemens AG
@@ -1759,6 +1853,7 @@ const DIRECTIVES = [
1759
1853
  IxDatetimePicker,
1760
1854
  IxDrawer,
1761
1855
  IxDropdown,
1856
+ IxDropdownButton,
1762
1857
  IxDropdownItem,
1763
1858
  IxEventList,
1764
1859
  IxEventListItem,
@@ -1809,6 +1904,47 @@ const DIRECTIVES = [
1809
1904
  IxWorkflowSteps
1810
1905
  ];
1811
1906
 
1907
+ /*
1908
+ * SPDX-FileCopyrightText: 2022 Siemens AG
1909
+ *
1910
+ * SPDX-License-Identifier: MIT
1911
+ *
1912
+ * This source code is licensed under the MIT license found in the
1913
+ * LICENSE file in the root directory of this source tree.
1914
+ */
1915
+ class ThemeService {
1916
+ constructor() {
1917
+ this.themeChanged = new EventEmitter();
1918
+ this.themeSwitcher = themeSwitcher;
1919
+ this.themeSwitcher.themeChanged.on((theme) => this.themeChanged.emit(theme));
1920
+ }
1921
+ toggleMode() {
1922
+ this.themeSwitcher.toggleMode();
1923
+ }
1924
+ setTheme(themeName) {
1925
+ this.themeSwitcher.setTheme(themeName);
1926
+ }
1927
+ }
1928
+ /** @nocollapse */ ThemeService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: ThemeService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1929
+ /** @nocollapse */ ThemeService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: ThemeService, providedIn: 'root' });
1930
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: ThemeService, decorators: [{
1931
+ type: Injectable,
1932
+ args: [{
1933
+ providedIn: 'root',
1934
+ }]
1935
+ }], ctorParameters: function () { return []; }, propDecorators: { themeChanged: [{
1936
+ type: Output
1937
+ }] } });
1938
+
1939
+ /*
1940
+ * SPDX-FileCopyrightText: 2022 Siemens AG
1941
+ *
1942
+ * SPDX-License-Identifier: MIT
1943
+ *
1944
+ * This source code is licensed under the MIT license found in the
1945
+ * LICENSE file in the root directory of this source tree.
1946
+ */
1947
+
1812
1948
  /*
1813
1949
  * SPDX-FileCopyrightText: 2022 Siemens AG
1814
1950
  *
@@ -1959,13 +2095,14 @@ class IxModule {
1959
2095
  deps: [DOCUMENT, NgZone],
1960
2096
  },
1961
2097
  ModalService,
2098
+ ThemeService,
1962
2099
  ToastService,
1963
2100
  ],
1964
2101
  };
1965
2102
  }
1966
2103
  }
1967
2104
  /** @nocollapse */ IxModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: IxModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1968
- /** @nocollapse */ IxModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: IxModule, declarations: [IxAnimatedTab, IxAnimatedTabs, IxApplicationHeader, IxBasicNavigation, IxBlind, IxBreadcrumb, IxBreadcrumbItem, IxButton, IxCategoryFilter, IxChip, IxCounterPill, IxDatePicker, IxDateTimeCard, IxDatetimePicker, IxDrawer, IxDropdown, IxDropdownItem, IxEventList, IxEventListItem, IxExpandingSearch, IxFilterChip, IxFlipTile, IxFlipTileContent, IxGroup, IxGroupContextMenu, IxGroupDropdownItem, IxGroupItem, IxIcon, IxIconButton, IxInputGroup, IxKpi, IxMapNavigation, IxMapNavigationOverlay, IxMenu, IxMenuAbout, IxMenuAboutItem, IxMenuAboutNews, IxMenuAvatar, IxMenuAvatarItem, IxMenuItem, IxMenuSettings, IxMenuSettingsItem, IxMessageBar, IxModal, IxModalContainer, IxModalExample, IxPill, IxSelect, IxSelectItem, IxSpinner, IxSplitButton, IxSplitButtonItem, IxTabItem, IxTabs, IxTile, IxTimePicker, IxToast, IxToastContainer, IxToggle, IxTreeItem, IxUpload, IxValidationTooltip, IxWorkflowStep, IxWorkflowSteps, IxTree, IxDropdownTriggerDirective], exports: [IxAnimatedTab, IxAnimatedTabs, IxApplicationHeader, IxBasicNavigation, IxBlind, IxBreadcrumb, IxBreadcrumbItem, IxButton, IxCategoryFilter, IxChip, IxCounterPill, IxDatePicker, IxDateTimeCard, IxDatetimePicker, IxDrawer, IxDropdown, IxDropdownItem, IxEventList, IxEventListItem, IxExpandingSearch, IxFilterChip, IxFlipTile, IxFlipTileContent, IxGroup, IxGroupContextMenu, IxGroupDropdownItem, IxGroupItem, IxIcon, IxIconButton, IxInputGroup, IxKpi, IxMapNavigation, IxMapNavigationOverlay, IxMenu, IxMenuAbout, IxMenuAboutItem, IxMenuAboutNews, IxMenuAvatar, IxMenuAvatarItem, IxMenuItem, IxMenuSettings, IxMenuSettingsItem, IxMessageBar, IxModal, IxModalContainer, IxModalExample, IxPill, IxSelect, IxSelectItem, IxSpinner, IxSplitButton, IxSplitButtonItem, IxTabItem, IxTabs, IxTile, IxTimePicker, IxToast, IxToastContainer, IxToggle, IxTreeItem, IxUpload, IxValidationTooltip, IxWorkflowStep, IxWorkflowSteps, IxTree, IxDropdownTriggerDirective] });
2105
+ /** @nocollapse */ IxModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: IxModule, declarations: [IxAnimatedTab, IxAnimatedTabs, IxApplicationHeader, IxBasicNavigation, IxBlind, IxBreadcrumb, IxBreadcrumbItem, IxButton, IxCategoryFilter, IxChip, IxCounterPill, IxDatePicker, IxDateTimeCard, IxDatetimePicker, IxDrawer, IxDropdown, IxDropdownButton, IxDropdownItem, IxEventList, IxEventListItem, IxExpandingSearch, IxFilterChip, IxFlipTile, IxFlipTileContent, IxGroup, IxGroupContextMenu, IxGroupDropdownItem, IxGroupItem, IxIcon, IxIconButton, IxInputGroup, IxKpi, IxMapNavigation, IxMapNavigationOverlay, IxMenu, IxMenuAbout, IxMenuAboutItem, IxMenuAboutNews, IxMenuAvatar, IxMenuAvatarItem, IxMenuItem, IxMenuSettings, IxMenuSettingsItem, IxMessageBar, IxModal, IxModalContainer, IxModalExample, IxPill, IxSelect, IxSelectItem, IxSpinner, IxSplitButton, IxSplitButtonItem, IxTabItem, IxTabs, IxTile, IxTimePicker, IxToast, IxToastContainer, IxToggle, IxTreeItem, IxUpload, IxValidationTooltip, IxWorkflowStep, IxWorkflowSteps, IxTree, IxDropdownTriggerDirective], exports: [IxAnimatedTab, IxAnimatedTabs, IxApplicationHeader, IxBasicNavigation, IxBlind, IxBreadcrumb, IxBreadcrumbItem, IxButton, IxCategoryFilter, IxChip, IxCounterPill, IxDatePicker, IxDateTimeCard, IxDatetimePicker, IxDrawer, IxDropdown, IxDropdownButton, IxDropdownItem, IxEventList, IxEventListItem, IxExpandingSearch, IxFilterChip, IxFlipTile, IxFlipTileContent, IxGroup, IxGroupContextMenu, IxGroupDropdownItem, IxGroupItem, IxIcon, IxIconButton, IxInputGroup, IxKpi, IxMapNavigation, IxMapNavigationOverlay, IxMenu, IxMenuAbout, IxMenuAboutItem, IxMenuAboutNews, IxMenuAvatar, IxMenuAvatarItem, IxMenuItem, IxMenuSettings, IxMenuSettingsItem, IxMessageBar, IxModal, IxModalContainer, IxModalExample, IxPill, IxSelect, IxSelectItem, IxSpinner, IxSplitButton, IxSplitButtonItem, IxTabItem, IxTabs, IxTile, IxTimePicker, IxToast, IxToastContainer, IxToggle, IxTreeItem, IxUpload, IxValidationTooltip, IxWorkflowStep, IxWorkflowSteps, IxTree, IxDropdownTriggerDirective] });
1969
2106
  /** @nocollapse */ IxModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: IxModule });
1970
2107
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: IxModule, decorators: [{
1971
2108
  type: NgModule,
@@ -1988,5 +2125,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
1988
2125
  * Generated bundle index. Do not edit.
1989
2126
  */
1990
2127
 
1991
- export { IxAnimatedTab, IxAnimatedTabs, IxApplicationHeader, IxBasicNavigation, IxBlind, IxBreadcrumb, IxBreadcrumbItem, IxButton, IxCategoryFilter, IxChip, IxCounterPill, IxDatePicker, IxDateTimeCard, IxDatetimePicker, IxDrawer, IxDropdown, IxDropdownItem, IxDropdownTriggerDirective, IxEventList, IxEventListItem, IxExpandingSearch, IxFilterChip, IxFlipTile, IxFlipTileContent, IxGroup, IxGroupContextMenu, IxGroupDropdownItem, IxGroupItem, IxIcon, IxIconButton, IxInputGroup, IxKpi, IxMapNavigation, IxMapNavigationOverlay, IxMenu, IxMenuAbout, IxMenuAboutItem, IxMenuAboutNews, IxMenuAvatar, IxMenuAvatarItem, IxMenuItem, IxMenuSettings, IxMenuSettingsItem, IxMessageBar, IxModal, IxModalContainer, IxModalExample, IxModule, IxPill, IxSelect, IxSelectItem, IxSpinner, IxSplitButton, IxSplitButtonItem, IxTabItem, IxTabs, IxTile, IxTimePicker, IxToast, IxToastContainer, IxToggle, IxTree, IxTreeItem, IxUpload, IxValidationTooltip, IxWorkflowStep, IxWorkflowSteps, ModalService, ToastService };
2128
+ export { IxActiveModal, IxAnimatedTab, IxAnimatedTabs, IxApplicationHeader, IxBasicNavigation, IxBlind, IxBreadcrumb, IxBreadcrumbItem, IxButton, IxCategoryFilter, IxChip, IxCounterPill, IxDatePicker, IxDateTimeCard, IxDatetimePicker, IxDrawer, IxDropdown, IxDropdownButton, IxDropdownItem, IxDropdownTriggerDirective, IxEventList, IxEventListItem, IxExpandingSearch, IxFilterChip, IxFlipTile, IxFlipTileContent, IxGroup, IxGroupContextMenu, IxGroupDropdownItem, IxGroupItem, IxIcon, IxIconButton, IxInputGroup, IxKpi, IxMapNavigation, IxMapNavigationOverlay, IxMenu, IxMenuAbout, IxMenuAboutItem, IxMenuAboutNews, IxMenuAvatar, IxMenuAvatarItem, IxMenuItem, IxMenuSettings, IxMenuSettingsItem, IxMessageBar, IxModal, IxModalContainer, IxModalExample, IxModule, IxPill, IxSelect, IxSelectItem, IxSpinner, IxSplitButton, IxSplitButtonItem, IxTabItem, IxTabs, IxTile, IxTimePicker, IxToast, IxToastContainer, IxToggle, IxTree, IxTreeItem, IxUpload, IxValidationTooltip, IxWorkflowStep, IxWorkflowSteps, ModalService, ThemeService, ToastService };
1992
2129
  //# sourceMappingURL=siemens-ix-angular.mjs.map