@educarehq/solaris-ui 0.2.0 → 0.3.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.
- package/esm2022/index.js +40 -1
- package/esm2022/index.js.map +1 -1
- package/esm2022/lib/components/actions/button/index.js +3 -0
- package/esm2022/lib/components/actions/button/index.js.map +1 -0
- package/esm2022/lib/components/data-display/badge/index.js +3 -0
- package/esm2022/lib/components/data-display/badge/index.js.map +1 -0
- package/esm2022/lib/components/data-display/divider/component/divider.component.js +46 -0
- package/esm2022/lib/components/data-display/divider/component/divider.component.js.map +1 -0
- package/esm2022/lib/components/data-display/divider/index.js +2 -0
- package/esm2022/lib/components/data-display/divider/index.js.map +1 -0
- package/esm2022/lib/components/data-display/divider/model/divider.types.js +1 -0
- package/esm2022/lib/components/data-display/divider/model/divider.types.js.map +1 -0
- package/esm2022/lib/components/feedback/toast/component/toast.component.js +268 -0
- package/esm2022/lib/components/feedback/toast/component/toast.component.js.map +1 -0
- package/esm2022/lib/components/feedback/toast/container/toast-container.component.js +24 -0
- package/esm2022/lib/components/feedback/toast/container/toast-container.component.js.map +1 -0
- package/esm2022/lib/components/feedback/toast/model/toast.types.js +1 -0
- package/esm2022/lib/components/feedback/toast/model/toast.types.js.map +1 -0
- package/esm2022/lib/components/feedback/toast/provider/provide-solaris-toast.js +17 -0
- package/esm2022/lib/components/feedback/toast/provider/provide-solaris-toast.js.map +1 -0
- package/esm2022/lib/components/feedback/toast/service/toast.service.js +219 -0
- package/esm2022/lib/components/feedback/toast/service/toast.service.js.map +1 -0
- package/esm2022/lib/components/feedback/toast/token/toast.tokens.js +13 -0
- package/esm2022/lib/components/feedback/toast/token/toast.tokens.js.map +1 -0
- package/esm2022/lib/components/forms/email-field/component/email-field.component.js +5 -4
- package/esm2022/lib/components/forms/email-field/component/email-field.component.js.map +1 -1
- package/esm2022/lib/components/forms/form-field/component/form-field.component.js +50 -2
- package/esm2022/lib/components/forms/form-field/component/form-field.component.js.map +1 -1
- package/esm2022/lib/components/forms/form-field/directives/form-field-trigger.directive.js.map +1 -1
- package/esm2022/lib/components/forms/form-field/index.js.map +1 -1
- package/esm2022/lib/components/forms/multi-select/component/multi-select.component.js +11 -28
- package/esm2022/lib/components/forms/multi-select/component/multi-select.component.js.map +1 -1
- package/esm2022/lib/components/forms/multi-select/model/multi-select.types.js.map +1 -1
- package/esm2022/lib/components/forms/option/component/option.component.js +2 -2
- package/esm2022/lib/components/forms/option/component/option.component.js.map +1 -1
- package/esm2022/lib/components/forms/password-field/component/password-field.component.js +2 -2
- package/esm2022/lib/components/forms/password-field/component/password-field.component.js.map +1 -1
- package/esm2022/lib/components/forms/radio/component/radio.component.js +2 -2
- package/esm2022/lib/components/forms/select/component/select.component.js +4 -8
- package/esm2022/lib/components/forms/select/component/select.component.js.map +1 -1
- package/esm2022/lib/components/icon/component/solaris-icon.component.js +2 -2
- package/esm2022/lib/components/icon/component/solaris-icon.component.js.map +1 -1
- package/esm2022/lib/components/interaction/dropdown-menu/component/dropdown-menu-group.component.js +27 -0
- package/esm2022/lib/components/interaction/dropdown-menu/component/dropdown-menu-group.component.js.map +1 -0
- package/esm2022/lib/components/interaction/dropdown-menu/component/dropdown-menu-item.component.js +96 -0
- package/esm2022/lib/components/interaction/dropdown-menu/component/dropdown-menu-item.component.js.map +1 -0
- package/esm2022/lib/components/interaction/dropdown-menu/component/dropdown-menu-label.component.js +22 -0
- package/esm2022/lib/components/interaction/dropdown-menu/component/dropdown-menu-label.component.js.map +1 -0
- package/esm2022/lib/components/interaction/dropdown-menu/component/dropdown-menu.component.js +105 -0
- package/esm2022/lib/components/interaction/dropdown-menu/component/dropdown-menu.component.js.map +1 -0
- package/esm2022/lib/components/interaction/dropdown-menu/component/dropdown-submenu-trigger.component.js +95 -0
- package/esm2022/lib/components/interaction/dropdown-menu/component/dropdown-submenu-trigger.component.js.map +1 -0
- package/esm2022/lib/components/interaction/dropdown-menu/component/dropdown-submenu.component.js +631 -0
- package/esm2022/lib/components/interaction/dropdown-menu/component/dropdown-submenu.component.js.map +1 -0
- package/esm2022/lib/components/interaction/dropdown-menu/directives/dropdown-menu-trigger.directive.js +365 -0
- package/esm2022/lib/components/interaction/dropdown-menu/directives/dropdown-menu-trigger.directive.js.map +1 -0
- package/esm2022/lib/components/interaction/dropdown-menu/index.js +8 -0
- package/esm2022/lib/components/interaction/dropdown-menu/index.js.map +1 -0
- package/esm2022/lib/components/interaction/dropdown-menu/model/dropdown-menu-navigation.js +3 -0
- package/esm2022/lib/components/interaction/dropdown-menu/model/dropdown-menu-navigation.js.map +1 -0
- package/esm2022/lib/components/interaction/dropdown-menu/model/dropdown-menu.types.js +1 -0
- package/esm2022/lib/components/interaction/dropdown-menu/model/dropdown-menu.types.js.map +1 -0
- package/esm2022/lib/components/interaction/dropdown-menu/model/dropdown-submenu.types.js +1 -0
- package/esm2022/lib/components/interaction/dropdown-menu/model/dropdown-submenu.types.js.map +1 -0
- package/esm2022/lib/components/interaction/popover/component/popover-panel.component.js +2 -2
- package/esm2022/lib/components/interaction/popover/component/popover-panel.component.js.map +1 -1
- package/esm2022/lib/components/interaction/popover/directives/popover-trigger.directive.js +28 -20
- package/esm2022/lib/components/interaction/popover/directives/popover-trigger.directive.js.map +1 -1
- package/esm2022/lib/components/interaction/tooltip/component/tooltip-panel.component.js.map +1 -1
- package/esm2022/lib/components/interaction/tooltip/directive/tooltip.directive.js.map +1 -1
- package/esm2022/lib/components/interaction/tooltip/model/tooltip-position.js.map +1 -1
- package/esm2022/lib/components/navigation/editable-tabs/component/editable-tabs.component.js +323 -0
- package/esm2022/lib/components/navigation/editable-tabs/component/editable-tabs.component.js.map +1 -0
- package/esm2022/lib/components/navigation/editable-tabs/editable-tab/editable-tab.component.js +34 -0
- package/esm2022/lib/components/navigation/editable-tabs/editable-tab/editable-tab.component.js.map +1 -0
- package/esm2022/lib/components/navigation/editable-tabs/model/editable-tabs.types.js +1 -0
- package/esm2022/lib/components/navigation/editable-tabs/model/editable-tabs.types.js.map +1 -0
- package/esm2022/lib/components/navigation/segmented-control/component/segmented-control.component.js +242 -0
- package/esm2022/lib/components/navigation/segmented-control/component/segmented-control.component.js.map +1 -0
- package/esm2022/lib/components/navigation/segmented-control/item/segmented-item.component.js +197 -0
- package/esm2022/lib/components/navigation/segmented-control/item/segmented-item.component.js.map +1 -0
- package/esm2022/lib/components/navigation/segmented-control/model/segmented-control.types.js +1 -0
- package/esm2022/lib/components/navigation/segmented-control/model/segmented-control.types.js.map +1 -0
- package/esm2022/lib/components/navigation/segmented-control/token/segmented-control.tokens.js +3 -0
- package/esm2022/lib/components/navigation/segmented-control/token/segmented-control.tokens.js.map +1 -0
- package/esm2022/lib/components/navigation/stepper/actions/stepper-actions.component.js +15 -0
- package/esm2022/lib/components/navigation/stepper/actions/stepper-actions.component.js.map +1 -0
- package/esm2022/lib/components/navigation/stepper/component/stepper.component.js +99 -0
- package/esm2022/lib/components/navigation/stepper/component/stepper.component.js.map +1 -0
- package/esm2022/lib/components/navigation/stepper/content/stepper-content.component.js +13 -0
- package/esm2022/lib/components/navigation/stepper/content/stepper-content.component.js.map +1 -0
- package/esm2022/lib/components/navigation/stepper/model/stepper.types.js +1 -0
- package/esm2022/lib/components/navigation/stepper/model/stepper.types.js.map +1 -0
- package/esm2022/lib/components/navigation/stepper/step/step.component.js +91 -0
- package/esm2022/lib/components/navigation/stepper/step/step.component.js.map +1 -0
- package/esm2022/lib/components/navigation/stepper/token/stepper.tokens.js +3 -0
- package/esm2022/lib/components/navigation/stepper/token/stepper.tokens.js.map +1 -0
- package/esm2022/lib/components/navigation/tabs/component/tabs.component.js +169 -0
- package/esm2022/lib/components/navigation/tabs/component/tabs.component.js.map +1 -0
- package/esm2022/lib/components/navigation/tabs/index.js +5 -0
- package/esm2022/lib/components/navigation/tabs/index.js.map +1 -0
- package/esm2022/lib/components/navigation/tabs/model/tabs.types.js +1 -0
- package/esm2022/lib/components/navigation/tabs/model/tabs.types.js.map +1 -0
- package/esm2022/lib/components/navigation/tabs/tab/tab.component.js +195 -0
- package/esm2022/lib/components/navigation/tabs/tab/tab.component.js.map +1 -0
- package/esm2022/lib/components/navigation/tabs/tab-panel/tab-panel.component.js +55 -0
- package/esm2022/lib/components/navigation/tabs/tab-panel/tab-panel.component.js.map +1 -0
- package/esm2022/lib/components/navigation/tabs/token/tabs.tokens.js +3 -0
- package/esm2022/lib/components/navigation/tabs/token/tabs.tokens.js.map +1 -0
- package/esm2022/lib/components/overlay/dialog/component/dialog.component.js +49 -0
- package/esm2022/lib/components/overlay/dialog/component/dialog.component.js.map +1 -0
- package/esm2022/lib/components/overlay/dialog/components/dialog-actions.component.js +37 -0
- package/esm2022/lib/components/overlay/dialog/components/dialog-actions.component.js.map +1 -0
- package/esm2022/lib/components/overlay/dialog/components/dialog-content.component.js +13 -0
- package/esm2022/lib/components/overlay/dialog/components/dialog-content.component.js.map +1 -0
- package/esm2022/lib/components/overlay/dialog/components/dialog-header.component.js +32 -0
- package/esm2022/lib/components/overlay/dialog/components/dialog-header.component.js.map +1 -0
- package/esm2022/lib/components/overlay/dialog/container/dialog-container.component.js +142 -0
- package/esm2022/lib/components/overlay/dialog/container/dialog-container.component.js.map +1 -0
- package/esm2022/lib/components/overlay/dialog/flow/dialog-flow.component.js +56 -0
- package/esm2022/lib/components/overlay/dialog/flow/dialog-flow.component.js.map +1 -0
- package/esm2022/lib/components/overlay/dialog/flow/dialog-step.component.js +20 -0
- package/esm2022/lib/components/overlay/dialog/flow/dialog-step.component.js.map +1 -0
- package/esm2022/lib/components/overlay/dialog/model/dialog.types.js +1 -0
- package/esm2022/lib/components/overlay/dialog/model/dialog.types.js.map +1 -0
- package/esm2022/lib/components/overlay/dialog/provider/provide-solaris-dialog.js +13 -0
- package/esm2022/lib/components/overlay/dialog/provider/provide-solaris-dialog.js.map +1 -0
- package/esm2022/lib/components/overlay/dialog/service/dialog-ref.js +23 -0
- package/esm2022/lib/components/overlay/dialog/service/dialog-ref.js.map +1 -0
- package/esm2022/lib/components/overlay/dialog/service/dialog.service.js +111 -0
- package/esm2022/lib/components/overlay/dialog/service/dialog.service.js.map +1 -0
- package/esm2022/lib/components/overlay/dialog/token/dialog-data.token.js +4 -0
- package/esm2022/lib/components/overlay/dialog/token/dialog-data.token.js.map +1 -0
- package/esm2022/lib/components/overlay/dialog/token/dialog.tokens.js +15 -0
- package/esm2022/lib/components/overlay/dialog/token/dialog.tokens.js.map +1 -0
- package/esm2022/lib/services/icon/icons/groups/actions.js +242 -0
- package/esm2022/lib/services/icon/icons/groups/actions.js.map +1 -0
- package/esm2022/lib/services/icon/icons/groups/data.js +129 -0
- package/esm2022/lib/services/icon/icons/groups/data.js.map +1 -0
- package/esm2022/lib/services/icon/icons/groups/layout.js +50 -0
- package/esm2022/lib/services/icon/icons/groups/layout.js.map +1 -0
- package/esm2022/lib/services/icon/icons/groups/navigation.js +354 -0
- package/esm2022/lib/services/icon/icons/groups/navigation.js.map +1 -0
- package/esm2022/lib/services/icon/icons/groups/status.js +70 -0
- package/esm2022/lib/services/icon/icons/groups/status.js.map +1 -0
- package/esm2022/lib/services/icon/icons/groups/theme.js +49 -0
- package/esm2022/lib/services/icon/icons/groups/theme.js.map +1 -0
- package/esm2022/lib/services/icon/icons/solaris-built-in-icons.js +12 -204
- package/esm2022/lib/services/icon/icons/solaris-built-in-icons.js.map +1 -1
- package/esm2022/lib/services/icon/model/solaris-icon-definition.interface.js.map +1 -1
- package/esm2022/lib/services/icon/model/solaris-icon.types.js.map +1 -1
- package/esm2022/lib/services/translation/model/solaris-translate-defaults.js +56 -0
- package/esm2022/lib/services/translation/model/solaris-translate-defaults.js.map +1 -1
- package/index.d.ts +92 -1
- package/lib/components/actions/button/index.d.ts +3 -0
- package/lib/components/data-display/badge/index.d.ts +3 -0
- package/lib/components/data-display/divider/component/divider.component.d.ts +17 -0
- package/lib/components/data-display/divider/index.d.ts +2 -0
- package/lib/components/data-display/divider/model/divider.types.d.ts +5 -0
- package/lib/components/feedback/toast/component/toast.component.d.ts +62 -0
- package/lib/components/feedback/toast/container/toast-container.component.d.ts +10 -0
- package/lib/components/feedback/toast/model/toast.types.d.ts +106 -0
- package/lib/components/feedback/toast/provider/provide-solaris-toast.d.ts +3 -0
- package/lib/components/feedback/toast/service/toast.service.d.ts +36 -0
- package/lib/components/feedback/toast/token/toast.tokens.d.ts +5 -0
- package/lib/components/forms/email-field/component/email-field.component.d.ts +2 -1
- package/lib/components/forms/form-field/component/form-field.component.d.ts +6 -0
- package/lib/components/forms/multi-select/component/multi-select.component.d.ts +4 -7
- package/lib/components/forms/select/component/select.component.d.ts +2 -2
- package/lib/components/interaction/dropdown-menu/component/dropdown-menu-group.component.d.ts +10 -0
- package/lib/components/interaction/dropdown-menu/component/dropdown-menu-item.component.d.ts +28 -0
- package/lib/components/interaction/dropdown-menu/component/dropdown-menu-label.component.d.ts +7 -0
- package/lib/components/interaction/dropdown-menu/component/dropdown-menu.component.d.ts +21 -0
- package/lib/components/interaction/dropdown-menu/component/dropdown-submenu-trigger.component.d.ts +21 -0
- package/lib/components/interaction/dropdown-menu/component/dropdown-submenu.component.d.ts +68 -0
- package/lib/components/interaction/dropdown-menu/directives/dropdown-menu-trigger.directive.d.ts +61 -0
- package/lib/components/interaction/dropdown-menu/index.d.ts +9 -0
- package/lib/components/interaction/dropdown-menu/model/dropdown-menu-navigation.d.ts +8 -0
- package/lib/components/interaction/dropdown-menu/model/dropdown-menu.types.d.ts +11 -0
- package/lib/components/interaction/dropdown-menu/model/dropdown-submenu.types.d.ts +2 -0
- package/lib/components/navigation/editable-tabs/component/editable-tabs.component.d.ts +69 -0
- package/lib/components/navigation/editable-tabs/editable-tab/editable-tab.component.d.ts +20 -0
- package/lib/components/navigation/editable-tabs/model/editable-tabs.types.d.ts +60 -0
- package/lib/components/navigation/segmented-control/component/segmented-control.component.d.ts +64 -0
- package/lib/components/navigation/segmented-control/item/segmented-item.component.d.ts +35 -0
- package/lib/components/navigation/segmented-control/model/segmented-control.types.d.ts +12 -0
- package/lib/components/navigation/segmented-control/token/segmented-control.tokens.d.ts +22 -0
- package/lib/components/navigation/stepper/actions/stepper-actions.component.d.ts +7 -0
- package/lib/components/navigation/stepper/component/stepper.component.d.ts +36 -0
- package/lib/components/navigation/stepper/content/stepper-content.component.d.ts +5 -0
- package/lib/components/navigation/stepper/model/stepper.types.d.ts +15 -0
- package/lib/components/navigation/stepper/step/step.component.d.ts +27 -0
- package/lib/components/navigation/stepper/token/stepper.tokens.d.ts +13 -0
- package/lib/components/navigation/tabs/component/tabs.component.d.ts +47 -0
- package/lib/components/navigation/tabs/index.d.ts +6 -0
- package/lib/components/navigation/tabs/model/tabs.types.d.ts +17 -0
- package/lib/components/navigation/tabs/tab/tab.component.d.ts +38 -0
- package/lib/components/navigation/tabs/tab-panel/tab-panel.component.d.ts +15 -0
- package/lib/components/navigation/tabs/token/tabs.tokens.d.ts +19 -0
- package/lib/components/overlay/dialog/component/dialog.component.d.ts +29 -0
- package/lib/components/overlay/dialog/components/dialog-actions.component.d.ts +12 -0
- package/lib/components/overlay/dialog/components/dialog-content.component.d.ts +5 -0
- package/lib/components/overlay/dialog/components/dialog-header.component.d.ts +19 -0
- package/lib/components/overlay/dialog/container/dialog-container.component.d.ts +32 -0
- package/lib/components/overlay/dialog/flow/dialog-flow.component.d.ts +19 -0
- package/lib/components/overlay/dialog/flow/dialog-step.component.d.ts +7 -0
- package/lib/components/overlay/dialog/model/dialog.types.d.ts +87 -0
- package/lib/components/overlay/dialog/provider/provide-solaris-dialog.d.ts +3 -0
- package/lib/components/overlay/dialog/service/dialog-ref.d.ts +11 -0
- package/lib/components/overlay/dialog/service/dialog.service.d.ts +20 -0
- package/lib/components/overlay/dialog/token/dialog-data.token.d.ts +4 -0
- package/lib/components/overlay/dialog/token/dialog.tokens.d.ts +4 -0
- package/lib/services/icon/icons/groups/actions.d.ts +2 -0
- package/lib/services/icon/icons/groups/data.d.ts +2 -0
- package/lib/services/icon/icons/groups/layout.d.ts +2 -0
- package/lib/services/icon/icons/groups/navigation.d.ts +2 -0
- package/lib/services/icon/icons/groups/status.d.ts +2 -0
- package/lib/services/icon/icons/groups/theme.d.ts +2 -0
- package/lib/services/icon/model/solaris-icon-definition.interface.d.ts +10 -1
- package/lib/services/icon/model/solaris-icon.types.d.ts +1 -1
- package/package.json +1 -1
- package/styles/_dropdown-menu.scss +72 -0
- package/styles/_popover.scss +24 -19
- package/styles/_toast.scss +9 -0
- package/styles/_tooltip.scss +3 -3
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { Component, input, effect, signal, ViewChild, ViewContainerRef, inject, HostListener, ChangeDetectionStrategy, Injector, } from '@angular/core';
|
|
2
|
+
import { CdkTrapFocus } from '@angular/cdk/a11y';
|
|
3
|
+
import { SOLARIS_DIALOG_REF, SOLARIS_DIALOG_DATA, } from '../token/dialog-data.token';
|
|
4
|
+
import { SolarisDialogComponent } from '../component/dialog.component';
|
|
5
|
+
import * as i0 from "@angular/core";
|
|
6
|
+
export class SolarisDialogContainerComponent {
|
|
7
|
+
dialogRef = inject(SOLARIS_DIALOG_REF);
|
|
8
|
+
injector = inject(Injector);
|
|
9
|
+
externalComponent = input(null, ...(ngDevMode ? [{ debugName: "externalComponent" }] : /* istanbul ignore next */ []));
|
|
10
|
+
simpleOptions = input(null, ...(ngDevMode ? [{ debugName: "simpleOptions" }] : /* istanbul ignore next */ []));
|
|
11
|
+
externalComponentConfig = input(null, ...(ngDevMode ? [{ debugName: "externalComponentConfig" }] : /* istanbul ignore next */ []));
|
|
12
|
+
set componentHostRef(vcr) {
|
|
13
|
+
this._componentHost.set(vcr);
|
|
14
|
+
}
|
|
15
|
+
_componentHost = signal(undefined, ...(ngDevMode ? [{ debugName: "_componentHost" }] : /* istanbul ignore next */ []));
|
|
16
|
+
componentRef = null;
|
|
17
|
+
get hostAppearance() {
|
|
18
|
+
if (this.simpleOptions())
|
|
19
|
+
return this.simpleOptions()?.appearance ?? 'surface';
|
|
20
|
+
return this.externalComponentConfig()?.appearance ?? 'surface';
|
|
21
|
+
}
|
|
22
|
+
get hostSize() {
|
|
23
|
+
if (this.simpleOptions())
|
|
24
|
+
return this.simpleOptions()?.size ?? 'md';
|
|
25
|
+
return this.externalComponentConfig()?.size ?? 'md';
|
|
26
|
+
}
|
|
27
|
+
get hostVariant() {
|
|
28
|
+
if (this.simpleOptions())
|
|
29
|
+
return this.simpleOptions()?.variant ?? 'neutral';
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
get panelWidth() {
|
|
33
|
+
if (this.simpleOptions())
|
|
34
|
+
return this.simpleOptions()?.width ?? '';
|
|
35
|
+
return this.externalComponentConfig()?.width ?? '';
|
|
36
|
+
}
|
|
37
|
+
get panelHeight() {
|
|
38
|
+
if (this.simpleOptions())
|
|
39
|
+
return this.simpleOptions()?.height ?? '';
|
|
40
|
+
return this.externalComponentConfig()?.height ?? '';
|
|
41
|
+
}
|
|
42
|
+
get panelMinWidth() {
|
|
43
|
+
if (this.simpleOptions())
|
|
44
|
+
return this.simpleOptions()?.minWidth ?? '';
|
|
45
|
+
return this.externalComponentConfig()?.minWidth ?? '';
|
|
46
|
+
}
|
|
47
|
+
get panelMaxWidth() {
|
|
48
|
+
if (this.simpleOptions())
|
|
49
|
+
return this.simpleOptions()?.maxWidth ?? '';
|
|
50
|
+
return this.externalComponentConfig()?.maxWidth ?? '';
|
|
51
|
+
}
|
|
52
|
+
get panelMinHeight() {
|
|
53
|
+
if (this.simpleOptions())
|
|
54
|
+
return this.simpleOptions()?.minHeight ?? '';
|
|
55
|
+
return this.externalComponentConfig()?.minHeight ?? '';
|
|
56
|
+
}
|
|
57
|
+
get panelMaxHeight() {
|
|
58
|
+
if (this.simpleOptions())
|
|
59
|
+
return this.simpleOptions()?.maxHeight ?? '';
|
|
60
|
+
return this.externalComponentConfig()?.maxHeight ?? '';
|
|
61
|
+
}
|
|
62
|
+
get isSimpleMode() {
|
|
63
|
+
return this.simpleOptions() !== null;
|
|
64
|
+
}
|
|
65
|
+
get closeOnBackdrop() {
|
|
66
|
+
if (this.simpleOptions()) {
|
|
67
|
+
return this.simpleOptions()?.closeOnBackdropClick ?? true;
|
|
68
|
+
}
|
|
69
|
+
return this.externalComponentConfig()?.closeOnBackdropClick ?? true;
|
|
70
|
+
}
|
|
71
|
+
get closeOnEscapeEnabled() {
|
|
72
|
+
if (this.simpleOptions()) {
|
|
73
|
+
return this.simpleOptions()?.closeOnEscape ?? true;
|
|
74
|
+
}
|
|
75
|
+
return this.externalComponentConfig()?.closeOnEscape ?? true;
|
|
76
|
+
}
|
|
77
|
+
get dialogRole() {
|
|
78
|
+
if (this.simpleOptions())
|
|
79
|
+
return this.simpleOptions()?.role ?? 'dialog';
|
|
80
|
+
return this.externalComponentConfig()?.role ?? 'dialog';
|
|
81
|
+
}
|
|
82
|
+
constructor() {
|
|
83
|
+
effect(() => {
|
|
84
|
+
const comp = this.externalComponent();
|
|
85
|
+
const host = this._componentHost();
|
|
86
|
+
if (comp && host) {
|
|
87
|
+
this.createComponentInHost(comp);
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
createComponentInHost(compType) {
|
|
92
|
+
const host = this._componentHost();
|
|
93
|
+
if (!host)
|
|
94
|
+
return;
|
|
95
|
+
host.clear();
|
|
96
|
+
const providers = [
|
|
97
|
+
{ provide: SOLARIS_DIALOG_REF, useValue: this.dialogRef },
|
|
98
|
+
];
|
|
99
|
+
const data = this.externalComponentConfig()?.data;
|
|
100
|
+
if (data !== undefined) {
|
|
101
|
+
providers.push({ provide: SOLARIS_DIALOG_DATA, useValue: data });
|
|
102
|
+
}
|
|
103
|
+
const injector = Injector.create({
|
|
104
|
+
providers,
|
|
105
|
+
parent: this.injector,
|
|
106
|
+
});
|
|
107
|
+
this.componentRef = host.createComponent(compType, {
|
|
108
|
+
injector,
|
|
109
|
+
});
|
|
110
|
+
this.dialogRef.componentInstance = this.componentRef.instance;
|
|
111
|
+
}
|
|
112
|
+
onEscapePress() {
|
|
113
|
+
if (this.closeOnEscapeEnabled) {
|
|
114
|
+
this.dialogRef.close();
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
onBackdropClick(event) {
|
|
118
|
+
const target = event.target;
|
|
119
|
+
if (this.closeOnBackdrop &&
|
|
120
|
+
target.classList.contains('solaris-dialog-backdrop')) {
|
|
121
|
+
this.dialogRef.close();
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: SolarisDialogContainerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
125
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.17", type: SolarisDialogContainerComponent, isStandalone: true, selector: "solaris-dialog-container", inputs: { externalComponent: { classPropertyName: "externalComponent", publicName: "externalComponent", isSignal: true, isRequired: false, transformFunction: null }, simpleOptions: { classPropertyName: "simpleOptions", publicName: "simpleOptions", isSignal: true, isRequired: false, transformFunction: null }, externalComponentConfig: { classPropertyName: "externalComponentConfig", publicName: "externalComponentConfig", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "document:keydown.escape": "onEscapePress()" }, properties: { "attr.data-size": "hostSize", "attr.data-variant": "hostVariant", "attr.data-appearance": "hostAppearance" }, classAttribute: "solaris-dialog-container" }, viewQueries: [{ propertyName: "componentHostRef", first: true, predicate: ["componentHost"], descendants: true, read: ViewContainerRef }], ngImport: i0, template: "<div\n class=\"solaris-dialog-backdrop\"\n tabindex=\"-1\"\n (click)=\"onBackdropClick($event)\"\n (keydown.escape)=\"onBackdropClick($event)\"\n>\n <div\n cdkTrapFocus\n cdkTrapFocusAutoCapture\n [attr.aria-modal]=\"true\"\n [attr.role]=\"dialogRole\"\n [style.width]=\"panelWidth\"\n class=\"solaris-dialog-panel\"\n [style.height]=\"panelHeight\"\n [style.min-width]=\"panelMinWidth\"\n [style.max-width]=\"panelMaxWidth\"\n [style.min-height]=\"panelMinHeight\"\n [style.max-height]=\"panelMaxHeight\"\n >\n @if (isSimpleMode) {\n <solaris-dialog [options]=\"simpleOptions()!\" />\n } @else {\n <ng-template #componentHost></ng-template>\n }\n </div>\n</div>\n", styles: [":host{--solaris-dialog-panel-padding: 0;--solaris-dialog-panel-min-width: 28rem;--solaris-dialog-backdrop-bg: var(--solaris-backdrop);--solaris-dialog-z-index: var(--solaris-z-index-modal);--solaris-dialog-panel-shadow: var(--solaris-shadow-lg);--solaris-dialog-panel-radius: var(--solaris-radius-lg);--solaris-dialog-panel-border: var(--solaris-border-default);--solaris-dialog-panel-bg: var( --solaris-surface-raised, var(--solaris-surface-base) );--solaris-dialog-panel-max-height: calc(100dvh - var(--solaris-spacing-8));--solaris-dialog-panel-max-width: calc(100vw - var(--solaris-spacing-8));inset:0;display:flex;overflow:hidden;position:fixed;align-items:center;justify-content:center;z-index:var(--solaris-dialog-z-index)}.solaris-dialog-backdrop{inset:0;display:flex;position:fixed;align-items:center;justify-content:center;background:var(--solaris-dialog-backdrop-bg)}.solaris-dialog-panel{display:flex;overflow:hidden;position:relative;flex-direction:column;box-sizing:border-box;background:var(--solaris-dialog-panel-bg);animation:solaris-dialog-enter .2s ease-out;box-shadow:var(--solaris-dialog-panel-shadow);max-width:var(--solaris-dialog-panel-max-width);min-width:var(--solaris-dialog-panel-min-width);border-radius:var(--solaris-dialog-panel-radius);max-height:var(--solaris-dialog-panel-max-height)}:host([data-appearance=outline]) .solaris-dialog-panel{border:1px solid var(--solaris-dialog-panel-border)}:host([data-size=sm]) .solaris-dialog-panel{width:56rem}:host([data-size=md]) .solaris-dialog-panel{width:72rem}:host([data-size=lg]) .solaris-dialog-panel{width:96rem}:host([data-size=xl]) .solaris-dialog-panel{width:128rem}:host([data-size=fullscreen]) .solaris-dialog-panel{width:100vw;height:100dvh;max-width:100vw;border-radius:0;max-height:100dvh}@keyframes solaris-dialog-enter{0%{opacity:0;transform:scale(.95)}to{opacity:1;transform:scale(1)}}@media(prefers-reduced-motion:reduce){.solaris-dialog-panel{animation:none}}:host-context([data-reduced-motion=true]) .solaris-dialog-panel{animation:none}\n"], dependencies: [{ kind: "directive", type: CdkTrapFocus, selector: "[cdkTrapFocus]", inputs: ["cdkTrapFocus", "cdkTrapFocusAutoCapture"], exportAs: ["cdkTrapFocus"] }, { kind: "component", type: SolarisDialogComponent, selector: "solaris-dialog", inputs: ["options"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
126
|
+
}
|
|
127
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: SolarisDialogContainerComponent, decorators: [{
|
|
128
|
+
type: Component,
|
|
129
|
+
args: [{ selector: 'solaris-dialog-container', standalone: true, imports: [CdkTrapFocus, SolarisDialogComponent], changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
130
|
+
'[attr.data-size]': 'hostSize',
|
|
131
|
+
class: 'solaris-dialog-container',
|
|
132
|
+
'[attr.data-variant]': 'hostVariant',
|
|
133
|
+
'[attr.data-appearance]': 'hostAppearance',
|
|
134
|
+
}, template: "<div\n class=\"solaris-dialog-backdrop\"\n tabindex=\"-1\"\n (click)=\"onBackdropClick($event)\"\n (keydown.escape)=\"onBackdropClick($event)\"\n>\n <div\n cdkTrapFocus\n cdkTrapFocusAutoCapture\n [attr.aria-modal]=\"true\"\n [attr.role]=\"dialogRole\"\n [style.width]=\"panelWidth\"\n class=\"solaris-dialog-panel\"\n [style.height]=\"panelHeight\"\n [style.min-width]=\"panelMinWidth\"\n [style.max-width]=\"panelMaxWidth\"\n [style.min-height]=\"panelMinHeight\"\n [style.max-height]=\"panelMaxHeight\"\n >\n @if (isSimpleMode) {\n <solaris-dialog [options]=\"simpleOptions()!\" />\n } @else {\n <ng-template #componentHost></ng-template>\n }\n </div>\n</div>\n", styles: [":host{--solaris-dialog-panel-padding: 0;--solaris-dialog-panel-min-width: 28rem;--solaris-dialog-backdrop-bg: var(--solaris-backdrop);--solaris-dialog-z-index: var(--solaris-z-index-modal);--solaris-dialog-panel-shadow: var(--solaris-shadow-lg);--solaris-dialog-panel-radius: var(--solaris-radius-lg);--solaris-dialog-panel-border: var(--solaris-border-default);--solaris-dialog-panel-bg: var( --solaris-surface-raised, var(--solaris-surface-base) );--solaris-dialog-panel-max-height: calc(100dvh - var(--solaris-spacing-8));--solaris-dialog-panel-max-width: calc(100vw - var(--solaris-spacing-8));inset:0;display:flex;overflow:hidden;position:fixed;align-items:center;justify-content:center;z-index:var(--solaris-dialog-z-index)}.solaris-dialog-backdrop{inset:0;display:flex;position:fixed;align-items:center;justify-content:center;background:var(--solaris-dialog-backdrop-bg)}.solaris-dialog-panel{display:flex;overflow:hidden;position:relative;flex-direction:column;box-sizing:border-box;background:var(--solaris-dialog-panel-bg);animation:solaris-dialog-enter .2s ease-out;box-shadow:var(--solaris-dialog-panel-shadow);max-width:var(--solaris-dialog-panel-max-width);min-width:var(--solaris-dialog-panel-min-width);border-radius:var(--solaris-dialog-panel-radius);max-height:var(--solaris-dialog-panel-max-height)}:host([data-appearance=outline]) .solaris-dialog-panel{border:1px solid var(--solaris-dialog-panel-border)}:host([data-size=sm]) .solaris-dialog-panel{width:56rem}:host([data-size=md]) .solaris-dialog-panel{width:72rem}:host([data-size=lg]) .solaris-dialog-panel{width:96rem}:host([data-size=xl]) .solaris-dialog-panel{width:128rem}:host([data-size=fullscreen]) .solaris-dialog-panel{width:100vw;height:100dvh;max-width:100vw;border-radius:0;max-height:100dvh}@keyframes solaris-dialog-enter{0%{opacity:0;transform:scale(.95)}to{opacity:1;transform:scale(1)}}@media(prefers-reduced-motion:reduce){.solaris-dialog-panel{animation:none}}:host-context([data-reduced-motion=true]) .solaris-dialog-panel{animation:none}\n"] }]
|
|
135
|
+
}], ctorParameters: () => [], propDecorators: { externalComponent: [{ type: i0.Input, args: [{ isSignal: true, alias: "externalComponent", required: false }] }], simpleOptions: [{ type: i0.Input, args: [{ isSignal: true, alias: "simpleOptions", required: false }] }], externalComponentConfig: [{ type: i0.Input, args: [{ isSignal: true, alias: "externalComponentConfig", required: false }] }], componentHostRef: [{
|
|
136
|
+
type: ViewChild,
|
|
137
|
+
args: ['componentHost', { read: ViewContainerRef }]
|
|
138
|
+
}], onEscapePress: [{
|
|
139
|
+
type: HostListener,
|
|
140
|
+
args: ['document:keydown.escape']
|
|
141
|
+
}] } });
|
|
142
|
+
//# sourceMappingURL=dialog-container.component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dialog-container.component.js","sourceRoot":"","sources":["../../../../../../../../../packages/angular/src/lib/components/overlay/dialog/container/dialog-container.component.ts","../../../../../../../../../packages/angular/src/lib/components/overlay/dialog/container/dialog-container.component.html"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,KAAK,EACL,MAAM,EACN,MAAM,EACN,SAAS,EACT,gBAAgB,EAChB,MAAM,EACN,YAAY,EACZ,uBAAuB,EAGvB,QAAQ,GAET,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,OAAO,EACL,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,4BAA4B,CAAC;AAKpC,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;;AAiBvE,MAAM,OAAO,+BAA+B;IACzB,SAAS,GAAG,MAAM,CAAC,kBAAkB,CAAqB,CAAC;IAC3D,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;IAEpC,iBAAiB,GAAG,KAAK,CAAuB,IAAI,wFAAC,CAAC;IACtD,aAAa,GAAG,KAAK,CAA8B,IAAI,oFAAC,CAAC;IACzD,uBAAuB,GAAG,KAAK,CACtC,IAAI,8FACL,CAAC;IAEF,IACI,gBAAgB,CAAC,GAAiC;QACpD,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC/B,CAAC;IAEgB,cAAc,GAAG,MAAM,CACtC,SAAS,qFACV,CAAC;IAEM,YAAY,GAAiC,IAAI,CAAC;IAE1D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AC;IACH,CAAC;IAES,eAAe,CAAC,KAAY;QACpC,MAAM,MAAM,GAAG,KAAK,CAAC,MAAqB,CAAC;QAC3C,IACE,IAAI,CAAC,eAAe;YACpB,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,yBAAyB,CAAC,EACpD,CAAC;YACD,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC;QACzB,CAAC;IACH,CAAC;wGA5IU,+BAA+B;4FAA/B,+BAA+B,u4BAUN,gBAAgB,6BCpDtD,qtBA0BA,4iEDKY,YAAY,4IAAE,sBAAsB;;4FAWnC,+BAA+B;kBAd3C,SAAS;+BACE,0BAA0B,cACxB,IAAI,WACP,CAAC,YAAY,EAAE,sBAAsB,CAAC,mBAG9B,uBAAuB,CAAC,MAAM,QACzC;wBACJ,kBAAkB,EAAE,UAAU;wBAC9B,KAAK,EAAE,0BAA0B;wBACjC,qBAAqB,EAAE,aAAa;wBACpC,wBAAwB,EAAE,gBAAgB;qBAC3C;;sBAYA,SAAS;uBAAC,eAAe,EAAE,EAAE,IAAI,EAAE,gBAAgB,EAAE;;sBAmHrD,YAAY;uBAAC,yBAAyB","sourcesContent":["import {\n Component,\n input,\n effect,\n signal,\n ViewChild,\n ViewContainerRef,\n inject,\n HostListener,\n ChangeDetectionStrategy,\n type Type,\n type ComponentRef,\n Injector,\n type Provider,\n} from '@angular/core';\nimport { CdkTrapFocus } from '@angular/cdk/a11y';\n\nimport {\n SOLARIS_DIALOG_REF,\n SOLARIS_DIALOG_DATA,\n} from '../token/dialog-data.token';\nimport type {\n SolarisDialogOptions,\n SolarisDialogComponentConfig,\n} from '../model/dialog.types';\nimport { SolarisDialogComponent } from '../component/dialog.component';\nimport { SolarisDialogRef } from '../service/dialog-ref';\n\n@Component({\n selector: 'solaris-dialog-container',\n standalone: true,\n imports: [CdkTrapFocus, SolarisDialogComponent],\n templateUrl: './dialog-container.component.html',\n styleUrls: ['./dialog-container.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n '[attr.data-size]': 'hostSize',\n class: 'solaris-dialog-container',\n '[attr.data-variant]': 'hostVariant',\n '[attr.data-appearance]': 'hostAppearance',\n },\n})\nexport class SolarisDialogContainerComponent {\n private readonly dialogRef = inject(SOLARIS_DIALOG_REF) as SolarisDialogRef;\n private readonly injector = inject(Injector);\n\n readonly externalComponent = input<Type<unknown> | null>(null);\n readonly simpleOptions = input<SolarisDialogOptions | null>(null);\n readonly externalComponentConfig = input<SolarisDialogComponentConfig | null>(\n null,\n );\n\n @ViewChild('componentHost', { read: ViewContainerRef })\n set componentHostRef(vcr: ViewContainerRef | undefined) {\n this._componentHost.set(vcr);\n }\n\n private readonly _componentHost = signal<ViewContainerRef | undefined>(\n undefined,\n );\n\n private componentRef: ComponentRef<unknown> | null = null;\n\n protected get hostAppearance(): string {\n if (this.simpleOptions())\n return this.simpleOptions()?.appearance ?? 'surface';\n return this.externalComponentConfig()?.appearance ?? 'surface';\n }\n\n protected get hostSize(): string {\n if (this.simpleOptions()) return this.simpleOptions()?.size ?? 'md';\n return this.externalComponentConfig()?.size ?? 'md';\n }\n\n protected get hostVariant(): string | undefined | null {\n if (this.simpleOptions()) return this.simpleOptions()?.variant ?? 'neutral';\n return null;\n }\n\n protected get panelWidth(): string {\n if (this.simpleOptions()) return this.simpleOptions()?.width ?? '';\n return this.externalComponentConfig()?.width ?? '';\n }\n\n protected get panelHeight(): string {\n if (this.simpleOptions()) return this.simpleOptions()?.height ?? '';\n return this.externalComponentConfig()?.height ?? '';\n }\n\n protected get panelMinWidth(): string {\n if (this.simpleOptions()) return this.simpleOptions()?.minWidth ?? '';\n return this.externalComponentConfig()?.minWidth ?? '';\n }\n\n protected get panelMaxWidth(): string {\n if (this.simpleOptions()) return this.simpleOptions()?.maxWidth ?? '';\n return this.externalComponentConfig()?.maxWidth ?? '';\n }\n\n protected get panelMinHeight(): string {\n if (this.simpleOptions()) return this.simpleOptions()?.minHeight ?? '';\n return this.externalComponentConfig()?.minHeight ?? '';\n }\n\n protected get panelMaxHeight(): string {\n if (this.simpleOptions()) return this.simpleOptions()?.maxHeight ?? '';\n return this.externalComponentConfig()?.maxHeight ?? '';\n }\n\n protected get isSimpleMode(): boolean {\n return this.simpleOptions() !== null;\n }\n\n protected get closeOnBackdrop(): boolean {\n if (this.simpleOptions()) {\n return this.simpleOptions()?.closeOnBackdropClick ?? true;\n }\n return this.externalComponentConfig()?.closeOnBackdropClick ?? true;\n }\n\n protected get closeOnEscapeEnabled(): boolean {\n if (this.simpleOptions()) {\n return this.simpleOptions()?.closeOnEscape ?? true;\n }\n return this.externalComponentConfig()?.closeOnEscape ?? true;\n }\n\n protected get dialogRole(): string {\n if (this.simpleOptions()) return this.simpleOptions()?.role ?? 'dialog';\n return this.externalComponentConfig()?.role ?? 'dialog';\n }\n\n constructor() {\n effect(() => {\n const comp = this.externalComponent();\n const host = this._componentHost();\n if (comp && host) {\n this.createComponentInHost(comp);\n }\n });\n }\n\n private createComponentInHost(compType: Type<unknown>): void {\n const host = this._componentHost();\n if (!host) return;\n host.clear();\n\n const providers: Provider[] = [\n { provide: SOLARIS_DIALOG_REF, useValue: this.dialogRef },\n ];\n const data = this.externalComponentConfig()?.data;\n if (data !== undefined) {\n providers.push({ provide: SOLARIS_DIALOG_DATA, useValue: data });\n }\n\n const injector = Injector.create({\n providers,\n parent: this.injector,\n });\n\n this.componentRef = host.createComponent(compType, {\n injector,\n });\n\n this.dialogRef.componentInstance = this.componentRef.instance;\n }\n\n @HostListener('document:keydown.escape')\n protected onEscapePress(): void {\n if (this.closeOnEscapeEnabled) {\n this.dialogRef.close();\n }\n }\n\n protected onBackdropClick(event: Event): void {\n const target = event.target as HTMLElement;\n if (\n this.closeOnBackdrop &&\n target.classList.contains('solaris-dialog-backdrop')\n ) {\n this.dialogRef.close();\n }\n }\n}\n","<div\n class=\"solaris-dialog-backdrop\"\n tabindex=\"-1\"\n (click)=\"onBackdropClick($event)\"\n (keydown.escape)=\"onBackdropClick($event)\"\n>\n <div\n cdkTrapFocus\n cdkTrapFocusAutoCapture\n [attr.aria-modal]=\"true\"\n [attr.role]=\"dialogRole\"\n [style.width]=\"panelWidth\"\n class=\"solaris-dialog-panel\"\n [style.height]=\"panelHeight\"\n [style.min-width]=\"panelMinWidth\"\n [style.max-width]=\"panelMaxWidth\"\n [style.min-height]=\"panelMinHeight\"\n [style.max-height]=\"panelMaxHeight\"\n >\n @if (isSimpleMode) {\n <solaris-dialog [options]=\"simpleOptions()!\" />\n } @else {\n <ng-template #componentHost></ng-template>\n }\n </div>\n</div>\n"]}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { Component, input, model, ContentChildren, effect, signal, ChangeDetectionStrategy, } from '@angular/core';
|
|
2
|
+
import { NgTemplateOutlet } from '@angular/common';
|
|
3
|
+
import { SolarisDialogStepComponent } from './dialog-step.component';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
export class SolarisDialogFlowComponent {
|
|
6
|
+
activeIndex = model(0, ...(ngDevMode ? [{ debugName: "activeIndex" }] : /* istanbul ignore next */ []));
|
|
7
|
+
transition = input('slide', ...(ngDevMode ? [{ debugName: "transition" }] : /* istanbul ignore next */ []));
|
|
8
|
+
steps;
|
|
9
|
+
stepTemplates = signal([], ...(ngDevMode ? [{ debugName: "stepTemplates" }] : /* istanbul ignore next */ []));
|
|
10
|
+
animationDirection = signal(null, ...(ngDevMode ? [{ debugName: "animationDirection" }] : /* istanbul ignore next */ []));
|
|
11
|
+
previousIndex = 0;
|
|
12
|
+
hasNavigated = false;
|
|
13
|
+
constructor() {
|
|
14
|
+
effect(() => {
|
|
15
|
+
const current = this.activeIndex();
|
|
16
|
+
if (this.hasNavigated) {
|
|
17
|
+
if (current > this.previousIndex) {
|
|
18
|
+
this.animationDirection.set('forward');
|
|
19
|
+
}
|
|
20
|
+
else if (current < this.previousIndex) {
|
|
21
|
+
this.animationDirection.set('backward');
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
this.previousIndex = current;
|
|
25
|
+
this.hasNavigated = true;
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
ngAfterContentInit() {
|
|
29
|
+
if (this.steps) {
|
|
30
|
+
this.stepTemplates.set(this.steps.toArray().map((s, i) => ({
|
|
31
|
+
template: s.templateRef,
|
|
32
|
+
index: i,
|
|
33
|
+
})));
|
|
34
|
+
this.steps.changes.subscribe(() => {
|
|
35
|
+
this.stepTemplates.set((this.steps?.toArray() ?? []).map((s, i) => ({
|
|
36
|
+
template: s.templateRef,
|
|
37
|
+
index: i,
|
|
38
|
+
})));
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: SolarisDialogFlowComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
43
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.17", type: SolarisDialogFlowComponent, isStandalone: true, selector: "solaris-dialog-flow", inputs: { activeIndex: { classPropertyName: "activeIndex", publicName: "activeIndex", isSignal: true, isRequired: false, transformFunction: null }, transition: { classPropertyName: "transition", publicName: "transition", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { activeIndex: "activeIndexChange" }, host: { properties: { "attr.data-transition": "transition()", "attr.data-direction": "animationDirection()" }, classAttribute: "solaris-dialog-flow" }, queries: [{ propertyName: "steps", predicate: SolarisDialogStepComponent }], ngImport: i0, template: "<div class=\"solaris-dialog-flow__stage\">\n <div class=\"solaris-dialog-flow__steps\">\n @for (step of stepTemplates(); track step.index) {\n <div\n class=\"solaris-dialog-flow__step\"\n [class.solaris-dialog-flow__step--active]=\"step.index === activeIndex()\"\n [class.solaris-dialog-flow__step--exit]=\"step.index !== activeIndex()\"\n >\n <ng-container [ngTemplateOutlet]=\"step.template\" />\n </div>\n }\n </div>\n\n <div class=\"solaris-dialog-flow__footer\">\n <ng-content select=\"[solaris-dialog-flow-footer]\" />\n </div>\n</div>\n", styles: ["@keyframes slide-in-forward{0%{opacity:0;transform:translate(var(--solaris-spacing-20))}to{opacity:1;transform:translate(0)}}@keyframes slide-out-forward{0%{opacity:1;transform:translate(0)}to{opacity:0;transform:translate(calc(var(--solaris-spacing-20) * -1))}}@keyframes slide-in-backward{0%{opacity:0;transform:translate(calc(var(--solaris-spacing-20) * -1))}to{opacity:1;transform:translate(0)}}@keyframes slide-out-backward{0%{opacity:1;transform:translate(0)}to{opacity:0;transform:translate(var(--solaris-spacing-20))}}:host{flex:1;min-height:0;display:flex;flex-direction:column}.solaris-dialog-flow__stage{flex:1;min-height:0;display:flex;flex-direction:column}.solaris-dialog-flow__steps{flex:1;min-height:0;position:relative}.solaris-dialog-flow__step{inset:0;opacity:0;position:absolute;pointer-events:none}.solaris-dialog-flow__step--active{opacity:1;pointer-events:auto}:host([data-direction=forward]) .solaris-dialog-flow__step--active{animation:slide-in-forward var(--solaris-motion-duration-normal) var(--solaris-motion-easing-standard) both}:host([data-direction=backward]) .solaris-dialog-flow__step--active{animation:slide-in-backward var(--solaris-motion-duration-normal) var(--solaris-motion-easing-standard) both}:host([data-direction=forward]) .solaris-dialog-flow__step--exit{animation:slide-out-forward var(--solaris-motion-duration-normal) var(--solaris-motion-easing-standard) both}:host([data-direction=backward]) .solaris-dialog-flow__step--exit{animation:slide-out-backward var(--solaris-motion-duration-normal) var(--solaris-motion-easing-standard) both}.solaris-dialog-flow__footer{opacity:1;transform:none}:host([data-transition=fade]) .solaris-dialog-flow__step--active,:host([data-transition=fade]) .solaris-dialog-flow__step--exit{animation-name:none}:host([data-transition=fade]) .solaris-dialog-flow__step--active{opacity:1;transition:opacity var(--solaris-motion-duration-normal) var(--solaris-motion-easing-standard)}:host([data-transition=fade]) .solaris-dialog-flow__step--exit{opacity:0;transition:opacity var(--solaris-motion-duration-normal) var(--solaris-motion-easing-standard)}:host([data-transition=none]) .solaris-dialog-flow__step--active,:host([data-transition=none]) .solaris-dialog-flow__step--exit{animation:none;transition:none}@media(prefers-reduced-motion:reduce){.solaris-dialog-flow__step--active,.solaris-dialog-flow__step--exit{animation-name:none}.solaris-dialog-flow__step--active{opacity:1;transition:opacity var(--solaris-motion-duration-fast) var(--solaris-motion-easing-standard)}.solaris-dialog-flow__step--exit{opacity:0;transition:opacity var(--solaris-motion-duration-fast) var(--solaris-motion-easing-standard)}}:host-context([data-reduced-motion=true]) .solaris-dialog-flow__step--active,:host-context([data-reduced-motion=true]) .solaris-dialog-flow__step--exit{animation-name:none}:host-context([data-reduced-motion=true]) .solaris-dialog-flow__step--active{opacity:1;transition:opacity var(--solaris-motion-duration-fast) var(--solaris-motion-easing-standard)}:host-context([data-reduced-motion=true]) .solaris-dialog-flow__step--exit{opacity:0;transition:opacity var(--solaris-motion-duration-fast) var(--solaris-motion-easing-standard)}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
44
|
+
}
|
|
45
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: SolarisDialogFlowComponent, decorators: [{
|
|
46
|
+
type: Component,
|
|
47
|
+
args: [{ selector: 'solaris-dialog-flow', standalone: true, imports: [NgTemplateOutlet], changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
48
|
+
class: 'solaris-dialog-flow',
|
|
49
|
+
'[attr.data-transition]': 'transition()',
|
|
50
|
+
'[attr.data-direction]': 'animationDirection()',
|
|
51
|
+
}, template: "<div class=\"solaris-dialog-flow__stage\">\n <div class=\"solaris-dialog-flow__steps\">\n @for (step of stepTemplates(); track step.index) {\n <div\n class=\"solaris-dialog-flow__step\"\n [class.solaris-dialog-flow__step--active]=\"step.index === activeIndex()\"\n [class.solaris-dialog-flow__step--exit]=\"step.index !== activeIndex()\"\n >\n <ng-container [ngTemplateOutlet]=\"step.template\" />\n </div>\n }\n </div>\n\n <div class=\"solaris-dialog-flow__footer\">\n <ng-content select=\"[solaris-dialog-flow-footer]\" />\n </div>\n</div>\n", styles: ["@keyframes slide-in-forward{0%{opacity:0;transform:translate(var(--solaris-spacing-20))}to{opacity:1;transform:translate(0)}}@keyframes slide-out-forward{0%{opacity:1;transform:translate(0)}to{opacity:0;transform:translate(calc(var(--solaris-spacing-20) * -1))}}@keyframes slide-in-backward{0%{opacity:0;transform:translate(calc(var(--solaris-spacing-20) * -1))}to{opacity:1;transform:translate(0)}}@keyframes slide-out-backward{0%{opacity:1;transform:translate(0)}to{opacity:0;transform:translate(var(--solaris-spacing-20))}}:host{flex:1;min-height:0;display:flex;flex-direction:column}.solaris-dialog-flow__stage{flex:1;min-height:0;display:flex;flex-direction:column}.solaris-dialog-flow__steps{flex:1;min-height:0;position:relative}.solaris-dialog-flow__step{inset:0;opacity:0;position:absolute;pointer-events:none}.solaris-dialog-flow__step--active{opacity:1;pointer-events:auto}:host([data-direction=forward]) .solaris-dialog-flow__step--active{animation:slide-in-forward var(--solaris-motion-duration-normal) var(--solaris-motion-easing-standard) both}:host([data-direction=backward]) .solaris-dialog-flow__step--active{animation:slide-in-backward var(--solaris-motion-duration-normal) var(--solaris-motion-easing-standard) both}:host([data-direction=forward]) .solaris-dialog-flow__step--exit{animation:slide-out-forward var(--solaris-motion-duration-normal) var(--solaris-motion-easing-standard) both}:host([data-direction=backward]) .solaris-dialog-flow__step--exit{animation:slide-out-backward var(--solaris-motion-duration-normal) var(--solaris-motion-easing-standard) both}.solaris-dialog-flow__footer{opacity:1;transform:none}:host([data-transition=fade]) .solaris-dialog-flow__step--active,:host([data-transition=fade]) .solaris-dialog-flow__step--exit{animation-name:none}:host([data-transition=fade]) .solaris-dialog-flow__step--active{opacity:1;transition:opacity var(--solaris-motion-duration-normal) var(--solaris-motion-easing-standard)}:host([data-transition=fade]) .solaris-dialog-flow__step--exit{opacity:0;transition:opacity var(--solaris-motion-duration-normal) var(--solaris-motion-easing-standard)}:host([data-transition=none]) .solaris-dialog-flow__step--active,:host([data-transition=none]) .solaris-dialog-flow__step--exit{animation:none;transition:none}@media(prefers-reduced-motion:reduce){.solaris-dialog-flow__step--active,.solaris-dialog-flow__step--exit{animation-name:none}.solaris-dialog-flow__step--active{opacity:1;transition:opacity var(--solaris-motion-duration-fast) var(--solaris-motion-easing-standard)}.solaris-dialog-flow__step--exit{opacity:0;transition:opacity var(--solaris-motion-duration-fast) var(--solaris-motion-easing-standard)}}:host-context([data-reduced-motion=true]) .solaris-dialog-flow__step--active,:host-context([data-reduced-motion=true]) .solaris-dialog-flow__step--exit{animation-name:none}:host-context([data-reduced-motion=true]) .solaris-dialog-flow__step--active{opacity:1;transition:opacity var(--solaris-motion-duration-fast) var(--solaris-motion-easing-standard)}:host-context([data-reduced-motion=true]) .solaris-dialog-flow__step--exit{opacity:0;transition:opacity var(--solaris-motion-duration-fast) var(--solaris-motion-easing-standard)}\n"] }]
|
|
52
|
+
}], ctorParameters: () => [], propDecorators: { activeIndex: [{ type: i0.Input, args: [{ isSignal: true, alias: "activeIndex", required: false }] }, { type: i0.Output, args: ["activeIndexChange"] }], transition: [{ type: i0.Input, args: [{ isSignal: true, alias: "transition", required: false }] }], steps: [{
|
|
53
|
+
type: ContentChildren,
|
|
54
|
+
args: [SolarisDialogStepComponent]
|
|
55
|
+
}] } });
|
|
56
|
+
//# sourceMappingURL=dialog-flow.component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dialog-flow.component.js","sourceRoot":"","sources":["../../../../../../../../../packages/angular/src/lib/components/overlay/dialog/flow/dialog-flow.component.ts","../../../../../../../../../packages/angular/src/lib/components/overlay/dialog/flow/dialog-flow.component.html"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,KAAK,EACL,KAAK,EACL,eAAe,EAGf,MAAM,EACN,MAAM,EACN,uBAAuB,GACxB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,gBAAgB,EAAE,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CAAC,OAAO,CAAC,SAAS,CAAC,GAAG,EAAE;gBAChC,IAAI,CAAC,aAAa,CAAC,GAAG,CACpB,CAAC,IAAI,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;oBAC3C,QAAQ,EAAE,CAAC,CAAC,WAAW;oBACvB,KAAK,EAAE,CAAC;iBACT,CAAC,CAAC,CACJ,CAAC;YACJ,CAAC,CAAC,CAAC;QACL,CAAC;IACH,CAAC;wGAtDU,0BAA0B;4FAA1B,0BAA0B,ykBAIpB,0BAA0B,6BChC7C,ylBAiBA,4sGDCY,gBAAgB;;4FAUf,0BAA0B;kBAbtC,SAAS;+BACE,qBAAqB,cACnB,IAAI,WACP,CAAC,gBAAgB,CAAC,mBAGV,uBAAuB,CAAC,MAAM,QACzC;wBACJ,KAAK,EAAE,qBAAqB;wBAC5B,wBAAwB,EAAE,cAAc;wBACxC,uBAAuB,EAAE,sBAAsB;qBAChD;;sBAMA,eAAe;uBAAC,0BAA0B","sourcesContent":["import {\n Component,\n input,\n model,\n ContentChildren,\n QueryList,\n AfterContentInit,\n effect,\n signal,\n ChangeDetectionStrategy,\n} from '@angular/core';\nimport { NgTemplateOutlet } from '@angular/common';\n\nimport { SolarisDialogStepComponent } from './dialog-step.component';\n\n@Component({\n selector: 'solaris-dialog-flow',\n standalone: true,\n imports: [NgTemplateOutlet],\n templateUrl: './dialog-flow.component.html',\n styleUrls: ['./dialog-flow.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n class: 'solaris-dialog-flow',\n '[attr.data-transition]': 'transition()',\n '[attr.data-direction]': 'animationDirection()',\n },\n})\nexport class SolarisDialogFlowComponent implements AfterContentInit {\n readonly activeIndex = model<number>(0);\n readonly transition = input<'slide' | 'fade' | 'none'>('slide');\n\n @ContentChildren(SolarisDialogStepComponent)\n steps?: QueryList<SolarisDialogStepComponent>;\n\n protected readonly stepTemplates = signal<\n {\n template: import('@angular/core').TemplateRef<unknown>;\n index: number;\n }[]\n >([]);\n\n protected readonly animationDirection = signal<'forward' | 'backward' | null>(\n null,\n );\n\n private previousIndex = 0;\n private hasNavigated = false;\n\n constructor() {\n effect(() => {\n const current = this.activeIndex();\n if (this.hasNavigated) {\n if (current > this.previousIndex) {\n this.animationDirection.set('forward');\n } else if (current < this.previousIndex) {\n this.animationDirection.set('backward');\n }\n }\n this.previousIndex = current;\n this.hasNavigated = true;\n });\n }\n\n ngAfterContentInit(): void {\n if (this.steps) {\n this.stepTemplates.set(\n this.steps.toArray().map((s, i) => ({\n template: s.templateRef,\n index: i,\n })),\n );\n\n this.steps.changes.subscribe(() => {\n this.stepTemplates.set(\n (this.steps?.toArray() ?? []).map((s, i) => ({\n template: s.templateRef,\n index: i,\n })),\n );\n });\n }\n }\n}\n","<div class=\"solaris-dialog-flow__stage\">\n <div class=\"solaris-dialog-flow__steps\">\n @for (step of stepTemplates(); track step.index) {\n <div\n class=\"solaris-dialog-flow__step\"\n [class.solaris-dialog-flow__step--active]=\"step.index === activeIndex()\"\n [class.solaris-dialog-flow__step--exit]=\"step.index !== activeIndex()\"\n >\n <ng-container [ngTemplateOutlet]=\"step.template\" />\n </div>\n }\n </div>\n\n <div class=\"solaris-dialog-flow__footer\">\n <ng-content select=\"[solaris-dialog-flow-footer]\" />\n </div>\n</div>\n"]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Component, TemplateRef, ViewChild, ChangeDetectionStrategy, } from '@angular/core';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
export class SolarisDialogStepComponent {
|
|
4
|
+
templateRef;
|
|
5
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: SolarisDialogStepComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
6
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.17", type: SolarisDialogStepComponent, isStandalone: true, selector: "solaris-dialog-step", viewQueries: [{ propertyName: "templateRef", first: true, predicate: TemplateRef, descendants: true, static: true }], ngImport: i0, template: '<ng-template><ng-content /></ng-template>', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
7
|
+
}
|
|
8
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: SolarisDialogStepComponent, decorators: [{
|
|
9
|
+
type: Component,
|
|
10
|
+
args: [{
|
|
11
|
+
selector: 'solaris-dialog-step',
|
|
12
|
+
standalone: true,
|
|
13
|
+
template: '<ng-template><ng-content /></ng-template>',
|
|
14
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
15
|
+
}]
|
|
16
|
+
}], propDecorators: { templateRef: [{
|
|
17
|
+
type: ViewChild,
|
|
18
|
+
args: [TemplateRef, { static: true }]
|
|
19
|
+
}] } });
|
|
20
|
+
//# sourceMappingURL=dialog-step.component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dialog-step.component.js","sourceRoot":"","sources":["../../../../../../../../../packages/angular/src/lib/components/overlay/dialog/flow/dialog-step.component.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,WAAW,EACX,SAAS,EACT,uBAAuB,GACxB,MAAM,eAAe,CAAC;;AAQvB,MAAM,OAAO,0BAA0B;IAErC,WAAW,CAAwB;wGAFxB,0BAA0B;4FAA1B,0BAA0B,4HAC1B,WAAW,8DAJZ,2CAA2C;;4FAG1C,0BAA0B;kBANtC,SAAS;mBAAC;oBACT,QAAQ,EAAE,qBAAqB;oBAC/B,UAAU,EAAE,IAAI;oBAChB,QAAQ,EAAE,2CAA2C;oBACrD,eAAe,EAAE,uBAAuB,CAAC,MAAM;iBAChD;;sBAEE,SAAS;uBAAC,WAAW,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE","sourcesContent":["import {\n Component,\n TemplateRef,\n ViewChild,\n ChangeDetectionStrategy,\n} from '@angular/core';\n\n@Component({\n selector: 'solaris-dialog-step',\n standalone: true,\n template: '<ng-template><ng-content /></ng-template>',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class SolarisDialogStepComponent {\n @ViewChild(TemplateRef, { static: true })\n templateRef!: TemplateRef<unknown>;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=dialog.types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dialog.types.js","sourceRoot":"","sources":["../../../../../../../../../packages/angular/src/lib/components/overlay/dialog/model/dialog.types.ts"],"names":[],"mappings":"","sourcesContent":["export type SolarisDialogAppearance = 'surface' | 'outline';\n\nexport type SolarisDialogVariant =\n | 'neutral'\n | 'info'\n | 'success'\n | 'warning'\n | 'danger';\n\nexport type SolarisDialogSize = 'sm' | 'md' | 'lg' | 'xl' | 'fullscreen';\n\nexport type SolarisDialogActionsAlign =\n | 'start'\n | 'center'\n | 'end'\n | 'space-between';\n\nexport type SolarisDialogActionsStack = 'auto' | 'horizontal' | 'vertical';\n\nexport type SolarisDialogAutoFocus = 'first-tabbable' | 'panel' | false;\n\nexport type SolarisDialogRole = 'dialog' | 'alertdialog';\n\nexport type SolarisDialogButtonAppearance =\n | 'solid'\n | 'outline'\n | 'ghost'\n | 'tonal'\n | 'surface';\n\nexport type SolarisDialogButtonColor =\n | 'neutral'\n | 'primary'\n | 'success'\n | 'warning'\n | 'danger'\n | 'info'\n | 'custom';\n\nexport interface SolarisDialogAction<TResult = unknown> {\n label: string;\n labelKey?: string;\n appearance?: SolarisDialogButtonAppearance;\n color?: SolarisDialogButtonColor;\n disabled?: boolean;\n close?: boolean;\n result?: TResult;\n action?: (\n dialogRef: SolarisDialogRefInterface<TResult>,\n ) => void | Promise<void>;\n autoFocus?: boolean;\n}\n\nexport interface SolarisDialogOptions<TResult = unknown> {\n title?: string;\n titleKey?: string;\n description?: string;\n descriptionKey?: string;\n icon?: string;\n iconDecorative?: boolean;\n variant?: SolarisDialogVariant;\n appearance?: SolarisDialogAppearance;\n size?: SolarisDialogSize;\n width?: string;\n height?: string;\n minWidth?: string;\n maxWidth?: string;\n minHeight?: string;\n maxHeight?: string;\n closeable?: boolean;\n closeLabel?: string;\n closeLabelKey?: string;\n closeOnEscape?: boolean;\n closeOnBackdropClick?: boolean;\n autoFocus?: SolarisDialogAutoFocus;\n restoreFocus?: boolean;\n role?: SolarisDialogRole;\n ariaLabel?: string;\n ariaLabelKey?: string;\n ariaLabelledBy?: string;\n ariaDescribedBy?: string;\n actions?: SolarisDialogAction<TResult>[];\n actionsAlign?: SolarisDialogActionsAlign;\n actionsStack?: SolarisDialogActionsStack;\n data?: unknown;\n}\n\nexport interface SolarisDialogComponentConfig<TData = unknown> {\n width?: string;\n height?: string;\n minWidth?: string;\n maxWidth?: string;\n minHeight?: string;\n maxHeight?: string;\n data?: TData;\n closeable?: boolean;\n closeOnEscape?: boolean;\n closeOnBackdropClick?: boolean;\n autoFocus?: SolarisDialogAutoFocus;\n restoreFocus?: boolean;\n role?: SolarisDialogRole;\n appearance?: SolarisDialogAppearance;\n size?: SolarisDialogSize;\n}\n\nexport interface SolarisDialogConfig {\n appearance?: SolarisDialogAppearance;\n size?: SolarisDialogSize;\n closeable?: boolean;\n closeOnEscape?: boolean;\n closeOnBackdropClick?: boolean;\n autoFocus?: SolarisDialogAutoFocus;\n restoreFocus?: boolean;\n role?: SolarisDialogRole;\n actionsAlign?: SolarisDialogActionsAlign;\n actionsStack?: SolarisDialogActionsStack;\n}\n\nexport interface SolarisDialogRefInterface<TResult = unknown> {\n id: string;\n close(result?: TResult): void;\n afterClosed(): import('rxjs').Observable<TResult | undefined>;\n}\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { SOLARIS_DIALOG_CONFIG, SOLARIS_DIALOG_DEFAULT_CONFIG, } from '../token/dialog.tokens';
|
|
2
|
+
import { SolarisDialogService } from '../service/dialog.service';
|
|
3
|
+
export function provideSolarisDialog(config) {
|
|
4
|
+
const merged = {
|
|
5
|
+
...SOLARIS_DIALOG_DEFAULT_CONFIG,
|
|
6
|
+
...config,
|
|
7
|
+
};
|
|
8
|
+
return [
|
|
9
|
+
SolarisDialogService,
|
|
10
|
+
{ provide: SOLARIS_DIALOG_CONFIG, useValue: merged },
|
|
11
|
+
];
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=provide-solaris-dialog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provide-solaris-dialog.js","sourceRoot":"","sources":["../../../../../../../../../packages/angular/src/lib/components/overlay/dialog/provider/provide-solaris-dialog.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,qBAAqB,EACrB,6BAA6B,GAC9B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAGjE,MAAM,UAAU,oBAAoB,CAClC,MAAqC;IAErC,MAAM,MAAM,GAAwB;QAClC,GAAG,6BAA6B;QAChC,GAAG,MAAM;KACV,CAAC;IAEF,OAAO;QACL,oBAAoB;QACpB,EAAE,OAAO,EAAE,qBAAqB,EAAE,QAAQ,EAAE,MAAM,EAAE;KACrD,CAAC;AACJ,CAAC","sourcesContent":["import type { Provider } from '@angular/core';\n\nimport {\n SOLARIS_DIALOG_CONFIG,\n SOLARIS_DIALOG_DEFAULT_CONFIG,\n} from '../token/dialog.tokens';\nimport { SolarisDialogService } from '../service/dialog.service';\nimport type { SolarisDialogConfig } from '../model/dialog.types';\n\nexport function provideSolarisDialog(\n config?: Partial<SolarisDialogConfig>,\n): Provider[] {\n const merged: SolarisDialogConfig = {\n ...SOLARIS_DIALOG_DEFAULT_CONFIG,\n ...config,\n };\n\n return [\n SolarisDialogService,\n { provide: SOLARIS_DIALOG_CONFIG, useValue: merged },\n ];\n}\n"]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Subject } from 'rxjs';
|
|
2
|
+
export class SolarisDialogRef {
|
|
3
|
+
id;
|
|
4
|
+
afterClosedSubject = new Subject();
|
|
5
|
+
_componentInstance = null;
|
|
6
|
+
constructor(id) {
|
|
7
|
+
this.id = id;
|
|
8
|
+
}
|
|
9
|
+
get componentInstance() {
|
|
10
|
+
return this._componentInstance;
|
|
11
|
+
}
|
|
12
|
+
set componentInstance(value) {
|
|
13
|
+
this._componentInstance = value;
|
|
14
|
+
}
|
|
15
|
+
close(result) {
|
|
16
|
+
this.afterClosedSubject.next(result);
|
|
17
|
+
this.afterClosedSubject.complete();
|
|
18
|
+
}
|
|
19
|
+
afterClosed() {
|
|
20
|
+
return this.afterClosedSubject.asObservable();
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=dialog-ref.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dialog-ref.js","sourceRoot":"","sources":["../../../../../../../../../packages/angular/src/lib/components/overlay/dialog/service/dialog-ref.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAc,MAAM,MAAM,CAAC;AAE3C,MAAM,OAAO,gBAAgB;IAClB,EAAE,CAAS;IACH,kBAAkB,GAAG,IAAI,OAAO,EAAuB,CAAC;IACjE,kBAAkB,GAAY,IAAI,CAAC;IAE3C,YAAY,EAAU;QACpB,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;IACf,CAAC;IAED,IAAI,iBAAiB;QACnB,OAAO,IAAI,CAAC,kBAAkB,CAAC;IACjC,CAAC;IAED,IAAI,iBAAiB,CAAC,KAAc;QAClC,IAAI,CAAC,kBAAkB,GAAG,KAAK,CAAC;IAClC,CAAC;IAED,KAAK,CAAC,MAAgB;QACpB,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACrC,IAAI,CAAC,kBAAkB,CAAC,QAAQ,EAAE,CAAC;IACrC,CAAC;IAED,WAAW;QACT,OAAO,IAAI,CAAC,kBAAkB,CAAC,YAAY,EAAE,CAAC;IAChD,CAAC;CACF","sourcesContent":["import { Subject, Observable } from 'rxjs';\n\nexport class SolarisDialogRef<TResult = unknown> {\n readonly id: string;\n private readonly afterClosedSubject = new Subject<TResult | undefined>();\n private _componentInstance: unknown = null;\n\n constructor(id: string) {\n this.id = id;\n }\n\n get componentInstance(): unknown {\n return this._componentInstance;\n }\n\n set componentInstance(value: unknown) {\n this._componentInstance = value;\n }\n\n close(result?: TResult): void {\n this.afterClosedSubject.next(result);\n this.afterClosedSubject.complete();\n }\n\n afterClosed(): Observable<TResult | undefined> {\n return this.afterClosedSubject.asObservable();\n }\n}\n"]}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { Injectable, inject, Injector, } from '@angular/core';
|
|
2
|
+
import { Overlay } from '@angular/cdk/overlay';
|
|
3
|
+
import { ComponentPortal } from '@angular/cdk/portal';
|
|
4
|
+
import { SolarisDialogContainerComponent } from '../container/dialog-container.component';
|
|
5
|
+
import { SolarisDialogRef } from './dialog-ref';
|
|
6
|
+
import { SOLARIS_DIALOG_REF, SOLARIS_DIALOG_DATA, } from '../token/dialog-data.token';
|
|
7
|
+
import { SOLARIS_DIALOG_CONFIG, SOLARIS_DIALOG_DEFAULT_CONFIG, } from '../token/dialog.tokens';
|
|
8
|
+
import * as i0 from "@angular/core";
|
|
9
|
+
let nextDialogId = 0;
|
|
10
|
+
export class SolarisDialogService {
|
|
11
|
+
injector = inject(Injector);
|
|
12
|
+
overlay = inject(Overlay);
|
|
13
|
+
config;
|
|
14
|
+
openDialogs = new Set();
|
|
15
|
+
constructor() {
|
|
16
|
+
const userConfig = inject(SOLARIS_DIALOG_CONFIG, {
|
|
17
|
+
optional: true,
|
|
18
|
+
});
|
|
19
|
+
this.config = {
|
|
20
|
+
...SOLARIS_DIALOG_DEFAULT_CONFIG,
|
|
21
|
+
...userConfig,
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
open(options) {
|
|
25
|
+
const id = `solaris-dialog-${++nextDialogId}`;
|
|
26
|
+
const ref = new SolarisDialogRef(id);
|
|
27
|
+
const mergedOptions = this.resolveOptions(options);
|
|
28
|
+
const overlayRef = this.createOverlay();
|
|
29
|
+
const injector = this.createInjector(ref, undefined);
|
|
30
|
+
const portal = new ComponentPortal(SolarisDialogContainerComponent, null, injector);
|
|
31
|
+
const componentRef = overlayRef.attach(portal);
|
|
32
|
+
componentRef.setInput('simpleOptions', mergedOptions);
|
|
33
|
+
this.trackDialog(ref, overlayRef);
|
|
34
|
+
return ref;
|
|
35
|
+
}
|
|
36
|
+
openComponent(component, config) {
|
|
37
|
+
const id = `solaris-dialog-${++nextDialogId}`;
|
|
38
|
+
const ref = new SolarisDialogRef(id);
|
|
39
|
+
const data = config?.data;
|
|
40
|
+
const overlayRef = this.createOverlay();
|
|
41
|
+
const injector = this.createInjector(ref, data);
|
|
42
|
+
const portal = new ComponentPortal(SolarisDialogContainerComponent, null, injector);
|
|
43
|
+
const componentRef = overlayRef.attach(portal);
|
|
44
|
+
componentRef.setInput('externalComponent', component);
|
|
45
|
+
componentRef.setInput('externalComponentConfig', config ?? {});
|
|
46
|
+
this.trackDialog(ref, overlayRef);
|
|
47
|
+
return ref;
|
|
48
|
+
}
|
|
49
|
+
createOverlay() {
|
|
50
|
+
return this.overlay.create({
|
|
51
|
+
hasBackdrop: false,
|
|
52
|
+
positionStrategy: this.overlay
|
|
53
|
+
.position()
|
|
54
|
+
.global()
|
|
55
|
+
.centerHorizontally()
|
|
56
|
+
.centerVertically(),
|
|
57
|
+
scrollStrategy: this.overlay.scrollStrategies.block(),
|
|
58
|
+
panelClass: 'solaris-dialog-overlay-panel',
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
createInjector(ref, data) {
|
|
62
|
+
const providers = [
|
|
63
|
+
{ provide: SOLARIS_DIALOG_REF, useValue: ref },
|
|
64
|
+
];
|
|
65
|
+
if (data !== undefined) {
|
|
66
|
+
providers.push({ provide: SOLARIS_DIALOG_DATA, useValue: data });
|
|
67
|
+
}
|
|
68
|
+
return Injector.create({
|
|
69
|
+
providers,
|
|
70
|
+
parent: this.injector,
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
trackDialog(ref, overlayRef) {
|
|
74
|
+
const entry = { ref, overlayRef };
|
|
75
|
+
this.openDialogs.add(entry);
|
|
76
|
+
ref.afterClosed().subscribe(() => {
|
|
77
|
+
overlayRef.detach();
|
|
78
|
+
overlayRef.dispose();
|
|
79
|
+
this.openDialogs.delete(entry);
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
resolveOptions(options) {
|
|
83
|
+
return {
|
|
84
|
+
variant: options.variant ?? 'neutral',
|
|
85
|
+
appearance: options.appearance ?? this.config.appearance,
|
|
86
|
+
size: options.size ?? this.config.size,
|
|
87
|
+
closeable: options.closeable ?? this.config.closeable ?? true,
|
|
88
|
+
closeOnEscape: options.closeOnEscape ?? this.config.closeOnEscape ?? true,
|
|
89
|
+
closeOnBackdropClick: options.closeOnBackdropClick ??
|
|
90
|
+
this.config.closeOnBackdropClick ??
|
|
91
|
+
true,
|
|
92
|
+
autoFocus: options.autoFocus ?? this.config.autoFocus,
|
|
93
|
+
restoreFocus: options.restoreFocus ?? this.config.restoreFocus ?? true,
|
|
94
|
+
role: options.role ?? this.config.role,
|
|
95
|
+
actionsAlign: options.actionsAlign ?? this.config.actionsAlign ?? 'end',
|
|
96
|
+
actionsStack: options.actionsStack ?? this.config.actionsStack ?? 'auto',
|
|
97
|
+
...options,
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
closeAll() {
|
|
101
|
+
for (const entry of this.openDialogs) {
|
|
102
|
+
entry.ref.close();
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: SolarisDialogService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
106
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: SolarisDialogService });
|
|
107
|
+
}
|
|
108
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: SolarisDialogService, decorators: [{
|
|
109
|
+
type: Injectable
|
|
110
|
+
}], ctorParameters: () => [] });
|
|
111
|
+
//# sourceMappingURL=dialog.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dialog.service.js","sourceRoot":"","sources":["../../../../../../../../../packages/angular/src/lib/components/overlay/dialog/service/dialog.service.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,MAAM,EACN,QAAQ,GAGT,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,OAAO,EAAc,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtD,OAAO,EAAE,+BAA+B,EAAE,MAAM,yCAAyC,CAAC;AAC1F,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EACL,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,qBAAqB,EACrB,6BAA6B,GAC9B,MAAM,wBAAwB,CAAC;;AAOhC,IAAI,YAAY,GAAG,CAAC,CAAC;AAGrB,MAAM,OAAO,oBAAoB;IACd,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;IAC5B,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC;IAE1B,MAAM,CAAsB;IAE5B,WAAW,GAAG,IAAI,GAAG,EAGlC,CAAC;IAEL;QACE,MAAM,UAAU,GAAG,MAAM,CAAC,qBAAqB,EAAE;YAC/C,QAAQ,EAAE,IAAI;SACf,CAA+B,CAAC;QAEjC,IAAI,CAAC,MAAM,GAAG;YACZ,GAAG,6BAA6B;YAChC,GAAG,UAAU;SACd,CAAC;IACJ,CAAC;IAED,IAAI,CACF,OAAsC;QAEtC,MAAM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Overlay, OverlayRef } from '@angular/cdk/overlay';\nimport { ComponentPortal } from '@angular/cdk/portal';\n\nimport { SolarisDialogContainerComponent } from '../container/dialog-container.component';\nimport { SolarisDialogRef } from './dialog-ref';\nimport {\n SOLARIS_DIALOG_REF,\n SOLARIS_DIALOG_DATA,\n} from '../token/dialog-data.token';\nimport {\n SOLARIS_DIALOG_CONFIG,\n SOLARIS_DIALOG_DEFAULT_CONFIG,\n} from '../token/dialog.tokens';\nimport type {\n SolarisDialogOptions,\n SolarisDialogComponentConfig,\n SolarisDialogConfig,\n} from '../model/dialog.types';\n\nlet nextDialogId = 0;\n\n@Injectable()\nexport class SolarisDialogService {\n private readonly injector = inject(Injector);\n private readonly overlay = inject(Overlay);\n\n private readonly config: SolarisDialogConfig;\n\n private readonly openDialogs = new Set<{\n ref: SolarisDialogRef;\n overlayRef: OverlayRef;\n }>();\n\n constructor() {\n const userConfig = inject(SOLARIS_DIALOG_CONFIG, {\n optional: true,\n }) as SolarisDialogConfig | null;\n\n this.config = {\n ...SOLARIS_DIALOG_DEFAULT_CONFIG,\n ...userConfig,\n };\n }\n\n open<TResult = unknown>(\n options: SolarisDialogOptions<TResult>,\n ): SolarisDialogRef<TResult> {\n const id = `solaris-dialog-${++nextDialogId}`;\n const ref = new SolarisDialogRef<TResult>(id);\n const mergedOptions = this.resolveOptions(options);\n\n const overlayRef = this.createOverlay();\n const injector = this.createInjector(ref, undefined);\n\n const portal = new ComponentPortal(\n SolarisDialogContainerComponent,\n null,\n injector,\n );\n\n const componentRef = overlayRef.attach(portal);\n componentRef.setInput('simpleOptions', mergedOptions);\n\n this.trackDialog(ref as unknown as SolarisDialogRef, overlayRef);\n\n return ref;\n }\n\n openComponent<TComponent, TResult = unknown, TData = unknown>(\n component: Type<TComponent>,\n config?: SolarisDialogComponentConfig<TData>,\n ): SolarisDialogRef<TResult> {\n const id = `solaris-dialog-${++nextDialogId}`;\n const ref = new SolarisDialogRef<TResult>(id);\n const data = config?.data as TData | undefined;\n\n const overlayRef = this.createOverlay();\n const injector = this.createInjector(ref, data);\n\n const portal = new ComponentPortal(\n SolarisDialogContainerComponent,\n null,\n injector,\n );\n\n const componentRef = overlayRef.attach(portal);\n componentRef.setInput('externalComponent', component);\n componentRef.setInput('externalComponentConfig', config ?? {});\n\n this.trackDialog(ref as unknown as SolarisDialogRef, overlayRef);\n\n return ref;\n }\n\n private createOverlay(): OverlayRef {\n return this.overlay.create({\n hasBackdrop: false,\n positionStrategy: this.overlay\n .position()\n .global()\n .centerHorizontally()\n .centerVertically(),\n scrollStrategy: this.overlay.scrollStrategies.block(),\n panelClass: 'solaris-dialog-overlay-panel',\n });\n }\n\n private createInjector<T>(ref: SolarisDialogRef<T>, data: unknown): Injector {\n const providers: Provider[] = [\n { provide: SOLARIS_DIALOG_REF, useValue: ref },\n ];\n\n if (data !== undefined) {\n providers.push({ provide: SOLARIS_DIALOG_DATA, useValue: data });\n }\n\n return Injector.create({\n providers,\n parent: this.injector,\n });\n }\n\n private trackDialog(ref: SolarisDialogRef, overlayRef: OverlayRef): void {\n const entry = { ref, overlayRef };\n this.openDialogs.add(entry);\n\n ref.afterClosed().subscribe(() => {\n overlayRef.detach();\n overlayRef.dispose();\n this.openDialogs.delete(entry);\n });\n }\n\n private resolveOptions<T>(\n options: SolarisDialogOptions<T>,\n ): SolarisDialogOptions<T> {\n return {\n variant: options.variant ?? 'neutral',\n appearance: options.appearance ?? this.config.appearance,\n size: options.size ?? this.config.size,\n closeable: options.closeable ?? this.config.closeable ?? true,\n closeOnEscape: options.closeOnEscape ?? this.config.closeOnEscape ?? true,\n closeOnBackdropClick:\n options.closeOnBackdropClick ??\n this.config.closeOnBackdropClick ??\n true,\n autoFocus: options.autoFocus ?? this.config.autoFocus,\n restoreFocus: options.restoreFocus ?? this.config.restoreFocus ?? true,\n role: options.role ?? this.config.role,\n actionsAlign: options.actionsAlign ?? this.config.actionsAlign ?? 'end',\n actionsStack: options.actionsStack ?? this.config.actionsStack ?? 'auto',\n ...options,\n };\n }\n\n closeAll(): void {\n for (const entry of this.openDialogs) {\n entry.ref.close();\n }\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dialog-data.token.js","sourceRoot":"","sources":["../../../../../../../../../packages/angular/src/lib/components/overlay/dialog/token/dialog-data.token.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAI/C,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,cAAc,CACnD,mBAAmB,CACpB,CAAC;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAAG,IAAI,cAAc,CAClD,kBAAkB,CACnB,CAAC","sourcesContent":["import { InjectionToken } from '@angular/core';\n\nimport type { SolarisDialogRef } from '../service/dialog-ref';\n\nexport const SOLARIS_DIALOG_DATA = new InjectionToken<unknown>(\n 'SolarisDialogData',\n);\n\nexport const SOLARIS_DIALOG_REF = new InjectionToken<SolarisDialogRef<unknown>>(\n 'SolarisDialogRef',\n);\n"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { InjectionToken } from '@angular/core';
|
|
2
|
+
export const SOLARIS_DIALOG_CONFIG = new InjectionToken('SolarisDialogConfig');
|
|
3
|
+
export const SOLARIS_DIALOG_DEFAULT_CONFIG = {
|
|
4
|
+
appearance: 'surface',
|
|
5
|
+
size: 'md',
|
|
6
|
+
closeable: true,
|
|
7
|
+
closeOnEscape: true,
|
|
8
|
+
closeOnBackdropClick: true,
|
|
9
|
+
autoFocus: 'first-tabbable',
|
|
10
|
+
restoreFocus: true,
|
|
11
|
+
role: 'dialog',
|
|
12
|
+
actionsAlign: 'end',
|
|
13
|
+
actionsStack: 'auto',
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=dialog.tokens.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dialog.tokens.js","sourceRoot":"","sources":["../../../../../../../../../packages/angular/src/lib/components/overlay/dialog/token/dialog.tokens.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAI/C,MAAM,CAAC,MAAM,qBAAqB,GAAG,IAAI,cAAc,CACrD,qBAAqB,CACtB,CAAC;AAEF,MAAM,CAAC,MAAM,6BAA6B,GAAwB;IAChE,UAAU,EAAE,SAAS;IACrB,IAAI,EAAE,IAAI;IACV,SAAS,EAAE,IAAI;IACf,aAAa,EAAE,IAAI;IACnB,oBAAoB,EAAE,IAAI;IAC1B,SAAS,EAAE,gBAAgB;IAC3B,YAAY,EAAE,IAAI;IAClB,IAAI,EAAE,QAAQ;IACd,YAAY,EAAE,KAAK;IACnB,YAAY,EAAE,MAAM;CACrB,CAAC","sourcesContent":["import { InjectionToken } from '@angular/core';\n\nimport type { SolarisDialogConfig } from '../model/dialog.types';\n\nexport const SOLARIS_DIALOG_CONFIG = new InjectionToken<SolarisDialogConfig>(\n 'SolarisDialogConfig',\n);\n\nexport const SOLARIS_DIALOG_DEFAULT_CONFIG: SolarisDialogConfig = {\n appearance: 'surface',\n size: 'md',\n closeable: true,\n closeOnEscape: true,\n closeOnBackdropClick: true,\n autoFocus: 'first-tabbable',\n restoreFocus: true,\n role: 'dialog',\n actionsAlign: 'end',\n actionsStack: 'auto',\n};\n"]}
|