@progress/kendo-angular-buttons 7.0.6 → 8.0.0-dev.202204190655
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/bundles/kendo-angular-buttons.umd.js +5 -0
- package/{dist/es2015/button → button}/button.directive.d.ts +64 -62
- package/{dist/es2015/button → button}/button.module.d.ts +5 -0
- package/{dist/es2015/button → button}/button.service.d.ts +3 -0
- package/{dist/es2015/button → button}/selection-settings.d.ts +0 -0
- package/{dist/es2015/buttongroup → buttongroup}/buttongroup.component.d.ts +14 -11
- package/{dist/es2015/buttongroup → buttongroup}/buttongroup.module.d.ts +7 -0
- package/{dist/es2015/buttons.module.d.ts → buttons.module.d.ts} +10 -0
- package/{dist/es2015/chip → chip}/chip-content-click-event-args.interface.d.ts +0 -0
- package/{dist/es2015/chip → chip}/chip-list-remove-event-args.interface.d.ts +0 -0
- package/{dist/es2015/chip → chip}/chip-list.component.d.ts +8 -4
- package/{dist/es2015/chip → chip}/chip-remove-event-args.interface.d.ts +0 -0
- package/{dist/es2015/chip → chip}/chip.component.d.ts +39 -33
- package/{dist/es2015/chip → chip}/chip.module.d.ts +7 -0
- package/{dist/es2015/chip → chip}/models/selection.d.ts +0 -0
- package/{dist/es2015/common → common}/models/fillmode.d.ts +2 -2
- package/{dist/es2015/common → common}/models/rounded.d.ts +2 -2
- package/{dist/es2015/common → common}/models/size.d.ts +3 -3
- package/{dist/es2015/common → common}/models/styling-classes.d.ts +0 -0
- package/{dist/es2015/common → common}/models/theme-color.d.ts +3 -3
- package/{dist/es2015/common → common}/models.d.ts +0 -1
- package/{dist/es2015/direction.d.ts → direction.d.ts} +0 -0
- package/{dist/es2015/dropdownbutton → dropdownbutton}/dropdownbutton.component.d.ts +37 -38
- package/dropdownbutton/dropdownbutton.module.d.ts +23 -0
- package/{dist/es2015 → esm2015}/button/button.directive.js +145 -215
- package/{dist/es2015 → esm2015}/button/button.module.js +13 -10
- package/{dist/es2015 → esm2015}/button/button.service.js +8 -10
- package/{dist/es → esm2015}/button/selection-settings.js +1 -0
- package/{dist/es2015 → esm2015}/buttongroup/buttongroup.component.js +88 -111
- package/esm2015/buttongroup/buttongroup.module.js +30 -0
- package/{dist/es → esm2015}/buttons.module.js +12 -12
- package/{dist/es2015 → esm2015}/chip/chip-content-click-event-args.interface.js +1 -0
- package/{dist/es2015 → esm2015}/chip/chip-list-remove-event-args.interface.js +1 -0
- package/{dist/es2015 → esm2015}/chip/chip-list.component.js +62 -73
- package/{dist/es2015 → esm2015}/chip/chip-remove-event-args.interface.js +1 -0
- package/{dist/es2015 → esm2015}/chip/chip.component.js +171 -167
- package/{dist/es2015 → esm2015}/chip/chip.module.js +16 -11
- package/{dist/es → esm2015}/chip/models/selection.js +1 -0
- package/{dist/es → esm2015}/common/models/fillmode.js +1 -0
- package/{dist/es → esm2015}/common/models/rounded.js +1 -0
- package/{dist/es → esm2015}/common/models/size.js +1 -0
- package/{dist/es → esm2015}/common/models/styling-classes.js +1 -0
- package/{dist/es → esm2015}/common/models/theme-color.js +1 -0
- package/{dist/es → esm2015}/common/models.js +5 -0
- package/{dist/es → esm2015}/direction.js +1 -0
- package/{dist/es2015 → esm2015}/dropdownbutton/dropdownbutton.component.js +185 -214
- package/esm2015/dropdownbutton/dropdownbutton.module.js +32 -0
- package/{dist/es2015 → esm2015}/floatingactionbutton/animations/animations.js +0 -0
- package/esm2015/floatingactionbutton/dial-item.component.js +127 -0
- package/esm2015/floatingactionbutton/dial-list.component.js +90 -0
- package/{dist/es2015 → esm2015}/floatingactionbutton/floatingactionbutton.component.js +205 -210
- package/{dist/es2015 → esm2015}/floatingactionbutton/floatingactionbutton.module.js +19 -11
- package/{dist/es → esm2015}/floatingactionbutton/models/align.js +1 -0
- package/{dist/es → esm2015}/floatingactionbutton/models/item-animation.interface.js +1 -0
- package/{dist/es → esm2015}/floatingactionbutton/models/item-click.event.js +1 -0
- package/{dist/es → esm2015}/floatingactionbutton/models/item.interface.js +1 -0
- package/{dist/es → esm2015}/floatingactionbutton/models/offset.js +1 -0
- package/{dist/es → esm2015}/floatingactionbutton/models/position-mode.js +1 -0
- package/esm2015/floatingactionbutton/templates/dial-item-template.directive.js +27 -0
- package/esm2015/floatingactionbutton/templates/fab-template.directive.js +27 -0
- package/{dist/es2015 → esm2015}/floatingactionbutton/utils.js +0 -0
- package/{dist/es2015 → esm2015}/focusable/focus.service.js +8 -10
- package/{dist/es2015 → esm2015}/focusable/focusable.directive.js +20 -27
- package/{dist/es2015/listbutton/list.module.d.ts → esm2015/kendo-angular-buttons.js} +2 -3
- package/{dist/es2015 → esm2015}/listbutton/button-item-template.directive.js +12 -12
- package/{dist/es2015 → esm2015}/listbutton/list-button.js +30 -37
- package/{dist/es → esm2015}/listbutton/list-item-model.js +1 -0
- package/esm2015/listbutton/list.component.js +140 -0
- package/esm2015/listbutton/list.module.js +39 -0
- package/{dist/es → esm2015}/listbutton/popup-settings.js +1 -0
- package/esm2015/listbutton/template-context.directive.js +34 -0
- package/{dist/es2015 → esm2015}/main.js +7 -0
- package/{dist/es → esm2015}/navigation/key-events.js +0 -0
- package/{dist/es2015 → esm2015}/navigation/navigation-action.js +1 -0
- package/{dist/es2015 → esm2015}/navigation/navigation-config.js +0 -0
- package/{dist/es2015 → esm2015}/navigation/navigation.service.js +11 -9
- package/{dist/es2015 → esm2015}/package-metadata.js +1 -1
- package/{dist/es2015 → esm2015}/preventable-event.js +0 -0
- package/esm2015/splitbutton/localization/custom-messages.component.js +37 -0
- package/esm2015/splitbutton/localization/localized-messages.directive.js +36 -0
- package/esm2015/splitbutton/localization/messages.js +23 -0
- package/{dist/es2015 → esm2015}/splitbutton/splitbutton.component.js +221 -209
- package/esm2015/splitbutton/splitbutton.module.js +34 -0
- package/{dist/es2015 → esm2015}/util.js +7 -7
- package/{dist/fesm2015/index.js → fesm2015/kendo-angular-buttons.js} +1885 -1941
- package/{dist/es2015/floatingactionbutton → floatingactionbutton}/animations/animations.d.ts +0 -0
- package/{dist/es2015/floatingactionbutton → floatingactionbutton}/dial-item.component.d.ts +8 -5
- package/{dist/es2015/floatingactionbutton → floatingactionbutton}/dial-list.component.d.ts +5 -2
- package/{dist/es2015/floatingactionbutton → floatingactionbutton}/floatingactionbutton.component.d.ts +50 -51
- package/{dist/es2015/floatingactionbutton → floatingactionbutton}/floatingactionbutton.module.d.ts +13 -0
- package/{dist/es2015/floatingactionbutton → floatingactionbutton}/models/align.d.ts +0 -0
- package/{dist/es2015/floatingactionbutton → floatingactionbutton}/models/item-animation.interface.d.ts +0 -0
- package/{dist/es2015/floatingactionbutton → floatingactionbutton}/models/item-click.event.d.ts +0 -0
- package/{dist/es2015/floatingactionbutton → floatingactionbutton}/models/item.interface.d.ts +0 -0
- package/{dist/es2015/floatingactionbutton → floatingactionbutton}/models/offset.d.ts +0 -0
- package/{dist/es2015/floatingactionbutton → floatingactionbutton}/models/position-mode.d.ts +0 -0
- package/{dist/es2015/floatingactionbutton → floatingactionbutton}/templates/dial-item-template.directive.d.ts +3 -0
- package/{dist/es2015/floatingactionbutton → floatingactionbutton}/templates/fab-template.directive.d.ts +3 -0
- package/{dist/es2015/floatingactionbutton → floatingactionbutton}/utils.d.ts +0 -0
- package/{dist/es2015/focusable → focusable}/focus.service.d.ts +5 -1
- package/{dist/es2015/focusable → focusable}/focusable.directive.d.ts +4 -2
- package/{dist/es2015/common/models/shape.d.ts → kendo-angular-buttons.d.ts} +3 -3
- package/{dist/es2015/listbutton → listbutton}/button-item-template.directive.d.ts +3 -0
- package/{dist/es2015/listbutton → listbutton}/list-button.d.ts +7 -13
- package/{dist/es2015/listbutton → listbutton}/list-item-model.d.ts +0 -0
- package/{dist/es2015/listbutton → listbutton}/list.component.d.ts +4 -1
- package/listbutton/list.module.d.ts +18 -0
- package/{dist/es2015/listbutton → listbutton}/popup-settings.d.ts +0 -0
- package/{dist/es2015/listbutton → listbutton}/template-context.directive.d.ts +4 -1
- package/{dist/es2015/main.d.ts → main.d.ts} +7 -1
- package/{dist/es2015/navigation → navigation}/key-events.d.ts +0 -0
- package/{dist/es2015/navigation → navigation}/navigation-action.d.ts +0 -0
- package/{dist/es2015/navigation → navigation}/navigation-config.d.ts +0 -0
- package/{dist/es2015/navigation → navigation}/navigation.service.d.ts +3 -0
- package/{dist/es2015/package-metadata.d.ts → package-metadata.d.ts} +0 -0
- package/package.json +38 -113
- package/{dist/es2015/preventable-event.d.ts → preventable-event.d.ts} +0 -0
- package/schematics/ngAdd/index.js +5 -2
- package/schematics/ngAdd/index.js.map +1 -1
- package/{dist/es2015/splitbutton → splitbutton}/localization/custom-messages.component.d.ts +4 -1
- package/{dist/es2015/splitbutton → splitbutton}/localization/localized-messages.directive.d.ts +3 -0
- package/{dist/es2015/splitbutton → splitbutton}/localization/messages.d.ts +3 -0
- package/{dist/es2015/splitbutton → splitbutton}/splitbutton.component.d.ts +39 -27
- package/splitbutton/splitbutton.module.d.ts +25 -0
- package/{dist/es2015/util.d.ts → util.d.ts} +0 -0
- package/dist/cdn/js/kendo-angular-buttons.js +0 -20
- package/dist/cdn/main.js +0 -5
- package/dist/es/button/button.directive.js +0 -775
- package/dist/es/button/button.module.js +0 -50
- package/dist/es/button/button.service.js +0 -24
- package/dist/es/buttongroup/buttongroup.component.js +0 -353
- package/dist/es/buttongroup/buttongroup.module.js +0 -30
- package/dist/es/chip/chip-content-click-event-args.interface.js +0 -4
- package/dist/es/chip/chip-list-remove-event-args.interface.js +0 -4
- package/dist/es/chip/chip-list.component.js +0 -214
- package/dist/es/chip/chip-remove-event-args.interface.js +0 -4
- package/dist/es/chip/chip.component.js +0 -449
- package/dist/es/chip/chip.module.js +0 -55
- package/dist/es/common/models/shape.js +0 -4
- package/dist/es/dropdownbutton/dropdownbutton.component.js +0 -704
- package/dist/es/dropdownbutton/dropdownbutton.module.js +0 -32
- package/dist/es/floatingactionbutton/animations/animations.js +0 -33
- package/dist/es/floatingactionbutton/dial-item.component.js +0 -143
- package/dist/es/floatingactionbutton/dial-list.component.js +0 -76
- package/dist/es/floatingactionbutton/floatingactionbutton.component.js +0 -903
- package/dist/es/floatingactionbutton/floatingactionbutton.module.js +0 -65
- package/dist/es/floatingactionbutton/templates/dial-item-template.directive.js +0 -26
- package/dist/es/floatingactionbutton/templates/fab-template.directive.js +0 -26
- package/dist/es/floatingactionbutton/utils.js +0 -38
- package/dist/es/focusable/focus.service.js +0 -43
- package/dist/es/focusable/focusable.directive.js +0 -68
- package/dist/es/index.js +0 -22
- package/dist/es/listbutton/button-item-template.directive.js +0 -68
- package/dist/es/listbutton/list-button.js +0 -243
- package/dist/es/listbutton/list.component.js +0 -85
- package/dist/es/listbutton/list.module.js +0 -33
- package/dist/es/listbutton/template-context.directive.js +0 -40
- package/dist/es/main.js +0 -22
- package/dist/es/navigation/navigation-action.js +0 -19
- package/dist/es/navigation/navigation-config.js +0 -9
- package/dist/es/navigation/navigation.service.js +0 -114
- package/dist/es/package-metadata.js +0 -15
- package/dist/es/preventable-event.js +0 -29
- package/dist/es/splitbutton/localization/custom-messages.component.js +0 -44
- package/dist/es/splitbutton/localization/localized-messages.directive.js +0 -35
- package/dist/es/splitbutton/localization/messages.js +0 -22
- package/dist/es/splitbutton/splitbutton.component.js +0 -830
- package/dist/es/splitbutton/splitbutton.module.js +0 -34
- package/dist/es/util.js +0 -108
- package/dist/es2015/button/selection-settings.js +0 -4
- package/dist/es2015/buttongroup/buttongroup.module.js +0 -27
- package/dist/es2015/buttons.module.js +0 -51
- package/dist/es2015/chip/models/selection.js +0 -4
- package/dist/es2015/common/models/fillmode.js +0 -4
- package/dist/es2015/common/models/rounded.js +0 -4
- package/dist/es2015/common/models/shape.js +0 -4
- package/dist/es2015/common/models/size.js +0 -4
- package/dist/es2015/common/models/styling-classes.js +0 -4
- package/dist/es2015/common/models/theme-color.js +0 -4
- package/dist/es2015/common/models.js +0 -4
- package/dist/es2015/direction.js +0 -4
- package/dist/es2015/dropdownbutton/dropdownbutton.module.d.ts +0 -14
- package/dist/es2015/dropdownbutton/dropdownbutton.module.js +0 -29
- package/dist/es2015/floatingactionbutton/dial-item.component.js +0 -133
- package/dist/es2015/floatingactionbutton/dial-list.component.js +0 -81
- package/dist/es2015/floatingactionbutton/models/align.js +0 -4
- package/dist/es2015/floatingactionbutton/models/item-animation.interface.js +0 -4
- package/dist/es2015/floatingactionbutton/models/item-click.event.js +0 -4
- package/dist/es2015/floatingactionbutton/models/item.interface.js +0 -4
- package/dist/es2015/floatingactionbutton/models/offset.js +0 -4
- package/dist/es2015/floatingactionbutton/models/position-mode.js +0 -4
- package/dist/es2015/floatingactionbutton/templates/dial-item-template.directive.js +0 -25
- package/dist/es2015/floatingactionbutton/templates/fab-template.directive.js +0 -25
- package/dist/es2015/index.d.ts +0 -22
- package/dist/es2015/index.js +0 -22
- package/dist/es2015/index.metadata.json +0 -1
- package/dist/es2015/listbutton/list-item-model.js +0 -4
- package/dist/es2015/listbutton/list.component.js +0 -115
- package/dist/es2015/listbutton/list.module.js +0 -30
- package/dist/es2015/listbutton/popup-settings.js +0 -4
- package/dist/es2015/listbutton/template-context.directive.js +0 -35
- package/dist/es2015/navigation/key-events.js +0 -13
- package/dist/es2015/splitbutton/localization/custom-messages.component.js +0 -36
- package/dist/es2015/splitbutton/localization/localized-messages.directive.js +0 -31
- package/dist/es2015/splitbutton/localization/messages.js +0 -16
- package/dist/es2015/splitbutton/splitbutton.module.d.ts +0 -14
- package/dist/es2015/splitbutton/splitbutton.module.js +0 -31
- package/dist/fesm5/index.js +0 -5577
- package/dist/npm/button/button.directive.js +0 -777
- package/dist/npm/button/button.module.js +0 -52
- package/dist/npm/button/button.service.js +0 -26
- package/dist/npm/button/selection-settings.js +0 -6
- package/dist/npm/buttongroup/buttongroup.component.js +0 -355
- package/dist/npm/buttongroup/buttongroup.module.js +0 -32
- package/dist/npm/buttons.module.js +0 -56
- package/dist/npm/chip/chip-content-click-event-args.interface.js +0 -6
- package/dist/npm/chip/chip-list-remove-event-args.interface.js +0 -6
- package/dist/npm/chip/chip-list.component.js +0 -216
- package/dist/npm/chip/chip-remove-event-args.interface.js +0 -6
- package/dist/npm/chip/chip.component.js +0 -451
- package/dist/npm/chip/chip.module.js +0 -57
- package/dist/npm/chip/models/selection.js +0 -6
- package/dist/npm/common/models/fillmode.js +0 -6
- package/dist/npm/common/models/rounded.js +0 -6
- package/dist/npm/common/models/shape.js +0 -6
- package/dist/npm/common/models/size.js +0 -6
- package/dist/npm/common/models/styling-classes.js +0 -6
- package/dist/npm/common/models/theme-color.js +0 -6
- package/dist/npm/common/models.js +0 -6
- package/dist/npm/direction.js +0 -6
- package/dist/npm/dropdownbutton/dropdownbutton.component.js +0 -706
- package/dist/npm/dropdownbutton/dropdownbutton.module.js +0 -34
- package/dist/npm/floatingactionbutton/animations/animations.js +0 -37
- package/dist/npm/floatingactionbutton/dial-item.component.js +0 -145
- package/dist/npm/floatingactionbutton/dial-list.component.js +0 -78
- package/dist/npm/floatingactionbutton/floatingactionbutton.component.js +0 -905
- package/dist/npm/floatingactionbutton/floatingactionbutton.module.js +0 -67
- package/dist/npm/floatingactionbutton/models/align.js +0 -6
- package/dist/npm/floatingactionbutton/models/item-animation.interface.js +0 -6
- package/dist/npm/floatingactionbutton/models/item-click.event.js +0 -6
- package/dist/npm/floatingactionbutton/models/item.interface.js +0 -6
- package/dist/npm/floatingactionbutton/models/offset.js +0 -6
- package/dist/npm/floatingactionbutton/models/position-mode.js +0 -6
- package/dist/npm/floatingactionbutton/templates/dial-item-template.directive.js +0 -28
- package/dist/npm/floatingactionbutton/templates/fab-template.directive.js +0 -28
- package/dist/npm/floatingactionbutton/utils.js +0 -42
- package/dist/npm/focusable/focus.service.js +0 -45
- package/dist/npm/focusable/focusable.directive.js +0 -70
- package/dist/npm/index.js +0 -39
- package/dist/npm/listbutton/button-item-template.directive.js +0 -70
- package/dist/npm/listbutton/list-button.js +0 -245
- package/dist/npm/listbutton/list-item-model.js +0 -6
- package/dist/npm/listbutton/list.component.js +0 -87
- package/dist/npm/listbutton/list.module.js +0 -35
- package/dist/npm/listbutton/popup-settings.js +0 -6
- package/dist/npm/listbutton/template-context.directive.js +0 -42
- package/dist/npm/main.js +0 -45
- package/dist/npm/navigation/key-events.js +0 -15
- package/dist/npm/navigation/navigation-action.js +0 -21
- package/dist/npm/navigation/navigation-config.js +0 -11
- package/dist/npm/navigation/navigation.service.js +0 -116
- package/dist/npm/package-metadata.js +0 -17
- package/dist/npm/preventable-event.js +0 -31
- package/dist/npm/splitbutton/localization/custom-messages.component.js +0 -46
- package/dist/npm/splitbutton/localization/localized-messages.directive.js +0 -37
- package/dist/npm/splitbutton/localization/messages.js +0 -24
- package/dist/npm/splitbutton/splitbutton.component.js +0 -832
- package/dist/npm/splitbutton/splitbutton.module.js +0 -36
- package/dist/npm/util.js +0 -111
- package/dist/systemjs/kendo-angular-buttons.js +0 -5
|
@@ -1,903 +0,0 @@
|
|
|
1
|
-
/**-----------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright © 2021 Progress Software Corporation. All rights reserved.
|
|
3
|
-
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
-
*-------------------------------------------------------------------------------------------*/
|
|
5
|
-
import * as tslib_1 from "tslib";
|
|
6
|
-
import { AnimationBuilder } from '@angular/animations';
|
|
7
|
-
import { Component, ElementRef, EventEmitter, HostBinding, Input, Output, NgZone, Renderer2, ViewChild, ContentChild, TemplateRef } from '@angular/core';
|
|
8
|
-
import { merge, Subscription } from 'rxjs';
|
|
9
|
-
import { take } from 'rxjs/operators';
|
|
10
|
-
import { L10N_PREFIX, LocalizationService } from '@progress/kendo-angular-l10n';
|
|
11
|
-
import { validatePackage } from '@progress/kendo-licensing';
|
|
12
|
-
import { packageMetadata } from '../package-metadata';
|
|
13
|
-
import { guid, isDocumentAvailable } from '@progress/kendo-angular-common';
|
|
14
|
-
import { PopupService } from '@progress/kendo-angular-popup';
|
|
15
|
-
import { FocusService } from '../focusable/focus.service';
|
|
16
|
-
import { NavigationAction } from '../navigation/navigation-action';
|
|
17
|
-
import { NAVIGATION_CONFIG } from '../navigation/navigation-config';
|
|
18
|
-
import { NavigationService } from '../navigation/navigation.service';
|
|
19
|
-
import { closest, isPresent } from '../util';
|
|
20
|
-
import { getAnchorAlign, getPopupAlign } from './utils';
|
|
21
|
-
import { closeAnimation, openAnimation } from './animations/animations';
|
|
22
|
-
import { PreventableEvent } from '../preventable-event';
|
|
23
|
-
import { DialItemTemplateDirective } from './templates/dial-item-template.directive';
|
|
24
|
-
import { FloatingActionButtonTemplateDirective } from './templates/fab-template.directive';
|
|
25
|
-
var NAVIGATION_SETTINGS = {
|
|
26
|
-
useLeftRightArrows: false
|
|
27
|
-
};
|
|
28
|
-
var ɵ0 = NAVIGATION_SETTINGS;
|
|
29
|
-
var NAVIGATION_SETTINGS_PROVIDER = {
|
|
30
|
-
provide: NAVIGATION_CONFIG,
|
|
31
|
-
useValue: ɵ0
|
|
32
|
-
};
|
|
33
|
-
var SIZE_CLASSES = {
|
|
34
|
-
small: 'k-fab-sm',
|
|
35
|
-
medium: 'k-fab-md',
|
|
36
|
-
large: 'k-fab-lg'
|
|
37
|
-
};
|
|
38
|
-
var SHAPE_CLASSES = {
|
|
39
|
-
rectangle: 'k-fab-rectangle',
|
|
40
|
-
square: 'k-fab-square'
|
|
41
|
-
};
|
|
42
|
-
var ROUNDED_CLASSES = {
|
|
43
|
-
small: 'k-rounded-sm',
|
|
44
|
-
medium: 'k-rounded-md',
|
|
45
|
-
large: 'k-rounded-lg',
|
|
46
|
-
full: 'k-rounded-full'
|
|
47
|
-
};
|
|
48
|
-
var FILLMODE_CLASS = 'k-fab-solid';
|
|
49
|
-
var DEFAULT_DURATION = 180;
|
|
50
|
-
var DEFAULT_ITEM_GAP = 90;
|
|
51
|
-
var DEFAULT_OFFSET = '16px';
|
|
52
|
-
/**
|
|
53
|
-
*
|
|
54
|
-
* Represents the [Kendo UI FloatingActionButton component for Angular]({% slug overview_floatingactionbutton %}).
|
|
55
|
-
* Used to specify the primary or the most common action in an application.
|
|
56
|
-
*
|
|
57
|
-
*/
|
|
58
|
-
var FloatingActionButtonComponent = /** @class */ (function () {
|
|
59
|
-
function FloatingActionButtonComponent(renderer, element, focusService, navigationService, ngZone, popupService, builder, localizationService) {
|
|
60
|
-
var _this = this;
|
|
61
|
-
this.renderer = renderer;
|
|
62
|
-
this.element = element;
|
|
63
|
-
this.focusService = focusService;
|
|
64
|
-
this.navigationService = navigationService;
|
|
65
|
-
this.ngZone = ngZone;
|
|
66
|
-
this.popupService = popupService;
|
|
67
|
-
this.builder = builder;
|
|
68
|
-
this.localizationService = localizationService;
|
|
69
|
-
/**
|
|
70
|
-
* Specifies the positionMode of the FloatingActionButton
|
|
71
|
-
* ([see example]({% slug positioning_floatingactionbutton %}#toc-positionMode)).
|
|
72
|
-
*
|
|
73
|
-
* * The possible values are:
|
|
74
|
-
* * `absolute`—Positions the FloatingActionButton absolutely to its first positioned parent element.
|
|
75
|
-
* * `fixed` (Default)—Positions the FloatingActionButton relative to the viewport. It always stays in the same place even if the page is scrolled.
|
|
76
|
-
*/
|
|
77
|
-
this.positionMode = 'fixed';
|
|
78
|
-
/**
|
|
79
|
-
* Specifies the animation settings of the FloatingActionButton dial items.
|
|
80
|
-
* ([see example]({% slug dialitems_floatingactionbutton %}#toc-animation)).
|
|
81
|
-
*
|
|
82
|
-
* The possible values are:
|
|
83
|
-
* * Boolean
|
|
84
|
-
* * (Default) `true`—Applies the default [`DialItemAnimation`]({% slug api_buttons_dialitemanimation %}) settings.
|
|
85
|
-
* * `false`
|
|
86
|
-
* * `DialItemAnimation`
|
|
87
|
-
* * `duration`—Specifies the animation duration in milliseconds for each dial item. Defaults to `180ms`.
|
|
88
|
-
* * `gap`—Specifies the animation duration gap in milliseconds after each dial item is animated. Defaults to `90ms`.
|
|
89
|
-
*/
|
|
90
|
-
this.dialItemAnimation = true;
|
|
91
|
-
/**
|
|
92
|
-
* Specifies the [`tabIndex`](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex) of the FloatingActionButton.
|
|
93
|
-
*/
|
|
94
|
-
this.tabIndex = 0;
|
|
95
|
-
/**
|
|
96
|
-
* Specifies the collection of the dial items that will be rendered in the FloatingActionButton popup.
|
|
97
|
-
*/
|
|
98
|
-
this.dialItems = [];
|
|
99
|
-
/**
|
|
100
|
-
* Fires each time the FloatingActionButton gets blurred.
|
|
101
|
-
*/
|
|
102
|
-
this.onBlur = new EventEmitter();
|
|
103
|
-
/**
|
|
104
|
-
* Fires each time the FloatingActionButton gets focused.
|
|
105
|
-
*/
|
|
106
|
-
this.onFocus = new EventEmitter();
|
|
107
|
-
/**
|
|
108
|
-
* Fires each time a dial item is clicked.
|
|
109
|
-
*/
|
|
110
|
-
this.dialItemClick = new EventEmitter();
|
|
111
|
-
/**
|
|
112
|
-
* Fires each time the popup is about to open.
|
|
113
|
-
* This event is preventable. If you cancel the event, the popup will remain closed
|
|
114
|
-
* ([more information and example]({% slug overview_floatingactionbutton %}#toc-events)).
|
|
115
|
-
*/
|
|
116
|
-
this.open = new EventEmitter();
|
|
117
|
-
/**
|
|
118
|
-
* Fires each time the popup is about to close.
|
|
119
|
-
* This event is preventable. If you cancel the event, the popup will remain open
|
|
120
|
-
* ([more information and example]({% slug overview_floatingactionbutton %}#toc-events)).
|
|
121
|
-
*/
|
|
122
|
-
this.close = new EventEmitter();
|
|
123
|
-
/**
|
|
124
|
-
* @hidden
|
|
125
|
-
*/
|
|
126
|
-
this.id = "k-" + guid();
|
|
127
|
-
this._themeColor = 'primary';
|
|
128
|
-
this._size = 'medium';
|
|
129
|
-
this._shape = 'rectangle';
|
|
130
|
-
this._disabled = false;
|
|
131
|
-
this._align = { horizontal: 'end', vertical: 'bottom' };
|
|
132
|
-
this._offset = { x: DEFAULT_OFFSET, y: DEFAULT_OFFSET };
|
|
133
|
-
this._rounded = 'full';
|
|
134
|
-
this.subscriptions = new Subscription();
|
|
135
|
-
this.rtl = false;
|
|
136
|
-
this.animationEnd = new EventEmitter();
|
|
137
|
-
this.initialSetup = true;
|
|
138
|
-
validatePackage(packageMetadata);
|
|
139
|
-
this.subscribeNavigationEvents();
|
|
140
|
-
this.subscriptions.add(this.localizationService.changes.subscribe(function (_a) {
|
|
141
|
-
var rtl = _a.rtl;
|
|
142
|
-
_this.rtl = rtl;
|
|
143
|
-
_this.direction = _this.rtl ? 'rtl' : 'ltr';
|
|
144
|
-
}));
|
|
145
|
-
}
|
|
146
|
-
Object.defineProperty(FloatingActionButtonComponent.prototype, "fixedClass", {
|
|
147
|
-
get: function () {
|
|
148
|
-
return this.positionMode === 'fixed';
|
|
149
|
-
},
|
|
150
|
-
enumerable: true,
|
|
151
|
-
configurable: true
|
|
152
|
-
});
|
|
153
|
-
Object.defineProperty(FloatingActionButtonComponent.prototype, "absoluteClass", {
|
|
154
|
-
get: function () {
|
|
155
|
-
return this.positionMode === 'absolute';
|
|
156
|
-
},
|
|
157
|
-
enumerable: true,
|
|
158
|
-
configurable: true
|
|
159
|
-
});
|
|
160
|
-
Object.defineProperty(FloatingActionButtonComponent.prototype, "themeColor", {
|
|
161
|
-
get: function () {
|
|
162
|
-
return this._themeColor;
|
|
163
|
-
},
|
|
164
|
-
/**
|
|
165
|
-
* Specifies the theme color of the FloatingActionButton
|
|
166
|
-
* ([see example]({% slug appearance_floatingactionbutton %}#toc-themeColor)).
|
|
167
|
-
* The theme color will be applied as background color of the component.
|
|
168
|
-
*
|
|
169
|
-
* The possible values are:
|
|
170
|
-
* * `'primary'` (Default)—Applies coloring based on the `primary` theme color.
|
|
171
|
-
* * `'secondary'`—Applies coloring based on the `secondary` theme color.
|
|
172
|
-
* * `'tertiary'`— Applies coloring based on the `tertiary` theme color.
|
|
173
|
-
* * `'info'`—Applies coloring based on the `info` theme color.
|
|
174
|
-
* * `'success'`— Applies coloring based on the `success` theme color.
|
|
175
|
-
* * `'warning'`— Applies coloring based on the `warning` theme color.
|
|
176
|
-
* * `'error'`— Applies coloring based on the `error` theme color.
|
|
177
|
-
* * `'dark'`— Applies coloring based on the `dark` theme color.
|
|
178
|
-
* * `'light'`— Applies coloring based on the `light` theme color.
|
|
179
|
-
* * `'inverse'`— Applies coloring based on the `inverse` theme color.
|
|
180
|
-
*/
|
|
181
|
-
set: function (themeColor) {
|
|
182
|
-
this.handleClasses(themeColor, 'themeColor');
|
|
183
|
-
this._themeColor = themeColor;
|
|
184
|
-
},
|
|
185
|
-
enumerable: true,
|
|
186
|
-
configurable: true
|
|
187
|
-
});
|
|
188
|
-
Object.defineProperty(FloatingActionButtonComponent.prototype, "size", {
|
|
189
|
-
get: function () {
|
|
190
|
-
return this._size;
|
|
191
|
-
},
|
|
192
|
-
/**
|
|
193
|
-
* Specifies the size of the FloatingActionButton
|
|
194
|
-
* ([see example]({% slug appearance_floatingactionbutton %}#toc-size)).
|
|
195
|
-
*
|
|
196
|
-
* The possible values are:
|
|
197
|
-
* * `'small'`
|
|
198
|
-
* * `'medium'` (Default)
|
|
199
|
-
* * `'large'`
|
|
200
|
-
*/
|
|
201
|
-
set: function (size) {
|
|
202
|
-
this.handleClasses(size, 'size');
|
|
203
|
-
this._size = size;
|
|
204
|
-
},
|
|
205
|
-
enumerable: true,
|
|
206
|
-
configurable: true
|
|
207
|
-
});
|
|
208
|
-
Object.defineProperty(FloatingActionButtonComponent.prototype, "rounded", {
|
|
209
|
-
get: function () {
|
|
210
|
-
return this._rounded;
|
|
211
|
-
},
|
|
212
|
-
/**
|
|
213
|
-
* The rounded property specifies the border radius of the FloatingActionButton.
|
|
214
|
-
*
|
|
215
|
-
* The possible values are:
|
|
216
|
-
* * `'small'`
|
|
217
|
-
* * `'medium'`
|
|
218
|
-
* * `'large'`
|
|
219
|
-
* * `'full'` (default)
|
|
220
|
-
* * `null`
|
|
221
|
-
*/
|
|
222
|
-
set: function (rounded) {
|
|
223
|
-
this.handleClasses(rounded, 'rounded');
|
|
224
|
-
this._rounded = rounded;
|
|
225
|
-
},
|
|
226
|
-
enumerable: true,
|
|
227
|
-
configurable: true
|
|
228
|
-
});
|
|
229
|
-
Object.defineProperty(FloatingActionButtonComponent.prototype, "shape", {
|
|
230
|
-
get: function () {
|
|
231
|
-
return this._shape;
|
|
232
|
-
},
|
|
233
|
-
/**
|
|
234
|
-
* Specifies the shape of the FloatingActionButton
|
|
235
|
-
* ([see example]({% slug appearance_floatingactionbutton %}#toc-shape)).
|
|
236
|
-
*
|
|
237
|
-
* The possible values are:
|
|
238
|
-
* * `rectangle` (Default)—Applies rectangular shape on the FloatingActionButton.
|
|
239
|
-
* * `square`—Applies square shape on the FloatingActionButton.
|
|
240
|
-
*
|
|
241
|
-
*/
|
|
242
|
-
set: function (shape) {
|
|
243
|
-
this.handleClasses(shape, 'shape');
|
|
244
|
-
this._shape = shape;
|
|
245
|
-
},
|
|
246
|
-
enumerable: true,
|
|
247
|
-
configurable: true
|
|
248
|
-
});
|
|
249
|
-
Object.defineProperty(FloatingActionButtonComponent.prototype, "disabled", {
|
|
250
|
-
get: function () {
|
|
251
|
-
return this._disabled;
|
|
252
|
-
},
|
|
253
|
-
/**
|
|
254
|
-
* Specifies whether the FloatingActionButton is disabled.
|
|
255
|
-
*/
|
|
256
|
-
set: function (disabled) {
|
|
257
|
-
this._disabled = disabled;
|
|
258
|
-
},
|
|
259
|
-
enumerable: true,
|
|
260
|
-
configurable: true
|
|
261
|
-
});
|
|
262
|
-
Object.defineProperty(FloatingActionButtonComponent.prototype, "align", {
|
|
263
|
-
get: function () {
|
|
264
|
-
return this._align;
|
|
265
|
-
},
|
|
266
|
-
/**
|
|
267
|
-
* Specifies the horizontal and vertical alignment of the FloatingActionButton
|
|
268
|
-
* ([see example]({% slug positioning_floatingactionbutton %}#toc-align)).
|
|
269
|
-
*
|
|
270
|
-
* The possible values are:
|
|
271
|
-
* * `{ horizontal: 'start'|'center'|'end', vertical: 'top'|'middle'|'bottom' }`
|
|
272
|
-
*
|
|
273
|
-
* The default value is:
|
|
274
|
-
* * `{ horizontal: 'end', vertical: 'bottom' }`
|
|
275
|
-
*
|
|
276
|
-
*/
|
|
277
|
-
set: function (align) {
|
|
278
|
-
this._align = Object.assign(this._align, align);
|
|
279
|
-
},
|
|
280
|
-
enumerable: true,
|
|
281
|
-
configurable: true
|
|
282
|
-
});
|
|
283
|
-
Object.defineProperty(FloatingActionButtonComponent.prototype, "offset", {
|
|
284
|
-
get: function () {
|
|
285
|
-
return this._offset;
|
|
286
|
-
},
|
|
287
|
-
/**
|
|
288
|
-
* Specifies the horizontal and vertical offset position of the FloatingActionButton
|
|
289
|
-
* ([see example]({% slug positioning_floatingactionbutton %}#toc-offset)).
|
|
290
|
-
*
|
|
291
|
-
* * The default value is:
|
|
292
|
-
* * `{ x: '16px', y: '16px' }`
|
|
293
|
-
*/
|
|
294
|
-
set: function (offset) {
|
|
295
|
-
this._offset = Object.assign(this._offset, offset);
|
|
296
|
-
this.offsetStyles();
|
|
297
|
-
},
|
|
298
|
-
enumerable: true,
|
|
299
|
-
configurable: true
|
|
300
|
-
});
|
|
301
|
-
Object.defineProperty(FloatingActionButtonComponent.prototype, "componentTabIndex", {
|
|
302
|
-
/**
|
|
303
|
-
* @hidden
|
|
304
|
-
*/
|
|
305
|
-
get: function () {
|
|
306
|
-
return this.disabled ? (-1) : this.tabIndex;
|
|
307
|
-
},
|
|
308
|
-
enumerable: true,
|
|
309
|
-
configurable: true
|
|
310
|
-
});
|
|
311
|
-
FloatingActionButtonComponent.prototype.ngAfterViewInit = function () {
|
|
312
|
-
var _this = this;
|
|
313
|
-
['shape', 'size', 'rounded', 'themeColor'].forEach(function (option) { return _this.handleClasses(_this[option], option); });
|
|
314
|
-
this.renderer.addClass(this.element.nativeElement, this.alignClass());
|
|
315
|
-
this.offsetStyles();
|
|
316
|
-
this.initialSetup = false;
|
|
317
|
-
};
|
|
318
|
-
FloatingActionButtonComponent.prototype.ngOnDestroy = function () {
|
|
319
|
-
this.subscriptions.unsubscribe();
|
|
320
|
-
};
|
|
321
|
-
Object.defineProperty(FloatingActionButtonComponent.prototype, "isOpen", {
|
|
322
|
-
/**
|
|
323
|
-
* Indicates whether the FloatingActionButton is currently open.
|
|
324
|
-
*/
|
|
325
|
-
get: function () { return isPresent(this.popupRef); },
|
|
326
|
-
enumerable: true,
|
|
327
|
-
configurable: true
|
|
328
|
-
});
|
|
329
|
-
/**
|
|
330
|
-
* Focuses the FloatingActionButton.
|
|
331
|
-
*/
|
|
332
|
-
FloatingActionButtonComponent.prototype.focus = function () {
|
|
333
|
-
if (isDocumentAvailable()) {
|
|
334
|
-
this.button.nativeElement.focus();
|
|
335
|
-
}
|
|
336
|
-
};
|
|
337
|
-
/**
|
|
338
|
-
* Blurs the FloatingActionButton.
|
|
339
|
-
*/
|
|
340
|
-
FloatingActionButtonComponent.prototype.blur = function () {
|
|
341
|
-
if (isDocumentAvailable()) {
|
|
342
|
-
this.button.nativeElement.blur();
|
|
343
|
-
}
|
|
344
|
-
};
|
|
345
|
-
/**
|
|
346
|
-
* Toggles the visibility of the FloatingActionButton dial items popup.
|
|
347
|
-
*
|
|
348
|
-
* If you use the `toggleDial` method to open or close the dial items,
|
|
349
|
-
* the `open` and `close` events do not fire ([more information and examples]({% slug openstate_floatingactionbutton %}#toc-events)).
|
|
350
|
-
*
|
|
351
|
-
* @param open - The state of dial items popup.
|
|
352
|
-
*/
|
|
353
|
-
FloatingActionButtonComponent.prototype.toggleDial = function (open) {
|
|
354
|
-
var _this = this;
|
|
355
|
-
if (this.disabled || !this.hasDialItems) {
|
|
356
|
-
return;
|
|
357
|
-
}
|
|
358
|
-
var shouldOpen = isPresent(open) ? open : !this.isOpen;
|
|
359
|
-
if (this.disabled || shouldOpen === this.isOpen) {
|
|
360
|
-
return;
|
|
361
|
-
}
|
|
362
|
-
shouldOpen ? setTimeout(function () { return _this.openDial(); }) : this.closeDial();
|
|
363
|
-
};
|
|
364
|
-
Object.defineProperty(FloatingActionButtonComponent.prototype, "role", {
|
|
365
|
-
/**
|
|
366
|
-
* @hidden
|
|
367
|
-
*/
|
|
368
|
-
get: function () {
|
|
369
|
-
return (this.dialItems && this.dialItems.length) ? 'menubutton' : 'button';
|
|
370
|
-
},
|
|
371
|
-
enumerable: true,
|
|
372
|
-
configurable: true
|
|
373
|
-
});
|
|
374
|
-
Object.defineProperty(FloatingActionButtonComponent.prototype, "ariaExpanded", {
|
|
375
|
-
/**
|
|
376
|
-
* @hidden
|
|
377
|
-
*/
|
|
378
|
-
get: function () {
|
|
379
|
-
return isPresent(this.isOpen);
|
|
380
|
-
},
|
|
381
|
-
enumerable: true,
|
|
382
|
-
configurable: true
|
|
383
|
-
});
|
|
384
|
-
Object.defineProperty(FloatingActionButtonComponent.prototype, "ariaHasPopup", {
|
|
385
|
-
/**
|
|
386
|
-
* @hidden
|
|
387
|
-
*/
|
|
388
|
-
get: function () {
|
|
389
|
-
return isPresent(this.isOpen);
|
|
390
|
-
},
|
|
391
|
-
enumerable: true,
|
|
392
|
-
configurable: true
|
|
393
|
-
});
|
|
394
|
-
Object.defineProperty(FloatingActionButtonComponent.prototype, "iconClasses", {
|
|
395
|
-
/**
|
|
396
|
-
* @hidden
|
|
397
|
-
*/
|
|
398
|
-
get: function () {
|
|
399
|
-
var classes = [];
|
|
400
|
-
if (this.iconClass) {
|
|
401
|
-
classes.push("" + this.iconClass);
|
|
402
|
-
}
|
|
403
|
-
if (this.icon) {
|
|
404
|
-
classes.push("k-fab-icon k-icon k-i-" + this.icon);
|
|
405
|
-
}
|
|
406
|
-
return classes;
|
|
407
|
-
},
|
|
408
|
-
enumerable: true,
|
|
409
|
-
configurable: true
|
|
410
|
-
});
|
|
411
|
-
/**
|
|
412
|
-
* @hidden
|
|
413
|
-
*/
|
|
414
|
-
FloatingActionButtonComponent.prototype.clickHandler = function () {
|
|
415
|
-
var _this = this;
|
|
416
|
-
if (this.disabled || !this.hasDialItems) {
|
|
417
|
-
return;
|
|
418
|
-
}
|
|
419
|
-
this.ngZone.run(function () {
|
|
420
|
-
var shouldOpen = !_this.isOpen;
|
|
421
|
-
_this.toggleDialWithEvents(shouldOpen);
|
|
422
|
-
});
|
|
423
|
-
};
|
|
424
|
-
/**
|
|
425
|
-
* @hidden
|
|
426
|
-
*/
|
|
427
|
-
FloatingActionButtonComponent.prototype.keyDownHandler = function (event) {
|
|
428
|
-
this.keyHandler(event);
|
|
429
|
-
};
|
|
430
|
-
/**
|
|
431
|
-
* @hidden
|
|
432
|
-
*/
|
|
433
|
-
FloatingActionButtonComponent.prototype.keyHandler = function (event, keyEvent) {
|
|
434
|
-
if (this.disabled) {
|
|
435
|
-
return;
|
|
436
|
-
}
|
|
437
|
-
var focused = this.focusService.focused || 0;
|
|
438
|
-
var keyCode = event.keyCode;
|
|
439
|
-
var action = this.navigationService.process({
|
|
440
|
-
altKey: event.altKey,
|
|
441
|
-
current: focused,
|
|
442
|
-
keyCode: keyCode,
|
|
443
|
-
keyEvent: keyEvent,
|
|
444
|
-
max: this.dialItems ? this.dialItems.length - 1 : 0,
|
|
445
|
-
min: 0,
|
|
446
|
-
flipNavigation: this.align.vertical === 'bottom'
|
|
447
|
-
});
|
|
448
|
-
if (action !== NavigationAction.Undefined &&
|
|
449
|
-
action !== NavigationAction.Tab) {
|
|
450
|
-
event.preventDefault();
|
|
451
|
-
}
|
|
452
|
-
};
|
|
453
|
-
/**
|
|
454
|
-
* @hidden
|
|
455
|
-
*/
|
|
456
|
-
FloatingActionButtonComponent.prototype.onItemClick = function (event) {
|
|
457
|
-
var item = closest(event.target, '.k-fab-item');
|
|
458
|
-
if (!item) {
|
|
459
|
-
return;
|
|
460
|
-
}
|
|
461
|
-
var index = item.getAttribute('data-fab-item-index');
|
|
462
|
-
this.emitItemClick(index);
|
|
463
|
-
};
|
|
464
|
-
/**
|
|
465
|
-
* @hidden
|
|
466
|
-
*/
|
|
467
|
-
FloatingActionButtonComponent.prototype.focusHandler = function () {
|
|
468
|
-
if (!this.disabled) {
|
|
469
|
-
this.onFocus.emit();
|
|
470
|
-
}
|
|
471
|
-
};
|
|
472
|
-
/**
|
|
473
|
-
* @hidden
|
|
474
|
-
*/
|
|
475
|
-
FloatingActionButtonComponent.prototype.blurHandler = function () {
|
|
476
|
-
this.onBlur.emit();
|
|
477
|
-
this.toggleDialWithEvents(false);
|
|
478
|
-
};
|
|
479
|
-
FloatingActionButtonComponent.prototype.handleClasses = function (inputValue, input) {
|
|
480
|
-
if (isPresent(this.button) && (this[input] !== inputValue || this.initialSetup)) {
|
|
481
|
-
var button = this.button.nativeElement;
|
|
482
|
-
var classesToRemove = {
|
|
483
|
-
themeColor: FILLMODE_CLASS + "-" + this.themeColor,
|
|
484
|
-
size: SIZE_CLASSES[this.size],
|
|
485
|
-
shape: SHAPE_CLASSES[this.shape],
|
|
486
|
-
rounded: ROUNDED_CLASSES[this.rounded]
|
|
487
|
-
};
|
|
488
|
-
var classesToAdd = {
|
|
489
|
-
themeColor: inputValue ? FILLMODE_CLASS + "-" + inputValue : null,
|
|
490
|
-
size: SIZE_CLASSES[inputValue],
|
|
491
|
-
shape: SHAPE_CLASSES[inputValue],
|
|
492
|
-
rounded: ROUNDED_CLASSES[inputValue]
|
|
493
|
-
};
|
|
494
|
-
this.renderer.removeClass(button, classesToRemove[input]);
|
|
495
|
-
if (classesToAdd[input]) {
|
|
496
|
-
this.renderer.addClass(button, classesToAdd[input]);
|
|
497
|
-
}
|
|
498
|
-
}
|
|
499
|
-
};
|
|
500
|
-
FloatingActionButtonComponent.prototype.onEnterPressed = function () {
|
|
501
|
-
var index = this.focusService.focused;
|
|
502
|
-
this.emitItemClick(index);
|
|
503
|
-
};
|
|
504
|
-
FloatingActionButtonComponent.prototype.emitItemClick = function (index) {
|
|
505
|
-
var item = this.dialItems[index];
|
|
506
|
-
if (item && !item.disabled) {
|
|
507
|
-
var clickEventArgs = { item: item, index: index };
|
|
508
|
-
this.dialItemClick.emit(clickEventArgs);
|
|
509
|
-
this.toggleDialWithEvents(false);
|
|
510
|
-
}
|
|
511
|
-
};
|
|
512
|
-
FloatingActionButtonComponent.prototype.subscribeNavigationEvents = function () {
|
|
513
|
-
this.subscriptions.add(this.navigationService.navigate.subscribe(this.onArrowKeyNavigate.bind(this)));
|
|
514
|
-
this.subscriptions.add(this.navigationService.enter.subscribe(this.onNavigationEnterPress.bind(this)));
|
|
515
|
-
this.subscriptions.add(merge(this.navigationService.close, this.navigationService.esc).subscribe(this.onNavigationClose.bind(this)));
|
|
516
|
-
};
|
|
517
|
-
FloatingActionButtonComponent.prototype.onArrowKeyNavigate = function (index) {
|
|
518
|
-
this.focusService.focus(index);
|
|
519
|
-
};
|
|
520
|
-
FloatingActionButtonComponent.prototype.onNavigationEnterPress = function () {
|
|
521
|
-
var _this = this;
|
|
522
|
-
this.ngZone.run(function () {
|
|
523
|
-
if (_this.isOpen) {
|
|
524
|
-
var focusedIndex = _this.focusService.focused;
|
|
525
|
-
var focusedItem = _this.dialItems[focusedIndex];
|
|
526
|
-
if (focusedItem && focusedItem.disabled) {
|
|
527
|
-
return;
|
|
528
|
-
}
|
|
529
|
-
if (isPresent(focusedIndex) && focusedIndex !== -1) {
|
|
530
|
-
_this.onEnterPressed();
|
|
531
|
-
return;
|
|
532
|
-
}
|
|
533
|
-
}
|
|
534
|
-
if (!_this.isOpen && isDocumentAvailable()) {
|
|
535
|
-
_this.toggleDialWithEvents(true);
|
|
536
|
-
_this.button.nativeElement.focus();
|
|
537
|
-
}
|
|
538
|
-
});
|
|
539
|
-
};
|
|
540
|
-
FloatingActionButtonComponent.prototype.onNavigationClose = function () {
|
|
541
|
-
var _this = this;
|
|
542
|
-
if (this.isOpen) {
|
|
543
|
-
this.ngZone.run(function () {
|
|
544
|
-
_this.toggleDialWithEvents(false);
|
|
545
|
-
if (isDocumentAvailable()) {
|
|
546
|
-
_this.button.nativeElement.focus();
|
|
547
|
-
}
|
|
548
|
-
});
|
|
549
|
-
}
|
|
550
|
-
};
|
|
551
|
-
FloatingActionButtonComponent.prototype.alignClass = function () {
|
|
552
|
-
return "k-pos-" + this.align.vertical + "-" + this.align.horizontal;
|
|
553
|
-
};
|
|
554
|
-
FloatingActionButtonComponent.prototype.toggleDialWithEvents = function (open) {
|
|
555
|
-
if (open === this.isOpen) {
|
|
556
|
-
return;
|
|
557
|
-
}
|
|
558
|
-
var event = new PreventableEvent();
|
|
559
|
-
open ? this.open.emit(event) : this.close.emit(event);
|
|
560
|
-
if (event.isDefaultPrevented()) {
|
|
561
|
-
return;
|
|
562
|
-
}
|
|
563
|
-
open ? this.openDial() : this.closeDial();
|
|
564
|
-
};
|
|
565
|
-
FloatingActionButtonComponent.prototype.openPopup = function () {
|
|
566
|
-
var _this = this;
|
|
567
|
-
if (this.isOpen) {
|
|
568
|
-
return;
|
|
569
|
-
}
|
|
570
|
-
var isIconFab = this.icon && !this.text;
|
|
571
|
-
var rtl = this.rtl;
|
|
572
|
-
var align = this.align;
|
|
573
|
-
this.popupRef = this.popupService.open({
|
|
574
|
-
anchor: this.element.nativeElement,
|
|
575
|
-
animate: false,
|
|
576
|
-
content: this.popupTemplate,
|
|
577
|
-
anchorAlign: getAnchorAlign(align, rtl),
|
|
578
|
-
popupAlign: getPopupAlign(align, rtl),
|
|
579
|
-
popupClass: 'k-fab-popup k-popup-transparent'
|
|
580
|
-
});
|
|
581
|
-
var popupElement = this.popupRef.popupElement;
|
|
582
|
-
this.renderer.setStyle(popupElement, 'box-shadow', 'none');
|
|
583
|
-
if (isIconFab) {
|
|
584
|
-
this.subscriptions.add(this.popupRef.popupOpen.subscribe(function () { return _this.positionPopup(); }));
|
|
585
|
-
}
|
|
586
|
-
this.ngZone.runOutsideAngular(function () {
|
|
587
|
-
_this.popupMouseDownListener = _this.renderer.listen(popupElement, 'mousedown', function (event) {
|
|
588
|
-
event.preventDefault();
|
|
589
|
-
});
|
|
590
|
-
});
|
|
591
|
-
this.popupRef.popupAnchorViewportLeave.subscribe(function () { return _this.toggleDialWithEvents(false); });
|
|
592
|
-
};
|
|
593
|
-
FloatingActionButtonComponent.prototype.closePopup = function () {
|
|
594
|
-
if (this.isOpen) {
|
|
595
|
-
if (this.popupMouseDownListener) {
|
|
596
|
-
this.popupMouseDownListener();
|
|
597
|
-
}
|
|
598
|
-
this.popupRef.close();
|
|
599
|
-
this.popupRef = null;
|
|
600
|
-
}
|
|
601
|
-
};
|
|
602
|
-
FloatingActionButtonComponent.prototype.openDial = function () {
|
|
603
|
-
this.openPopup();
|
|
604
|
-
this.focusService.focus(0);
|
|
605
|
-
if (this.dialItemAnimation && this.isValidAnimation()) {
|
|
606
|
-
this.playAnimation(true);
|
|
607
|
-
}
|
|
608
|
-
};
|
|
609
|
-
FloatingActionButtonComponent.prototype.closeDial = function () {
|
|
610
|
-
var _this = this;
|
|
611
|
-
if (this.dialItemAnimation && this.isValidAnimation()) {
|
|
612
|
-
this.playAnimation(false);
|
|
613
|
-
this.animationEnd.pipe(take(1)).subscribe(function () { return _this.closePopup(); });
|
|
614
|
-
}
|
|
615
|
-
else {
|
|
616
|
-
this.closePopup();
|
|
617
|
-
}
|
|
618
|
-
};
|
|
619
|
-
FloatingActionButtonComponent.prototype.isValidAnimation = function () {
|
|
620
|
-
var animation = this.dialItemAnimation;
|
|
621
|
-
if (typeof animation !== 'boolean') {
|
|
622
|
-
return animation.duration !== 0;
|
|
623
|
-
}
|
|
624
|
-
return true;
|
|
625
|
-
};
|
|
626
|
-
FloatingActionButtonComponent.prototype.positionPopup = function () {
|
|
627
|
-
if (this.dialItemTemplate) {
|
|
628
|
-
return;
|
|
629
|
-
}
|
|
630
|
-
var fab = this.element.nativeElement;
|
|
631
|
-
var fabWidth = fab.getBoundingClientRect().width;
|
|
632
|
-
var popupEl = this.popupRef.popupElement;
|
|
633
|
-
var icon = popupEl.querySelector('.k-fab-item-icon');
|
|
634
|
-
if (!icon) {
|
|
635
|
-
return;
|
|
636
|
-
}
|
|
637
|
-
var iconWidth = icon.getBoundingClientRect().width;
|
|
638
|
-
var left = (fabWidth / 2) - (iconWidth / 2);
|
|
639
|
-
var popupLeft = popupEl.getBoundingClientRect().left;
|
|
640
|
-
var isEndAlign = this.align.horizontal === 'end';
|
|
641
|
-
var leftValue = isEndAlign ? (popupLeft - left) : (left + popupLeft);
|
|
642
|
-
var rtlLeftValue = isEndAlign ? (left + popupLeft) : (popupLeft - left);
|
|
643
|
-
popupEl.style.left = this.rtl ? rtlLeftValue + "px" : leftValue + "px";
|
|
644
|
-
};
|
|
645
|
-
FloatingActionButtonComponent.prototype.offsetStyles = function () {
|
|
646
|
-
var hostElement = this.element.nativeElement;
|
|
647
|
-
this.renderer.setStyle(hostElement, this.horizontalPosition, this.horizontalOffset);
|
|
648
|
-
this.renderer.setStyle(hostElement, this.verticalPosition, this.verticalOffset);
|
|
649
|
-
};
|
|
650
|
-
Object.defineProperty(FloatingActionButtonComponent.prototype, "hasDialItems", {
|
|
651
|
-
get: function () {
|
|
652
|
-
return isPresent(this.dialItems) && this.dialItems.length !== 0;
|
|
653
|
-
},
|
|
654
|
-
enumerable: true,
|
|
655
|
-
configurable: true
|
|
656
|
-
});
|
|
657
|
-
Object.defineProperty(FloatingActionButtonComponent.prototype, "verticalPosition", {
|
|
658
|
-
/**
|
|
659
|
-
* Gets the CSS prop name of the selected vertical position (`top`/`bottom`);
|
|
660
|
-
*/
|
|
661
|
-
get: function () {
|
|
662
|
-
return {
|
|
663
|
-
top: 'top',
|
|
664
|
-
middle: 'top',
|
|
665
|
-
bottom: 'bottom'
|
|
666
|
-
}[this.align.vertical];
|
|
667
|
-
},
|
|
668
|
-
enumerable: true,
|
|
669
|
-
configurable: true
|
|
670
|
-
});
|
|
671
|
-
Object.defineProperty(FloatingActionButtonComponent.prototype, "verticalOffset", {
|
|
672
|
-
/**
|
|
673
|
-
* Gets the offset according to the selected vertical position.
|
|
674
|
-
*/
|
|
675
|
-
get: function () {
|
|
676
|
-
if (this.align.vertical === 'middle') {
|
|
677
|
-
return this.offset.y === DEFAULT_OFFSET ? '50%' : "calc(50% + " + this.offset.y + ")";
|
|
678
|
-
}
|
|
679
|
-
return this.offset.y;
|
|
680
|
-
},
|
|
681
|
-
enumerable: true,
|
|
682
|
-
configurable: true
|
|
683
|
-
});
|
|
684
|
-
Object.defineProperty(FloatingActionButtonComponent.prototype, "horizontalPosition", {
|
|
685
|
-
/**
|
|
686
|
-
* Gets the CSS prop name of the selected horizontal position (`left`/`right`);
|
|
687
|
-
*/
|
|
688
|
-
get: function () {
|
|
689
|
-
var horizontal = this.align.horizontal;
|
|
690
|
-
return {
|
|
691
|
-
end: this.rtl ? 'left' : 'right',
|
|
692
|
-
center: 'left',
|
|
693
|
-
start: this.rtl ? 'right' : 'left'
|
|
694
|
-
}[horizontal];
|
|
695
|
-
},
|
|
696
|
-
enumerable: true,
|
|
697
|
-
configurable: true
|
|
698
|
-
});
|
|
699
|
-
Object.defineProperty(FloatingActionButtonComponent.prototype, "horizontalOffset", {
|
|
700
|
-
/**
|
|
701
|
-
* Gets the offset according to the selected horizontal position.
|
|
702
|
-
*/
|
|
703
|
-
get: function () {
|
|
704
|
-
if (this.align.horizontal === 'center') {
|
|
705
|
-
return this.offset.x === DEFAULT_OFFSET ? '50%' : "calc(50% + " + this.offset.x + ")";
|
|
706
|
-
}
|
|
707
|
-
return this.offset.x;
|
|
708
|
-
},
|
|
709
|
-
enumerable: true,
|
|
710
|
-
configurable: true
|
|
711
|
-
});
|
|
712
|
-
FloatingActionButtonComponent.prototype.playerFor = function (element, animation) {
|
|
713
|
-
var factory = this.builder.build(animation);
|
|
714
|
-
return factory.create(element);
|
|
715
|
-
};
|
|
716
|
-
FloatingActionButtonComponent.prototype.playAnimation = function (open) {
|
|
717
|
-
var _this = this;
|
|
718
|
-
var durationSettings = this.durationSettings();
|
|
719
|
-
var animationSettings = {
|
|
720
|
-
duration: durationSettings.duration,
|
|
721
|
-
gap: durationSettings.gap,
|
|
722
|
-
align: this.align
|
|
723
|
-
};
|
|
724
|
-
var animation = open ? openAnimation(animationSettings) : closeAnimation(animationSettings);
|
|
725
|
-
var player = this.playerFor(this.popupRef.popupElement, animation);
|
|
726
|
-
player.play();
|
|
727
|
-
player.onDone(function () {
|
|
728
|
-
if (player) {
|
|
729
|
-
_this.animationEnd.emit();
|
|
730
|
-
player.destroy();
|
|
731
|
-
player = null;
|
|
732
|
-
}
|
|
733
|
-
});
|
|
734
|
-
};
|
|
735
|
-
FloatingActionButtonComponent.prototype.durationSettings = function () {
|
|
736
|
-
return {
|
|
737
|
-
duration: this.animationDuration(),
|
|
738
|
-
gap: this.animationGap()
|
|
739
|
-
};
|
|
740
|
-
};
|
|
741
|
-
FloatingActionButtonComponent.prototype.animationGap = function () {
|
|
742
|
-
var animation = this.dialItemAnimation;
|
|
743
|
-
if (typeof animation !== 'boolean' && isPresent(animation.gap)) {
|
|
744
|
-
return animation.gap;
|
|
745
|
-
}
|
|
746
|
-
return DEFAULT_ITEM_GAP;
|
|
747
|
-
};
|
|
748
|
-
FloatingActionButtonComponent.prototype.animationDuration = function () {
|
|
749
|
-
var animation = this.dialItemAnimation;
|
|
750
|
-
if (typeof animation !== 'boolean' && isPresent(animation.duration)) {
|
|
751
|
-
return animation.duration;
|
|
752
|
-
}
|
|
753
|
-
return DEFAULT_DURATION;
|
|
754
|
-
};
|
|
755
|
-
tslib_1.__decorate([
|
|
756
|
-
HostBinding('class.k-pos-fixed'),
|
|
757
|
-
tslib_1.__metadata("design:type", Boolean),
|
|
758
|
-
tslib_1.__metadata("design:paramtypes", [])
|
|
759
|
-
], FloatingActionButtonComponent.prototype, "fixedClass", null);
|
|
760
|
-
tslib_1.__decorate([
|
|
761
|
-
HostBinding('class.k-pos-absolute'),
|
|
762
|
-
tslib_1.__metadata("design:type", Boolean),
|
|
763
|
-
tslib_1.__metadata("design:paramtypes", [])
|
|
764
|
-
], FloatingActionButtonComponent.prototype, "absoluteClass", null);
|
|
765
|
-
tslib_1.__decorate([
|
|
766
|
-
HostBinding('attr.dir'),
|
|
767
|
-
tslib_1.__metadata("design:type", String)
|
|
768
|
-
], FloatingActionButtonComponent.prototype, "direction", void 0);
|
|
769
|
-
tslib_1.__decorate([
|
|
770
|
-
ViewChild('button', { static: true }),
|
|
771
|
-
tslib_1.__metadata("design:type", ElementRef)
|
|
772
|
-
], FloatingActionButtonComponent.prototype, "button", void 0);
|
|
773
|
-
tslib_1.__decorate([
|
|
774
|
-
ViewChild('popupTemplate', { static: true }),
|
|
775
|
-
tslib_1.__metadata("design:type", TemplateRef)
|
|
776
|
-
], FloatingActionButtonComponent.prototype, "popupTemplate", void 0);
|
|
777
|
-
tslib_1.__decorate([
|
|
778
|
-
ContentChild(DialItemTemplateDirective, { static: false }),
|
|
779
|
-
tslib_1.__metadata("design:type", DialItemTemplateDirective)
|
|
780
|
-
], FloatingActionButtonComponent.prototype, "dialItemTemplate", void 0);
|
|
781
|
-
tslib_1.__decorate([
|
|
782
|
-
ContentChild(FloatingActionButtonTemplateDirective, { static: false }),
|
|
783
|
-
tslib_1.__metadata("design:type", FloatingActionButtonTemplateDirective)
|
|
784
|
-
], FloatingActionButtonComponent.prototype, "fabTemplate", void 0);
|
|
785
|
-
tslib_1.__decorate([
|
|
786
|
-
Input(),
|
|
787
|
-
tslib_1.__metadata("design:type", String),
|
|
788
|
-
tslib_1.__metadata("design:paramtypes", [String])
|
|
789
|
-
], FloatingActionButtonComponent.prototype, "themeColor", null);
|
|
790
|
-
tslib_1.__decorate([
|
|
791
|
-
Input(),
|
|
792
|
-
tslib_1.__metadata("design:type", String),
|
|
793
|
-
tslib_1.__metadata("design:paramtypes", [String])
|
|
794
|
-
], FloatingActionButtonComponent.prototype, "size", null);
|
|
795
|
-
tslib_1.__decorate([
|
|
796
|
-
Input(),
|
|
797
|
-
tslib_1.__metadata("design:type", String),
|
|
798
|
-
tslib_1.__metadata("design:paramtypes", [String])
|
|
799
|
-
], FloatingActionButtonComponent.prototype, "rounded", null);
|
|
800
|
-
tslib_1.__decorate([
|
|
801
|
-
Input(),
|
|
802
|
-
tslib_1.__metadata("design:type", String),
|
|
803
|
-
tslib_1.__metadata("design:paramtypes", [String])
|
|
804
|
-
], FloatingActionButtonComponent.prototype, "shape", null);
|
|
805
|
-
tslib_1.__decorate([
|
|
806
|
-
Input(),
|
|
807
|
-
tslib_1.__metadata("design:type", Boolean),
|
|
808
|
-
tslib_1.__metadata("design:paramtypes", [Boolean])
|
|
809
|
-
], FloatingActionButtonComponent.prototype, "disabled", null);
|
|
810
|
-
tslib_1.__decorate([
|
|
811
|
-
Input(),
|
|
812
|
-
tslib_1.__metadata("design:type", Object),
|
|
813
|
-
tslib_1.__metadata("design:paramtypes", [Object])
|
|
814
|
-
], FloatingActionButtonComponent.prototype, "align", null);
|
|
815
|
-
tslib_1.__decorate([
|
|
816
|
-
Input(),
|
|
817
|
-
tslib_1.__metadata("design:type", Object),
|
|
818
|
-
tslib_1.__metadata("design:paramtypes", [Object])
|
|
819
|
-
], FloatingActionButtonComponent.prototype, "offset", null);
|
|
820
|
-
tslib_1.__decorate([
|
|
821
|
-
Input(),
|
|
822
|
-
tslib_1.__metadata("design:type", String)
|
|
823
|
-
], FloatingActionButtonComponent.prototype, "positionMode", void 0);
|
|
824
|
-
tslib_1.__decorate([
|
|
825
|
-
Input(),
|
|
826
|
-
tslib_1.__metadata("design:type", String)
|
|
827
|
-
], FloatingActionButtonComponent.prototype, "icon", void 0);
|
|
828
|
-
tslib_1.__decorate([
|
|
829
|
-
Input(),
|
|
830
|
-
tslib_1.__metadata("design:type", String)
|
|
831
|
-
], FloatingActionButtonComponent.prototype, "iconClass", void 0);
|
|
832
|
-
tslib_1.__decorate([
|
|
833
|
-
Input(),
|
|
834
|
-
tslib_1.__metadata("design:type", Object)
|
|
835
|
-
], FloatingActionButtonComponent.prototype, "buttonClass", void 0);
|
|
836
|
-
tslib_1.__decorate([
|
|
837
|
-
Input(),
|
|
838
|
-
tslib_1.__metadata("design:type", Object)
|
|
839
|
-
], FloatingActionButtonComponent.prototype, "dialClass", void 0);
|
|
840
|
-
tslib_1.__decorate([
|
|
841
|
-
Input(),
|
|
842
|
-
tslib_1.__metadata("design:type", String)
|
|
843
|
-
], FloatingActionButtonComponent.prototype, "text", void 0);
|
|
844
|
-
tslib_1.__decorate([
|
|
845
|
-
Input(),
|
|
846
|
-
tslib_1.__metadata("design:type", Object)
|
|
847
|
-
], FloatingActionButtonComponent.prototype, "dialItemAnimation", void 0);
|
|
848
|
-
tslib_1.__decorate([
|
|
849
|
-
Input(),
|
|
850
|
-
tslib_1.__metadata("design:type", Number)
|
|
851
|
-
], FloatingActionButtonComponent.prototype, "tabIndex", void 0);
|
|
852
|
-
tslib_1.__decorate([
|
|
853
|
-
Input(),
|
|
854
|
-
tslib_1.__metadata("design:type", Array)
|
|
855
|
-
], FloatingActionButtonComponent.prototype, "dialItems", void 0);
|
|
856
|
-
tslib_1.__decorate([
|
|
857
|
-
Output('blur'),
|
|
858
|
-
tslib_1.__metadata("design:type", EventEmitter)
|
|
859
|
-
], FloatingActionButtonComponent.prototype, "onBlur", void 0);
|
|
860
|
-
tslib_1.__decorate([
|
|
861
|
-
Output('focus'),
|
|
862
|
-
tslib_1.__metadata("design:type", EventEmitter)
|
|
863
|
-
], FloatingActionButtonComponent.prototype, "onFocus", void 0);
|
|
864
|
-
tslib_1.__decorate([
|
|
865
|
-
Output('dialItemClick'),
|
|
866
|
-
tslib_1.__metadata("design:type", EventEmitter)
|
|
867
|
-
], FloatingActionButtonComponent.prototype, "dialItemClick", void 0);
|
|
868
|
-
tslib_1.__decorate([
|
|
869
|
-
Output(),
|
|
870
|
-
tslib_1.__metadata("design:type", EventEmitter)
|
|
871
|
-
], FloatingActionButtonComponent.prototype, "open", void 0);
|
|
872
|
-
tslib_1.__decorate([
|
|
873
|
-
Output(),
|
|
874
|
-
tslib_1.__metadata("design:type", EventEmitter)
|
|
875
|
-
], FloatingActionButtonComponent.prototype, "close", void 0);
|
|
876
|
-
FloatingActionButtonComponent = tslib_1.__decorate([
|
|
877
|
-
Component({
|
|
878
|
-
selector: 'kendo-floatingactionbutton',
|
|
879
|
-
providers: [
|
|
880
|
-
FocusService,
|
|
881
|
-
NavigationService,
|
|
882
|
-
NAVIGATION_SETTINGS_PROVIDER,
|
|
883
|
-
LocalizationService,
|
|
884
|
-
{
|
|
885
|
-
provide: L10N_PREFIX,
|
|
886
|
-
useValue: 'kendo.floatingactionbutton'
|
|
887
|
-
}
|
|
888
|
-
],
|
|
889
|
-
template: "\n <button\n #button\n [attr.id]=\"id\"\n [attr.role]=\"role\"\n [tabIndex]=\"componentTabIndex\"\n type=\"button\"\n class=\"k-fab k-fab-solid\"\n [class.k-disabled]=\"disabled\"\n [ngClass]=\"buttonClass\"\n [disabled]=\"disabled\"\n [attr.aria-disabled]=\"disabled\"\n [attr.aria-expanded]=\"ariaExpanded\"\n [attr.aria-haspopup]=\"ariaHasPopup\"\n (focus)=\"focusHandler()\"\n (blur)=\"blurHandler()\"\n [kendoEventsOutsideAngular]=\"{\n keydown: keyDownHandler,\n click: clickHandler\n }\"\n [scope]=\"this\"\n >\n <ng-template *ngIf=\"fabTemplate\"\n [ngTemplateOutlet]=\"fabTemplate?.templateRef\"\n >\n </ng-template>\n\n <ng-container *ngIf=\"!fabTemplate\">\n <span *ngIf=\"icon || iconClass\" [ngClass]=\"iconClasses\"></span>\n <span *ngIf=\"text\" class=\"k-fab-text\">{{ text }}</span>\n </ng-container>\n </button>\n\n <ng-template #popupTemplate>\n <ul\n kendoDialList\n [ngClass]=\"dialClass\"\n [dialItems]=\"dialItems\"\n [dialItemTemplate]='dialItemTemplate?.templateRef'\n [align]=\"align\"\n [attr.aria-labelledby]=\"id\"\n (click)=\"onItemClick($event)\"\n >\n </ul>\n </ng-template>\n "
|
|
890
|
-
}),
|
|
891
|
-
tslib_1.__metadata("design:paramtypes", [Renderer2,
|
|
892
|
-
ElementRef,
|
|
893
|
-
FocusService,
|
|
894
|
-
NavigationService,
|
|
895
|
-
NgZone,
|
|
896
|
-
PopupService,
|
|
897
|
-
AnimationBuilder,
|
|
898
|
-
LocalizationService])
|
|
899
|
-
], FloatingActionButtonComponent);
|
|
900
|
-
return FloatingActionButtonComponent;
|
|
901
|
-
}());
|
|
902
|
-
export { FloatingActionButtonComponent };
|
|
903
|
-
export { ɵ0 };
|