@koobiq/components 16.0.0-beta.6 → 16.0.0-beta.7
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/autocomplete/autocomplete-trigger.directive.d.ts +5 -15
- package/button-toggle/button-toggle.component.d.ts +2 -2
- package/checkbox/_checkbox-theme.scss +10 -2
- package/checkbox/checkbox.d.ts +1 -1
- package/code-block/README.md +14 -14
- package/code-block/_code-block-theme.scss +8 -0
- package/code-block/code-block.component.d.ts +1 -1
- package/core/animation/index.d.ts +1 -1
- package/core/animation/select-animations.d.ts +1 -1
- package/core/formatters/index.d.ts +1 -1
- package/core/formatters/number/formatter.d.ts +56 -1
- package/core/forms/forms.directive.d.ts +2 -2
- package/core/locales/en-US.d.ts +19 -1
- package/core/locales/es-LA.d.ts +27 -0
- package/core/locales/fa-IR.d.ts +28 -0
- package/core/locales/locale-service.d.ts +148 -3
- package/core/locales/pt-BR.d.ts +27 -0
- package/core/locales/ru-RU.d.ts +20 -1
- package/core/locales/zh-CN.d.ts +26 -0
- package/core/option/action.d.ts +1 -1
- package/core/option/optgroup.d.ts +1 -1
- package/core/option/option.d.ts +37 -8
- package/core/overlay/overlay-position-map.d.ts +7 -1
- package/core/pop-up/constants.d.ts +2 -1
- package/core/public-api.d.ts +1 -0
- package/core/select/constants.d.ts +2 -2
- package/core/services/theme.service.d.ts +23 -0
- package/core/styles/_variables.scss +1 -0
- package/core/styles/common/_select.scss +24 -24
- package/core/styles/theming/_components-theming.scss +31 -5
- package/datepicker/calendar-body.component.d.ts +1 -1
- package/datepicker/calendar-header.component.d.ts +9 -3
- package/datepicker/calendar.component.d.ts +4 -5
- package/datepicker/datepicker-animations.d.ts +1 -1
- package/datepicker/datepicker-input.directive.d.ts +4 -4
- package/datepicker/datepicker-toggle.component.d.ts +3 -3
- package/datepicker/datepicker.component.d.ts +2 -2
- package/datepicker/month-view.component.d.ts +5 -6
- package/dl/_dl-theme.scss +2 -56
- package/dl/dl.component.d.ts +1 -2
- package/dl/dl.scss +10 -47
- package/dropdown/dropdown-animations.d.ts +1 -1
- package/dropdown/dropdown-content.directive.d.ts +1 -1
- package/dropdown/dropdown-item.component.d.ts +1 -1
- package/dropdown/dropdown-trigger.directive.d.ts +2 -2
- package/dropdown/dropdown.component.d.ts +1 -1
- package/dropdown/dropdown.types.d.ts +1 -1
- package/esm2022/alert/alert.component.mjs +2 -2
- package/esm2022/autocomplete/autocomplete-trigger.directive.mjs +24 -21
- package/esm2022/button-toggle/button-toggle.component.mjs +8 -8
- package/esm2022/checkbox/checkbox.mjs +3 -3
- package/esm2022/code-block/actionbar.component.mjs +1 -1
- package/esm2022/code-block/code-block.component.mjs +3 -3
- package/esm2022/core/animation/index.mjs +2 -2
- package/esm2022/core/animation/select-animations.mjs +4 -4
- package/esm2022/core/formatters/index.mjs +10 -2
- package/esm2022/core/formatters/number/formatter.mjs +224 -3
- package/esm2022/core/forms/forms.directive.mjs +5 -5
- package/esm2022/core/locales/en-US.mjs +22 -4
- package/esm2022/core/locales/es-LA.mjs +31 -2
- package/esm2022/core/locales/fa-IR.mjs +30 -2
- package/esm2022/core/locales/locale-service.mjs +4 -4
- package/esm2022/core/locales/pt-BR.mjs +29 -2
- package/esm2022/core/locales/ru-RU.mjs +23 -2
- package/esm2022/core/locales/zh-CN.mjs +28 -2
- package/esm2022/core/option/action.mjs +3 -3
- package/esm2022/core/option/optgroup.mjs +3 -3
- package/esm2022/core/option/option.mjs +47 -10
- package/esm2022/core/overlay/overlay-position-map.mjs +7 -1
- package/esm2022/core/pop-up/constants.mjs +2 -1
- package/esm2022/core/pop-up/pop-up-trigger.mjs +12 -3
- package/esm2022/core/public-api.mjs +2 -1
- package/esm2022/core/select/constants.mjs +3 -3
- package/esm2022/core/services/theme.service.mjs +60 -0
- package/esm2022/core/version.mjs +2 -2
- package/esm2022/datepicker/calendar-body.component.mjs +3 -3
- package/esm2022/datepicker/calendar-header.component.mjs +9 -8
- package/esm2022/datepicker/calendar.component.mjs +7 -16
- package/esm2022/datepicker/datepicker-animations.mjs +2 -2
- package/esm2022/datepicker/datepicker-input.directive.mjs +29 -20
- package/esm2022/datepicker/datepicker-toggle.component.mjs +6 -6
- package/esm2022/datepicker/datepicker.component.mjs +11 -11
- package/esm2022/datepicker/month-view.component.mjs +9 -18
- package/esm2022/dl/dl.component.mjs +3 -7
- package/esm2022/dropdown/dropdown-animations.mjs +4 -4
- package/esm2022/dropdown/dropdown-content.directive.mjs +3 -3
- package/esm2022/dropdown/dropdown-errors.mjs +6 -6
- package/esm2022/dropdown/dropdown-item.component.mjs +5 -5
- package/esm2022/dropdown/dropdown-trigger.directive.mjs +8 -8
- package/esm2022/dropdown/dropdown.component.mjs +8 -8
- package/esm2022/dropdown/dropdown.types.mjs +1 -1
- package/esm2022/file-upload/file-drop.mjs +4 -4
- package/esm2022/file-upload/multiple-file-upload.component.mjs +12 -8
- package/esm2022/file-upload/single-file-upload.component.mjs +12 -8
- package/esm2022/form-field/cleaner.mjs +3 -3
- package/esm2022/form-field/form-field.mjs +7 -7
- package/esm2022/form-field/hint.mjs +4 -4
- package/esm2022/form-field/password-hint.mjs +11 -11
- package/esm2022/form-field/password-toggle.mjs +21 -8
- package/esm2022/form-field/suffix.mjs +3 -3
- package/esm2022/form-field/validate.directive.mjs +4 -4
- package/esm2022/input/input-number.mjs +259 -43
- package/esm2022/link/link.component.mjs +3 -3
- package/esm2022/list/list-selection.component.mjs +6 -6
- package/esm2022/loader-overlay/loader-overlay.component.mjs +2 -2
- package/esm2022/modal/modal-control.service.mjs +5 -5
- package/esm2022/modal/modal-ref.class.mjs +1 -1
- package/esm2022/modal/modal.component.mjs +124 -111
- package/esm2022/modal/modal.service.mjs +23 -23
- package/esm2022/modal/modal.type.mjs +1 -3
- package/esm2022/navbar/navbar-item.component.mjs +6 -6
- package/esm2022/navbar/navbar.component.mjs +18 -9
- package/esm2022/navbar/vertical-navbar.component.mjs +9 -6
- package/esm2022/popover/popover-animations.mjs +2 -2
- package/esm2022/popover/popover-confirm.component.mjs +9 -9
- package/esm2022/popover/popover.component.mjs +23 -23
- package/esm2022/radio/radio.component.mjs +10 -8
- package/esm2022/select/select.component.mjs +32 -17
- package/esm2022/sidebar/sidebar-animations.mjs +2 -2
- package/esm2022/sidebar/sidebar.component.mjs +9 -9
- package/esm2022/sidepanel/sidepanel-directives.mjs +2 -2
- package/esm2022/splitter/splitter.component.mjs +3 -3
- package/esm2022/table/table.component.mjs +3 -3
- package/esm2022/tabs/tab-body.component.mjs +7 -7
- package/esm2022/tabs/tab-content.directive.mjs +3 -3
- package/esm2022/tabs/tab-group.component.mjs +3 -3
- package/esm2022/tabs/tab-nav-bar/tab-nav-bar.mjs +6 -6
- package/esm2022/tabs/tab.component.mjs +14 -5
- package/esm2022/tabs/tabs-animations.mjs +2 -2
- package/esm2022/tags/tag-input.mjs +3 -3
- package/esm2022/tags/tag-list.component.mjs +5 -5
- package/esm2022/tags/tag.component.mjs +10 -10
- package/esm2022/timepicker/timepicker.directive.mjs +10 -10
- package/esm2022/timezone/timezone-option.component.mjs +3 -3
- package/esm2022/timezone/timezone-select.component.mjs +5 -5
- package/esm2022/title/title.directive.mjs +5 -5
- package/esm2022/toast/toast.module.mjs +10 -4
- package/esm2022/toggle/toggle.component.mjs +3 -3
- package/esm2022/tooltip/tooltip.component.mjs +16 -16
- package/esm2022/tree/node.mjs +5 -5
- package/esm2022/tree/outlet.mjs +3 -3
- package/esm2022/tree/padding.directive.mjs +6 -6
- package/esm2022/tree/toggle.mjs +8 -8
- package/esm2022/tree/tree-base.mjs +3 -3
- package/esm2022/tree/tree-option.component.mjs +8 -5
- package/esm2022/tree/tree-selection.component.mjs +8 -6
- package/esm2022/tree/tree.mjs +3 -3
- package/esm2022/tree-select/tree-select.component.mjs +13 -13
- package/fesm2022/koobiq-components-alert.mjs +2 -2
- package/fesm2022/koobiq-components-alert.mjs.map +1 -1
- package/fesm2022/koobiq-components-autocomplete.mjs +24 -21
- package/fesm2022/koobiq-components-autocomplete.mjs.map +1 -1
- package/fesm2022/koobiq-components-button-toggle.mjs +7 -7
- package/fesm2022/koobiq-components-button-toggle.mjs.map +1 -1
- package/fesm2022/koobiq-components-checkbox.mjs +2 -2
- package/fesm2022/koobiq-components-checkbox.mjs.map +1 -1
- package/fesm2022/koobiq-components-code-block.mjs +3 -3
- package/fesm2022/koobiq-components-code-block.mjs.map +1 -1
- package/fesm2022/koobiq-components-core.mjs +526 -39
- package/fesm2022/koobiq-components-core.mjs.map +1 -1
- package/fesm2022/koobiq-components-datepicker.mjs +66 -74
- package/fesm2022/koobiq-components-datepicker.mjs.map +1 -1
- package/fesm2022/koobiq-components-dl.mjs +2 -6
- package/fesm2022/koobiq-components-dl.mjs.map +1 -1
- package/fesm2022/koobiq-components-dropdown.mjs +28 -28
- package/fesm2022/koobiq-components-dropdown.mjs.map +1 -1
- package/fesm2022/koobiq-components-file-upload.mjs +23 -15
- package/fesm2022/koobiq-components-file-upload.mjs.map +1 -1
- package/fesm2022/koobiq-components-form-field.mjs +46 -34
- package/fesm2022/koobiq-components-form-field.mjs.map +1 -1
- package/fesm2022/koobiq-components-input.mjs +257 -43
- package/fesm2022/koobiq-components-input.mjs.map +1 -1
- package/fesm2022/koobiq-components-link.mjs +2 -2
- package/fesm2022/koobiq-components-link.mjs.map +1 -1
- package/fesm2022/koobiq-components-list.mjs +5 -5
- package/fesm2022/koobiq-components-list.mjs.map +1 -1
- package/fesm2022/koobiq-components-loader-overlay.mjs +2 -2
- package/fesm2022/koobiq-components-loader-overlay.mjs.map +1 -1
- package/fesm2022/koobiq-components-modal.mjs +149 -140
- package/fesm2022/koobiq-components-modal.mjs.map +1 -1
- package/fesm2022/koobiq-components-navbar.mjs +28 -20
- package/fesm2022/koobiq-components-navbar.mjs.map +1 -1
- package/fesm2022/koobiq-components-popover.mjs +30 -30
- package/fesm2022/koobiq-components-popover.mjs.map +1 -1
- package/fesm2022/koobiq-components-radio.mjs +9 -7
- package/fesm2022/koobiq-components-radio.mjs.map +1 -1
- package/fesm2022/koobiq-components-select.mjs +31 -16
- package/fesm2022/koobiq-components-select.mjs.map +1 -1
- package/fesm2022/koobiq-components-sidebar.mjs +8 -8
- package/fesm2022/koobiq-components-sidebar.mjs.map +1 -1
- package/fesm2022/koobiq-components-sidepanel.mjs +1 -1
- package/fesm2022/koobiq-components-sidepanel.mjs.map +1 -1
- package/fesm2022/koobiq-components-splitter.mjs +2 -2
- package/fesm2022/koobiq-components-splitter.mjs.map +1 -1
- package/fesm2022/koobiq-components-table.mjs +2 -2
- package/fesm2022/koobiq-components-table.mjs.map +1 -1
- package/fesm2022/koobiq-components-tabs.mjs +29 -20
- package/fesm2022/koobiq-components-tabs.mjs.map +1 -1
- package/fesm2022/koobiq-components-tags.mjs +15 -15
- package/fesm2022/koobiq-components-tags.mjs.map +1 -1
- package/fesm2022/koobiq-components-timepicker.mjs +9 -9
- package/fesm2022/koobiq-components-timepicker.mjs.map +1 -1
- package/fesm2022/koobiq-components-timezone.mjs +6 -6
- package/fesm2022/koobiq-components-timezone.mjs.map +1 -1
- package/fesm2022/koobiq-components-title.mjs +4 -4
- package/fesm2022/koobiq-components-title.mjs.map +1 -1
- package/fesm2022/koobiq-components-toast.mjs +8 -2
- package/fesm2022/koobiq-components-toast.mjs.map +1 -1
- package/fesm2022/koobiq-components-toggle.mjs +2 -2
- package/fesm2022/koobiq-components-toggle.mjs.map +1 -1
- package/fesm2022/koobiq-components-tooltip.mjs +15 -15
- package/fesm2022/koobiq-components-tooltip.mjs.map +1 -1
- package/fesm2022/koobiq-components-tree-select.mjs +12 -12
- package/fesm2022/koobiq-components-tree-select.mjs.map +1 -1
- package/fesm2022/koobiq-components-tree.mjs +36 -31
- package/fesm2022/koobiq-components-tree.mjs.map +1 -1
- package/file-upload/file-drop.d.ts +1 -1
- package/file-upload/multiple-file-upload.component.d.ts +4 -3
- package/file-upload/single-file-upload.component.d.ts +4 -3
- package/form-field/_hint-theme.scss +1 -1
- package/form-field/cleaner.d.ts +1 -1
- package/form-field/form-field.d.ts +2 -2
- package/form-field/form-field.scss +2 -2
- package/form-field/hint.d.ts +1 -1
- package/form-field/password-hint.d.ts +2 -1
- package/form-field/password-toggle.d.ts +11 -6
- package/form-field/suffix.d.ts +1 -1
- package/form-field/validate.directive.d.ts +1 -1
- package/icon/_icon-theme.scss +2 -1
- package/input/input-number.d.ts +61 -10
- package/link/_link-theme.scss +4 -0
- package/link/link.component.d.ts +1 -1
- package/list/list-selection.component.d.ts +1 -1
- package/loader-overlay/loader-overlay.scss +3 -0
- package/modal/README.md +5 -5
- package/modal/modal-ref.class.d.ts +2 -2
- package/modal/modal.component.d.ts +51 -47
- package/modal/modal.type.d.ts +35 -36
- package/navbar/navbar-item.component.d.ts +2 -2
- package/navbar/navbar.component.d.ts +5 -2
- package/navbar/vertical-navbar.component.d.ts +4 -2
- package/package.json +9 -11
- package/popover/README.md +14 -14
- package/popover/_popover-theme.scss +11 -11
- package/popover/popover-animations.d.ts +1 -1
- package/popover/popover-confirm.component.d.ts +1 -1
- package/popover/popover.component.d.ts +3 -3
- package/prebuilt-themes/dark-theme.css +1 -1
- package/prebuilt-themes/light-theme.css +1 -1
- package/radio/_radio-theme.scss +15 -2
- package/radio/radio.component.d.ts +2 -2
- package/radio/radio.scss +13 -0
- package/select/select.component.d.ts +14 -11
- package/sidebar/sidebar-animations.d.ts +1 -1
- package/sidebar/sidebar.component.d.ts +3 -3
- package/splitter/splitter.component.d.ts +1 -1
- package/table/table.component.d.ts +1 -1
- package/tabs/tab-body.component.d.ts +1 -1
- package/tabs/tab-content.directive.d.ts +1 -1
- package/tabs/tab-nav-bar/tab-nav-bar.d.ts +2 -2
- package/tabs/tab.component.d.ts +1 -1
- package/tabs/tabs-animations.d.ts +1 -1
- package/tags/_tag-theme.scss +1 -1
- package/tags/tag-input.d.ts +2 -2
- package/tags/tag-list.component.d.ts +2 -2
- package/tags/tag-list.scss +2 -0
- package/tags/tag.component.d.ts +3 -3
- package/timepicker/timepicker.directive.d.ts +2 -2
- package/timezone/timezone-option.component.d.ts +1 -1
- package/timezone/timezone-select.component.d.ts +1 -1
- package/title/title.directive.d.ts +1 -1
- package/toggle/toggle.component.d.ts +1 -1
- package/tooltip/tooltip.component.d.ts +3 -3
- package/tree/node.d.ts +1 -1
- package/tree/outlet.d.ts +1 -1
- package/tree/padding.directive.d.ts +1 -1
- package/tree/toggle.d.ts +3 -3
- package/tree/tree-base.d.ts +1 -1
- package/tree/tree-option.component.d.ts +1 -1
- package/tree/tree-option.scss +2 -0
- package/tree/tree-selection.component.d.ts +1 -1
- package/tree/tree.d.ts +1 -1
- package/tree-select/tree-select.component.d.ts +1 -1
|
@@ -1,14 +1,15 @@
|
|
|
1
|
+
import * as i3 from '@angular/cdk/a11y';
|
|
2
|
+
import { A11yModule, FocusTrapFactory, ConfigurableFocusTrapFactory } from '@angular/cdk/a11y';
|
|
1
3
|
import * as i1 from '@angular/cdk/overlay';
|
|
2
4
|
import { OverlayRef, OverlayModule } from '@angular/cdk/overlay';
|
|
3
|
-
import * as
|
|
5
|
+
import * as i4 from '@angular/common';
|
|
4
6
|
import { DOCUMENT, CommonModule } from '@angular/common';
|
|
5
7
|
import * as i0 from '@angular/core';
|
|
6
8
|
import { Injectable, Optional, SkipSelf, Pipe, EventEmitter, TemplateRef, Type, Injector, ViewContainerRef, ElementRef, Component, ViewEncapsulation, ChangeDetectionStrategy, Inject, Input, Output, ViewChild, ViewChildren, Directive, NgModule } from '@angular/core';
|
|
7
9
|
import { ESCAPE, ENTER } from '@koobiq/cdk/keycodes';
|
|
8
10
|
import { KbqComponentColors } from '@koobiq/components/core';
|
|
11
|
+
import { take, filter } from 'rxjs/operators';
|
|
9
12
|
import { Subject } from 'rxjs';
|
|
10
|
-
import * as i4 from '@angular/cdk/a11y';
|
|
11
|
-
import { A11yModule, FocusTrapFactory, ConfigurableFocusTrapFactory } from '@angular/cdk/a11y';
|
|
12
13
|
import * as i5 from '@koobiq/components/button';
|
|
13
14
|
import { KbqButtonModule } from '@koobiq/components/button';
|
|
14
15
|
import * as i6 from '@koobiq/components/icon';
|
|
@@ -16,7 +17,6 @@ import { KbqIconModule } from '@koobiq/components/icon';
|
|
|
16
17
|
import * as i7 from '@koobiq/components/title';
|
|
17
18
|
import { KbqTitleModule } from '@koobiq/components/title';
|
|
18
19
|
import { ComponentPortal } from '@angular/cdk/portal';
|
|
19
|
-
import { filter } from 'rxjs/operators';
|
|
20
20
|
|
|
21
21
|
class KbqModalControlService {
|
|
22
22
|
// Track singleton afterAllClose through over the injection tree
|
|
@@ -70,20 +70,20 @@ class KbqModalControlService {
|
|
|
70
70
|
}
|
|
71
71
|
handleMultipleMasks(modalRef) {
|
|
72
72
|
const modals = Array.from(this.registeredMetaMap.values()).map((v) => v.modalRef);
|
|
73
|
-
if (modals.filter((modal) => modal.
|
|
73
|
+
if (modals.filter((modal) => modal.kbqVisible).length > 1) {
|
|
74
74
|
const otherModals = modals.splice(0, modals.length - 1)
|
|
75
|
-
.filter((modal) => modal.
|
|
75
|
+
.filter((modal) => modal.kbqVisible && modal.kbqMask);
|
|
76
76
|
// hide other masks
|
|
77
77
|
setTimeout(() => {
|
|
78
78
|
otherModals.forEach((modal) => {
|
|
79
|
-
modal.getInstance().
|
|
79
|
+
modal.getInstance().kbqMask = false;
|
|
80
80
|
modal.markForCheck();
|
|
81
81
|
});
|
|
82
82
|
});
|
|
83
83
|
// show other masks on close
|
|
84
84
|
modalRef.afterClose.subscribe(() => {
|
|
85
85
|
otherModals.forEach((modal) => {
|
|
86
|
-
modal.getInstance().
|
|
86
|
+
modal.getInstance().kbqMask = true;
|
|
87
87
|
modal.markForCheck();
|
|
88
88
|
});
|
|
89
89
|
});
|
|
@@ -129,8 +129,6 @@ var ModalSize;
|
|
|
129
129
|
(function (ModalSize) {
|
|
130
130
|
ModalSize["Small"] = "small";
|
|
131
131
|
ModalSize["Medium"] = "medium";
|
|
132
|
-
// Normal is deprecated and will be deleted in 16.x
|
|
133
|
-
ModalSize["Normal"] = "medium";
|
|
134
132
|
ModalSize["Large"] = "large";
|
|
135
133
|
})(ModalSize || (ModalSize = {}));
|
|
136
134
|
|
|
@@ -152,37 +150,37 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.5", ngImpor
|
|
|
152
150
|
// Duration when perform animations (ms)
|
|
153
151
|
const MODAL_ANIMATE_DURATION = 200;
|
|
154
152
|
class KbqModalComponent extends KbqModalRef {
|
|
155
|
-
get
|
|
156
|
-
set
|
|
157
|
-
get
|
|
158
|
-
set
|
|
159
|
-
get
|
|
160
|
-
set
|
|
161
|
-
get
|
|
162
|
-
set
|
|
163
|
-
get
|
|
164
|
-
set
|
|
165
|
-
get
|
|
166
|
-
set
|
|
167
|
-
// Observable alias for
|
|
153
|
+
get kbqVisible() { return this._kbqVisible; }
|
|
154
|
+
set kbqVisible(value) { this._kbqVisible = value; }
|
|
155
|
+
get kbqClosable() { return this._kbqClosable; }
|
|
156
|
+
set kbqClosable(value) { this._kbqClosable = value; }
|
|
157
|
+
get kbqMask() { return this._kbqMask; }
|
|
158
|
+
set kbqMask(value) { this._kbqMask = value; }
|
|
159
|
+
get kbqMaskClosable() { return this._kbqMaskClosable; }
|
|
160
|
+
set kbqMaskClosable(value) { this._kbqMaskClosable = value; }
|
|
161
|
+
get kbqOkLoading() { return this._kbqOkLoading; }
|
|
162
|
+
set kbqOkLoading(value) { this._kbqOkLoading = value; }
|
|
163
|
+
get kbqCancelLoading() { return this._kbqCancelLoading; }
|
|
164
|
+
set kbqCancelLoading(value) { this._kbqCancelLoading = value; }
|
|
165
|
+
// Observable alias for kbqAfterOpen
|
|
168
166
|
get afterOpen() {
|
|
169
|
-
return this.
|
|
167
|
+
return this.kbqAfterOpen.asObservable();
|
|
170
168
|
}
|
|
171
|
-
// Observable alias for
|
|
169
|
+
// Observable alias for kbqAfterClose
|
|
172
170
|
get afterClose() {
|
|
173
|
-
return this.
|
|
171
|
+
return this.kbqAfterClose.asObservable();
|
|
174
172
|
}
|
|
175
173
|
get okText() {
|
|
176
|
-
return this.
|
|
174
|
+
return this.kbqOkText;
|
|
177
175
|
}
|
|
178
176
|
get cancelText() {
|
|
179
|
-
return this.
|
|
177
|
+
return this.kbqCancelText;
|
|
180
178
|
}
|
|
181
179
|
// Indicate whether this dialog should hidden
|
|
182
180
|
get hidden() {
|
|
183
|
-
return !this.
|
|
181
|
+
return !this.kbqVisible && !this.animationState;
|
|
184
182
|
}
|
|
185
|
-
constructor(overlay, renderer, cfr, elementRef, viewContainer, modalControl, changeDetector, document) {
|
|
183
|
+
constructor(overlay, renderer, cfr, elementRef, viewContainer, modalControl, changeDetector, focusMonitor, document) {
|
|
186
184
|
super();
|
|
187
185
|
this.overlay = overlay;
|
|
188
186
|
this.renderer = renderer;
|
|
@@ -191,45 +189,46 @@ class KbqModalComponent extends KbqModalRef {
|
|
|
191
189
|
this.viewContainer = viewContainer;
|
|
192
190
|
this.modalControl = modalControl;
|
|
193
191
|
this.changeDetector = changeDetector;
|
|
192
|
+
this.focusMonitor = focusMonitor;
|
|
194
193
|
this.document = document;
|
|
195
194
|
this.componentColors = KbqComponentColors;
|
|
196
|
-
this.
|
|
197
|
-
this.
|
|
198
|
-
this.
|
|
199
|
-
this.
|
|
200
|
-
this.
|
|
201
|
-
this.
|
|
202
|
-
this.
|
|
203
|
-
this.
|
|
204
|
-
this.
|
|
195
|
+
this.kbqModalType = 'default';
|
|
196
|
+
this._kbqVisible = false;
|
|
197
|
+
this.kbqVisibleChange = new EventEmitter();
|
|
198
|
+
this.kbqZIndex = 1000;
|
|
199
|
+
this.kbqSize = ModalSize.Medium;
|
|
200
|
+
this.kbqCloseByESC = true;
|
|
201
|
+
this._kbqClosable = true;
|
|
202
|
+
this._kbqMask = true;
|
|
203
|
+
this._kbqMaskClosable = false;
|
|
205
204
|
// Trigger when modal open(visible) after animations
|
|
206
|
-
this.
|
|
205
|
+
this.kbqAfterOpen = new EventEmitter();
|
|
207
206
|
// Trigger when modal leave-animation over
|
|
208
|
-
this.
|
|
209
|
-
this.
|
|
210
|
-
this.
|
|
211
|
-
this.
|
|
212
|
-
this.
|
|
213
|
-
this.
|
|
214
|
-
this.
|
|
207
|
+
this.kbqAfterClose = new EventEmitter();
|
|
208
|
+
this.kbqOkType = KbqComponentColors.Contrast;
|
|
209
|
+
this.kbqRestoreFocus = true;
|
|
210
|
+
this._kbqOkLoading = false;
|
|
211
|
+
this.kbqOnOk = new EventEmitter();
|
|
212
|
+
this._kbqCancelLoading = false;
|
|
213
|
+
this.kbqOnCancel = new EventEmitter();
|
|
215
214
|
// The origin point that animation based on
|
|
216
215
|
this.transformOrigin = '0px 0px 0px';
|
|
217
|
-
this.
|
|
216
|
+
this.kbqGetContainer = () => this.overlay.create();
|
|
218
217
|
}
|
|
219
218
|
ngOnInit() {
|
|
220
219
|
// Create component along without View
|
|
221
|
-
if (this.isComponent(this.
|
|
222
|
-
this.createDynamicComponent(this.
|
|
220
|
+
if (this.isComponent(this.kbqContent)) {
|
|
221
|
+
this.createDynamicComponent(this.kbqContent);
|
|
223
222
|
}
|
|
224
223
|
// Setup default button options
|
|
225
|
-
if (this.isModalButtons(this.
|
|
226
|
-
this.
|
|
224
|
+
if (this.isModalButtons(this.kbqFooter)) {
|
|
225
|
+
this.kbqFooter = this.formatModalButtons(this.kbqFooter);
|
|
227
226
|
}
|
|
228
|
-
if (this.isComponent(this.
|
|
229
|
-
this.createDynamicComponent(this.
|
|
227
|
+
if (this.isComponent(this.kbqComponent)) {
|
|
228
|
+
this.createDynamicComponent(this.kbqComponent);
|
|
230
229
|
}
|
|
231
230
|
// Place the modal dom to elsewhere
|
|
232
|
-
this.container = typeof this.
|
|
231
|
+
this.container = typeof this.kbqGetContainer === 'function' ? this.kbqGetContainer() : this.kbqGetContainer;
|
|
233
232
|
if (this.container instanceof HTMLElement) {
|
|
234
233
|
this.container.appendChild(this.elementRef.nativeElement);
|
|
235
234
|
}
|
|
@@ -242,13 +241,13 @@ class KbqModalComponent extends KbqModalRef {
|
|
|
242
241
|
}
|
|
243
242
|
// [NOTE] NOT available when using by service!
|
|
244
243
|
// Because ngOnChanges never be called when using by service,
|
|
245
|
-
// here we can't support "
|
|
246
|
-
// BUT: User also can change "
|
|
244
|
+
// here we can't support "kbqContent"(Component) etc. as inputs that initialized dynamically.
|
|
245
|
+
// BUT: User also can change "kbqContent" dynamically to trigger UI changes
|
|
247
246
|
// (provided you don't use Component that needs initializations)
|
|
248
247
|
ngOnChanges(changes) {
|
|
249
|
-
if (changes.
|
|
248
|
+
if (changes.kbqVisible) {
|
|
250
249
|
// Do not trigger animation while initializing
|
|
251
|
-
this.handleVisibleStateChange(this.
|
|
250
|
+
this.handleVisibleStateChange(this.kbqVisible, !changes.kbqVisible.firstChange);
|
|
252
251
|
}
|
|
253
252
|
}
|
|
254
253
|
ngAfterViewInit() {
|
|
@@ -271,14 +270,21 @@ class KbqModalComponent extends KbqModalRef {
|
|
|
271
270
|
}
|
|
272
271
|
open() {
|
|
273
272
|
this.focusedElementBeforeOpen = this.document.activeElement;
|
|
273
|
+
this.focusMonitor.monitor(this.modalContainer, true)
|
|
274
|
+
.pipe(take(1))
|
|
275
|
+
.subscribe((origin) => {
|
|
276
|
+
this.previouslyFocusedElementOrigin = origin;
|
|
277
|
+
this.focusMonitor.stopMonitoring(this.modalContainer);
|
|
278
|
+
});
|
|
274
279
|
this.changeVisibleFromInside(true);
|
|
275
280
|
}
|
|
276
281
|
close(result) {
|
|
277
|
-
|
|
278
|
-
this.focusedElementBeforeOpen
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
+
this.changeVisibleFromInside(false, result).then(() => {
|
|
283
|
+
if (this.kbqRestoreFocus && this.focusedElementBeforeOpen) {
|
|
284
|
+
this.focusMonitor.focusVia(this.focusedElementBeforeOpen, this.previouslyFocusedElementOrigin);
|
|
285
|
+
this.focusedElementBeforeOpen = null;
|
|
286
|
+
}
|
|
287
|
+
});
|
|
282
288
|
}
|
|
283
289
|
// Destroy equals Close
|
|
284
290
|
destroy(result) {
|
|
@@ -309,16 +315,16 @@ class KbqModalComponent extends KbqModalRef {
|
|
|
309
315
|
return this.getElement().getElementsByClassName('kbq-modal-footer').item(0);
|
|
310
316
|
}
|
|
311
317
|
onClickMask($event) {
|
|
312
|
-
if (this.
|
|
313
|
-
this.
|
|
318
|
+
if (this.kbqMask &&
|
|
319
|
+
this.kbqMaskClosable &&
|
|
314
320
|
$event.target.classList.contains('kbq-modal-wrap') &&
|
|
315
|
-
this.
|
|
321
|
+
this.kbqVisible) {
|
|
316
322
|
this.onClickOkCancel('cancel');
|
|
317
323
|
}
|
|
318
324
|
}
|
|
319
325
|
// tslint:disable-next-line: no-reserved-keywords
|
|
320
326
|
isModalType(type) {
|
|
321
|
-
return this.
|
|
327
|
+
return this.kbqModalType === type;
|
|
322
328
|
}
|
|
323
329
|
onKeyDown(event) {
|
|
324
330
|
// tslint:disable-next-line:deprecation .key isn't supported in Edge
|
|
@@ -328,7 +334,7 @@ class KbqModalComponent extends KbqModalRef {
|
|
|
328
334
|
}
|
|
329
335
|
// tslint:disable-next-line:deprecation .key isn't supported in Edge
|
|
330
336
|
if (event.ctrlKey && event.keyCode === ENTER) {
|
|
331
|
-
if (this.
|
|
337
|
+
if (this.kbqModalType === 'confirm') {
|
|
332
338
|
this.triggerOk();
|
|
333
339
|
}
|
|
334
340
|
this.getElement().querySelector('[kbq-modal-main-action]')?.click();
|
|
@@ -337,22 +343,25 @@ class KbqModalComponent extends KbqModalRef {
|
|
|
337
343
|
}
|
|
338
344
|
// AoT
|
|
339
345
|
onClickCloseBtn() {
|
|
340
|
-
if (this.
|
|
346
|
+
if (this.kbqVisible) {
|
|
341
347
|
this.onClickOkCancel('cancel');
|
|
342
348
|
}
|
|
343
349
|
}
|
|
344
350
|
// AoT
|
|
345
351
|
// tslint:disable-next-line: no-reserved-keywords
|
|
346
352
|
onClickOkCancel(type) {
|
|
347
|
-
|
|
348
|
-
|
|
353
|
+
this.handleCloseResult(type, (doClose) => doClose !== false);
|
|
354
|
+
}
|
|
355
|
+
handleCloseResult(triggerType, canClose) {
|
|
356
|
+
const trigger = { ok: this.kbqOnOk, cancel: this.kbqOnCancel }[triggerType];
|
|
357
|
+
const loadingKey = { ok: 'kbqOkLoading', cancel: 'kbqCancelLoading' }[triggerType];
|
|
349
358
|
if (trigger instanceof EventEmitter) {
|
|
350
359
|
trigger.emit(this.getContentComponent());
|
|
351
360
|
}
|
|
352
361
|
else if (typeof trigger === 'function') {
|
|
353
362
|
const result = trigger(this.getContentComponent());
|
|
354
363
|
// Users can return "false" to prevent closing by default
|
|
355
|
-
const caseClose = (doClose) => (doClose
|
|
364
|
+
const caseClose = (doClose) => canClose(doClose) && this.close(doClose);
|
|
356
365
|
if (isPromise(result)) {
|
|
357
366
|
this[loadingKey] = true;
|
|
358
367
|
const handleThen = (doClose) => {
|
|
@@ -392,7 +401,7 @@ class KbqModalComponent extends KbqModalRef {
|
|
|
392
401
|
}
|
|
393
402
|
return typeof value === 'function' ? value.apply(options, args) : value;
|
|
394
403
|
}
|
|
395
|
-
// On
|
|
404
|
+
// On kbqFooter's modal button click
|
|
396
405
|
// AoT
|
|
397
406
|
onButtonClick(button) {
|
|
398
407
|
// Call onClick directly
|
|
@@ -414,21 +423,21 @@ class KbqModalComponent extends KbqModalRef {
|
|
|
414
423
|
// Emit open/close event after animations over
|
|
415
424
|
.then(() => {
|
|
416
425
|
if (visible) {
|
|
417
|
-
this.
|
|
426
|
+
this.kbqAfterOpen.emit();
|
|
418
427
|
}
|
|
419
428
|
else {
|
|
420
|
-
this.
|
|
429
|
+
this.kbqAfterClose.emit(closeResult);
|
|
421
430
|
// Show/hide scrollbar when animation is over
|
|
422
431
|
this.changeBodyOverflow();
|
|
423
432
|
}
|
|
424
433
|
});
|
|
425
434
|
}
|
|
426
|
-
// Change
|
|
435
|
+
// Change kbqVisible from inside
|
|
427
436
|
changeVisibleFromInside(visible, closeResult) {
|
|
428
|
-
if (this.
|
|
429
|
-
// Change
|
|
430
|
-
this.
|
|
431
|
-
this.
|
|
437
|
+
if (this.kbqVisible !== visible) {
|
|
438
|
+
// Change kbqVisible value immediately
|
|
439
|
+
this.kbqVisible = visible;
|
|
440
|
+
this.kbqVisibleChange.emit(visible);
|
|
432
441
|
return this.handleVisibleStateChange(visible, true, closeResult);
|
|
433
442
|
}
|
|
434
443
|
return Promise.resolve();
|
|
@@ -499,9 +508,9 @@ class KbqModalComponent extends KbqModalRef {
|
|
|
499
508
|
parent: this.viewContainer.injector
|
|
500
509
|
});
|
|
501
510
|
this.contentComponentRef = factory.create(childInjector);
|
|
502
|
-
if (this.
|
|
511
|
+
if (this.kbqComponentParams) {
|
|
503
512
|
// @ts-ignore
|
|
504
|
-
Object.assign(this.contentComponentRef.instance, this.
|
|
513
|
+
Object.assign(this.contentComponentRef.instance, this.kbqComponentParams);
|
|
505
514
|
}
|
|
506
515
|
// Do the first change detection immediately
|
|
507
516
|
// (or we do detection at ngAfterViewInit, multi-changes error will be thrown)
|
|
@@ -528,78 +537,78 @@ class KbqModalComponent extends KbqModalRef {
|
|
|
528
537
|
this.renderer.removeStyle(this.document.body, 'overflow');
|
|
529
538
|
}
|
|
530
539
|
}
|
|
531
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.5", ngImport: i0, type: KbqModalComponent, deps: [{ token: i1.Overlay }, { token: i0.Renderer2 }, { token: i0.ComponentFactoryResolver }, { token: i0.ElementRef }, { token: i0.ViewContainerRef }, { token: KbqModalControlService }, { token: i0.ChangeDetectorRef }, { token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
532
|
-
/** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.5", type: KbqModalComponent, selector: "kbq-modal", inputs: { mcModalType: "mcModalType", mcComponent: "mcComponent", mcContent: "mcContent", mcComponentParams: "mcComponentParams", mcFooter: "mcFooter", mcVisible: "mcVisible", mcZIndex: "mcZIndex", mcWidth: "mcWidth", mcSize: "mcSize", mcWrapClassName: "mcWrapClassName", mcClassName: "mcClassName", mcStyle: "mcStyle", mcTitle: "mcTitle", mcCloseByESC: "mcCloseByESC", mcClosable: "mcClosable", mcMask: "mcMask", mcMaskClosable: "mcMaskClosable", mcMaskStyle: "mcMaskStyle", mcBodyStyle: "mcBodyStyle", mcOkText: "mcOkText", mcOkType: "mcOkType", mcRestoreFocus: "mcRestoreFocus", mcOkLoading: "mcOkLoading", mcOnOk: "mcOnOk", mcCancelText: "mcCancelText", mcCancelLoading: "mcCancelLoading", mcOnCancel: "mcOnCancel", mcGetContainer: "mcGetContainer" }, outputs: { mcVisibleChange: "mcVisibleChange", mcAfterOpen: "mcAfterOpen", mcAfterClose: "mcAfterClose", mcOnOk: "mcOnOk", mcOnCancel: "mcOnCancel" }, host: { listeners: { "keydown": "onKeyDown($event)" } }, viewQueries: [{ propertyName: "modalContainer", first: true, predicate: ["modalContainer"], descendants: true, static: true }, { propertyName: "bodyContainer", first: true, predicate: ["bodyContainer"], descendants: true, read: ViewContainerRef }, { propertyName: "modalBody", first: true, predicate: ["modalBody"], descendants: true }, { propertyName: "autoFocusedButtons", predicate: ["autoFocusedButton"], descendants: true, read: ElementRef }], usesInheritance: true, usesOnChanges: true, ngImport: i0, template: "<!-- Compatible: the <ng-content> can appear only once -->\n<ng-template #tplOriginContent>\n <ng-content></ng-content>\n</ng-template>\n\n<div>\n <div *ngIf=\"mcMask\"\n class=\"kbq-modal-mask\"\n [ngClass]=\"maskAnimationClassMap\"\n [class.kbq-modal-mask-hidden]=\"hidden\"\n [ngStyle]=\"mcMaskStyle\"\n [style.zIndex]=\"mcZIndex\">\n </div>\n\n <div (mousedown)=\"onClickMask($event)\"\n class=\"kbq-modal-wrap {{ mcWrapClassName }}\"\n [style.zIndex]=\"mcZIndex\"\n [style.display]=\"hidden ? 'none' : ''\"\n tabindex=\"-1\">\n\n <div #modalContainer\n class=\"kbq-modal {{ mcClassName }} kbq-modal_{{ mcSize }}\"\n [ngClass]=\"modalAnimationClassMap\"\n [ngStyle]=\"mcStyle\"\n [style.width]=\"mcWidth | toCssUnit\"\n [style.transform-origin]=\"transformOrigin\">\n\n <div class=\"kbq-modal-content\" cdkTrapFocus [cdkTrapFocusAutoCapture]=\"mcRestoreFocus\">\n <ng-container [ngSwitch]=\"true\">\n <ng-container *ngSwitchCase=\"isModalType('default')\"\n [ngTemplateOutlet]=\"tplContentDefault\"></ng-container>\n <ng-container *ngSwitchCase=\"isModalType('confirm')\"\n [ngTemplateOutlet]=\"tplContentConfirm\"></ng-container>\n <ng-container *ngSwitchCase=\"isModalType('custom')\"\n [ngTemplateOutlet]=\"tplContentCustom\"></ng-container>\n </ng-container>\n </div>\n </div>\n </div>\n</div>\n\n<ng-template #tplContentCustom>\n <ng-container #bodyContainer></ng-container>\n</ng-template>\n\n\n<!-- [Predefined] Default Modal Content -->\n<ng-template #tplContentDefault>\n <div *ngIf=\"mcTitle\" class=\"kbq-modal-header\" kbq-title>\n <div class=\"kbq-modal-title\">\n <ng-container [ngSwitch]=\"true\">\n <ng-container *ngSwitchCase=\"isTemplateRef(mcTitle)\" [ngTemplateOutlet]=\"$any(mcTitle)\"></ng-container>\n <ng-container *ngSwitchCase=\"isNonEmptyString(mcTitle)\">\n <div [innerHTML]=\"mcTitle\"></div>\n </ng-container>\n </ng-container>\n </div>\n\n <button *ngIf=\"mcClosable\"\n kbq-button\n [color]=\"'contrast'\"\n (click)=\"onClickCloseBtn()\"\n class=\"kbq-modal-close kbq-button_transparent\">\n <i kbq-icon=\"mc-close-L_16\" [color]=\"componentColors.Contrast\"></i>\n </button>\n </div>\n <div class=\"kbq-modal-body kbq-scrollbar\" #modalBody [ngStyle]=\"mcBodyStyle\">\n <ng-container #bodyContainer>\n <ng-container *ngIf=\"!isComponent(mcContent)\" [ngSwitch]=\"true\">\n <ng-container *ngSwitchCase=\"isTemplateRef(mcContent)\" [ngTemplateOutlet]=\"$any(mcContent)\"></ng-container>\n <ng-container *ngSwitchCase=\"isNonEmptyString(mcContent)\">\n <div [innerHTML]=\"mcContent\"></div>\n </ng-container>\n <ng-container *ngSwitchDefault [ngTemplateOutlet]=\"tplOriginContent\"></ng-container>\n </ng-container>\n </ng-container>\n </div>\n <div *ngIf=\"mcFooter || mcOkText || mcCancelText\" class=\"kbq-modal-footer\">\n <ng-container [ngSwitch]=\"true\">\n <ng-container *ngSwitchCase=\"isTemplateRef(mcFooter)\" [ngTemplateOutlet]=\"$any(mcFooter)\"></ng-container>\n <ng-container *ngSwitchCase=\"isNonEmptyString(mcFooter)\">\n <div [innerHTML]=\"mcFooter\"></div>\n </ng-container>\n <ng-container *ngSwitchCase=\"isModalButtons(mcFooter)\">\n <ng-container *ngFor=\"let button of $any(mcFooter)\">\n <button\n kbq-button\n #autoFocusedButton\n [attr.autofocus]=\"button.autoFocus\"\n [attr.kbq-modal-main-action]=\"button.mcModalMainAction\"\n *ngIf=\"getButtonCallableProp(button, 'show')\"\n [disabled]=\"getButtonCallableProp(button, 'disabled')\"\n [class.kbq-progress]=\"getButtonCallableProp(button, 'loading')\"\n (click)=\"onButtonClick(button)\"\n [color]=\"button.type\">\n {{ button.label }}\n </button>\n </ng-container>\n </ng-container>\n <ng-container *ngSwitchDefault>\n <button\n #autoFocusedButton\n [attr.autofocus]=\"true\"\n *ngIf=\"mcOkText\"\n kbq-button\n [color]=\"componentColors.Contrast\"\n (click)=\"onClickOkCancel('ok')\">\n\n {{ okText }}\n </button>\n <button *ngIf=\"mcCancelText\" kbq-button (click)=\"onClickOkCancel('cancel')\">\n {{ cancelText }}\n </button>\n </ng-container>\n </ng-container>\n </div>\n</ng-template>\n<!-- /[Predefined] Default Modal Content -->\n\n<!-- [Predefined] Confirm Modal Content -->\n<ng-template #tplContentConfirm>\n <div class=\"kbq-modal-body\" [ngStyle]=\"mcBodyStyle\">\n <ng-container #bodyContainer>\n <ng-container *ngIf=\"!isComponent(mcContent)\" [ngSwitch]=\"true\">\n <ng-container *ngSwitchCase=\"isTemplateRef(mcContent)\"\n [ngTemplateOutlet]=\"$any(mcContent)\">\n </ng-container>\n <ng-container *ngSwitchCase=\"isNonEmptyString(mcContent)\">\n <div [innerHTML]=\"mcContent\"></div>\n </ng-container>\n <ng-container *ngSwitchDefault [ngTemplateOutlet]=\"tplOriginContent\"></ng-container>\n </ng-container>\n </ng-container>\n </div>\n <div class=\"kbq-confirm-footer\" *ngIf=\"mcOkText || mcCancelText\">\n <button\n kbq-button\n #autoFocusedButton\n [color]=\"mcOkType\"\n [attr.autofocus]=\"true\"\n *ngIf=\"mcOkText\"\n (click)=\"onClickOkCancel('ok')\">\n\n {{ okText }}\n </button>\n\n <button kbq-button *ngIf=\"mcCancelText\" (click)=\"onClickOkCancel('cancel')\">\n {{ cancelText }}\n </button>\n </div>\n</ng-template>\n<!-- /[Predefined] Confirm Modal Content -->\n", styles: [".kbq-confirm .kbq-modal-close{display:none}.kbq-confirm .kbq-modal-body{padding-right:var(--kbq-modal-size-content-padding-horizontal, 32px);padding-left:var(--kbq-modal-size-content-padding-horizontal, 32px);padding-bottom:var(--kbq-modal-size-content-padding-bottom, 24px)}.kbq-confirm .kbq-confirm-footer{display:flex;padding:var(--kbq-modal-size-footer-padding-top, 8px) var(--kbq-modal-size-footer-padding-horizontal, ) var(--kbq-modal-size-footer-padding-bottom, 32px) var(--kbq-modal-size-footer-padding-horizontal, 32px);gap:var(--kbq-modal-size-footer-content-gap-horizontal, 16px)}.kbq-modal{box-sizing:border-box;position:relative;top:48px;border-radius:var(--kbq-modal-size-border-radius, 8px);width:auto;margin:0 auto;list-style:none}.kbq-modal.zoom-enter,.kbq-modal.zoom-appear{animation-duration:.3s;transform:none;opacity:0}.kbq-modal.kbq-modal_small{width:var(--kbq-modal-size-small-width, 400px)}.kbq-modal.kbq-modal_medium{width:var(--kbq-modal-size-medium-width, 640px)}.kbq-modal.kbq-modal_large{width:var(--kbq-modal-size-large-width, 960px)}.kbq-modal-wrap{position:fixed;z-index:1000;inset:0;overflow:auto;-webkit-overflow-scrolling:touch;outline:0}.kbq-modal-content{position:relative;border-radius:var(--kbq-modal-size-border-radius, 8px);background-clip:padding-box;background-color:#fff}.kbq-modal-header{display:flex;align-items:center;justify-content:space-between;padding:var(--kbq-modal-size-header-padding-vertical, 16px) var(--kbq-modal-size-header-padding-right, 12px) var(--kbq-modal-size-header-padding-vertical, 16px) var(--kbq-modal-size-header-padding-left, 32px)}.kbq-modal-title{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden}.kbq-modal-body{display:block;overflow-y:auto;max-height:calc(100vh - 260px);padding-right:var(--kbq-modal-size-content-padding-horizontal, 32px);padding-left:var(--kbq-modal-size-content-padding-horizontal, 32px);padding-bottom:var(--kbq-modal-size-content-padding-bottom, 24px);word-wrap:break-word}.kbq-modal-footer{display:flex;align-items:center;padding:var(--kbq-modal-size-footer-padding-top, 8px) var(--kbq-modal-size-footer-padding-horizontal, ) var(--kbq-modal-size-footer-padding-bottom, 32px) var(--kbq-modal-size-footer-padding-horizontal, 32px);gap:var(--kbq-modal-size-footer-content-gap-horizontal, 16px)}.kbq-modal-mask{position:fixed;z-index:1000;inset:0;height:100%}.kbq-modal-mask.kbq-modal-mask-hidden{display:none}.kbq-modal-open{overflow:hidden}\n"], dependencies: [{ kind: "directive", type: i3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i3.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i3.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: i3.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { kind: "directive", type: i3.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { kind: "directive", type: i3.NgSwitchDefault, selector: "[ngSwitchDefault]" }, { kind: "directive", type: i4.CdkTrapFocus, selector: "[cdkTrapFocus]", inputs: ["cdkTrapFocus", "cdkTrapFocusAutoCapture"], exportAs: ["cdkTrapFocus"] }, { kind: "component", type: i5.KbqButton, selector: "[kbq-button]", inputs: ["color", "tabIndex", "kbqStyle", "disabled"] }, { kind: "directive", type: i5.KbqButtonCssStyler, selector: "[kbq-button]" }, { kind: "component", type: i6.KbqIcon, selector: "[kbq-icon]", inputs: ["color", "small", "autoColor"] }, { kind: "directive", type: i7.KbqTitleDirective, selector: "[kbq-title]", exportAs: ["mcTitle"] }, { kind: "pipe", type: CssUnitPipe, name: "toCssUnit" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
540
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.5", ngImport: i0, type: KbqModalComponent, deps: [{ token: i1.Overlay }, { token: i0.Renderer2 }, { token: i0.ComponentFactoryResolver }, { token: i0.ElementRef }, { token: i0.ViewContainerRef }, { token: KbqModalControlService }, { token: i0.ChangeDetectorRef }, { token: i3.FocusMonitor }, { token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
541
|
+
/** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.5", type: KbqModalComponent, selector: "kbq-modal", inputs: { kbqModalType: "kbqModalType", kbqComponent: "kbqComponent", kbqContent: "kbqContent", kbqComponentParams: "kbqComponentParams", kbqFooter: "kbqFooter", kbqVisible: "kbqVisible", kbqZIndex: "kbqZIndex", kbqWidth: "kbqWidth", kbqSize: "kbqSize", kbqWrapClassName: "kbqWrapClassName", kbqClassName: "kbqClassName", kbqStyle: "kbqStyle", kbqTitle: "kbqTitle", kbqCloseByESC: "kbqCloseByESC", kbqClosable: "kbqClosable", kbqMask: "kbqMask", kbqMaskClosable: "kbqMaskClosable", kbqMaskStyle: "kbqMaskStyle", kbqBodyStyle: "kbqBodyStyle", kbqOkText: "kbqOkText", kbqOkType: "kbqOkType", kbqRestoreFocus: "kbqRestoreFocus", kbqOkLoading: "kbqOkLoading", kbqOnOk: "kbqOnOk", kbqCancelText: "kbqCancelText", kbqCancelLoading: "kbqCancelLoading", kbqOnCancel: "kbqOnCancel", kbqGetContainer: "kbqGetContainer" }, outputs: { kbqVisibleChange: "kbqVisibleChange", kbqAfterOpen: "kbqAfterOpen", kbqAfterClose: "kbqAfterClose", kbqOnOk: "kbqOnOk", kbqOnCancel: "kbqOnCancel" }, host: { listeners: { "keydown": "onKeyDown($event)" } }, viewQueries: [{ propertyName: "modalContainer", first: true, predicate: ["modalContainer"], descendants: true, static: true }, { propertyName: "bodyContainer", first: true, predicate: ["bodyContainer"], descendants: true, read: ViewContainerRef }, { propertyName: "modalBody", first: true, predicate: ["modalBody"], descendants: true }, { propertyName: "autoFocusedButtons", predicate: ["autoFocusedButton"], descendants: true, read: ElementRef }], usesInheritance: true, usesOnChanges: true, ngImport: i0, template: "<!-- Compatible: the <ng-content> can appear only once -->\n<ng-template #tplOriginContent>\n <ng-content></ng-content>\n</ng-template>\n\n<div>\n <div *ngIf=\"kbqMask\"\n class=\"kbq-modal-mask\"\n [ngClass]=\"maskAnimationClassMap\"\n [class.kbq-modal-mask-hidden]=\"hidden\"\n [ngStyle]=\"kbqMaskStyle\"\n [style.zIndex]=\"kbqZIndex\">\n </div>\n\n <div (mousedown)=\"onClickMask($event)\"\n class=\"kbq-modal-wrap {{ kbqWrapClassName }}\"\n [style.zIndex]=\"kbqZIndex\"\n [style.display]=\"hidden ? 'none' : ''\"\n tabindex=\"-1\">\n\n <div #modalContainer\n class=\"kbq-modal {{ kbqClassName }} kbq-modal_{{ kbqSize }}\"\n [ngClass]=\"modalAnimationClassMap\"\n [ngStyle]=\"kbqStyle\"\n [style.width]=\"kbqWidth | toCssUnit\"\n [style.transform-origin]=\"transformOrigin\">\n\n <div class=\"kbq-modal-content\" cdkTrapFocus>\n <ng-container [ngSwitch]=\"true\">\n <ng-container *ngSwitchCase=\"isModalType('default')\"\n [ngTemplateOutlet]=\"tplContentDefault\"></ng-container>\n <ng-container *ngSwitchCase=\"isModalType('confirm')\"\n [ngTemplateOutlet]=\"tplContentConfirm\"></ng-container>\n <ng-container *ngSwitchCase=\"isModalType('custom')\"\n [ngTemplateOutlet]=\"tplContentCustom\"></ng-container>\n </ng-container>\n </div>\n </div>\n </div>\n</div>\n\n<ng-template #tplContentCustom>\n <ng-container #bodyContainer></ng-container>\n</ng-template>\n\n\n<!-- [Predefined] Default Modal Content -->\n<ng-template #tplContentDefault>\n <div *ngIf=\"kbqTitle\" class=\"kbq-modal-header\" kbq-title>\n <div class=\"kbq-modal-title\">\n <ng-container [ngSwitch]=\"true\">\n <ng-container *ngSwitchCase=\"isTemplateRef(kbqTitle)\" [ngTemplateOutlet]=\"$any(kbqTitle)\"></ng-container>\n <ng-container *ngSwitchCase=\"isNonEmptyString(kbqTitle)\">\n <div [innerHTML]=\"kbqTitle\"></div>\n </ng-container>\n </ng-container>\n </div>\n\n <button *ngIf=\"kbqClosable\"\n kbq-button\n [color]=\"'contrast'\"\n (click)=\"onClickCloseBtn()\"\n class=\"kbq-modal-close kbq-button_transparent\">\n <i kbq-icon=\"mc-close-L_16\" [color]=\"componentColors.Contrast\"></i>\n </button>\n </div>\n <div class=\"kbq-modal-body kbq-scrollbar\" #modalBody [ngStyle]=\"kbqBodyStyle\">\n <ng-container #bodyContainer>\n <ng-container *ngIf=\"!isComponent(kbqContent)\" [ngSwitch]=\"true\">\n <ng-container *ngSwitchCase=\"isTemplateRef(kbqContent)\" [ngTemplateOutlet]=\"$any(kbqContent)\"></ng-container>\n <ng-container *ngSwitchCase=\"isNonEmptyString(kbqContent)\">\n <div [innerHTML]=\"kbqContent\"></div>\n </ng-container>\n <ng-container *ngSwitchDefault [ngTemplateOutlet]=\"tplOriginContent\"></ng-container>\n </ng-container>\n </ng-container>\n </div>\n <div *ngIf=\"kbqFooter || kbqOkText || kbqCancelText\" class=\"kbq-modal-footer\">\n <ng-container [ngSwitch]=\"true\">\n <ng-container *ngSwitchCase=\"isTemplateRef(kbqFooter)\" [ngTemplateOutlet]=\"$any(kbqFooter)\"></ng-container>\n <ng-container *ngSwitchCase=\"isNonEmptyString(kbqFooter)\">\n <div [innerHTML]=\"kbqFooter\"></div>\n </ng-container>\n <ng-container *ngSwitchCase=\"isModalButtons(kbqFooter)\">\n <ng-container *ngFor=\"let button of $any(kbqFooter)\">\n <button\n kbq-button\n #autoFocusedButton\n [attr.autofocus]=\"button.autoFocus\"\n [attr.kbq-modal-main-action]=\"button.kbqModalMainAction\"\n *ngIf=\"getButtonCallableProp(button, 'show')\"\n [disabled]=\"getButtonCallableProp(button, 'disabled')\"\n [class.kbq-progress]=\"getButtonCallableProp(button, 'loading')\"\n (click)=\"onButtonClick(button)\"\n [color]=\"button.type\">\n {{ button.label }}\n </button>\n </ng-container>\n </ng-container>\n <ng-container *ngSwitchDefault>\n <button\n #autoFocusedButton\n [attr.autofocus]=\"true\"\n *ngIf=\"kbqOkText\"\n kbq-button\n [color]=\"componentColors.Contrast\"\n (click)=\"onClickOkCancel('ok')\">\n\n {{ okText }}\n </button>\n <button *ngIf=\"kbqCancelText\" kbq-button (click)=\"onClickOkCancel('cancel')\">\n {{ cancelText }}\n </button>\n </ng-container>\n </ng-container>\n </div>\n</ng-template>\n<!-- /[Predefined] Default Modal Content -->\n\n<!-- [Predefined] Confirm Modal Content -->\n<ng-template #tplContentConfirm>\n <div class=\"kbq-modal-body\" [ngStyle]=\"kbqBodyStyle\">\n <ng-container #bodyContainer>\n <ng-container *ngIf=\"!isComponent(kbqContent)\" [ngSwitch]=\"true\">\n <ng-container *ngSwitchCase=\"isTemplateRef(kbqContent)\"\n [ngTemplateOutlet]=\"$any(kbqContent)\">\n </ng-container>\n <ng-container *ngSwitchCase=\"isNonEmptyString(kbqContent)\">\n <div [innerHTML]=\"kbqContent\"></div>\n </ng-container>\n <ng-container *ngSwitchDefault [ngTemplateOutlet]=\"tplOriginContent\"></ng-container>\n </ng-container>\n </ng-container>\n </div>\n <div class=\"kbq-confirm-footer\" *ngIf=\"kbqOkText || kbqCancelText\">\n <button\n kbq-button\n #autoFocusedButton\n [color]=\"kbqOkType\"\n [attr.autofocus]=\"true\"\n *ngIf=\"kbqOkText\"\n (click)=\"onClickOkCancel('ok')\">\n\n {{ okText }}\n </button>\n\n <button kbq-button *ngIf=\"kbqCancelText\" (click)=\"onClickOkCancel('cancel')\">\n {{ cancelText }}\n </button>\n </div>\n</ng-template>\n<!-- /[Predefined] Confirm Modal Content -->\n", styles: [".kbq-confirm .kbq-modal-close{display:none}.kbq-confirm .kbq-modal-body{padding-right:var(--kbq-modal-size-content-padding-horizontal, 32px);padding-left:var(--kbq-modal-size-content-padding-horizontal, 32px);padding-bottom:var(--kbq-modal-size-content-padding-bottom, 24px)}.kbq-confirm .kbq-confirm-footer{display:flex;padding:var(--kbq-modal-size-footer-padding-top, 8px) var(--kbq-modal-size-footer-padding-horizontal, ) var(--kbq-modal-size-footer-padding-bottom, 32px) var(--kbq-modal-size-footer-padding-horizontal, 32px);gap:var(--kbq-modal-size-footer-content-gap-horizontal, 16px)}.kbq-modal{box-sizing:border-box;position:relative;top:48px;border-radius:var(--kbq-modal-size-border-radius, 8px);width:auto;margin:0 auto;list-style:none}.kbq-modal.zoom-enter,.kbq-modal.zoom-appear{animation-duration:.3s;transform:none;opacity:0}.kbq-modal.kbq-modal_small{width:var(--kbq-modal-size-small-width, 400px)}.kbq-modal.kbq-modal_medium{width:var(--kbq-modal-size-medium-width, 640px)}.kbq-modal.kbq-modal_large{width:var(--kbq-modal-size-large-width, 960px)}.kbq-modal-wrap{position:fixed;z-index:1000;inset:0;overflow:auto;-webkit-overflow-scrolling:touch;outline:0}.kbq-modal-content{position:relative;border-radius:var(--kbq-modal-size-border-radius, 8px);background-clip:padding-box;background-color:#fff}.kbq-modal-header{display:flex;align-items:center;justify-content:space-between;padding:var(--kbq-modal-size-header-padding-vertical, 16px) var(--kbq-modal-size-header-padding-right, 12px) var(--kbq-modal-size-header-padding-vertical, 16px) var(--kbq-modal-size-header-padding-left, 32px)}.kbq-modal-title{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden}.kbq-modal-body{display:block;overflow-y:auto;max-height:calc(100vh - 260px);padding-right:var(--kbq-modal-size-content-padding-horizontal, 32px);padding-left:var(--kbq-modal-size-content-padding-horizontal, 32px);padding-bottom:var(--kbq-modal-size-content-padding-bottom, 24px);word-wrap:break-word}.kbq-modal-footer{display:flex;align-items:center;padding:var(--kbq-modal-size-footer-padding-top, 8px) var(--kbq-modal-size-footer-padding-horizontal, ) var(--kbq-modal-size-footer-padding-bottom, 32px) var(--kbq-modal-size-footer-padding-horizontal, 32px);gap:var(--kbq-modal-size-footer-content-gap-horizontal, 16px)}.kbq-modal-mask{position:fixed;z-index:1000;inset:0;height:100%}.kbq-modal-mask.kbq-modal-mask-hidden{display:none}.kbq-modal-open{overflow:hidden}\n"], dependencies: [{ kind: "directive", type: i4.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i4.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i4.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: i4.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { kind: "directive", type: i4.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { kind: "directive", type: i4.NgSwitchDefault, selector: "[ngSwitchDefault]" }, { kind: "directive", type: i3.CdkTrapFocus, selector: "[cdkTrapFocus]", inputs: ["cdkTrapFocus", "cdkTrapFocusAutoCapture"], exportAs: ["cdkTrapFocus"] }, { kind: "component", type: i5.KbqButton, selector: "[kbq-button]", inputs: ["color", "tabIndex", "kbqStyle", "disabled"] }, { kind: "directive", type: i5.KbqButtonCssStyler, selector: "[kbq-button]" }, { kind: "component", type: i6.KbqIcon, selector: "[kbq-icon]", inputs: ["color", "small", "autoColor"] }, { kind: "directive", type: i7.KbqTitleDirective, selector: "[kbq-title]", exportAs: ["kbqTitle"] }, { kind: "pipe", type: CssUnitPipe, name: "toCssUnit" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
533
542
|
}
|
|
534
543
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.5", ngImport: i0, type: KbqModalComponent, decorators: [{
|
|
535
544
|
type: Component,
|
|
536
545
|
args: [{ selector: 'kbq-modal', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
537
546
|
'(keydown)': 'onKeyDown($event)'
|
|
538
|
-
}, template: "<!-- Compatible: the <ng-content> can appear only once -->\n<ng-template #tplOriginContent>\n <ng-content></ng-content>\n</ng-template>\n\n<div>\n <div *ngIf=\"
|
|
539
|
-
}], ctorParameters: function () { return [{ type: i1.Overlay }, { type: i0.Renderer2 }, { type: i0.ComponentFactoryResolver }, { type: i0.ElementRef }, { type: i0.ViewContainerRef }, { type: KbqModalControlService }, { type: i0.ChangeDetectorRef }, { type: undefined, decorators: [{
|
|
547
|
+
}, template: "<!-- Compatible: the <ng-content> can appear only once -->\n<ng-template #tplOriginContent>\n <ng-content></ng-content>\n</ng-template>\n\n<div>\n <div *ngIf=\"kbqMask\"\n class=\"kbq-modal-mask\"\n [ngClass]=\"maskAnimationClassMap\"\n [class.kbq-modal-mask-hidden]=\"hidden\"\n [ngStyle]=\"kbqMaskStyle\"\n [style.zIndex]=\"kbqZIndex\">\n </div>\n\n <div (mousedown)=\"onClickMask($event)\"\n class=\"kbq-modal-wrap {{ kbqWrapClassName }}\"\n [style.zIndex]=\"kbqZIndex\"\n [style.display]=\"hidden ? 'none' : ''\"\n tabindex=\"-1\">\n\n <div #modalContainer\n class=\"kbq-modal {{ kbqClassName }} kbq-modal_{{ kbqSize }}\"\n [ngClass]=\"modalAnimationClassMap\"\n [ngStyle]=\"kbqStyle\"\n [style.width]=\"kbqWidth | toCssUnit\"\n [style.transform-origin]=\"transformOrigin\">\n\n <div class=\"kbq-modal-content\" cdkTrapFocus>\n <ng-container [ngSwitch]=\"true\">\n <ng-container *ngSwitchCase=\"isModalType('default')\"\n [ngTemplateOutlet]=\"tplContentDefault\"></ng-container>\n <ng-container *ngSwitchCase=\"isModalType('confirm')\"\n [ngTemplateOutlet]=\"tplContentConfirm\"></ng-container>\n <ng-container *ngSwitchCase=\"isModalType('custom')\"\n [ngTemplateOutlet]=\"tplContentCustom\"></ng-container>\n </ng-container>\n </div>\n </div>\n </div>\n</div>\n\n<ng-template #tplContentCustom>\n <ng-container #bodyContainer></ng-container>\n</ng-template>\n\n\n<!-- [Predefined] Default Modal Content -->\n<ng-template #tplContentDefault>\n <div *ngIf=\"kbqTitle\" class=\"kbq-modal-header\" kbq-title>\n <div class=\"kbq-modal-title\">\n <ng-container [ngSwitch]=\"true\">\n <ng-container *ngSwitchCase=\"isTemplateRef(kbqTitle)\" [ngTemplateOutlet]=\"$any(kbqTitle)\"></ng-container>\n <ng-container *ngSwitchCase=\"isNonEmptyString(kbqTitle)\">\n <div [innerHTML]=\"kbqTitle\"></div>\n </ng-container>\n </ng-container>\n </div>\n\n <button *ngIf=\"kbqClosable\"\n kbq-button\n [color]=\"'contrast'\"\n (click)=\"onClickCloseBtn()\"\n class=\"kbq-modal-close kbq-button_transparent\">\n <i kbq-icon=\"mc-close-L_16\" [color]=\"componentColors.Contrast\"></i>\n </button>\n </div>\n <div class=\"kbq-modal-body kbq-scrollbar\" #modalBody [ngStyle]=\"kbqBodyStyle\">\n <ng-container #bodyContainer>\n <ng-container *ngIf=\"!isComponent(kbqContent)\" [ngSwitch]=\"true\">\n <ng-container *ngSwitchCase=\"isTemplateRef(kbqContent)\" [ngTemplateOutlet]=\"$any(kbqContent)\"></ng-container>\n <ng-container *ngSwitchCase=\"isNonEmptyString(kbqContent)\">\n <div [innerHTML]=\"kbqContent\"></div>\n </ng-container>\n <ng-container *ngSwitchDefault [ngTemplateOutlet]=\"tplOriginContent\"></ng-container>\n </ng-container>\n </ng-container>\n </div>\n <div *ngIf=\"kbqFooter || kbqOkText || kbqCancelText\" class=\"kbq-modal-footer\">\n <ng-container [ngSwitch]=\"true\">\n <ng-container *ngSwitchCase=\"isTemplateRef(kbqFooter)\" [ngTemplateOutlet]=\"$any(kbqFooter)\"></ng-container>\n <ng-container *ngSwitchCase=\"isNonEmptyString(kbqFooter)\">\n <div [innerHTML]=\"kbqFooter\"></div>\n </ng-container>\n <ng-container *ngSwitchCase=\"isModalButtons(kbqFooter)\">\n <ng-container *ngFor=\"let button of $any(kbqFooter)\">\n <button\n kbq-button\n #autoFocusedButton\n [attr.autofocus]=\"button.autoFocus\"\n [attr.kbq-modal-main-action]=\"button.kbqModalMainAction\"\n *ngIf=\"getButtonCallableProp(button, 'show')\"\n [disabled]=\"getButtonCallableProp(button, 'disabled')\"\n [class.kbq-progress]=\"getButtonCallableProp(button, 'loading')\"\n (click)=\"onButtonClick(button)\"\n [color]=\"button.type\">\n {{ button.label }}\n </button>\n </ng-container>\n </ng-container>\n <ng-container *ngSwitchDefault>\n <button\n #autoFocusedButton\n [attr.autofocus]=\"true\"\n *ngIf=\"kbqOkText\"\n kbq-button\n [color]=\"componentColors.Contrast\"\n (click)=\"onClickOkCancel('ok')\">\n\n {{ okText }}\n </button>\n <button *ngIf=\"kbqCancelText\" kbq-button (click)=\"onClickOkCancel('cancel')\">\n {{ cancelText }}\n </button>\n </ng-container>\n </ng-container>\n </div>\n</ng-template>\n<!-- /[Predefined] Default Modal Content -->\n\n<!-- [Predefined] Confirm Modal Content -->\n<ng-template #tplContentConfirm>\n <div class=\"kbq-modal-body\" [ngStyle]=\"kbqBodyStyle\">\n <ng-container #bodyContainer>\n <ng-container *ngIf=\"!isComponent(kbqContent)\" [ngSwitch]=\"true\">\n <ng-container *ngSwitchCase=\"isTemplateRef(kbqContent)\"\n [ngTemplateOutlet]=\"$any(kbqContent)\">\n </ng-container>\n <ng-container *ngSwitchCase=\"isNonEmptyString(kbqContent)\">\n <div [innerHTML]=\"kbqContent\"></div>\n </ng-container>\n <ng-container *ngSwitchDefault [ngTemplateOutlet]=\"tplOriginContent\"></ng-container>\n </ng-container>\n </ng-container>\n </div>\n <div class=\"kbq-confirm-footer\" *ngIf=\"kbqOkText || kbqCancelText\">\n <button\n kbq-button\n #autoFocusedButton\n [color]=\"kbqOkType\"\n [attr.autofocus]=\"true\"\n *ngIf=\"kbqOkText\"\n (click)=\"onClickOkCancel('ok')\">\n\n {{ okText }}\n </button>\n\n <button kbq-button *ngIf=\"kbqCancelText\" (click)=\"onClickOkCancel('cancel')\">\n {{ cancelText }}\n </button>\n </div>\n</ng-template>\n<!-- /[Predefined] Confirm Modal Content -->\n", styles: [".kbq-confirm .kbq-modal-close{display:none}.kbq-confirm .kbq-modal-body{padding-right:var(--kbq-modal-size-content-padding-horizontal, 32px);padding-left:var(--kbq-modal-size-content-padding-horizontal, 32px);padding-bottom:var(--kbq-modal-size-content-padding-bottom, 24px)}.kbq-confirm .kbq-confirm-footer{display:flex;padding:var(--kbq-modal-size-footer-padding-top, 8px) var(--kbq-modal-size-footer-padding-horizontal, ) var(--kbq-modal-size-footer-padding-bottom, 32px) var(--kbq-modal-size-footer-padding-horizontal, 32px);gap:var(--kbq-modal-size-footer-content-gap-horizontal, 16px)}.kbq-modal{box-sizing:border-box;position:relative;top:48px;border-radius:var(--kbq-modal-size-border-radius, 8px);width:auto;margin:0 auto;list-style:none}.kbq-modal.zoom-enter,.kbq-modal.zoom-appear{animation-duration:.3s;transform:none;opacity:0}.kbq-modal.kbq-modal_small{width:var(--kbq-modal-size-small-width, 400px)}.kbq-modal.kbq-modal_medium{width:var(--kbq-modal-size-medium-width, 640px)}.kbq-modal.kbq-modal_large{width:var(--kbq-modal-size-large-width, 960px)}.kbq-modal-wrap{position:fixed;z-index:1000;inset:0;overflow:auto;-webkit-overflow-scrolling:touch;outline:0}.kbq-modal-content{position:relative;border-radius:var(--kbq-modal-size-border-radius, 8px);background-clip:padding-box;background-color:#fff}.kbq-modal-header{display:flex;align-items:center;justify-content:space-between;padding:var(--kbq-modal-size-header-padding-vertical, 16px) var(--kbq-modal-size-header-padding-right, 12px) var(--kbq-modal-size-header-padding-vertical, 16px) var(--kbq-modal-size-header-padding-left, 32px)}.kbq-modal-title{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden}.kbq-modal-body{display:block;overflow-y:auto;max-height:calc(100vh - 260px);padding-right:var(--kbq-modal-size-content-padding-horizontal, 32px);padding-left:var(--kbq-modal-size-content-padding-horizontal, 32px);padding-bottom:var(--kbq-modal-size-content-padding-bottom, 24px);word-wrap:break-word}.kbq-modal-footer{display:flex;align-items:center;padding:var(--kbq-modal-size-footer-padding-top, 8px) var(--kbq-modal-size-footer-padding-horizontal, ) var(--kbq-modal-size-footer-padding-bottom, 32px) var(--kbq-modal-size-footer-padding-horizontal, 32px);gap:var(--kbq-modal-size-footer-content-gap-horizontal, 16px)}.kbq-modal-mask{position:fixed;z-index:1000;inset:0;height:100%}.kbq-modal-mask.kbq-modal-mask-hidden{display:none}.kbq-modal-open{overflow:hidden}\n"] }]
|
|
548
|
+
}], ctorParameters: function () { return [{ type: i1.Overlay }, { type: i0.Renderer2 }, { type: i0.ComponentFactoryResolver }, { type: i0.ElementRef }, { type: i0.ViewContainerRef }, { type: KbqModalControlService }, { type: i0.ChangeDetectorRef }, { type: i3.FocusMonitor }, { type: undefined, decorators: [{
|
|
540
549
|
type: Inject,
|
|
541
550
|
args: [DOCUMENT]
|
|
542
|
-
}] }]; }, propDecorators: {
|
|
551
|
+
}] }]; }, propDecorators: { kbqModalType: [{
|
|
543
552
|
type: Input
|
|
544
|
-
}],
|
|
553
|
+
}], kbqComponent: [{
|
|
545
554
|
type: Input
|
|
546
|
-
}],
|
|
555
|
+
}], kbqContent: [{
|
|
547
556
|
type: Input
|
|
548
|
-
}],
|
|
557
|
+
}], kbqComponentParams: [{
|
|
549
558
|
type: Input
|
|
550
|
-
}],
|
|
559
|
+
}], kbqFooter: [{
|
|
551
560
|
type: Input
|
|
552
|
-
}],
|
|
561
|
+
}], kbqVisible: [{
|
|
553
562
|
type: Input
|
|
554
|
-
}],
|
|
563
|
+
}], kbqVisibleChange: [{
|
|
555
564
|
type: Output
|
|
556
|
-
}],
|
|
565
|
+
}], kbqZIndex: [{
|
|
557
566
|
type: Input
|
|
558
|
-
}],
|
|
567
|
+
}], kbqWidth: [{
|
|
559
568
|
type: Input
|
|
560
|
-
}],
|
|
569
|
+
}], kbqSize: [{
|
|
561
570
|
type: Input
|
|
562
|
-
}],
|
|
571
|
+
}], kbqWrapClassName: [{
|
|
563
572
|
type: Input
|
|
564
|
-
}],
|
|
573
|
+
}], kbqClassName: [{
|
|
565
574
|
type: Input
|
|
566
|
-
}],
|
|
575
|
+
}], kbqStyle: [{
|
|
567
576
|
type: Input
|
|
568
|
-
}],
|
|
577
|
+
}], kbqTitle: [{
|
|
569
578
|
type: Input
|
|
570
|
-
}],
|
|
579
|
+
}], kbqCloseByESC: [{
|
|
571
580
|
type: Input
|
|
572
|
-
}],
|
|
581
|
+
}], kbqClosable: [{
|
|
573
582
|
type: Input
|
|
574
|
-
}],
|
|
583
|
+
}], kbqMask: [{
|
|
575
584
|
type: Input
|
|
576
|
-
}],
|
|
585
|
+
}], kbqMaskClosable: [{
|
|
577
586
|
type: Input
|
|
578
|
-
}],
|
|
587
|
+
}], kbqMaskStyle: [{
|
|
579
588
|
type: Input
|
|
580
|
-
}],
|
|
589
|
+
}], kbqBodyStyle: [{
|
|
581
590
|
type: Input
|
|
582
|
-
}],
|
|
591
|
+
}], kbqAfterOpen: [{
|
|
583
592
|
type: Output
|
|
584
|
-
}],
|
|
593
|
+
}], kbqAfterClose: [{
|
|
585
594
|
type: Output
|
|
586
|
-
}],
|
|
595
|
+
}], kbqOkText: [{
|
|
587
596
|
type: Input
|
|
588
|
-
}],
|
|
597
|
+
}], kbqOkType: [{
|
|
589
598
|
type: Input
|
|
590
|
-
}],
|
|
599
|
+
}], kbqRestoreFocus: [{
|
|
591
600
|
type: Input
|
|
592
|
-
}],
|
|
601
|
+
}], kbqOkLoading: [{
|
|
593
602
|
type: Input
|
|
594
|
-
}],
|
|
603
|
+
}], kbqOnOk: [{
|
|
595
604
|
type: Input
|
|
596
605
|
}, {
|
|
597
606
|
type: Output
|
|
598
|
-
}],
|
|
607
|
+
}], kbqCancelText: [{
|
|
599
608
|
type: Input
|
|
600
|
-
}],
|
|
609
|
+
}], kbqCancelLoading: [{
|
|
601
610
|
type: Input
|
|
602
|
-
}],
|
|
611
|
+
}], kbqOnCancel: [{
|
|
603
612
|
type: Input
|
|
604
613
|
}, {
|
|
605
614
|
type: Output
|
|
@@ -615,7 +624,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.5", ngImpor
|
|
|
615
624
|
}], modalBody: [{
|
|
616
625
|
type: ViewChild,
|
|
617
626
|
args: ['modalBody']
|
|
618
|
-
}],
|
|
627
|
+
}], kbqGetContainer: [{
|
|
619
628
|
type: Input
|
|
620
629
|
}] } });
|
|
621
630
|
////////////
|
|
@@ -682,18 +691,18 @@ class ModalBuilderForService {
|
|
|
682
691
|
constructor(overlay, options = {}) {
|
|
683
692
|
this.overlay = overlay;
|
|
684
693
|
this.createModal();
|
|
685
|
-
if (!('
|
|
686
|
-
options.
|
|
694
|
+
if (!('kbqGetContainer' in options)) {
|
|
695
|
+
options.kbqGetContainer = undefined;
|
|
687
696
|
}
|
|
688
697
|
this.changeProps(options);
|
|
689
698
|
this.modalRef.instance.open();
|
|
690
|
-
this.modalRef.instance.
|
|
699
|
+
this.modalRef.instance.kbqAfterClose.subscribe(() => this.destroyModal());
|
|
691
700
|
this.overlayRef.keydownEvents()
|
|
692
701
|
.pipe(filter((event) => {
|
|
693
702
|
// tslint:disable-next-line:deprecation replacement .key isn't supported in Edge
|
|
694
|
-
return !!(event.keyCode === ESCAPE && options.
|
|
703
|
+
return !!(event.keyCode === ESCAPE && options.kbqCloseByESC);
|
|
695
704
|
}))
|
|
696
|
-
.subscribe(() => this.
|
|
705
|
+
.subscribe(() => this.getInstance()?.handleCloseResult('cancel', () => true));
|
|
697
706
|
}
|
|
698
707
|
getInstance() {
|
|
699
708
|
return this.modalRef && this.modalRef.instance;
|
|
@@ -734,44 +743,44 @@ class KbqModalService {
|
|
|
734
743
|
this.modalControl.closeAll();
|
|
735
744
|
}
|
|
736
745
|
create(options = {}) {
|
|
737
|
-
if (typeof options.
|
|
746
|
+
if (typeof options.kbqOnCancel !== 'function') {
|
|
738
747
|
// Leave a empty function to close this modal by default
|
|
739
748
|
// tslint:disable-next-line
|
|
740
|
-
options.
|
|
749
|
+
options.kbqOnCancel = () => { };
|
|
741
750
|
}
|
|
742
|
-
if (!('
|
|
743
|
-
options.
|
|
751
|
+
if (!('kbqCloseByESC' in options)) {
|
|
752
|
+
options.kbqCloseByESC = true;
|
|
744
753
|
}
|
|
745
754
|
// Remove the Cancel button if the user not specify a Cancel button
|
|
746
|
-
if (!('
|
|
747
|
-
options.
|
|
755
|
+
if (!('kbqCancelText' in options)) {
|
|
756
|
+
options.kbqCancelText = undefined;
|
|
748
757
|
}
|
|
749
758
|
// Remove the Ok button if the user not specify a Ok button
|
|
750
|
-
if (!('
|
|
751
|
-
options.
|
|
759
|
+
if (!('kbqOkText' in options)) {
|
|
760
|
+
options.kbqOkText = undefined;
|
|
752
761
|
}
|
|
753
762
|
// Remove the footer if the user not specify a footer
|
|
754
|
-
if (!('
|
|
755
|
-
options.
|
|
763
|
+
if (!('kbqFooter' in options)) {
|
|
764
|
+
options.kbqFooter = undefined;
|
|
756
765
|
}
|
|
757
766
|
return new ModalBuilderForService(this.overlay, options).getInstance();
|
|
758
767
|
}
|
|
759
768
|
confirm(options = {}, confirmType = 'confirm') {
|
|
760
|
-
if ('
|
|
761
|
-
console.warn(`The Confirm-Modal doesn't support "
|
|
769
|
+
if ('kbqFooter' in options) {
|
|
770
|
+
console.warn(`The Confirm-Modal doesn't support "kbqFooter", this property will be ignored.`);
|
|
762
771
|
}
|
|
763
772
|
// NOTE: only support function currently by calling confirm()
|
|
764
|
-
if (typeof options.
|
|
773
|
+
if (typeof options.kbqOnOk !== 'function') {
|
|
765
774
|
// Leave a empty function to close this modal by default
|
|
766
775
|
// tslint:disable-next-line
|
|
767
|
-
options.
|
|
776
|
+
options.kbqOnOk = () => { };
|
|
768
777
|
}
|
|
769
|
-
options.
|
|
770
|
-
options.
|
|
778
|
+
options.kbqModalType = 'confirm';
|
|
779
|
+
options.kbqClassName = `kbq-confirm kbq-confirm-${confirmType} ${options.kbqClassName || ''}`;
|
|
771
780
|
return this.create(options);
|
|
772
781
|
}
|
|
773
782
|
open(options = {}) {
|
|
774
|
-
options.
|
|
783
|
+
options.kbqModalType = 'custom';
|
|
775
784
|
return this.create(options);
|
|
776
785
|
}
|
|
777
786
|
success(options = {}) {
|