aboutsummaryrefslogtreecommitdiffstats
path: root/sdc-workflow-designer-ui/src/app/paletx/plx-modal/modal.ts
diff options
context:
space:
mode:
authorYuanHu <yuan.hu1@zte.com.cn>2018-03-27 17:33:22 +0800
committerYuanHu <yuan.hu1@zte.com.cn>2018-03-27 17:33:22 +0800
commit8261a4ea8091c27b61ac581a852e2e18283b3cdd (patch)
treea2ca109f7600e9e0cbe73eb9139ffe6284be1159 /sdc-workflow-designer-ui/src/app/paletx/plx-modal/modal.ts
parent573f32b362f4639928485d66feb1c0721109716b (diff)
Include paletx components
Include paletx components to WF Designer UI. Issue-ID: SDC-1130,SDC-1131 Change-Id: Iad06b2dde8fc98d03a0e3633e829b686d75cafd0 Signed-off-by: YuanHu <yuan.hu1@zte.com.cn>
Diffstat (limited to 'sdc-workflow-designer-ui/src/app/paletx/plx-modal/modal.ts')
-rw-r--r--sdc-workflow-designer-ui/src/app/paletx/plx-modal/modal.ts54
1 files changed, 54 insertions, 0 deletions
diff --git a/sdc-workflow-designer-ui/src/app/paletx/plx-modal/modal.ts b/sdc-workflow-designer-ui/src/app/paletx/plx-modal/modal.ts
new file mode 100644
index 00000000..5935eee6
--- /dev/null
+++ b/sdc-workflow-designer-ui/src/app/paletx/plx-modal/modal.ts
@@ -0,0 +1,54 @@
+import {Injectable, Injector, ComponentFactoryResolver} from '@angular/core';
+import {PlxModalStack} from './modal-stack';
+import {PlxModalRef} from './modal-ref';
+
+/**
+ * Represent options available when opening new modal windows.
+ */
+export interface PlxModalOptions {
+ /**
+ * Whether a backdrop element should be created for a given modal (true by default).
+ * Alternatively, specify 'static' for a backdrop which doesn't close the modal on click.
+ */
+ backdrop?: boolean | 'static';
+
+ /**
+ * An element to which to attach newly opened modal windows.
+ */
+ container?: string;
+
+ /**
+ * Whether to close the modal when escape key is pressed (true by default).
+ */
+ keyboard?: boolean;
+
+ /**
+ * Size of a new modal window.
+ */
+ size?: 'sm' | 'lg';
+
+ /**
+ * Custom class to append to the modal window
+ */
+ windowClass?: string;
+}
+
+/**
+ * A service to open modal windows. Creating a modal is straightforward: create a template and pass it as an argument to
+ * the "open" method!
+ */
+@Injectable()
+export class PlxModal {
+ constructor(private _moduleCFR: ComponentFactoryResolver, private _injector: Injector, private _modalStack: PlxModalStack) {
+ }
+
+ /**
+ * Opens a new modal window with the specified content and using supplied options. Content can be provided
+ * as a TemplateRef or a component type. If you pass a component type as content than instances of those
+ * components can be injected with an instance of the PlxActiveModal class. You can use methods on the
+ * PlxActiveModal class to close / dismiss modals from "inside" of a component.
+ */
+ public open(content: any, options: PlxModalOptions = {}): PlxModalRef {
+ return this._modalStack.open(this._moduleCFR, this._injector, content, options);
+ }
+}