UNPKG

devextreme-angular

Version:

Angular UI and visualization components based on DevExtreme widgets

840 lines (799 loc) 30 kB
import * as i2 from '@angular/platform-browser'; import { BrowserTransferStateModule } from '@angular/platform-browser'; import * as i0 from '@angular/core'; import { PLATFORM_ID, Component, Inject, Input, Output, ContentChildren, NgModule } from '@angular/core'; import DxDiagram from 'devextreme/ui/diagram'; import * as i1 from 'devextreme-angular/core'; import { DxComponent, DxTemplateHost, WatcherHelper, NestedOptionHost, IterableDifferHelper, DxIntegrationModule, DxTemplateModule } from 'devextreme-angular/core'; import { DxiCustomShapeComponent, DxoContextMenuModule, DxiCommandModule, DxiItemModule, DxoContextToolboxModule, DxiCustomShapeModule, DxiConnectionPointModule, DxoDefaultItemPropertiesModule, DxoEdgesModule, DxoEditingModule, DxoExportModule, DxoGridSizeModule, DxoHistoryToolbarModule, DxoMainToolbarModule, DxoNodesModule, DxoAutoLayoutModule, DxoPageSizeModule, DxoPropertiesPanelModule, DxiTabModule, DxiGroupModule, DxoToolboxModule, DxoViewToolbarModule, DxoZoomLevelModule } from 'devextreme-angular/ui/nested'; /*! * devextreme-angular * Version: 22.1.14 * Build date: Mon Apr 29 2024 * * Copyright (c) 2012 - 2024 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ /** * The Diagram UI component provides a visual interface to help you design new and modify existing diagrams. */ class DxDiagramComponent extends DxComponent { constructor(elementRef, ngZone, templateHost, _watcherHelper, _idh, optionHost, transferState, platformId) { super(elementRef, ngZone, templateHost, _watcherHelper, transferState, platformId); this._watcherHelper = _watcherHelper; this._idh = _idh; this._createEventEmitters([ { subscribe: 'contentReady', emit: 'onContentReady' }, { subscribe: 'customCommand', emit: 'onCustomCommand' }, { subscribe: 'disposing', emit: 'onDisposing' }, { subscribe: 'initialized', emit: 'onInitialized' }, { subscribe: 'itemClick', emit: 'onItemClick' }, { subscribe: 'itemDblClick', emit: 'onItemDblClick' }, { subscribe: 'optionChanged', emit: 'onOptionChanged' }, { subscribe: 'requestEditOperation', emit: 'onRequestEditOperation' }, { subscribe: 'requestLayoutUpdate', emit: 'onRequestLayoutUpdate' }, { subscribe: 'selectionChanged', emit: 'onSelectionChanged' }, { emit: 'autoZoomModeChange' }, { emit: 'contextMenuChange' }, { emit: 'contextToolboxChange' }, { emit: 'customShapesChange' }, { emit: 'customShapeTemplateChange' }, { emit: 'customShapeToolboxTemplateChange' }, { emit: 'defaultItemPropertiesChange' }, { emit: 'disabledChange' }, { emit: 'edgesChange' }, { emit: 'editingChange' }, { emit: 'elementAttrChange' }, { emit: 'exportChange' }, { emit: 'fullScreenChange' }, { emit: 'gridSizeChange' }, { emit: 'hasChangesChange' }, { emit: 'heightChange' }, { emit: 'historyToolbarChange' }, { emit: 'mainToolbarChange' }, { emit: 'nodesChange' }, { emit: 'pageColorChange' }, { emit: 'pageOrientationChange' }, { emit: 'pageSizeChange' }, { emit: 'propertiesPanelChange' }, { emit: 'readOnlyChange' }, { emit: 'rtlEnabledChange' }, { emit: 'showGridChange' }, { emit: 'simpleViewChange' }, { emit: 'snapToGridChange' }, { emit: 'toolboxChange' }, { emit: 'unitsChange' }, { emit: 'useNativeScrollingChange' }, { emit: 'viewToolbarChange' }, { emit: 'viewUnitsChange' }, { emit: 'visibleChange' }, { emit: 'widthChange' }, { emit: 'zoomLevelChange' } ]); this._idh.setHost(this); optionHost.setHost(this); } /** * Specifies how the Diagram UI component automatically zooms the work area. */ get autoZoomMode() { return this._getOption('autoZoomMode'); } set autoZoomMode(value) { this._setOption('autoZoomMode', value); } /** * Configures the context menu's settings. */ get contextMenu() { return this._getOption('contextMenu'); } set contextMenu(value) { this._setOption('contextMenu', value); } /** * Configures the context toolbox's settings. */ get contextToolbox() { return this._getOption('contextToolbox'); } set contextToolbox(value) { this._setOption('contextToolbox', value); } /** * Provide access to an array of custom shapes. */ get customShapes() { return this._getOption('customShapes'); } set customShapes(value) { this._setOption('customShapes', value); } /** * Specifies a custom template for shapes. */ get customShapeTemplate() { return this._getOption('customShapeTemplate'); } set customShapeTemplate(value) { this._setOption('customShapeTemplate', value); } /** * Specifies a custom template for shapes in the toolbox. */ get customShapeToolboxTemplate() { return this._getOption('customShapeToolboxTemplate'); } set customShapeToolboxTemplate(value) { this._setOption('customShapeToolboxTemplate', value); } /** * Configures default item properties. */ get defaultItemProperties() { return this._getOption('defaultItemProperties'); } set defaultItemProperties(value) { this._setOption('defaultItemProperties', value); } /** * Specifies whether the UI component responds to user interaction. */ get disabled() { return this._getOption('disabled'); } set disabled(value) { this._setOption('disabled', value); } /** * Allows you to bind the collection of diagram edges to a data source. For more information, see the Data Binding section. */ get edges() { return this._getOption('edges'); } set edges(value) { this._setOption('edges', value); } /** * Specifies which editing operations a user can perform. */ get editing() { return this._getOption('editing'); } set editing(value) { this._setOption('editing', value); } /** * Specifies the global attributes to be attached to the UI component's container element. */ get elementAttr() { return this._getOption('elementAttr'); } set elementAttr(value) { this._setOption('elementAttr', value); } /** * Configures export settings. */ get export() { return this._getOption('export'); } set export(value) { this._setOption('export', value); } /** * Specifies whether or not to display the UI component in full-screen mode. */ get fullScreen() { return this._getOption('fullScreen'); } set fullScreen(value) { this._setOption('fullScreen', value); } /** * Specifies the grid pitch. */ get gridSize() { return this._getOption('gridSize'); } set gridSize(value) { this._setOption('gridSize', value); } /** * Indicates whether diagram content has unsaved changes. */ get hasChanges() { return this._getOption('hasChanges'); } set hasChanges(value) { this._setOption('hasChanges', value); } /** * Specifies the UI component's height. */ get height() { return this._getOption('height'); } set height(value) { this._setOption('height', value); } /** * Configures the history toolbar's settings. */ get historyToolbar() { return this._getOption('historyToolbar'); } set historyToolbar(value) { this._setOption('historyToolbar', value); } /** * Configures the main toolbar settings. */ get mainToolbar() { return this._getOption('mainToolbar'); } set mainToolbar(value) { this._setOption('mainToolbar', value); } /** * Allows you to bind the collection of diagram nodes to a data source. For more information, see the Data Binding section. */ get nodes() { return this._getOption('nodes'); } set nodes(value) { this._setOption('nodes', value); } /** * Specifies the color of a diagram page. */ get pageColor() { return this._getOption('pageColor'); } set pageColor(value) { this._setOption('pageColor', value); } /** * Specifies the page orientation. */ get pageOrientation() { return this._getOption('pageOrientation'); } set pageOrientation(value) { this._setOption('pageOrientation', value); } /** * Specifies a size of pages. */ get pageSize() { return this._getOption('pageSize'); } set pageSize(value) { this._setOption('pageSize', value); } /** * Configures the Properties panel settings. */ get propertiesPanel() { return this._getOption('propertiesPanel'); } set propertiesPanel(value) { this._setOption('propertiesPanel', value); } /** * Specifies whether the diagram is read-only. */ get readOnly() { return this._getOption('readOnly'); } set readOnly(value) { this._setOption('readOnly', value); } /** * Switches the UI component to a right-to-left representation. */ get rtlEnabled() { return this._getOption('rtlEnabled'); } set rtlEnabled(value) { this._setOption('rtlEnabled', value); } /** * Specifies whether grid lines are visible. */ get showGrid() { return this._getOption('showGrid'); } set showGrid(value) { this._setOption('showGrid', value); } /** * Switch the Diagram UI component to simple view mode. */ get simpleView() { return this._getOption('simpleView'); } set simpleView(value) { this._setOption('simpleView', value); } /** * Specifies whether diagram elements should snap to grid lines. */ get snapToGrid() { return this._getOption('snapToGrid'); } set snapToGrid(value) { this._setOption('snapToGrid', value); } /** * Configures the toolbox settings. */ get toolbox() { return this._getOption('toolbox'); } set toolbox(value) { this._setOption('toolbox', value); } /** * Specifies the measurement unit for size properties. */ get units() { return this._getOption('units'); } set units(value) { this._setOption('units', value); } /** * Specifies whether or not the UI component uses native scrolling. */ get useNativeScrolling() { return this._getOption('useNativeScrolling'); } set useNativeScrolling(value) { this._setOption('useNativeScrolling', value); } /** * Configures the view toolbar settings. */ get viewToolbar() { return this._getOption('viewToolbar'); } set viewToolbar(value) { this._setOption('viewToolbar', value); } /** * Specifies the measurement unit that is displayed in user interface elements. */ get viewUnits() { return this._getOption('viewUnits'); } set viewUnits(value) { this._setOption('viewUnits', value); } /** * Specifies whether the UI component is visible. */ get visible() { return this._getOption('visible'); } set visible(value) { this._setOption('visible', value); } /** * Specifies the UI component's width. */ get width() { return this._getOption('width'); } set width(value) { this._setOption('width', value); } /** * Specifies the zoom level. */ get zoomLevel() { return this._getOption('zoomLevel'); } set zoomLevel(value) { this._setOption('zoomLevel', value); } get customShapesChildren() { return this._getOption('customShapes'); } set customShapesChildren(value) { this.setChildren('customShapes', value); } _createInstance(element, options) { return new DxDiagram(element, options); } ngOnDestroy() { this._destroyWidget(); } ngOnChanges(changes) { super.ngOnChanges(changes); this.setupChanges('customShapes', changes); } setupChanges(prop, changes) { if (!(prop in this._optionsToUpdate)) { this._idh.setup(prop, changes); } } ngDoCheck() { this._idh.doCheck('customShapes'); this._watcherHelper.checkWatchers(); super.ngDoCheck(); super.clearChangedOptions(); } _setOption(name, value) { let isSetup = this._idh.setupSingle(name, value); let isChanged = this._idh.getChanges(name, value) !== null; if (isSetup || isChanged) { super._setOption(name, value); } } } /** @nocollapse */ DxDiagramComponent.ɵfac = function DxDiagramComponent_Factory(t) { return new (t || DxDiagramComponent)(i0.ɵɵdirectiveInject(i0.ElementRef), i0.ɵɵdirectiveInject(i0.NgZone), i0.ɵɵdirectiveInject(i1.DxTemplateHost), i0.ɵɵdirectiveInject(i1.WatcherHelper), i0.ɵɵdirectiveInject(i1.IterableDifferHelper), i0.ɵɵdirectiveInject(i1.NestedOptionHost), i0.ɵɵdirectiveInject(i2.TransferState), i0.ɵɵdirectiveInject(PLATFORM_ID)); }; /** @nocollapse */ DxDiagramComponent.ɵcmp = /** @pureOrBreakMyCode */ i0.ɵɵdefineComponent({ type: DxDiagramComponent, selectors: [["dx-diagram"]], contentQueries: function DxDiagramComponent_ContentQueries(rf, ctx, dirIndex) { if (rf & 1) { i0.ɵɵcontentQuery(dirIndex, DxiCustomShapeComponent, 4); } if (rf & 2) { let _t; i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.customShapesChildren = _t); } }, inputs: { autoZoomMode: "autoZoomMode", contextMenu: "contextMenu", contextToolbox: "contextToolbox", customShapes: "customShapes", customShapeTemplate: "customShapeTemplate", customShapeToolboxTemplate: "customShapeToolboxTemplate", defaultItemProperties: "defaultItemProperties", disabled: "disabled", edges: "edges", editing: "editing", elementAttr: "elementAttr", export: "export", fullScreen: "fullScreen", gridSize: "gridSize", hasChanges: "hasChanges", height: "height", historyToolbar: "historyToolbar", mainToolbar: "mainToolbar", nodes: "nodes", pageColor: "pageColor", pageOrientation: "pageOrientation", pageSize: "pageSize", propertiesPanel: "propertiesPanel", readOnly: "readOnly", rtlEnabled: "rtlEnabled", showGrid: "showGrid", simpleView: "simpleView", snapToGrid: "snapToGrid", toolbox: "toolbox", units: "units", useNativeScrolling: "useNativeScrolling", viewToolbar: "viewToolbar", viewUnits: "viewUnits", visible: "visible", width: "width", zoomLevel: "zoomLevel" }, outputs: { onContentReady: "onContentReady", onCustomCommand: "onCustomCommand", onDisposing: "onDisposing", onInitialized: "onInitialized", onItemClick: "onItemClick", onItemDblClick: "onItemDblClick", onOptionChanged: "onOptionChanged", onRequestEditOperation: "onRequestEditOperation", onRequestLayoutUpdate: "onRequestLayoutUpdate", onSelectionChanged: "onSelectionChanged", autoZoomModeChange: "autoZoomModeChange", contextMenuChange: "contextMenuChange", contextToolboxChange: "contextToolboxChange", customShapesChange: "customShapesChange", customShapeTemplateChange: "customShapeTemplateChange", customShapeToolboxTemplateChange: "customShapeToolboxTemplateChange", defaultItemPropertiesChange: "defaultItemPropertiesChange", disabledChange: "disabledChange", edgesChange: "edgesChange", editingChange: "editingChange", elementAttrChange: "elementAttrChange", exportChange: "exportChange", fullScreenChange: "fullScreenChange", gridSizeChange: "gridSizeChange", hasChangesChange: "hasChangesChange", heightChange: "heightChange", historyToolbarChange: "historyToolbarChange", mainToolbarChange: "mainToolbarChange", nodesChange: "nodesChange", pageColorChange: "pageColorChange", pageOrientationChange: "pageOrientationChange", pageSizeChange: "pageSizeChange", propertiesPanelChange: "propertiesPanelChange", readOnlyChange: "readOnlyChange", rtlEnabledChange: "rtlEnabledChange", showGridChange: "showGridChange", simpleViewChange: "simpleViewChange", snapToGridChange: "snapToGridChange", toolboxChange: "toolboxChange", unitsChange: "unitsChange", useNativeScrollingChange: "useNativeScrollingChange", viewToolbarChange: "viewToolbarChange", viewUnitsChange: "viewUnitsChange", visibleChange: "visibleChange", widthChange: "widthChange", zoomLevelChange: "zoomLevelChange" }, features: [i0.ɵɵProvidersFeature([ DxTemplateHost, WatcherHelper, NestedOptionHost, IterableDifferHelper ]), i0.ɵɵInheritDefinitionFeature, i0.ɵɵNgOnChangesFeature], decls: 0, vars: 0, template: function DxDiagramComponent_Template(rf, ctx) { }, encapsulation: 2 }); (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(DxDiagramComponent, [{ type: Component, args: [{ selector: 'dx-diagram', template: '', providers: [ DxTemplateHost, WatcherHelper, NestedOptionHost, IterableDifferHelper ] }] }], function () { return [{ type: i0.ElementRef }, { type: i0.NgZone }, { type: i1.DxTemplateHost }, { type: i1.WatcherHelper }, { type: i1.IterableDifferHelper }, { type: i1.NestedOptionHost }, { type: i2.TransferState }, { type: undefined, decorators: [{ type: Inject, args: [PLATFORM_ID] }] }]; }, { autoZoomMode: [{ type: Input }], contextMenu: [{ type: Input }], contextToolbox: [{ type: Input }], customShapes: [{ type: Input }], customShapeTemplate: [{ type: Input }], customShapeToolboxTemplate: [{ type: Input }], defaultItemProperties: [{ type: Input }], disabled: [{ type: Input }], edges: [{ type: Input }], editing: [{ type: Input }], elementAttr: [{ type: Input }], export: [{ type: Input }], fullScreen: [{ type: Input }], gridSize: [{ type: Input }], hasChanges: [{ type: Input }], height: [{ type: Input }], historyToolbar: [{ type: Input }], mainToolbar: [{ type: Input }], nodes: [{ type: Input }], pageColor: [{ type: Input }], pageOrientation: [{ type: Input }], pageSize: [{ type: Input }], propertiesPanel: [{ type: Input }], readOnly: [{ type: Input }], rtlEnabled: [{ type: Input }], showGrid: [{ type: Input }], simpleView: [{ type: Input }], snapToGrid: [{ type: Input }], toolbox: [{ type: Input }], units: [{ type: Input }], useNativeScrolling: [{ type: Input }], viewToolbar: [{ type: Input }], viewUnits: [{ type: Input }], visible: [{ type: Input }], width: [{ type: Input }], zoomLevel: [{ type: Input }], onContentReady: [{ type: Output }], onCustomCommand: [{ type: Output }], onDisposing: [{ type: Output }], onInitialized: [{ type: Output }], onItemClick: [{ type: Output }], onItemDblClick: [{ type: Output }], onOptionChanged: [{ type: Output }], onRequestEditOperation: [{ type: Output }], onRequestLayoutUpdate: [{ type: Output }], onSelectionChanged: [{ type: Output }], autoZoomModeChange: [{ type: Output }], contextMenuChange: [{ type: Output }], contextToolboxChange: [{ type: Output }], customShapesChange: [{ type: Output }], customShapeTemplateChange: [{ type: Output }], customShapeToolboxTemplateChange: [{ type: Output }], defaultItemPropertiesChange: [{ type: Output }], disabledChange: [{ type: Output }], edgesChange: [{ type: Output }], editingChange: [{ type: Output }], elementAttrChange: [{ type: Output }], exportChange: [{ type: Output }], fullScreenChange: [{ type: Output }], gridSizeChange: [{ type: Output }], hasChangesChange: [{ type: Output }], heightChange: [{ type: Output }], historyToolbarChange: [{ type: Output }], mainToolbarChange: [{ type: Output }], nodesChange: [{ type: Output }], pageColorChange: [{ type: Output }], pageOrientationChange: [{ type: Output }], pageSizeChange: [{ type: Output }], propertiesPanelChange: [{ type: Output }], readOnlyChange: [{ type: Output }], rtlEnabledChange: [{ type: Output }], showGridChange: [{ type: Output }], simpleViewChange: [{ type: Output }], snapToGridChange: [{ type: Output }], toolboxChange: [{ type: Output }], unitsChange: [{ type: Output }], useNativeScrollingChange: [{ type: Output }], viewToolbarChange: [{ type: Output }], viewUnitsChange: [{ type: Output }], visibleChange: [{ type: Output }], widthChange: [{ type: Output }], zoomLevelChange: [{ type: Output }], customShapesChildren: [{ type: ContentChildren, args: [DxiCustomShapeComponent] }] }); })(); class DxDiagramModule { } /** @nocollapse */ DxDiagramModule.ɵfac = function DxDiagramModule_Factory(t) { return new (t || DxDiagramModule)(); }; /** @nocollapse */ DxDiagramModule.ɵmod = /** @pureOrBreakMyCode */ i0.ɵɵdefineNgModule({ type: DxDiagramModule }); /** @nocollapse */ DxDiagramModule.ɵinj = /** @pureOrBreakMyCode */ i0.ɵɵdefineInjector({ imports: [[ DxoContextMenuModule, DxiCommandModule, DxiItemModule, DxoContextToolboxModule, DxiCustomShapeModule, DxiConnectionPointModule, DxoDefaultItemPropertiesModule, DxoEdgesModule, DxoEditingModule, DxoExportModule, DxoGridSizeModule, DxoHistoryToolbarModule, DxoMainToolbarModule, DxoNodesModule, DxoAutoLayoutModule, DxoPageSizeModule, DxoPropertiesPanelModule, DxiTabModule, DxiGroupModule, DxoToolboxModule, DxoViewToolbarModule, DxoZoomLevelModule, DxIntegrationModule, DxTemplateModule, BrowserTransferStateModule ], DxoContextMenuModule, DxiCommandModule, DxiItemModule, DxoContextToolboxModule, DxiCustomShapeModule, DxiConnectionPointModule, DxoDefaultItemPropertiesModule, DxoEdgesModule, DxoEditingModule, DxoExportModule, DxoGridSizeModule, DxoHistoryToolbarModule, DxoMainToolbarModule, DxoNodesModule, DxoAutoLayoutModule, DxoPageSizeModule, DxoPropertiesPanelModule, DxiTabModule, DxiGroupModule, DxoToolboxModule, DxoViewToolbarModule, DxoZoomLevelModule, DxTemplateModule] }); (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(DxDiagramModule, [{ type: NgModule, args: [{ imports: [ DxoContextMenuModule, DxiCommandModule, DxiItemModule, DxoContextToolboxModule, DxiCustomShapeModule, DxiConnectionPointModule, DxoDefaultItemPropertiesModule, DxoEdgesModule, DxoEditingModule, DxoExportModule, DxoGridSizeModule, DxoHistoryToolbarModule, DxoMainToolbarModule, DxoNodesModule, DxoAutoLayoutModule, DxoPageSizeModule, DxoPropertiesPanelModule, DxiTabModule, DxiGroupModule, DxoToolboxModule, DxoViewToolbarModule, DxoZoomLevelModule, DxIntegrationModule, DxTemplateModule, BrowserTransferStateModule ], declarations: [ DxDiagramComponent ], exports: [ DxDiagramComponent, DxoContextMenuModule, DxiCommandModule, DxiItemModule, DxoContextToolboxModule, DxiCustomShapeModule, DxiConnectionPointModule, DxoDefaultItemPropertiesModule, DxoEdgesModule, DxoEditingModule, DxoExportModule, DxoGridSizeModule, DxoHistoryToolbarModule, DxoMainToolbarModule, DxoNodesModule, DxoAutoLayoutModule, DxoPageSizeModule, DxoPropertiesPanelModule, DxiTabModule, DxiGroupModule, DxoToolboxModule, DxoViewToolbarModule, DxoZoomLevelModule, DxTemplateModule ] }] }], null, null); })(); (function () { (typeof ngJitMode === "undefined" || ngJitMode) && i0.ɵɵsetNgModuleScope(DxDiagramModule, { declarations: [DxDiagramComponent], imports: [DxoContextMenuModule, DxiCommandModule, DxiItemModule, DxoContextToolboxModule, DxiCustomShapeModule, DxiConnectionPointModule, DxoDefaultItemPropertiesModule, DxoEdgesModule, DxoEditingModule, DxoExportModule, DxoGridSizeModule, DxoHistoryToolbarModule, DxoMainToolbarModule, DxoNodesModule, DxoAutoLayoutModule, DxoPageSizeModule, DxoPropertiesPanelModule, DxiTabModule, DxiGroupModule, DxoToolboxModule, DxoViewToolbarModule, DxoZoomLevelModule, DxIntegrationModule, DxTemplateModule, BrowserTransferStateModule], exports: [DxDiagramComponent, DxoContextMenuModule, DxiCommandModule, DxiItemModule, DxoContextToolboxModule, DxiCustomShapeModule, DxiConnectionPointModule, DxoDefaultItemPropertiesModule, DxoEdgesModule, DxoEditingModule, DxoExportModule, DxoGridSizeModule, DxoHistoryToolbarModule, DxoMainToolbarModule, DxoNodesModule, DxoAutoLayoutModule, DxoPageSizeModule, DxoPropertiesPanelModule, DxiTabModule, DxiGroupModule, DxoToolboxModule, DxoViewToolbarModule, DxoZoomLevelModule, DxTemplateModule] }); })(); /** * Generated bundle index. Do not edit. */ export { DxDiagramComponent, DxDiagramModule }; //# sourceMappingURL=devextreme-angular-ui-diagram.js.map