UNPKG

1.11 MBJavaScriptView Raw
1(function (global, factory) {
2 typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('tslib'), require('@angular/common'), require('rxjs'), require('rxjs/operators'), require('@angular/forms'), require('@angular/router'), require('@angular/cdk/a11y'), require('@angular/cdk/portal'), require('@angular/cdk/overlay'), require('@angular/cdk/platform'), require('@angular/platform-browser'), require('@angular/animations'), require('intersection-observer'), require('@angular/cdk/bidi'), require('@angular/cdk/table'), require('@angular/cdk/coercion'), require('@angular/cdk/collections'), require('@angular/cdk/keycodes')) :
3 typeof define === 'function' && define.amd ? define(['exports', '@angular/core', 'tslib', '@angular/common', 'rxjs', 'rxjs/operators', '@angular/forms', '@angular/router', '@angular/cdk/a11y', '@angular/cdk/portal', '@angular/cdk/overlay', '@angular/cdk/platform', '@angular/platform-browser', '@angular/animations', 'intersection-observer', '@angular/cdk/bidi', '@angular/cdk/table', '@angular/cdk/coercion', '@angular/cdk/collections', '@angular/cdk/keycodes'], factory) :
4 (factory((global.nb = global.nb || {}, global.nb.theme = global.nb.theme || {}),global.ng.core,global.tslib,global.ng.common,global.Rx,global.Rx.operators,global.ng.forms,global.ng.router,global.ng.cdk.a11y,global.ng.cdk.portal,global.ng.cdk.overlay,global.ng.cdk.platform,global.ng.platformBrowser,global.ng.animations,global['intersection-observer'],global.ng.cdk.bidi,global.ng.cdk.table,global.ng.cdk.coercion,global.ng.cdk.collections,global.ng.cdk.keycodes));
5}(this, (function (exports,i0,tslib,_angular_common,rxjs,rxjs_operators,_angular_forms,_angular_router,_angular_cdk_a11y,_angular_cdk_portal,_angular_cdk_overlay,i1,_angular_platformBrowser,_angular_animations,intersectionObserver,_angular_cdk_bidi,_angular_cdk_table,_angular_cdk_coercion,_angular_cdk_collections,_angular_cdk_keycodes) { 'use strict';
6
7/**
8 * @license
9 * Copyright Akveo. All Rights Reserved.
10 * Licensed under the MIT License. See License.txt in the project root for license information.
11 */
12var NB_THEME_OPTIONS = new i0.InjectionToken('Nebular Theme Options');
13var NB_MEDIA_BREAKPOINTS = new i0.InjectionToken('Nebular Media Breakpoints');
14var NB_BUILT_IN_JS_THEMES = new i0.InjectionToken('Nebular Built-in JS Themes');
15var NB_JS_THEMES = new i0.InjectionToken('Nebular JS Themes');
16/**
17 * We're providing browser apis with tokens to improve testing capabilities.
18 * */
19var NB_WINDOW = new i0.InjectionToken('Window');
20var NB_DOCUMENT = new i0.InjectionToken('Document');
21
22var palette = {
23 primary: '#3366ff',
24 success: '#00d68f',
25 info: '#0095ff',
26 warning: '#ffaa00',
27 danger: '#ff3d71',
28};
29var DEFAULT_THEME = {
30 name: 'default',
31 variables: {
32 fontMain: 'Open Sans, sans-serif',
33 fontSecondary: 'Raleway, sans-serif',
34 bg: '#ffffff',
35 bg2: '#f7f9fc',
36 bg3: '#edf1f7',
37 bg4: '#e4e9f2',
38 border: '#ffffff',
39 border2: '#f7f9fc',
40 border3: '#edf1f7',
41 border4: '#e4e9f2',
42 border5: '#c5cee0',
43 fg: '#8f9bb3',
44 fgHeading: '#1a2138',
45 fgText: '#1a2138',
46 fgHighlight: palette.primary,
47 layoutBg: '#f7f9fc',
48 separator: '#edf1f7',
49 primary: palette.primary,
50 success: palette.success,
51 info: palette.info,
52 warning: palette.warning,
53 danger: palette.danger,
54 primaryLight: '#598bff',
55 successLight: '#2ce69b',
56 infoLight: '#42aaff',
57 warningLight: '#ffc94d',
58 dangerLight: '#ff708d',
59 },
60};
61
62var palette$1 = {
63 primary: '#a16eff',
64 success: '#00d68f',
65 info: '#0095ff',
66 warning: '#ffaa00',
67 danger: '#ff3d71',
68};
69var COSMIC_THEME = {
70 name: 'cosmic',
71 variables: {
72 fontMain: 'Open Sans, sans-serif',
73 fontSecondary: 'Raleway, sans-serif',
74 bg: '#323259',
75 bg2: '#252547',
76 bg3: '#1b1b38',
77 bg4: '#13132b',
78 border: '#323259',
79 border2: '#252547',
80 border3: '#1b1b38',
81 border4: '#13132b',
82 border5: '#13132b',
83 fg: '#b4b4db',
84 fgHeading: '#ffffff',
85 fgText: '#ffffff',
86 fgHighlight: palette$1.primary,
87 layoutBg: '#151a30',
88 separator: '#151a30',
89 primary: palette$1.primary,
90 success: palette$1.success,
91 info: palette$1.info,
92 warning: palette$1.warning,
93 danger: palette$1.danger,
94 primaryLight: '#b18aff',
95 successLight: '#2ce69b',
96 infoLight: '#42aaff',
97 warningLight: '#ffc94d',
98 dangerLight: '#ff708d',
99 },
100};
101
102var palette$2 = {
103 primary: '#73a1ff',
104 success: '#5dcfe3',
105 info: '#ba7fec',
106 warning: '#ffa36b',
107 danger: '#ff6b83',
108};
109var CORPORATE_THEME = {
110 name: 'corporate',
111 base: 'default',
112 variables: {
113 fontMain: 'Open Sans, sans-serif',
114 fontSecondary: 'Raleway, sans-serif',
115 bg: '#ffffff',
116 bg2: '#f7f9fc',
117 bg3: '#edf1f7',
118 bg4: '#e4e9f2',
119 border: '#ffffff',
120 border2: '#f7f9fc',
121 border3: '#edf1f7',
122 border4: '#e4e9f2',
123 border5: '#c5cee0',
124 fg: '#8f9bb3',
125 fgHeading: '#1a2138',
126 fgText: '#1a2138',
127 fgHighlight: palette$2.primary,
128 layoutBg: '#f7f9fc',
129 separator: '#edf1f7',
130 primary: palette$2.primary,
131 success: palette$2.success,
132 info: palette$2.info,
133 warning: palette$2.warning,
134 danger: palette$2.danger,
135 primaryLight: '#598bff',
136 successLight: '#2ce69b',
137 infoLight: '#42aaff',
138 warningLight: '#ffc94d',
139 dangerLight: '#ff708d',
140 },
141};
142
143var palette$3 = {
144 primary: '#3366ff',
145 success: '#00d68f',
146 info: '#0095ff',
147 warning: '#ffaa00',
148 danger: '#ff3d71',
149};
150var DARK_THEME = {
151 name: 'dark',
152 variables: {
153 fontMain: 'Open Sans, sans-serif',
154 fontSecondary: 'Raleway, sans-serif',
155 bg: '#222b45',
156 bg2: '#1a2138',
157 bg3: '#151a30',
158 bg4: '#101426',
159 border: '#222b45',
160 border2: '#1a2138',
161 border3: '#151a30',
162 border4: '#101426',
163 border5: '#101426',
164 fg: '#8f9bb3',
165 fgHeading: '#ffffff',
166 fgText: '#ffffff',
167 fgHighlight: palette$3.primary,
168 layoutBg: '#1b1b38',
169 separator: '#1b1b38',
170 primary: palette$3.primary,
171 success: palette$3.success,
172 info: palette$3.info,
173 warning: palette$3.warning,
174 danger: palette$3.danger,
175 primaryLight: '#598bff',
176 successLight: '#2ce69b',
177 infoLight: '#42aaff',
178 warningLight: '#ffc94d',
179 dangerLight: '#ff708d',
180 },
181};
182
183/**
184 * @license
185 * Copyright Akveo. All Rights Reserved.
186 * Licensed under the MIT License. See License.txt in the project root for license information.
187 */
188var BUILT_IN_THEMES = [
189 DEFAULT_THEME,
190 COSMIC_THEME,
191 CORPORATE_THEME,
192 DARK_THEME,
193];
194/**
195 * Js Themes registry - provides access to the JS themes' variables.
196 * Usually shouldn't be used directly, but through the NbThemeService class methods (getJsTheme).
197 */
198var NbJSThemesRegistry = /** @class */ (function () {
199 function NbJSThemesRegistry(builtInThemes, newThemes) {
200 var _this = this;
201 if (newThemes === void 0) { newThemes = []; }
202 this.themes = {};
203 var themes = this.combineByNames(newThemes, builtInThemes);
204 themes.forEach(function (theme) {
205 _this.register(theme, theme.name, theme.base);
206 });
207 }
208 /**
209 * Registers a new JS theme
210 * @param config any
211 * @param themeName string
212 * @param baseTheme string
213 */
214 NbJSThemesRegistry.prototype.register = function (config, themeName, baseTheme) {
215 var base = this.has(baseTheme) ? this.get(baseTheme) : {};
216 this.themes[themeName] = this.mergeDeep({}, base, config);
217 };
218 /**
219 * Checks whether the theme is registered
220 * @param themeName
221 * @returns boolean
222 */
223 NbJSThemesRegistry.prototype.has = function (themeName) {
224 return !!this.themes[themeName];
225 };
226 /**
227 * Return a theme
228 * @param themeName
229 * @returns NbJSThemeOptions
230 */
231 NbJSThemesRegistry.prototype.get = function (themeName) {
232 if (!this.themes[themeName]) {
233 throw Error("NbThemeConfig: no theme '" + themeName + "' found registered.");
234 }
235 return JSON.parse(JSON.stringify(this.themes[themeName]));
236 };
237 NbJSThemesRegistry.prototype.combineByNames = function (newThemes, oldThemes) {
238 var _this = this;
239 if (newThemes) {
240 var mergedThemes_1 = [];
241 newThemes.forEach(function (theme) {
242 var sameOld = oldThemes.find(function (tm) { return tm.name === theme.name; })
243 || {};
244 var mergedTheme = _this.mergeDeep({}, sameOld, theme);
245 mergedThemes_1.push(mergedTheme);
246 });
247 oldThemes.forEach(function (theme) {
248 if (!mergedThemes_1.find(function (tm) { return tm.name === theme.name; })) {
249 mergedThemes_1.push(theme);
250 }
251 });
252 return mergedThemes_1;
253 }
254 return oldThemes;
255 };
256 NbJSThemesRegistry.prototype.isObject = function (item) {
257 return item && typeof item === 'object' && !Array.isArray(item);
258 };
259 // TODO: move to helpers
260 NbJSThemesRegistry.prototype.mergeDeep = function (target) {
261 var _a, _b;
262 var sources = [];
263 for (var _i = 1; _i < arguments.length; _i++) {
264 sources[_i - 1] = arguments[_i];
265 }
266 if (!sources.length) {
267 return target;
268 }
269 var source = sources.shift();
270 if (this.isObject(target) && this.isObject(source)) {
271 for (var key in source) {
272 if (this.isObject(source[key])) {
273 if (!target[key]) {
274 Object.assign(target, (_a = {}, _a[key] = {}, _a));
275 }
276 this.mergeDeep(target[key], source[key]);
277 }
278 else {
279 Object.assign(target, (_b = {}, _b[key] = source[key], _b));
280 }
281 }
282 }
283 return this.mergeDeep.apply(this, tslib.__spreadArray([target], sources));
284 };
285 NbJSThemesRegistry.decorators = [
286 { type: i0.Injectable }
287 ];
288 NbJSThemesRegistry.ctorParameters = function () { return [
289 { type: Array, decorators: [{ type: i0.Inject, args: [NB_BUILT_IN_JS_THEMES,] }] },
290 { type: Array, decorators: [{ type: i0.Inject, args: [NB_JS_THEMES,] }] }
291 ]; };
292 return NbJSThemesRegistry;
293}());
294
295/**
296 * @license
297 * Copyright Akveo. All Rights Reserved.
298 * Licensed under the MIT License. See License.txt in the project root for license information.
299 */
300var DEFAULT_MEDIA_BREAKPOINTS = [
301 {
302 name: 'xs',
303 width: 0,
304 },
305 {
306 name: 'is',
307 width: 400,
308 },
309 {
310 name: 'sm',
311 width: 576,
312 },
313 {
314 name: 'md',
315 width: 768,
316 },
317 {
318 name: 'lg',
319 width: 992,
320 },
321 {
322 name: 'xl',
323 width: 1200,
324 },
325 {
326 name: 'xxl',
327 width: 1400,
328 },
329 {
330 name: 'xxxl',
331 width: 1600,
332 },
333];
334/**
335 * Manages media breakpoints
336 *
337 * Provides access to available media breakpoints to convert window width to a configured breakpoint,
338 * e.g. 200px - *xs* breakpoint
339 */
340var NbMediaBreakpointsService = /** @class */ (function () {
341 function NbMediaBreakpointsService(breakpoints) {
342 this.breakpoints = breakpoints;
343 this.breakpointsMap = this.breakpoints.reduce(function (res, b) {
344 res[b.name] = b.width;
345 return res;
346 }, {});
347 }
348 /**
349 * Returns a configured breakpoint by width
350 * @param width number
351 * @returns {Z|{name: string, width: number}}
352 */
353 NbMediaBreakpointsService.prototype.getByWidth = function (width) {
354 var unknown = { name: 'unknown', width: width };
355 var breakpoints = this.getBreakpoints();
356 return breakpoints
357 .find(function (point, index) {
358 var next = breakpoints[index + 1];
359 return width >= point.width && (!next || width < next.width);
360 }) || unknown;
361 };
362 /**
363 * Returns a configured breakpoint by name
364 * @param name string
365 * @returns NbMediaBreakpoint
366 */
367 NbMediaBreakpointsService.prototype.getByName = function (name) {
368 var unknown = { name: 'unknown', width: NaN };
369 var breakpoints = this.getBreakpoints();
370 return breakpoints.find(function (point) { return name === point.name; }) || unknown;
371 };
372 /**
373 * Returns a list of configured breakpoints for the theme
374 * @returns NbMediaBreakpoint[]
375 */
376 NbMediaBreakpointsService.prototype.getBreakpoints = function () {
377 return this.breakpoints;
378 };
379 /**
380 * Returns a map of configured breakpoints for the theme
381 * @returns {[p: string]: number}
382 */
383 NbMediaBreakpointsService.prototype.getBreakpointsMap = function () {
384 return this.breakpointsMap;
385 };
386 NbMediaBreakpointsService.decorators = [
387 { type: i0.Injectable }
388 ];
389 NbMediaBreakpointsService.ctorParameters = function () { return [
390 { type: undefined, decorators: [{ type: i0.Inject, args: [NB_MEDIA_BREAKPOINTS,] }] }
391 ]; };
392 return NbMediaBreakpointsService;
393}());
394
395/**
396 * @license
397 * Copyright Akveo. All Rights Reserved.
398 * Licensed under the MIT License. See License.txt in the project root for license information.
399 */
400/**
401 * Main Nebular service. Includes various helper methods.
402 */
403var NbThemeService = /** @class */ (function () {
404 function NbThemeService(options, breakpointService, jsThemesRegistry) {
405 this.options = options;
406 this.breakpointService = breakpointService;
407 this.jsThemesRegistry = jsThemesRegistry;
408 this.themeChanges$ = new rxjs.ReplaySubject(1);
409 this.appendLayoutClass$ = new rxjs.Subject();
410 this.removeLayoutClass$ = new rxjs.Subject();
411 this.changeWindowWidth$ = new rxjs.ReplaySubject(2);
412 if (options && options.name) {
413 this.changeTheme(options.name);
414 }
415 }
416 /**
417 * Change current application theme
418 * @param {string} name
419 */
420 NbThemeService.prototype.changeTheme = function (name) {
421 this.themeChanges$.next({ name: name, previous: this.currentTheme });
422 this.currentTheme = name;
423 };
424 NbThemeService.prototype.changeWindowWidth = function (width) {
425 this.changeWindowWidth$.next(width);
426 };
427 /**
428 * Returns a theme object with variables (color/paddings/etc) on a theme change.
429 * Once subscribed - returns current theme.
430 *
431 * @returns {Observable<NbJSThemeOptions>}
432 */
433 NbThemeService.prototype.getJsTheme = function () {
434 var _this = this;
435 return this.onThemeChange().pipe(rxjs_operators.map(function (theme) {
436 return _this.jsThemesRegistry.get(theme.name);
437 }));
438 };
439 /**
440 * Triggers media query breakpoint change
441 * Returns a pair where the first item is previous media breakpoint and the second item is current breakpoit.
442 * ```ts
443 * [{ name: 'xs', width: 0 }, { name: 'md', width: 768 }] // change from `xs` to `md`
444 * ```
445 * @returns {Observable<[NbMediaBreakpoint, NbMediaBreakpoint]>}
446 */
447 NbThemeService.prototype.onMediaQueryChange = function () {
448 var _this = this;
449 return this.changeWindowWidth$
450 .pipe(rxjs_operators.startWith(undefined), rxjs_operators.pairwise(), rxjs_operators.map(function (_a) {
451 var prevWidth = _a[0], width = _a[1];
452 return [
453 _this.breakpointService.getByWidth(prevWidth),
454 _this.breakpointService.getByWidth(width),
455 ];
456 }), rxjs_operators.filter(function (_a) {
457 var prevPoint = _a[0], point = _a[1];
458 return prevPoint.name !== point.name;
459 }), rxjs_operators.distinctUntilChanged(null, function (params) { return params[0].name + params[1].name; }), rxjs_operators.share());
460 };
461 /**
462 * Triggered when current theme is changed
463 * @returns {Observable<any>}
464 */
465 NbThemeService.prototype.onThemeChange = function () {
466 return this.themeChanges$.pipe(rxjs_operators.share());
467 };
468 /**
469 * Append a class to nb-layout
470 * @param {string} className
471 */
472 NbThemeService.prototype.appendLayoutClass = function (className) {
473 this.appendLayoutClass$.next(className);
474 };
475 /**
476 * Triggered when a new class is added to nb-layout through `appendLayoutClass` method
477 * @returns {Observable<any>}
478 */
479 NbThemeService.prototype.onAppendLayoutClass = function () {
480 return this.appendLayoutClass$.pipe(rxjs_operators.share());
481 };
482 /**
483 * Removes a class from nb-layout
484 * @param {string} className
485 */
486 NbThemeService.prototype.removeLayoutClass = function (className) {
487 this.removeLayoutClass$.next(className);
488 };
489 /**
490 * Triggered when a class is removed from nb-layout through `removeLayoutClass` method
491 * @returns {Observable<any>}
492 */
493 NbThemeService.prototype.onRemoveLayoutClass = function () {
494 return this.removeLayoutClass$.pipe(rxjs_operators.share());
495 };
496 NbThemeService.decorators = [
497 { type: i0.Injectable }
498 ];
499 NbThemeService.ctorParameters = function () { return [
500 { type: undefined, decorators: [{ type: i0.Inject, args: [NB_THEME_OPTIONS,] }] },
501 { type: NbMediaBreakpointsService },
502 { type: NbJSThemesRegistry }
503 ]; };
504 return NbThemeService;
505}());
506
507/**
508 * @license
509 * Copyright Akveo. All Rights Reserved.
510 * Licensed under the MIT License. See License.txt in the project root for license information.
511 */
512/**
513 * Service to control the global page spinner.
514 */
515var NbSpinnerService = /** @class */ (function () {
516 function NbSpinnerService(document) {
517 this.document = document;
518 this.loaders = [];
519 this.selector = 'nb-global-spinner';
520 }
521 /**
522 * Appends new loader to the list of loader to be completed before
523 * spinner will be hidden
524 * @param method Promise<any>
525 */
526 NbSpinnerService.prototype.registerLoader = function (method) {
527 this.loaders.push(method);
528 };
529 /**
530 * Clears the list of loader
531 */
532 NbSpinnerService.prototype.clear = function () {
533 this.loaders = [];
534 };
535 /**
536 * Start the loader process, show spinnder and execute loaders
537 */
538 NbSpinnerService.prototype.load = function () {
539 this.showSpinner();
540 this.executeAll();
541 };
542 NbSpinnerService.prototype.executeAll = function (done) {
543 var _this = this;
544 if (done === void 0) { done = function () { }; }
545 Promise.all(this.loaders).then(function (values) {
546 _this.hideSpinner();
547 done.call(null, values);
548 })
549 .catch(function (error) {
550 // TODO: Promise.reject
551 console.error(error);
552 });
553 };
554 // TODO is there any better way of doing this?
555 NbSpinnerService.prototype.showSpinner = function () {
556 var el = this.getSpinnerElement();
557 if (el) {
558 el.style['display'] = 'block';
559 }
560 };
561 NbSpinnerService.prototype.hideSpinner = function () {
562 var el = this.getSpinnerElement();
563 if (el) {
564 el.style['display'] = 'none';
565 }
566 };
567 NbSpinnerService.prototype.getSpinnerElement = function () {
568 return this.document.getElementById(this.selector);
569 };
570 NbSpinnerService.decorators = [
571 { type: i0.Injectable }
572 ];
573 NbSpinnerService.ctorParameters = function () { return [
574 { type: undefined, decorators: [{ type: i0.Inject, args: [NB_DOCUMENT,] }] }
575 ]; };
576 return NbSpinnerService;
577}());
578
579/**
580 * Layout direction.
581 * */
582
583(function (NbLayoutDirection) {
584 NbLayoutDirection["LTR"] = "ltr";
585 NbLayoutDirection["RTL"] = "rtl";
586})(exports.NbLayoutDirection || (exports.NbLayoutDirection = {}));
587
588/**
589 * Layout direction setting injection token.
590 * */
591var NB_LAYOUT_DIRECTION = new i0.InjectionToken('Layout direction');
592/**
593 * Layout Direction Service.
594 * Allows to set or get layout direction and listen to its changes
595 */
596var NbLayoutDirectionService = /** @class */ (function () {
597 function NbLayoutDirectionService(direction) {
598 if (direction === void 0) { direction = exports.NbLayoutDirection.LTR; }
599 this.direction = direction;
600 this.$directionChange = new rxjs.ReplaySubject(1);
601 this.setDirection(direction);
602 }
603 /**
604 * Returns true if layout direction set to left to right.
605 * @returns boolean.
606 * */
607 NbLayoutDirectionService.prototype.isLtr = function () {
608 return this.direction === exports.NbLayoutDirection.LTR;
609 };
610 /**
611 * Returns true if layout direction set to right to left.
612 * @returns boolean.
613 * */
614 NbLayoutDirectionService.prototype.isRtl = function () {
615 return this.direction === exports.NbLayoutDirection.RTL;
616 };
617 /**
618 * Returns current layout direction.
619 * @returns NbLayoutDirection.
620 * */
621 NbLayoutDirectionService.prototype.getDirection = function () {
622 return this.direction;
623 };
624 /**
625 * Sets layout direction
626 * @param {NbLayoutDirection} direction
627 */
628 NbLayoutDirectionService.prototype.setDirection = function (direction) {
629 this.direction = direction;
630 this.$directionChange.next(direction);
631 };
632 /**
633 * Triggered when direction was changed.
634 * @returns Observable<NbLayoutDirection>.
635 */
636 NbLayoutDirectionService.prototype.onDirectionChange = function () {
637 return this.$directionChange.pipe(rxjs_operators.share());
638 };
639 NbLayoutDirectionService.decorators = [
640 { type: i0.Injectable }
641 ];
642 NbLayoutDirectionService.ctorParameters = function () { return [
643 { type: undefined, decorators: [{ type: i0.Optional }, { type: i0.Inject, args: [NB_LAYOUT_DIRECTION,] }] }
644 ]; };
645 return NbLayoutDirectionService;
646}());
647
648/**
649 * Layout scroll service. Provides information about current scroll position,
650 * as well as methods to update position of the scroll.
651 *
652 * The reason we added this service is that in Nebular there are two scroll modes:
653 * - the default mode when scroll is on body
654 * - and the `withScroll` mode, when scroll is removed from the body and moved to an element inside of the
655 * `nb-layout` component
656 */
657var NbLayoutScrollService = /** @class */ (function () {
658 function NbLayoutScrollService() {
659 this.scrollPositionReq$ = new rxjs.Subject();
660 this.manualScroll$ = new rxjs.Subject();
661 this.scroll$ = new rxjs.Subject();
662 this.scrollable$ = new rxjs.Subject();
663 }
664 /**
665 * Returns scroll position
666 *
667 * @returns {Observable<NbScrollPosition>}
668 */
669 NbLayoutScrollService.prototype.getPosition = function () {
670 var _this = this;
671 return new rxjs.Observable(function (observer) {
672 var listener = new rxjs.Subject();
673 listener.subscribe(observer);
674 _this.scrollPositionReq$.next({ listener: listener });
675 return function () { return listener.complete(); };
676 });
677 };
678 /**
679 * Sets scroll position
680 *
681 * @param {number} x
682 * @param {number} y
683 */
684 NbLayoutScrollService.prototype.scrollTo = function (x, y) {
685 if (x === void 0) { x = null; }
686 if (y === void 0) { y = null; }
687 this.manualScroll$.next({ x: x, y: y });
688 };
689 /**
690 * Returns a stream of scroll events
691 *
692 * @returns {Observable<any>}
693 */
694 NbLayoutScrollService.prototype.onScroll = function () {
695 return this.scroll$.pipe(rxjs_operators.share());
696 };
697 /**
698 * @private
699 * @returns Observable<NbScrollPosition>.
700 */
701 NbLayoutScrollService.prototype.onManualScroll = function () {
702 return this.manualScroll$.pipe(rxjs_operators.share());
703 };
704 /**
705 * @private
706 * @returns {Subject<any>}
707 */
708 NbLayoutScrollService.prototype.onGetPosition = function () {
709 return this.scrollPositionReq$;
710 };
711 NbLayoutScrollService.prototype.onScrollableChange = function () {
712 return this.scrollable$.pipe(rxjs_operators.share());
713 };
714 /**
715 * @private
716 * @param {any} event
717 */
718 NbLayoutScrollService.prototype.fireScrollChange = function (event) {
719 this.scroll$.next(event);
720 };
721 NbLayoutScrollService.prototype.scrollable = function (scrollable) {
722 this.scrollable$.next(scrollable);
723 };
724 NbLayoutScrollService.decorators = [
725 { type: i0.Injectable }
726 ];
727 return NbLayoutScrollService;
728}());
729
730/**
731 * Simple helper service to return Layout dimensions
732 * Depending of current Layout scroll mode (default or `withScroll` when scroll is moved to an element
733 * inside of the layout) corresponding dimensions will be returns - of `documentElement` in first case and
734 * `.scrollable-container` in the second.
735 */
736var NbLayoutRulerService = /** @class */ (function () {
737 function NbLayoutRulerService() {
738 this.contentDimensionsReq$ = new rxjs.Subject();
739 }
740 /**
741 * Content dimensions
742 * @returns {Observable<NbLayoutDimensions>}
743 */
744 NbLayoutRulerService.prototype.getDimensions = function () {
745 var _this = this;
746 return new rxjs.Observable(function (observer) {
747 var listener = new rxjs.Subject();
748 listener.subscribe(observer);
749 _this.contentDimensionsReq$.next({ listener: listener });
750 return function () { return listener.complete(); };
751 });
752 };
753 /**
754 * @private
755 * @returns {Subject<any>}
756 */
757 NbLayoutRulerService.prototype.onGetDimensions = function () {
758 return this.contentDimensionsReq$;
759 };
760 NbLayoutRulerService.decorators = [
761 { type: i0.Injectable }
762 ];
763 return NbLayoutRulerService;
764}());
765
766/**
767 * @license
768 * Copyright Akveo. All Rights Reserved.
769 * Licensed under the MIT License. See License.txt in the project root for license information.
770 */
771var NbSharedModule = /** @class */ (function () {
772 function NbSharedModule() {
773 }
774 NbSharedModule.decorators = [
775 { type: i0.NgModule, args: [{
776 exports: [
777 _angular_common.CommonModule,
778 // TODO: probably we don't need FormsModule in SharedModule
779 _angular_forms.FormsModule,
780 _angular_router.RouterModule,
781 ],
782 },] }
783 ];
784 return NbSharedModule;
785}());
786
787/**
788 * Overrides angular cdk focus trap to keep restore functionality inside trap.
789 * */
790var NbFocusTrap = /** @class */ (function (_super) {
791 tslib.__extends(NbFocusTrap, _super);
792 function NbFocusTrap(element, checker, ngZone, document, deferAnchors) {
793 var _this = _super.call(this, element, checker, ngZone, document, deferAnchors) || this;
794 _this.element = element;
795 _this.checker = checker;
796 _this.ngZone = ngZone;
797 _this.document = document;
798 _this.savePreviouslyFocusedElement();
799 return _this;
800 }
801 NbFocusTrap.prototype.restoreFocus = function () {
802 this.previouslyFocusedElement.focus();
803 this.destroy();
804 };
805 NbFocusTrap.prototype.blurPreviouslyFocusedElement = function () {
806 this.previouslyFocusedElement.blur();
807 };
808 NbFocusTrap.prototype.savePreviouslyFocusedElement = function () {
809 this.previouslyFocusedElement = this.document.activeElement;
810 };
811 return NbFocusTrap;
812}(_angular_cdk_a11y.FocusTrap));
813var NbFocusTrapFactoryService = /** @class */ (function (_super) {
814 tslib.__extends(NbFocusTrapFactoryService, _super);
815 function NbFocusTrapFactoryService(checker, ngZone, document) {
816 var _this = _super.call(this, checker, ngZone, document) || this;
817 _this.checker = checker;
818 _this.ngZone = ngZone;
819 _this.document = document;
820 return _this;
821 }
822 NbFocusTrapFactoryService.prototype.create = function (element, deferCaptureElements) {
823 return new NbFocusTrap(element, this.checker, this.ngZone, this.document, deferCaptureElements);
824 };
825 NbFocusTrapFactoryService.decorators = [
826 { type: i0.Injectable }
827 ];
828 NbFocusTrapFactoryService.ctorParameters = function () { return [
829 { type: _angular_cdk_a11y.InteractivityChecker },
830 { type: i0.NgZone },
831 { type: undefined, decorators: [{ type: i0.Inject, args: [NB_DOCUMENT,] }] }
832 ]; };
833 return NbFocusTrapFactoryService;
834}(_angular_cdk_a11y.FocusTrapFactory));
835
836var NbFocusKeyManager = /** @class */ (function (_super) {
837 tslib.__extends(NbFocusKeyManager, _super);
838 function NbFocusKeyManager() {
839 return _super !== null && _super.apply(this, arguments) || this;
840 }
841 return NbFocusKeyManager;
842}(_angular_cdk_a11y.FocusKeyManager));
843var NbFocusKeyManagerFactoryService = /** @class */ (function () {
844 function NbFocusKeyManagerFactoryService() {
845 }
846 NbFocusKeyManagerFactoryService.prototype.create = function (items) {
847 return new NbFocusKeyManager(items);
848 };
849 return NbFocusKeyManagerFactoryService;
850}());
851
852var NbActiveDescendantKeyManager = /** @class */ (function (_super) {
853 tslib.__extends(NbActiveDescendantKeyManager, _super);
854 function NbActiveDescendantKeyManager() {
855 return _super !== null && _super.apply(this, arguments) || this;
856 }
857 return NbActiveDescendantKeyManager;
858}(_angular_cdk_a11y.ActiveDescendantKeyManager));
859var NbActiveDescendantKeyManagerFactoryService = /** @class */ (function () {
860 function NbActiveDescendantKeyManagerFactoryService() {
861 }
862 NbActiveDescendantKeyManagerFactoryService.prototype.create = function (items) {
863 return new NbActiveDescendantKeyManager(items);
864 };
865 return NbActiveDescendantKeyManagerFactoryService;
866}());
867var NbKeyManagerActiveItemMode;
868(function (NbKeyManagerActiveItemMode) {
869 NbKeyManagerActiveItemMode[NbKeyManagerActiveItemMode["RESET_ACTIVE"] = -1] = "RESET_ACTIVE";
870 NbKeyManagerActiveItemMode[NbKeyManagerActiveItemMode["FIRST_ACTIVE"] = 0] = "FIRST_ACTIVE";
871})(NbKeyManagerActiveItemMode || (NbKeyManagerActiveItemMode = {}));
872
873var NbFocusMonitor = /** @class */ (function (_super) {
874 tslib.__extends(NbFocusMonitor, _super);
875 function NbFocusMonitor() {
876 return _super !== null && _super.apply(this, arguments) || this;
877 }
878 NbFocusMonitor.decorators = [
879 { type: i0.Injectable }
880 ];
881 return NbFocusMonitor;
882}(_angular_cdk_a11y.FocusMonitor));
883var NbA11yModule = /** @class */ (function () {
884 function NbA11yModule() {
885 }
886 NbA11yModule.forRoot = function () {
887 return {
888 ngModule: NbA11yModule,
889 providers: [
890 NbFocusTrapFactoryService,
891 NbFocusKeyManagerFactoryService,
892 NbActiveDescendantKeyManagerFactoryService,
893 { provide: NbFocusMonitor, useClass: _angular_cdk_a11y.FocusMonitor },
894 ],
895 };
896 };
897 NbA11yModule.decorators = [
898 { type: i0.NgModule, args: [{},] }
899 ];
900 return NbA11yModule;
901}());
902
903var NbPortalDirective = /** @class */ (function (_super) {
904 tslib.__extends(NbPortalDirective, _super);
905 function NbPortalDirective() {
906 return _super !== null && _super.apply(this, arguments) || this;
907 }
908 NbPortalDirective.decorators = [
909 { type: i0.Directive, args: [{ selector: '[nbPortal]' },] }
910 ];
911 return NbPortalDirective;
912}(_angular_cdk_portal.CdkPortal));
913var NbPortalOutletDirective = /** @class */ (function (_super) {
914 tslib.__extends(NbPortalOutletDirective, _super);
915 function NbPortalOutletDirective() {
916 return _super !== null && _super.apply(this, arguments) || this;
917 }
918 NbPortalOutletDirective.decorators = [
919 { type: i0.Directive, args: [{ selector: '[nbPortalOutlet]' },] }
920 ];
921 return NbPortalOutletDirective;
922}(_angular_cdk_portal.CdkPortalOutlet));
923var NbComponentPortal = /** @class */ (function (_super) {
924 tslib.__extends(NbComponentPortal, _super);
925 function NbComponentPortal() {
926 return _super !== null && _super.apply(this, arguments) || this;
927 }
928 return NbComponentPortal;
929}(_angular_cdk_portal.ComponentPortal));
930var NbOverlay = /** @class */ (function (_super) {
931 tslib.__extends(NbOverlay, _super);
932 function NbOverlay() {
933 return _super !== null && _super.apply(this, arguments) || this;
934 }
935 NbOverlay.decorators = [
936 { type: i0.Injectable }
937 ];
938 return NbOverlay;
939}(_angular_cdk_overlay.Overlay));
940var NbOverlayPositionBuilder = /** @class */ (function (_super) {
941 tslib.__extends(NbOverlayPositionBuilder, _super);
942 function NbOverlayPositionBuilder() {
943 return _super !== null && _super.apply(this, arguments) || this;
944 }
945 NbOverlayPositionBuilder.decorators = [
946 { type: i0.Injectable }
947 ];
948 return NbOverlayPositionBuilder;
949}(_angular_cdk_overlay.OverlayPositionBuilder));
950var NbTemplatePortal = /** @class */ (function (_super) {
951 tslib.__extends(NbTemplatePortal, _super);
952 function NbTemplatePortal(template, viewContainerRef, context) {
953 return _super.call(this, template, viewContainerRef, context) || this;
954 }
955 return NbTemplatePortal;
956}(_angular_cdk_portal.TemplatePortal));
957var NbOverlayContainer = /** @class */ (function (_super) {
958 tslib.__extends(NbOverlayContainer, _super);
959 function NbOverlayContainer() {
960 return _super !== null && _super.apply(this, arguments) || this;
961 }
962 NbOverlayContainer.decorators = [
963 { type: i0.Injectable }
964 ];
965 return NbOverlayContainer;
966}(_angular_cdk_overlay.OverlayContainer));
967var NbFlexibleConnectedPositionStrategy = /** @class */ (function (_super) {
968 tslib.__extends(NbFlexibleConnectedPositionStrategy, _super);
969 function NbFlexibleConnectedPositionStrategy() {
970 return _super !== null && _super.apply(this, arguments) || this;
971 }
972 return NbFlexibleConnectedPositionStrategy;
973}(_angular_cdk_overlay.FlexibleConnectedPositionStrategy));
974var NbPortalInjector = /** @class */ (function (_super) {
975 tslib.__extends(NbPortalInjector, _super);
976 function NbPortalInjector() {
977 return _super !== null && _super.apply(this, arguments) || this;
978 }
979 return NbPortalInjector;
980}(_angular_cdk_portal.PortalInjector));
981var CDK_MODULES = [_angular_cdk_overlay.OverlayModule, _angular_cdk_portal.PortalModule];
982/**
983 * This module helps us to keep all angular/cdk deps inside our cdk module via providing aliases.
984 * Approach will help us move cdk in separate npm package and refactor nebular/theme code.
985 * */
986var NbCdkMappingModule = /** @class */ (function () {
987 function NbCdkMappingModule() {
988 }
989 NbCdkMappingModule.forRoot = function () {
990 return {
991 ngModule: NbCdkMappingModule,
992 providers: [
993 NbOverlay,
994 NbOverlayPositionBuilder,
995 ],
996 };
997 };
998 NbCdkMappingModule.decorators = [
999 { type: i0.NgModule, args: [{
1000 imports: tslib.__spreadArray([], CDK_MODULES),
1001 exports: tslib.__spreadArray(tslib.__spreadArray([], CDK_MODULES), [
1002 NbPortalDirective,
1003 NbPortalOutletDirective,
1004 ]),
1005 declarations: [NbPortalDirective, NbPortalOutletDirective],
1006 },] }
1007 ];
1008 return NbCdkMappingModule;
1009}());
1010
1011var NbPlatform = /** @class */ (function (_super) {
1012 tslib.__extends(NbPlatform, _super);
1013 function NbPlatform() {
1014 return _super !== null && _super.apply(this, arguments) || this;
1015 }
1016 NbPlatform.ɵprov = i0.ɵɵdefineInjectable({ factory: function NbPlatform_Factory() { return new i1.Platform(i0.ɵɵinject(i0.PLATFORM_ID)); }, token: NbPlatform, providedIn: "root" });
1017 NbPlatform.decorators = [
1018 { type: i0.Injectable, args: [{
1019 providedIn: 'root',
1020 useClass: i1.Platform,
1021 },] }
1022 ];
1023 return NbPlatform;
1024}(i1.Platform));
1025
1026/**
1027 * Provides nb-layout as overlay container.
1028 * Container has to be cleared when layout destroys.
1029 * Another way previous version of the container will be used
1030 * but it isn't inserted in DOM and exists in memory only.
1031 * This case important only if you switch between multiple layouts.
1032 * */
1033var NbOverlayContainerAdapter = /** @class */ (function (_super) {
1034 tslib.__extends(NbOverlayContainerAdapter, _super);
1035 function NbOverlayContainerAdapter() {
1036 return _super !== null && _super.apply(this, arguments) || this;
1037 }
1038 NbOverlayContainerAdapter.prototype.setContainer = function (container) {
1039 this.container = container;
1040 };
1041 NbOverlayContainerAdapter.prototype.clearContainer = function () {
1042 this.container = null;
1043 this._containerElement = null;
1044 };
1045 NbOverlayContainerAdapter.prototype._createContainer = function () {
1046 var container = this._document.createElement('div');
1047 container.classList.add('cdk-overlay-container');
1048 this.container.appendChild(container);
1049 this._containerElement = container;
1050 };
1051 NbOverlayContainerAdapter.decorators = [
1052 { type: i0.Injectable }
1053 ];
1054 return NbOverlayContainerAdapter;
1055}(NbOverlayContainer));
1056
1057var NbViewportRulerAdapter = /** @class */ (function (_super) {
1058 tslib.__extends(NbViewportRulerAdapter, _super);
1059 function NbViewportRulerAdapter(platform, ngZone, ruler, scroll, document) {
1060 var _this = _super.call(this, platform, ngZone, document) || this;
1061 _this.ruler = ruler;
1062 _this.scroll = scroll;
1063 return _this;
1064 }
1065 NbViewportRulerAdapter.prototype.getViewportSize = function () {
1066 var res;
1067 /*
1068 * getDimensions call is really synchronous operation.
1069 * And we have to conform with the interface of the original service.
1070 * */
1071 this.ruler.getDimensions()
1072 .pipe(rxjs_operators.map(function (dimensions) { return ({ width: dimensions.clientWidth, height: dimensions.clientHeight }); }))
1073 .subscribe(function (rect) { return res = rect; });
1074 return res;
1075 };
1076 NbViewportRulerAdapter.prototype.getViewportScrollPosition = function () {
1077 var res;
1078 /*
1079 * getPosition call is really synchronous operation.
1080 * And we have to conform with the interface of the original service.
1081 * */
1082 this.scroll.getPosition()
1083 .pipe(rxjs_operators.map(function (position) { return ({ top: position.y, left: position.x }); }))
1084 .subscribe(function (position) { return res = position; });
1085 return res;
1086 };
1087 NbViewportRulerAdapter.decorators = [
1088 { type: i0.Injectable }
1089 ];
1090 NbViewportRulerAdapter.ctorParameters = function () { return [
1091 { type: NbPlatform },
1092 { type: i0.NgZone },
1093 { type: NbLayoutRulerService },
1094 { type: NbLayoutScrollService },
1095 { type: undefined, decorators: [{ type: i0.Inject, args: [NB_DOCUMENT,] }] }
1096 ]; };
1097 return NbViewportRulerAdapter;
1098}(_angular_cdk_overlay.ViewportRuler));
1099
1100(function (NbGlobalLogicalPosition) {
1101 NbGlobalLogicalPosition["TOP_START"] = "top-start";
1102 NbGlobalLogicalPosition["TOP_END"] = "top-end";
1103 NbGlobalLogicalPosition["BOTTOM_START"] = "bottom-start";
1104 NbGlobalLogicalPosition["BOTTOM_END"] = "bottom-end";
1105})(exports.NbGlobalLogicalPosition || (exports.NbGlobalLogicalPosition = {}));
1106
1107(function (NbGlobalPhysicalPosition) {
1108 NbGlobalPhysicalPosition["TOP_RIGHT"] = "top-right";
1109 NbGlobalPhysicalPosition["TOP_LEFT"] = "top-left";
1110 NbGlobalPhysicalPosition["BOTTOM_RIGHT"] = "bottom-right";
1111 NbGlobalPhysicalPosition["BOTTOM_LEFT"] = "bottom-left";
1112})(exports.NbGlobalPhysicalPosition || (exports.NbGlobalPhysicalPosition = {}));
1113var NbPositionHelper = /** @class */ (function () {
1114 function NbPositionHelper(layoutDirection) {
1115 this.layoutDirection = layoutDirection;
1116 }
1117 NbPositionHelper.prototype.toLogicalPosition = function (position) {
1118 if (Object.values(exports.NbGlobalLogicalPosition).includes(position)) {
1119 return position;
1120 }
1121 if (this.layoutDirection.isLtr()) {
1122 return this.toLogicalPositionWhenLtr(position);
1123 }
1124 else {
1125 return this.toLogicalPositionWhenRtl(position);
1126 }
1127 };
1128 NbPositionHelper.prototype.toPhysicalPosition = function (position) {
1129 if (Object.values(exports.NbGlobalPhysicalPosition).includes(position)) {
1130 return position;
1131 }
1132 if (this.layoutDirection.isLtr()) {
1133 return this.toPhysicalPositionWhenLtr(position);
1134 }
1135 else {
1136 return this.toPhysicalPositionWhenRtl(position);
1137 }
1138 };
1139 NbPositionHelper.prototype.isTopPosition = function (position) {
1140 var logicalPosition = this.toLogicalPosition(position);
1141 return logicalPosition === exports.NbGlobalLogicalPosition.TOP_END
1142 || logicalPosition === exports.NbGlobalLogicalPosition.TOP_START;
1143 };
1144 NbPositionHelper.prototype.isRightPosition = function (position) {
1145 var physicalPosition = this.toPhysicalPosition(position);
1146 return physicalPosition === exports.NbGlobalPhysicalPosition.TOP_RIGHT
1147 || physicalPosition === exports.NbGlobalPhysicalPosition.BOTTOM_RIGHT;
1148 };
1149 NbPositionHelper.prototype.toLogicalPositionWhenLtr = function (position) {
1150 switch (position) {
1151 case exports.NbGlobalPhysicalPosition.TOP_RIGHT:
1152 return exports.NbGlobalLogicalPosition.TOP_END;
1153 case exports.NbGlobalPhysicalPosition.TOP_LEFT:
1154 return exports.NbGlobalLogicalPosition.TOP_START;
1155 case exports.NbGlobalPhysicalPosition.BOTTOM_RIGHT:
1156 return exports.NbGlobalLogicalPosition.BOTTOM_END;
1157 case exports.NbGlobalPhysicalPosition.BOTTOM_LEFT:
1158 return exports.NbGlobalLogicalPosition.BOTTOM_START;
1159 }
1160 };
1161 NbPositionHelper.prototype.toLogicalPositionWhenRtl = function (position) {
1162 switch (position) {
1163 case exports.NbGlobalPhysicalPosition.TOP_RIGHT:
1164 return exports.NbGlobalLogicalPosition.TOP_START;
1165 case exports.NbGlobalPhysicalPosition.TOP_LEFT:
1166 return exports.NbGlobalLogicalPosition.TOP_END;
1167 case exports.NbGlobalPhysicalPosition.BOTTOM_RIGHT:
1168 return exports.NbGlobalLogicalPosition.BOTTOM_START;
1169 case exports.NbGlobalPhysicalPosition.BOTTOM_LEFT:
1170 return exports.NbGlobalLogicalPosition.BOTTOM_END;
1171 }
1172 };
1173 NbPositionHelper.prototype.toPhysicalPositionWhenLtr = function (position) {
1174 switch (position) {
1175 case exports.NbGlobalLogicalPosition.TOP_START:
1176 return exports.NbGlobalPhysicalPosition.TOP_LEFT;
1177 case exports.NbGlobalLogicalPosition.TOP_END:
1178 return exports.NbGlobalPhysicalPosition.TOP_RIGHT;
1179 case exports.NbGlobalLogicalPosition.BOTTOM_START:
1180 return exports.NbGlobalPhysicalPosition.BOTTOM_LEFT;
1181 case exports.NbGlobalLogicalPosition.BOTTOM_END:
1182 return exports.NbGlobalPhysicalPosition.BOTTOM_RIGHT;
1183 }
1184 };
1185 NbPositionHelper.prototype.toPhysicalPositionWhenRtl = function (position) {
1186 switch (position) {
1187 case exports.NbGlobalLogicalPosition.TOP_START:
1188 return exports.NbGlobalPhysicalPosition.TOP_RIGHT;
1189 case exports.NbGlobalLogicalPosition.TOP_END:
1190 return exports.NbGlobalPhysicalPosition.TOP_LEFT;
1191 case exports.NbGlobalLogicalPosition.BOTTOM_START:
1192 return exports.NbGlobalPhysicalPosition.BOTTOM_RIGHT;
1193 case exports.NbGlobalLogicalPosition.BOTTOM_END:
1194 return exports.NbGlobalPhysicalPosition.BOTTOM_LEFT;
1195 }
1196 };
1197 NbPositionHelper.decorators = [
1198 { type: i0.Injectable }
1199 ];
1200 NbPositionHelper.ctorParameters = function () { return [
1201 { type: NbLayoutDirectionService }
1202 ]; };
1203 return NbPositionHelper;
1204}());
1205
1206var _a;
1207
1208(function (NbAdjustment) {
1209 NbAdjustment["NOOP"] = "noop";
1210 NbAdjustment["CLOCKWISE"] = "clockwise";
1211 NbAdjustment["COUNTERCLOCKWISE"] = "counterclockwise";
1212 NbAdjustment["VERTICAL"] = "vertical";
1213 NbAdjustment["HORIZONTAL"] = "horizontal";
1214})(exports.NbAdjustment || (exports.NbAdjustment = {}));
1215
1216(function (NbPosition) {
1217 NbPosition["TOP"] = "top";
1218 NbPosition["BOTTOM"] = "bottom";
1219 NbPosition["LEFT"] = "left";
1220 NbPosition["RIGHT"] = "right";
1221 NbPosition["START"] = "start";
1222 NbPosition["END"] = "end";
1223 NbPosition["TOP_END"] = "top-end";
1224 NbPosition["TOP_START"] = "top-start";
1225 NbPosition["BOTTOM_END"] = "bottom-end";
1226 NbPosition["BOTTOM_START"] = "bottom-start";
1227 NbPosition["END_TOP"] = "end-top";
1228 NbPosition["END_BOTTOM"] = "end-bottom";
1229 NbPosition["START_TOP"] = "start-top";
1230 NbPosition["START_BOTTOM"] = "start-bottom";
1231})(exports.NbPosition || (exports.NbPosition = {}));
1232var POSITIONS = (_a = {},
1233 _a[exports.NbPosition.RIGHT] = function (offset) {
1234 return { originX: 'end', originY: 'center', overlayX: 'start', overlayY: 'center', offsetX: offset };
1235 },
1236 _a[exports.NbPosition.BOTTOM] = function (offset) {
1237 return { originX: 'center', originY: 'bottom', overlayX: 'center', overlayY: 'top', offsetY: offset };
1238 },
1239 _a[exports.NbPosition.LEFT] = function (offset) {
1240 return { originX: 'start', originY: 'center', overlayX: 'end', overlayY: 'center', offsetX: -offset };
1241 },
1242 _a[exports.NbPosition.TOP] = function (offset) {
1243 return { originX: 'center', originY: 'top', overlayX: 'center', overlayY: 'bottom', offsetY: -offset };
1244 },
1245 _a[exports.NbPosition.START] = function (offset) {
1246 return this[exports.NbPosition.LEFT](offset);
1247 },
1248 _a[exports.NbPosition.END] = function (offset) {
1249 return this[exports.NbPosition.RIGHT](offset);
1250 },
1251 _a[exports.NbPosition.END_TOP] = function (offset) {
1252 return { originX: 'end', originY: 'bottom', overlayX: 'start', overlayY: 'bottom', offsetX: offset };
1253 },
1254 _a[exports.NbPosition.END_BOTTOM] = function (offset) {
1255 return { originX: 'end', originY: 'top', overlayX: 'start', overlayY: 'top', offsetX: offset };
1256 },
1257 _a[exports.NbPosition.BOTTOM_START] = function (offset) {
1258 return { originX: 'end', originY: 'bottom', overlayX: 'end', overlayY: 'top', offsetY: offset };
1259 },
1260 _a[exports.NbPosition.BOTTOM_END] = function (offset) {
1261 return { originX: 'start', originY: 'bottom', overlayX: 'start', overlayY: 'top', offsetY: offset };
1262 },
1263 _a[exports.NbPosition.START_TOP] = function (offset) {
1264 return { originX: 'start', originY: 'bottom', overlayX: 'end', overlayY: 'bottom', offsetX: -offset };
1265 },
1266 _a[exports.NbPosition.START_BOTTOM] = function (offset) {
1267 return { originX: 'start', originY: 'top', overlayX: 'end', overlayY: 'top', offsetX: -offset };
1268 },
1269 _a[exports.NbPosition.TOP_START] = function (offset) {
1270 return { originX: 'end', originY: 'top', overlayX: 'end', overlayY: 'bottom', offsetY: -offset };
1271 },
1272 _a[exports.NbPosition.TOP_END] = function (offset) {
1273 return { originX: 'start', originY: 'top', overlayX: 'start', overlayY: 'bottom', offsetY: -offset };
1274 },
1275 _a);
1276var COUNTER_CLOCKWISE_POSITIONS = [
1277 exports.NbPosition.TOP,
1278 exports.NbPosition.TOP_END,
1279 exports.NbPosition.TOP_START,
1280 exports.NbPosition.START,
1281 exports.NbPosition.START_TOP,
1282 exports.NbPosition.START_BOTTOM,
1283 exports.NbPosition.BOTTOM,
1284 exports.NbPosition.BOTTOM_START,
1285 exports.NbPosition.BOTTOM_END,
1286 exports.NbPosition.END,
1287 exports.NbPosition.END_BOTTOM,
1288 exports.NbPosition.END_TOP,
1289];
1290var CLOCKWISE_POSITIONS = [
1291 exports.NbPosition.TOP,
1292 exports.NbPosition.TOP_START,
1293 exports.NbPosition.TOP_END,
1294 exports.NbPosition.END,
1295 exports.NbPosition.END_TOP,
1296 exports.NbPosition.END_BOTTOM,
1297 exports.NbPosition.BOTTOM,
1298 exports.NbPosition.BOTTOM_END,
1299 exports.NbPosition.BOTTOM_START,
1300 exports.NbPosition.START,
1301 exports.NbPosition.START_BOTTOM,
1302 exports.NbPosition.START_TOP,
1303];
1304var VERTICAL_POSITIONS = [exports.NbPosition.BOTTOM, exports.NbPosition.TOP];
1305var HORIZONTAL_POSITIONS = [exports.NbPosition.START, exports.NbPosition.END];
1306function comparePositions(p1, p2) {
1307 return p1.originX === p2.originX
1308 && p1.originY === p2.originY
1309 && p1.overlayX === p2.overlayX
1310 && p1.overlayY === p2.overlayY;
1311}
1312/**
1313 * The main idea of the adjustable connected strategy is to provide predefined set of positions for your overlay.
1314 * You have to provide adjustment and appropriate strategy will be chosen in runtime.
1315 * */
1316var NbAdjustableConnectedPositionStrategy = /** @class */ (function (_super) {
1317 tslib.__extends(NbAdjustableConnectedPositionStrategy, _super);
1318 function NbAdjustableConnectedPositionStrategy() {
1319 var _this = _super !== null && _super.apply(this, arguments) || this;
1320 _this._offset = 15;
1321 _this.positionChange = _this.positionChanges.pipe(rxjs_operators.map(function (positionChange) { return positionChange.connectionPair; }), rxjs_operators.map(function (connectionPair) {
1322 return _this.appliedPositions.find(function (_a) {
1323 var connectedPosition = _a.connectedPosition;
1324 return comparePositions(connectedPosition, connectionPair);
1325 }).key;
1326 }));
1327 return _this;
1328 }
1329 NbAdjustableConnectedPositionStrategy.prototype.attach = function (overlayRef) {
1330 /**
1331 * We have to apply positions before attach because super.attach() validates positions and crashes app
1332 * if no positions provided.
1333 * */
1334 this.applyPositions();
1335 _super.prototype.attach.call(this, overlayRef);
1336 };
1337 NbAdjustableConnectedPositionStrategy.prototype.apply = function () {
1338 this.applyPositions();
1339 _super.prototype.apply.call(this);
1340 };
1341 NbAdjustableConnectedPositionStrategy.prototype.position = function (position) {
1342 this._position = position;
1343 return this;
1344 };
1345 NbAdjustableConnectedPositionStrategy.prototype.adjustment = function (adjustment) {
1346 this._adjustment = adjustment;
1347 return this;
1348 };
1349 NbAdjustableConnectedPositionStrategy.prototype.offset = function (offset) {
1350 this._offset = offset;
1351 return this;
1352 };
1353 NbAdjustableConnectedPositionStrategy.prototype.applyPositions = function () {
1354 var positions = this.createPositions();
1355 this.persistChosenPositions(positions);
1356 this.withPositions(this.appliedPositions.map(function (_a) {
1357 var connectedPosition = _a.connectedPosition;
1358 return connectedPosition;
1359 }));
1360 };
1361 NbAdjustableConnectedPositionStrategy.prototype.createPositions = function () {
1362 switch (this._adjustment) {
1363 case exports.NbAdjustment.NOOP:
1364 return [this._position];
1365 case exports.NbAdjustment.CLOCKWISE:
1366 return this.reorderPreferredPositions(CLOCKWISE_POSITIONS);
1367 case exports.NbAdjustment.COUNTERCLOCKWISE:
1368 return this.reorderPreferredPositions(COUNTER_CLOCKWISE_POSITIONS);
1369 case exports.NbAdjustment.HORIZONTAL:
1370 return this.reorderPreferredPositions(HORIZONTAL_POSITIONS);
1371 case exports.NbAdjustment.VERTICAL:
1372 return this.reorderPreferredPositions(VERTICAL_POSITIONS);
1373 }
1374 };
1375 NbAdjustableConnectedPositionStrategy.prototype.persistChosenPositions = function (positions) {
1376 var _this = this;
1377 this.appliedPositions = positions.map(function (position) { return ({
1378 key: position,
1379 connectedPosition: POSITIONS[position](_this._offset),
1380 }); });
1381 };
1382 NbAdjustableConnectedPositionStrategy.prototype.reorderPreferredPositions = function (positions) {
1383 // Physical positions should be mapped to logical as adjustments use logical positions.
1384 var startPositionIndex = positions.indexOf(this.mapToLogicalPosition(this._position));
1385 var firstPart = positions.slice(startPositionIndex);
1386 var secondPart = positions.slice(0, startPositionIndex);
1387 return firstPart.concat(secondPart);
1388 };
1389 NbAdjustableConnectedPositionStrategy.prototype.mapToLogicalPosition = function (position) {
1390 if (position === exports.NbPosition.LEFT) {
1391 return exports.NbPosition.START;
1392 }
1393 if (position === exports.NbPosition.RIGHT) {
1394 return exports.NbPosition.END;
1395 }
1396 return position;
1397 };
1398 return NbAdjustableConnectedPositionStrategy;
1399}(NbFlexibleConnectedPositionStrategy));
1400var NbGlobalPositionStrategy = /** @class */ (function (_super) {
1401 tslib.__extends(NbGlobalPositionStrategy, _super);
1402 function NbGlobalPositionStrategy() {
1403 return _super !== null && _super.apply(this, arguments) || this;
1404 }
1405 NbGlobalPositionStrategy.prototype.position = function (position) {
1406 switch (position) {
1407 case exports.NbGlobalLogicalPosition.TOP_START:
1408 return this.top().left();
1409 case exports.NbGlobalLogicalPosition.TOP_END:
1410 return this.top().right();
1411 case exports.NbGlobalLogicalPosition.BOTTOM_START:
1412 return this.bottom().left();
1413 case exports.NbGlobalLogicalPosition.BOTTOM_END:
1414 return this.bottom().right();
1415 }
1416 };
1417 return NbGlobalPositionStrategy;
1418}(_angular_cdk_overlay.GlobalPositionStrategy));
1419var NbPositionBuilderService = /** @class */ (function () {
1420 function NbPositionBuilderService(document, viewportRuler, platform, positionBuilder, overlayContainer) {
1421 this.document = document;
1422 this.viewportRuler = viewportRuler;
1423 this.platform = platform;
1424 this.positionBuilder = positionBuilder;
1425 this.overlayContainer = overlayContainer;
1426 }
1427 NbPositionBuilderService.prototype.global = function () {
1428 return new NbGlobalPositionStrategy();
1429 };
1430 NbPositionBuilderService.prototype.connectedTo = function (elementRef) {
1431 return new NbAdjustableConnectedPositionStrategy(elementRef, this.viewportRuler, this.document, this.platform, this.overlayContainer)
1432 .withFlexibleDimensions(false)
1433 .withPush(false);
1434 };
1435 NbPositionBuilderService.decorators = [
1436 { type: i0.Injectable }
1437 ];
1438 NbPositionBuilderService.ctorParameters = function () { return [
1439 { type: undefined, decorators: [{ type: i0.Inject, args: [NB_DOCUMENT,] }] },
1440 { type: NbViewportRulerAdapter },
1441 { type: NbPlatform },
1442 { type: NbOverlayPositionBuilder },
1443 { type: NbOverlayContainerAdapter }
1444 ]; };
1445 return NbPositionBuilderService;
1446}());
1447
1448var NbPositionedContainerComponent = /** @class */ (function () {
1449 function NbPositionedContainerComponent() {
1450 }
1451 Object.defineProperty(NbPositionedContainerComponent.prototype, "top", {
1452 get: function () {
1453 return this.position === exports.NbPosition.TOP;
1454 },
1455 enumerable: false,
1456 configurable: true
1457 });
1458 Object.defineProperty(NbPositionedContainerComponent.prototype, "topStart", {
1459 get: function () {
1460 return this.position === exports.NbPosition.TOP_START;
1461 },
1462 enumerable: false,
1463 configurable: true
1464 });
1465 Object.defineProperty(NbPositionedContainerComponent.prototype, "topEnd", {
1466 get: function () {
1467 return this.position === exports.NbPosition.TOP_END;
1468 },
1469 enumerable: false,
1470 configurable: true
1471 });
1472 Object.defineProperty(NbPositionedContainerComponent.prototype, "right", {
1473 get: function () {
1474 return this.position === exports.NbPosition.RIGHT || this.position === exports.NbPosition.END;
1475 },
1476 enumerable: false,
1477 configurable: true
1478 });
1479 Object.defineProperty(NbPositionedContainerComponent.prototype, "endTop", {
1480 get: function () {
1481 return this.position === exports.NbPosition.END_TOP;
1482 },
1483 enumerable: false,
1484 configurable: true
1485 });
1486 Object.defineProperty(NbPositionedContainerComponent.prototype, "endBottom", {
1487 get: function () {
1488 return this.position === exports.NbPosition.END_BOTTOM;
1489 },
1490 enumerable: false,
1491 configurable: true
1492 });
1493 Object.defineProperty(NbPositionedContainerComponent.prototype, "bottom", {
1494 get: function () {
1495 return this.position === exports.NbPosition.BOTTOM;
1496 },
1497 enumerable: false,
1498 configurable: true
1499 });
1500 Object.defineProperty(NbPositionedContainerComponent.prototype, "bottomStart", {
1501 get: function () {
1502 return this.position === exports.NbPosition.BOTTOM_START;
1503 },
1504 enumerable: false,
1505 configurable: true
1506 });
1507 Object.defineProperty(NbPositionedContainerComponent.prototype, "bottomEnd", {
1508 get: function () {
1509 return this.position === exports.NbPosition.BOTTOM_END;
1510 },
1511 enumerable: false,
1512 configurable: true
1513 });
1514 Object.defineProperty(NbPositionedContainerComponent.prototype, "left", {
1515 get: function () {
1516 return this.position === exports.NbPosition.LEFT || this.position === exports.NbPosition.START;
1517 },
1518 enumerable: false,
1519 configurable: true
1520 });
1521 Object.defineProperty(NbPositionedContainerComponent.prototype, "startTop", {
1522 get: function () {
1523 return this.position === exports.NbPosition.START_TOP;
1524 },
1525 enumerable: false,
1526 configurable: true
1527 });
1528 Object.defineProperty(NbPositionedContainerComponent.prototype, "startBottom", {
1529 get: function () {
1530 return this.position === exports.NbPosition.START_BOTTOM;
1531 },
1532 enumerable: false,
1533 configurable: true
1534 });
1535 NbPositionedContainerComponent.decorators = [
1536 { type: i0.Component, args: [{
1537 template: ''
1538 },] }
1539 ];
1540 NbPositionedContainerComponent.propDecorators = {
1541 position: [{ type: i0.Input }],
1542 top: [{ type: i0.HostBinding, args: ['class.nb-overlay-top',] }],
1543 topStart: [{ type: i0.HostBinding, args: ['class.nb-overlay-top-start',] }],
1544 topEnd: [{ type: i0.HostBinding, args: ['class.nb-overlay-top-end',] }],
1545 right: [{ type: i0.HostBinding, args: ['class.nb-overlay-right',] }],
1546 endTop: [{ type: i0.HostBinding, args: ['class.nb-overlay-end-top',] }],
1547 endBottom: [{ type: i0.HostBinding, args: ['class.nb-overlay-end-bottom',] }],
1548 bottom: [{ type: i0.HostBinding, args: ['class.nb-overlay-bottom',] }],
1549 bottomStart: [{ type: i0.HostBinding, args: ['class.nb-overlay-bottom-start',] }],
1550 bottomEnd: [{ type: i0.HostBinding, args: ['class.nb-overlay-bottom-end',] }],
1551 left: [{ type: i0.HostBinding, args: ['class.nb-overlay-left',] }],
1552 startTop: [{ type: i0.HostBinding, args: ['class.nb-overlay-start-top',] }],
1553 startBottom: [{ type: i0.HostBinding, args: ['class.nb-overlay-start-bottom',] }]
1554 };
1555 return NbPositionedContainerComponent;
1556}());
1557var NbOverlayContainerComponent = /** @class */ (function () {
1558 function NbOverlayContainerComponent(vcr, injector, changeDetectorRef) {
1559 this.vcr = vcr;
1560 this.injector = injector;
1561 this.changeDetectorRef = changeDetectorRef;
1562 this.isAttached = false;
1563 }
1564 Object.defineProperty(NbOverlayContainerComponent.prototype, "isStringContent", {
1565 get: function () {
1566 return !!this.content;
1567 },
1568 enumerable: false,
1569 configurable: true
1570 });
1571 NbOverlayContainerComponent.prototype.attachComponentPortal = function (portal, context) {
1572 portal.injector = this.createChildInjector(portal.componentFactoryResolver);
1573 var componentRef = this.portalOutlet.attachComponentPortal(portal);
1574 if (context) {
1575 Object.assign(componentRef.instance, context);
1576 }
1577 componentRef.changeDetectorRef.markForCheck();
1578 componentRef.changeDetectorRef.detectChanges();
1579 this.isAttached = true;
1580 return componentRef;
1581 };
1582 NbOverlayContainerComponent.prototype.attachTemplatePortal = function (portal) {
1583 var templateRef = this.portalOutlet.attachTemplatePortal(portal);
1584 templateRef.detectChanges();
1585 this.isAttached = true;
1586 return templateRef;
1587 };
1588 NbOverlayContainerComponent.prototype.attachStringContent = function (content) {
1589 this.content = content;
1590 this.changeDetectorRef.markForCheck();
1591 this.changeDetectorRef.detectChanges();
1592 this.isAttached = true;
1593 };
1594 NbOverlayContainerComponent.prototype.detach = function () {
1595 if (this.portalOutlet.hasAttached()) {
1596 this.portalOutlet.detach();
1597 }
1598 this.attachStringContent(null);
1599 this.isAttached = false;
1600 };
1601 NbOverlayContainerComponent.prototype.createChildInjector = function (cfr) {
1602 return new NbPortalInjector(this.injector, new WeakMap([
1603 [i0.ComponentFactoryResolver, cfr],
1604 ]));
1605 };
1606 NbOverlayContainerComponent.decorators = [
1607 { type: i0.Component, args: [{
1608 selector: 'nb-overlay-container',
1609 template: "\n <div *ngIf=\"isStringContent\" class=\"primitive-overlay\">{{ content }}</div>\n <ng-template nbPortalOutlet></ng-template>\n "
1610 },] }
1611 ];
1612 NbOverlayContainerComponent.ctorParameters = function () { return [
1613 { type: i0.ViewContainerRef },
1614 { type: i0.Injector },
1615 { type: i0.ChangeDetectorRef }
1616 ]; };
1617 NbOverlayContainerComponent.propDecorators = {
1618 portalOutlet: [{ type: i0.ViewChild, args: [NbPortalOutletDirective, { static: true },] }]
1619 };
1620 return NbOverlayContainerComponent;
1621}());
1622
1623function patch(container, containerContext) {
1624 Object.assign(container.instance, containerContext);
1625 container.changeDetectorRef.detectChanges();
1626 return container;
1627}
1628function createContainer(ref, container, context, componentFactoryResolver) {
1629 var containerRef = ref.attach(new NbComponentPortal(container, null, null, componentFactoryResolver));
1630 patch(containerRef, context);
1631 return containerRef;
1632}
1633var NbOverlayService = /** @class */ (function () {
1634 function NbOverlayService(overlay, layoutDirection) {
1635 this.overlay = overlay;
1636 this.layoutDirection = layoutDirection;
1637 }
1638 Object.defineProperty(NbOverlayService.prototype, "scrollStrategies", {
1639 get: function () {
1640 return this.overlay.scrollStrategies;
1641 },
1642 enumerable: false,
1643 configurable: true
1644 });
1645 NbOverlayService.prototype.create = function (config) {
1646 var overlayRef = this.overlay.create(config);
1647 this.layoutDirection.onDirectionChange()
1648 .subscribe(function (dir) { return overlayRef.setDirection(dir); });
1649 return overlayRef;
1650 };
1651 NbOverlayService.decorators = [
1652 { type: i0.Injectable }
1653 ];
1654 NbOverlayService.ctorParameters = function () { return [
1655 { type: NbOverlay },
1656 { type: NbLayoutDirectionService }
1657 ]; };
1658 return NbOverlayService;
1659}());
1660
1661var NbScrollDispatcherAdapter = /** @class */ (function (_super) {
1662 tslib.__extends(NbScrollDispatcherAdapter, _super);
1663 function NbScrollDispatcherAdapter(ngZone, platform, scrollService, document) {
1664 var _this = _super.call(this, ngZone, platform, document) || this;
1665 _this.scrollService = scrollService;
1666 return _this;
1667 }
1668 NbScrollDispatcherAdapter.prototype.scrolled = function (auditTimeInMs) {
1669 return rxjs.merge(_super.prototype.scrolled.call(this, auditTimeInMs), this.scrollService.onScroll());
1670 };
1671 NbScrollDispatcherAdapter.decorators = [
1672 { type: i0.Injectable }
1673 ];
1674 NbScrollDispatcherAdapter.ctorParameters = function () { return [
1675 { type: i0.NgZone },
1676 { type: NbPlatform },
1677 { type: NbLayoutScrollService },
1678 { type: undefined, decorators: [{ type: i0.Inject, args: [NB_DOCUMENT,] }] }
1679 ]; };
1680 return NbScrollDispatcherAdapter;
1681}(_angular_cdk_overlay.ScrollDispatcher));
1682
1683/**
1684 * Overrides default block scroll strategy because default strategy blocks scrolling on the body only.
1685 * But Nebular has its own scrollable container - nb-layout. So, we need to block scrolling in it to.
1686 * */
1687var NbBlockScrollStrategyAdapter = /** @class */ (function (_super) {
1688 tslib.__extends(NbBlockScrollStrategyAdapter, _super);
1689 function NbBlockScrollStrategyAdapter(document, viewportRuler, scrollService) {
1690 var _this = _super.call(this, viewportRuler, document) || this;
1691 _this.scrollService = scrollService;
1692 return _this;
1693 }
1694 NbBlockScrollStrategyAdapter.prototype.enable = function () {
1695 _super.prototype.enable.call(this);
1696 this.scrollService.scrollable(false);
1697 };
1698 NbBlockScrollStrategyAdapter.prototype.disable = function () {
1699 _super.prototype.disable.call(this);
1700 this.scrollService.scrollable(true);
1701 };
1702 NbBlockScrollStrategyAdapter.decorators = [
1703 { type: i0.Injectable }
1704 ];
1705 NbBlockScrollStrategyAdapter.ctorParameters = function () { return [
1706 { type: undefined, decorators: [{ type: i0.Inject, args: [NB_DOCUMENT,] }] },
1707 { type: NbViewportRulerAdapter },
1708 { type: NbLayoutScrollService }
1709 ]; };
1710 return NbBlockScrollStrategyAdapter;
1711}(_angular_cdk_overlay.BlockScrollStrategy));
1712var NbScrollStrategyOptions = /** @class */ (function (_super) {
1713 tslib.__extends(NbScrollStrategyOptions, _super);
1714 function NbScrollStrategyOptions(scrollService, scrollDispatcher, viewportRuler, ngZone, document) {
1715 var _this = _super.call(this, scrollDispatcher, viewportRuler, ngZone, document) || this;
1716 _this.scrollService = scrollService;
1717 _this.scrollDispatcher = scrollDispatcher;
1718 _this.viewportRuler = viewportRuler;
1719 _this.ngZone = ngZone;
1720 _this.document = document;
1721 _this.block = function () { return new NbBlockScrollStrategyAdapter(_this.document, _this.viewportRuler, _this.scrollService); };
1722 return _this;
1723 }
1724 NbScrollStrategyOptions.decorators = [
1725 { type: i0.Injectable }
1726 ];
1727 NbScrollStrategyOptions.ctorParameters = function () { return [
1728 { type: NbLayoutScrollService },
1729 { type: _angular_cdk_overlay.ScrollDispatcher },
1730 { type: NbViewportRulerAdapter },
1731 { type: i0.NgZone },
1732 { type: undefined, decorators: [{ type: i0.Inject, args: [NB_DOCUMENT,] }] }
1733 ]; };
1734 return NbScrollStrategyOptions;
1735}(_angular_cdk_overlay.ScrollStrategyOptions));
1736
1737var NbCdkAdapterModule = /** @class */ (function () {
1738 function NbCdkAdapterModule() {
1739 }
1740 NbCdkAdapterModule.forRoot = function () {
1741 return {
1742 ngModule: NbCdkAdapterModule,
1743 providers: [
1744 NbViewportRulerAdapter,
1745 NbOverlayContainerAdapter,
1746 NbBlockScrollStrategyAdapter,
1747 NbScrollDispatcherAdapter,
1748 NbScrollStrategyOptions,
1749 { provide: _angular_cdk_overlay.OverlayContainer, useExisting: NbOverlayContainerAdapter },
1750 { provide: NbOverlayContainer, useExisting: NbOverlayContainerAdapter },
1751 { provide: _angular_cdk_overlay.ScrollDispatcher, useExisting: NbScrollDispatcherAdapter },
1752 { provide: _angular_cdk_overlay.ScrollStrategyOptions, useExisting: NbScrollStrategyOptions },
1753 ],
1754 };
1755 };
1756 NbCdkAdapterModule.decorators = [
1757 { type: i0.NgModule, args: [{},] }
1758 ];
1759 return NbCdkAdapterModule;
1760}());
1761
1762(function (NbTrigger) {
1763 NbTrigger["NOOP"] = "noop";
1764 NbTrigger["CLICK"] = "click";
1765 NbTrigger["HOVER"] = "hover";
1766 NbTrigger["HINT"] = "hint";
1767 NbTrigger["FOCUS"] = "focus";
1768})(exports.NbTrigger || (exports.NbTrigger = {}));
1769/**
1770 * TODO maybe we have to use renderer.listen instead of observableFromEvent?
1771 * Renderer provides capability use it in service worker, ssr and so on.
1772 * */
1773var NbTriggerStrategyBase = /** @class */ (function () {
1774 function NbTriggerStrategyBase(document, host, container) {
1775 this.document = document;
1776 this.host = host;
1777 this.container = container;
1778 this.destroyed$ = new rxjs.Subject();
1779 }
1780 NbTriggerStrategyBase.prototype.destroy = function () {
1781 this.destroyed$.next();
1782 };
1783 NbTriggerStrategyBase.prototype.isNotOnHostOrContainer = function (event) {
1784 return !this.isOnHost(event) && !this.isOnContainer(event);
1785 };
1786 NbTriggerStrategyBase.prototype.isOnHostOrContainer = function (event) {
1787 return this.isOnHost(event) || this.isOnContainer(event);
1788 };
1789 NbTriggerStrategyBase.prototype.isOnHost = function (_a) {
1790 var target = _a.target;
1791 return this.host.contains(target);
1792 };
1793 NbTriggerStrategyBase.prototype.isOnContainer = function (_a) {
1794 var target = _a.target;
1795 return this.container() && this.container().location.nativeElement.contains(target);
1796 };
1797 return NbTriggerStrategyBase;
1798}());
1799/**
1800 * Creates show and hide event streams.
1801 * Fires toggle event when the click was performed on the host element.
1802 * Fires close event when the click was performed on the document but
1803 * not on the host or container.
1804 * */
1805var NbClickTriggerStrategy = /** @class */ (function (_super) {
1806 tslib.__extends(NbClickTriggerStrategy, _super);
1807 function NbClickTriggerStrategy() {
1808 var _this = _super !== null && _super.apply(this, arguments) || this;
1809 // since we should track click for both SHOW and HIDE event we firstly need to track the click and the state
1810 // of the container and then later on decide should we hide it or show
1811 // if we track the click & state separately this will case a behavior when the container is getting shown
1812 // and then hidden right away
1813 _this.click$ = rxjs.fromEvent(_this.document, 'click')
1814 .pipe(rxjs_operators.map(function (event) { return [!_this.container() && _this.isOnHost(event), event]; }), rxjs_operators.share(), rxjs_operators.takeUntil(_this.destroyed$));
1815 _this.show$ = _this.click$
1816 .pipe(rxjs_operators.filter(function (_a) {
1817 var shouldShow = _a[0];
1818 return shouldShow;
1819 }), rxjs_operators.map(function (_a) {
1820 var event = _a[1];
1821 return event;
1822 }), rxjs_operators.takeUntil(_this.destroyed$));
1823 _this.hide$ = _this.click$
1824 .pipe(rxjs_operators.filter(function (_a) {
1825 var shouldShow = _a[0], event = _a[1];
1826 return !shouldShow && !_this.isOnContainer(event);
1827 }), rxjs_operators.map(function (_a) {
1828 var event = _a[1];
1829 return event;
1830 }), rxjs_operators.takeUntil(_this.destroyed$));
1831 return _this;
1832 }
1833 return NbClickTriggerStrategy;
1834}(NbTriggerStrategyBase));
1835/**
1836 * Creates show and hide event streams.
1837 * Fires open event when a mouse hovers over the host element and stay over at least 100 milliseconds.
1838 * Fires close event when the mouse leaves the host element and stops out of the host and popover container.
1839 * */
1840var NbHoverTriggerStrategy = /** @class */ (function (_super) {
1841 tslib.__extends(NbHoverTriggerStrategy, _super);
1842 function NbHoverTriggerStrategy() {
1843 var _this = _super !== null && _super.apply(this, arguments) || this;
1844 _this.show$ = rxjs.fromEvent(_this.host, 'mouseenter')
1845 .pipe(rxjs_operators.filter(function () { return !_this.container(); }),
1846 // this `delay & takeUntil & repeat` operators combination is a synonym for `conditional debounce`
1847 // meaning that if one event occurs in some time after the initial one we won't react to it
1848 rxjs_operators.delay(100),
1849 // tslint:disable-next-line:rxjs-no-unsafe-takeuntil
1850 rxjs_operators.takeUntil(rxjs.fromEvent(_this.host, 'mouseleave')), rxjs_operators.repeat(), rxjs_operators.takeUntil(_this.destroyed$));
1851 _this.hide$ = rxjs.fromEvent(_this.host, 'mouseleave')
1852 .pipe(rxjs_operators.switchMap(function () { return rxjs.fromEvent(_this.document, 'mousemove')
1853 .pipe(rxjs_operators.debounceTime(100), rxjs_operators.takeWhile(function () { return !!_this.container(); }), rxjs_operators.filter(function (event) { return _this.isNotOnHostOrContainer(event); })); }), rxjs_operators.takeUntil(_this.destroyed$));
1854 return _this;
1855 }
1856 return NbHoverTriggerStrategy;
1857}(NbTriggerStrategyBase));
1858/**
1859 * Creates show and hide event streams.
1860 * Fires open event when a mouse hovers over the host element and stay over at least 100 milliseconds.
1861 * Fires close event when the mouse leaves the host element.
1862 * */
1863var NbHintTriggerStrategy = /** @class */ (function (_super) {
1864 tslib.__extends(NbHintTriggerStrategy, _super);
1865 function NbHintTriggerStrategy() {
1866 var _this = _super !== null && _super.apply(this, arguments) || this;
1867 _this.show$ = rxjs.fromEvent(_this.host, 'mouseenter')
1868 .pipe(
1869 // this `delay & takeUntil & repeat` operators combination is a synonym for `conditional debounce`
1870 // meaning that if one event occurs in some time after the initial one we won't react to it
1871 rxjs_operators.delay(100),
1872 // tslint:disable-next-line:rxjs-no-unsafe-takeuntil
1873 rxjs_operators.takeUntil(rxjs.fromEvent(_this.host, 'mouseleave')), rxjs_operators.repeat(), rxjs_operators.takeUntil(_this.destroyed$));
1874 _this.hide$ = rxjs.fromEvent(_this.host, 'mouseleave')
1875 .pipe(rxjs_operators.takeUntil(_this.destroyed$));
1876 return _this;
1877 }
1878 return NbHintTriggerStrategy;
1879}(NbTriggerStrategyBase));
1880/**
1881 * Creates show and hide event streams.
1882 * Fires open event when a focus is on the host element and stay over at least 100 milliseconds.
1883 * Fires close event when the focus leaves the host element.
1884 * */
1885var NbFocusTriggerStrategy = /** @class */ (function (_super) {
1886 tslib.__extends(NbFocusTriggerStrategy, _super);
1887 function NbFocusTriggerStrategy() {
1888 var _this = _super !== null && _super.apply(this, arguments) || this;
1889 _this.focusOut$ = rxjs.fromEvent(_this.host, 'focusout')
1890 .pipe(rxjs_operators.switchMap(function () { return rxjs.fromEvent(_this.document, 'focusin')
1891 .pipe(rxjs_operators.takeWhile(function () { return !!_this.container(); }), rxjs_operators.filter(function (event) { return _this.isNotOnHostOrContainer(event); })); }), rxjs_operators.takeUntil(_this.destroyed$));
1892 _this.clickIn$ = rxjs.fromEvent(_this.host, 'click')
1893 .pipe(rxjs_operators.filter(function () { return !_this.container(); }), rxjs_operators.takeUntil(_this.destroyed$));
1894 _this.clickOut$ = rxjs.fromEvent(_this.document, 'click')
1895 .pipe(rxjs_operators.filter(function () { return !!_this.container(); }), rxjs_operators.filter(function (event) { return _this.isNotOnHostOrContainer(event); }), rxjs_operators.takeUntil(_this.destroyed$));
1896 _this.tabKeyPress$ = rxjs.fromEvent(_this.document, 'keydown')
1897 .pipe(rxjs_operators.filter(function (event) { return event.keyCode === 9; }), rxjs_operators.filter(function () { return !!_this.container(); }), rxjs_operators.takeUntil(_this.destroyed$));
1898 _this.show$ = rxjs.merge(rxjs.fromEvent(_this.host, 'focusin'), _this.clickIn$)
1899 .pipe(rxjs_operators.filter(function () { return !_this.container(); }), rxjs_operators.debounceTime(100),
1900 // tslint:disable-next-line:rxjs-no-unsafe-takeuntil
1901 rxjs_operators.takeUntil(rxjs.fromEvent(_this.host, 'focusout')), rxjs_operators.repeat(), rxjs_operators.takeUntil(_this.destroyed$));
1902 _this.hide$ = rxjs.merge(_this.focusOut$, _this.tabKeyPress$, _this.clickOut$)
1903 .pipe(rxjs_operators.takeUntil(_this.destroyed$));
1904 return _this;
1905 }
1906 return NbFocusTriggerStrategy;
1907}(NbTriggerStrategyBase));
1908/**
1909 * Creates empty show and hide event streams.
1910 * */
1911var NbNoopTriggerStrategy = /** @class */ (function (_super) {
1912 tslib.__extends(NbNoopTriggerStrategy, _super);
1913 function NbNoopTriggerStrategy() {
1914 var _this = _super !== null && _super.apply(this, arguments) || this;
1915 _this.show$ = rxjs.EMPTY;
1916 _this.hide$ = rxjs.EMPTY;
1917 return _this;
1918 }
1919 return NbNoopTriggerStrategy;
1920}(NbTriggerStrategyBase));
1921var NbTriggerStrategyBuilderService = /** @class */ (function () {
1922 function NbTriggerStrategyBuilderService(_document) {
1923 this._document = _document;
1924 }
1925 NbTriggerStrategyBuilderService.prototype.trigger = function (trigger$$1) {
1926 this._trigger = trigger$$1;
1927 return this;
1928 };
1929 NbTriggerStrategyBuilderService.prototype.host = function (host) {
1930 this._host = host;
1931 return this;
1932 };
1933 NbTriggerStrategyBuilderService.prototype.container = function (container) {
1934 this._container = container;
1935 return this;
1936 };
1937 NbTriggerStrategyBuilderService.prototype.build = function () {
1938 switch (this._trigger) {
1939 case exports.NbTrigger.CLICK:
1940 return new NbClickTriggerStrategy(this._document, this._host, this._container);
1941 case exports.NbTrigger.HINT:
1942 return new NbHintTriggerStrategy(this._document, this._host, this._container);
1943 case exports.NbTrigger.HOVER:
1944 return new NbHoverTriggerStrategy(this._document, this._host, this._container);
1945 case exports.NbTrigger.FOCUS:
1946 return new NbFocusTriggerStrategy(this._document, this._host, this._container);
1947 case exports.NbTrigger.NOOP:
1948 return new NbNoopTriggerStrategy(this._document, this._host, this._container);
1949 default:
1950 throw new Error('Trigger have to be provided');
1951 }
1952 };
1953 NbTriggerStrategyBuilderService.decorators = [
1954 { type: i0.Injectable }
1955 ];
1956 NbTriggerStrategyBuilderService.ctorParameters = function () { return [
1957 { type: undefined, decorators: [{ type: i0.Inject, args: [NB_DOCUMENT,] }] }
1958 ]; };
1959 return NbTriggerStrategyBuilderService;
1960}());
1961
1962var NbOverlayModule = /** @class */ (function () {
1963 function NbOverlayModule() {
1964 }
1965 NbOverlayModule.forRoot = function () {
1966 return {
1967 ngModule: NbOverlayModule,
1968 providers: tslib.__spreadArray(tslib.__spreadArray(tslib.__spreadArray([
1969 NbPositionBuilderService,
1970 NbTriggerStrategyBuilderService,
1971 NbOverlayService,
1972 NbPositionHelper
1973 ], NbCdkMappingModule.forRoot().providers), NbCdkAdapterModule.forRoot().providers), NbA11yModule.forRoot().providers),
1974 };
1975 };
1976 NbOverlayModule.decorators = [
1977 { type: i0.NgModule, args: [{
1978 imports: [
1979 NbCdkMappingModule,
1980 NbSharedModule,
1981 ],
1982 declarations: [
1983 NbPositionedContainerComponent,
1984 NbOverlayContainerComponent,
1985 ],
1986 exports: [
1987 NbCdkMappingModule,
1988 NbCdkAdapterModule,
1989 NbOverlayContainerComponent,
1990 ],
1991 },] }
1992 ];
1993 return NbOverlayModule;
1994}());
1995
1996/**
1997 * @license
1998 * Copyright Akveo. All Rights Reserved.
1999 * Licensed under the MIT License. See License.txt in the project root for license information.
2000 */
2001var NbStatusService = /** @class */ (function () {
2002 function NbStatusService() {
2003 this.coreStatuses = ['basic', 'primary', 'info', 'warning', 'danger', 'control'];
2004 }
2005 NbStatusService.prototype.isCoreStatus = function (status) {
2006 return this.coreStatuses.includes(status);
2007 };
2008 NbStatusService.prototype.isCustomStatus = function (status) {
2009 if (this.isValidStatusString(status)) {
2010 return !this.isCoreStatus(status);
2011 }
2012 return false;
2013 };
2014 NbStatusService.prototype.getStatusClass = function (status) {
2015 if (this.isValidStatusString(status)) {
2016 return "status-" + status;
2017 }
2018 return undefined;
2019 };
2020 NbStatusService.prototype.isValidStatusString = function (status) {
2021 return typeof status === 'string' && status.length > 0;
2022 };
2023 NbStatusService.decorators = [
2024 { type: i0.Injectable }
2025 ];
2026 return NbStatusService;
2027}());
2028
2029/**
2030 * @license
2031 * Copyright Akveo. All Rights Reserved.
2032 * Licensed under the MIT License. See License.txt in the project root for license information.
2033 */
2034function windowFactory(platformId) {
2035 if (_angular_common.isPlatformBrowser(platformId)) {
2036 return window;
2037 }
2038 // Provide undefined to get the error when trying to access the window as it
2039 // shouldn't be used outside the browser. Those who need to provide something
2040 // instead of window (e.g. domino window when running in node) could override
2041 // NB_WINDOW token.
2042 return undefined;
2043}
2044var NbThemeModule = /** @class */ (function () {
2045 function NbThemeModule() {
2046 }
2047 // TODO: check the options (throw exception?)
2048 /**
2049 * Main Theme Module
2050 *
2051 * @param nbThemeOptions {NbThemeOptions} Main theme options
2052 * @param nbJSThemes {NbJSThemeOptions[]} List of JS Themes, will be merged with default themes
2053 * @param nbMediaBreakpoints {NbMediaBreakpoint} Available media breakpoints
2054 * @param layoutDirection {NbLayoutDirection} Layout direction
2055 *
2056 * @returns {ModuleWithProviders}
2057 */
2058 NbThemeModule.forRoot = function (nbThemeOptions, nbJSThemes, nbMediaBreakpoints, layoutDirection) {
2059 if (nbThemeOptions === void 0) { nbThemeOptions = { name: 'default' }; }
2060 return {
2061 ngModule: NbThemeModule,
2062 providers: tslib.__spreadArray(tslib.__spreadArray([
2063 { provide: NB_THEME_OPTIONS, useValue: nbThemeOptions || {} },
2064 { provide: NB_BUILT_IN_JS_THEMES, useValue: BUILT_IN_THEMES },
2065 { provide: NB_JS_THEMES, useValue: nbJSThemes || [] },
2066 { provide: NB_MEDIA_BREAKPOINTS, useValue: nbMediaBreakpoints || DEFAULT_MEDIA_BREAKPOINTS },
2067 { provide: NB_DOCUMENT, useExisting: _angular_common.DOCUMENT },
2068 { provide: NB_WINDOW, useFactory: windowFactory, deps: [i0.PLATFORM_ID] },
2069 NbJSThemesRegistry,
2070 NbThemeService,
2071 NbMediaBreakpointsService,
2072 NbSpinnerService,
2073 { provide: NB_LAYOUT_DIRECTION, useValue: layoutDirection || exports.NbLayoutDirection.LTR },
2074 NbLayoutDirectionService,
2075 NbLayoutScrollService,
2076 NbLayoutRulerService
2077 ], NbOverlayModule.forRoot().providers), [
2078 NbStatusService,
2079 ]),
2080 };
2081 };
2082 NbThemeModule.decorators = [
2083 { type: i0.NgModule, args: [{
2084 imports: [
2085 _angular_common.CommonModule,
2086 ],
2087 exports: [],
2088 },] }
2089 ];
2090 return NbThemeModule;
2091}());
2092
2093var NbColorHelper = /** @class */ (function () {
2094 function NbColorHelper() {
2095 }
2096 NbColorHelper.shade = function (color, weight) {
2097 return NbColorHelper.mix('#000000', color, weight);
2098 };
2099 NbColorHelper.tint = function (color, weight) {
2100 return NbColorHelper.mix('#ffffff', color, weight);
2101 };
2102 NbColorHelper.mix = function (color1, color2, weight) {
2103 var d2h = function (d) { return d.toString(16); };
2104 var h2d = function (h) { return parseInt(h, 16); };
2105 var result = '#';
2106 for (var i = 1; i < 7; i += 2) {
2107 var firstPart = h2d(color1.substr(i, 2));
2108 var secondPart = h2d(color2.substr(i, 2));
2109 var resultPart = d2h(Math.floor(secondPart + (firstPart - secondPart) * (weight / 100.0)));
2110 result += ('0' + resultPart).slice(-2);
2111 }
2112 return result;
2113 };
2114 NbColorHelper.hexToRgbA = function (hex, alpha) {
2115 var c;
2116 if (/^#([A-Fa-f0-9]{3}){1,2}$/.test(hex)) {
2117 c = hex.substring(1).split('');
2118 if (c.length === 3) {
2119 c = [c[0], c[0], c[1], c[1], c[2], c[2]];
2120 }
2121 c = '0x' + c.join('');
2122 return 'rgba(' + [(c >> 16) & 255, (c >> 8) & 255, c & 255].join(',') + ',' + alpha + ')';
2123 }
2124 throw new Error('Bad Hex');
2125 };
2126 return NbColorHelper;
2127}());
2128
2129(function (NbIconPackType) {
2130 NbIconPackType["SVG"] = "svg";
2131 NbIconPackType["FONT"] = "font";
2132})(exports.NbIconPackType || (exports.NbIconPackType = {}));
2133
2134var NbFontIcon = /** @class */ (function () {
2135 function NbFontIcon(name, content, params) {
2136 if (params === void 0) { params = {}; }
2137 this.name = name;
2138 this.content = content;
2139 this.params = params;
2140 }
2141 NbFontIcon.prototype.getClasses = function (options) {
2142 var classes = [];
2143 if (this.params.packClass) {
2144 classes.push(this.params.packClass);
2145 }
2146 var name = this.params.iconClassPrefix ? this.params.iconClassPrefix + "-" + this.name : this.name;
2147 classes.push(name);
2148 return classes;
2149 };
2150 NbFontIcon.prototype.getContent = function (options) {
2151 return this.content;
2152 };
2153 return NbFontIcon;
2154}());
2155var NbSvgIcon = /** @class */ (function () {
2156 function NbSvgIcon(name, content, params) {
2157 if (params === void 0) { params = {}; }
2158 this.name = name;
2159 this.content = content;
2160 this.params = params;
2161 }
2162 NbSvgIcon.prototype.getClasses = function (options) {
2163 var classes = [];
2164 if (this.params.packClass) {
2165 classes.push(this.params.packClass);
2166 }
2167 return classes;
2168 };
2169 NbSvgIcon.prototype.getContent = function (options) {
2170 return this.content;
2171 };
2172 return NbSvgIcon;
2173}());
2174
2175/**
2176 * @license
2177 * Copyright Akveo. All Rights Reserved.
2178 * Licensed under the MIT License. See License.txt in the project root for license information.
2179 */
2180var NbIconDefinition = /** @class */ (function () {
2181 function NbIconDefinition() {
2182 }
2183 return NbIconDefinition;
2184}());
2185function throwPackNotFoundError(name) {
2186 throw Error("Icon Pack '" + name + "' is not registered");
2187}
2188function throwNoDefaultPackError() {
2189 throw Error('Default pack is not registered.');
2190}
2191function throwWrongPackTypeError(name, type, desiredType) {
2192 throw Error("Pack '" + name + "' is not an '" + desiredType + "' Pack and its type is '" + type + "'");
2193}
2194/**
2195 * This service allows to register multiple icon packs to use them later within `<nb-icon></nb-icon>` component.
2196 */
2197var NbIconLibraries = /** @class */ (function () {
2198 function NbIconLibraries() {
2199 this.packs = new Map();
2200 }
2201 /**
2202 * Registers new Svg icon pack
2203 * @param {string} name
2204 * @param {NbIcon} icons
2205 * @param {NbIconPackParams} params
2206 */
2207 NbIconLibraries.prototype.registerSvgPack = function (name, icons, params) {
2208 if (params === void 0) { params = {}; }
2209 this.packs.set(name, {
2210 name: name,
2211 icons: new Map(Object.entries(icons)),
2212 params: params,
2213 type: exports.NbIconPackType.SVG,
2214 });
2215 };
2216 /**
2217 * Registers new font pack
2218 * @param {string} name
2219 * @param {NbIconPackParams} params
2220 */
2221 NbIconLibraries.prototype.registerFontPack = function (name, params) {
2222 if (params === void 0) { params = {}; }
2223 this.packs.set(name, {
2224 name: name,
2225 params: params,
2226 icons: new Map(),
2227 type: exports.NbIconPackType.FONT,
2228 });
2229 };
2230 /**
2231 * Returns pack by name
2232 * @param {string} name
2233 */
2234 NbIconLibraries.prototype.getPack = function (name) {
2235 return this.packs.get(name);
2236 };
2237 /**
2238 * Sets pack as a default
2239 * @param {string} name
2240 */
2241 NbIconLibraries.prototype.setDefaultPack = function (name) {
2242 if (!this.packs.has(name)) {
2243 throwPackNotFoundError(name);
2244 }
2245 this.defaultPack = this.packs.get(name);
2246 };
2247 /**
2248 * Returns Svg icon
2249 * @param {string} name
2250 * @param {string} pack
2251 *
2252 * @returns NbIconDefinition
2253 */
2254 NbIconLibraries.prototype.getSvgIcon = function (name, pack) {
2255 var iconsPack = pack ? this.getPackOrThrow(pack) : this.getDefaultPackOrThrow();
2256 if (iconsPack.type !== exports.NbIconPackType.SVG) {
2257 throwWrongPackTypeError(iconsPack.name, iconsPack.type, 'SVG');
2258 }
2259 var icon = this.getIconFromPack(name, iconsPack);
2260 if (!icon) {
2261 return null;
2262 }
2263 return {
2264 name: name,
2265 pack: iconsPack.name,
2266 type: exports.NbIconPackType.SVG,
2267 icon: this.createSvgIcon(name, icon, iconsPack.params),
2268 };
2269 };
2270 /**
2271 * Returns Font icon
2272 * @param {string} name
2273 * @param {string} pack
2274 *
2275 * @returns NbIconDefinition
2276 */
2277 NbIconLibraries.prototype.getFontIcon = function (name, pack) {
2278 var iconsPack = pack ? this.getPackOrThrow(pack) : this.getDefaultPackOrThrow();
2279 if (iconsPack.type !== exports.NbIconPackType.FONT) {
2280 throwWrongPackTypeError(iconsPack.name, iconsPack.type, 'Font');
2281 }
2282 var icon = this.getIconFromPack(name, iconsPack);
2283 return {
2284 name: name,
2285 pack: iconsPack.name,
2286 type: exports.NbIconPackType.FONT,
2287 icon: this.createFontIcon(name, icon ? icon : '', iconsPack.params),
2288 };
2289 };
2290 /**
2291 * Returns an icon
2292 * @param {string} name
2293 * @param {string} pack
2294 *
2295 * @returns NbIconDefinition
2296 */
2297 NbIconLibraries.prototype.getIcon = function (name, pack) {
2298 var iconsPack = pack ? this.getPackOrThrow(pack) : this.getDefaultPackOrThrow();
2299 if (iconsPack.type === exports.NbIconPackType.SVG) {
2300 return this.getSvgIcon(name, pack);
2301 }
2302 return this.getFontIcon(name, pack);
2303 };
2304 NbIconLibraries.prototype.createSvgIcon = function (name, content, params) {
2305 return content instanceof NbSvgIcon ? content : new NbSvgIcon(name, content, params);
2306 };
2307 NbIconLibraries.prototype.createFontIcon = function (name, content, params) {
2308 return content instanceof NbFontIcon ? content : new NbFontIcon(name, content, params);
2309 };
2310 NbIconLibraries.prototype.getPackOrThrow = function (name) {
2311 var pack = this.packs.get(name);
2312 if (!pack) {
2313 throwPackNotFoundError(name);
2314 }
2315 return pack;
2316 };
2317 NbIconLibraries.prototype.getDefaultPackOrThrow = function () {
2318 if (!this.defaultPack) {
2319 throwNoDefaultPackError();
2320 }
2321 return this.defaultPack;
2322 };
2323 NbIconLibraries.prototype.getIconFromPack = function (name, pack) {
2324 if (pack.icons.has(name)) {
2325 return pack.icons.get(name);
2326 }
2327 return null;
2328 };
2329 NbIconLibraries.ɵprov = i0.ɵɵdefineInjectable({ factory: function NbIconLibraries_Factory() { return new NbIconLibraries(); }, token: NbIconLibraries, providedIn: "root" });
2330 NbIconLibraries.decorators = [
2331 { type: i0.Injectable, args: [{ providedIn: 'root' },] }
2332 ];
2333 return NbIconLibraries;
2334}());
2335
2336/**
2337 * @license
2338 * Copyright Akveo. All Rights Reserved.
2339 * Licensed under the MIT License. See License.txt in the project root for license information.
2340 */
2341/**
2342 * Icon component. Allows to render both `svg` and `font` icons.
2343 * Starting from Nebular 4.0 uses [Eva Icons](https://akveo.github.io/eva-icons/) pack by default.
2344 *
2345 * Basic icon example:
2346 * @stacked-example(Showcase, icon/icon-showcase.component)
2347 *
2348 * Icon configuration:
2349 *
2350 * ```html
2351 * <nb-icon icon="star"></nb-icon>
2352 * ```
2353 * ### Installation
2354 *
2355 * By default Nebular comes without any pre-installed icon pack.
2356 * Starting with Nebular 4.0.0 we ship separate package called `@nebular/eva-icons`
2357 * which integrates SVG [Eva Icons](https://akveo.github.io/eva-icons/) pack to Nebular. To add it to your
2358 * project run:
2359 * ```sh
2360 * npm i eva-icons @nebular/eva-icons
2361 * ```
2362 * This command will install Eva Icons pack. Then register `NbEvaIconsModule` into your app module:
2363 * ```ts
2364 * import { NbEvaIconsModule } from '@nebular/eva-icons';
2365 *
2366 * @NgModule({
2367 * imports: [
2368 * // ...
2369 * NbEvaIconsModule,
2370 * ],
2371 * })
2372 * export class AppModule { }
2373 * ```
2374 * Last thing, import `NbIconModule` to your feature module where you need to show an icon:
2375 * ```ts
2376 * import { NbIconModule } from '@nebular/theme';
2377 *
2378 * @NgModule({
2379 * imports: [
2380 * // ...
2381 * NbIconModule,
2382 * ],
2383 * })
2384 * export class PageModule { }
2385 * ```
2386 * ### Usage
2387 *
2388 * Icon can be colored using `status` input:
2389 * ```html
2390 * <nb-icon icon="star" status="warning"></nb-icon>
2391 * ```
2392 *
2393 * Colored icons:
2394 * @stacked-example(Colored Icons, icon/icon-colors.component)
2395 *
2396 * In case you need to specify an icon from a specific icon pack, this could be done using `pack` input property:
2397 * ```html
2398 * <nb-icon icon="star" pack="font-awesome"></nb-icon>
2399 * ```
2400 * Additional icon settings (if available by the icon pack) could be passed using `options` input:
2401 *
2402 * ```html
2403 * <nb-icon icon="star" [options]="{ animation: { type: 'zoom' } }"></nb-icon>
2404 * ```
2405 *
2406 * @styles
2407 *
2408 * icon-font-size:
2409 * icon-line-height:
2410 * icon-width:
2411 * icon-height:
2412 * icon-svg-vertical-align:
2413 * icon-basic-color:
2414 * icon-primary-color:
2415 * icon-info-color:
2416 * icon-success-color:
2417 * icon-warning-color:
2418 * icon-danger-color:
2419 * icon-control-color:
2420 */
2421var NbIconComponent = /** @class */ (function () {
2422 function NbIconComponent(sanitizer, iconLibrary, el, renderer, statusService) {
2423 this.sanitizer = sanitizer;
2424 this.iconLibrary = iconLibrary;
2425 this.el = el;
2426 this.renderer = renderer;
2427 this.statusService = statusService;
2428 this.prevClasses = [];
2429 this.html = '';
2430 }
2431 Object.defineProperty(NbIconComponent.prototype, "primary", {
2432 get: function () {
2433 return this.status === 'primary';
2434 },
2435 enumerable: false,
2436 configurable: true
2437 });
2438 Object.defineProperty(NbIconComponent.prototype, "info", {
2439 get: function () {
2440 return this.status === 'info';
2441 },
2442 enumerable: false,
2443 configurable: true
2444 });
2445 Object.defineProperty(NbIconComponent.prototype, "success", {
2446 get: function () {
2447 return this.status === 'success';
2448 },
2449 enumerable: false,
2450 configurable: true
2451 });
2452 Object.defineProperty(NbIconComponent.prototype, "warning", {
2453 get: function () {
2454 return this.status === 'warning';
2455 },
2456 enumerable: false,
2457 configurable: true
2458 });
2459 Object.defineProperty(NbIconComponent.prototype, "danger", {
2460 get: function () {
2461 return this.status === 'danger';
2462 },
2463 enumerable: false,
2464 configurable: true
2465 });
2466 Object.defineProperty(NbIconComponent.prototype, "basic", {
2467 get: function () {
2468 return this.status === 'basic';
2469 },
2470 enumerable: false,
2471 configurable: true
2472 });
2473 Object.defineProperty(NbIconComponent.prototype, "control", {
2474 get: function () {
2475 return this.status === 'control';
2476 },
2477 enumerable: false,
2478 configurable: true
2479 });
2480 Object.defineProperty(NbIconComponent.prototype, "additionalClasses", {
2481 get: function () {
2482 if (this.statusService.isCustomStatus(this.status)) {
2483 return [this.statusService.getStatusClass(this.status)];
2484 }
2485 return [];
2486 },
2487 enumerable: false,
2488 configurable: true
2489 });
2490 Object.defineProperty(NbIconComponent.prototype, "config", {
2491 /**
2492 * Sets all icon configurable properties via config object.
2493 * If passed value is a string set icon name.
2494 * @docs-private
2495 */
2496 get: function () {
2497 return this._config;
2498 },
2499 set: function (value) {
2500 if (!value) {
2501 return;
2502 }
2503 this._config = value;
2504 if (typeof value === 'string') {
2505 this.icon = value;
2506 }
2507 else {
2508 this.icon = value.icon;
2509 this.pack = value.pack;
2510 this.status = value.status;
2511 this.options = value.options;
2512 }
2513 },
2514 enumerable: false,
2515 configurable: true
2516 });
2517 NbIconComponent.prototype.ngOnInit = function () {
2518 this.iconDef = this.renderIcon(this.icon, this.pack, this.options);
2519 };
2520 NbIconComponent.prototype.ngOnChanges = function () {
2521 var iconDef = this.iconLibrary.getIcon(this.icon, this.pack);
2522 if (iconDef) {
2523 this.renderIcon(this.icon, this.pack, this.options);
2524 }
2525 else {
2526 this.clearIcon();
2527 }
2528 };
2529 NbIconComponent.prototype.renderIcon = function (name, pack, options) {
2530 var iconDefinition = this.iconLibrary.getIcon(name, pack);
2531 if (!iconDefinition) {
2532 return;
2533 }
2534 var content = iconDefinition.icon.getContent(options);
2535 if (content) {
2536 this.html = this.sanitizer.bypassSecurityTrustHtml(content);
2537 }
2538 this.assignClasses(iconDefinition.icon.getClasses(options));
2539 return iconDefinition;
2540 };
2541 NbIconComponent.prototype.clearIcon = function () {
2542 this.html = '';
2543 this.assignClasses([]);
2544 };
2545 NbIconComponent.prototype.assignClasses = function (classes) {
2546 var _this = this;
2547 this.prevClasses.forEach(function (className) {
2548 _this.renderer.removeClass(_this.el.nativeElement, className);
2549 });
2550 classes.forEach(function (className) {
2551 _this.renderer.addClass(_this.el.nativeElement, className);
2552 });
2553 this.prevClasses = classes;
2554 };
2555 NbIconComponent.decorators = [
2556 { type: i0.Component, args: [{
2557 selector: 'nb-icon',
2558 template: '',
2559 changeDetection: i0.ChangeDetectionStrategy.OnPush,
2560 styles: [":host{display:inline-block}\n"]
2561 },] }
2562 ];
2563 NbIconComponent.ctorParameters = function () { return [
2564 { type: _angular_platformBrowser.DomSanitizer },
2565 { type: NbIconLibraries },
2566 { type: i0.ElementRef },
2567 { type: i0.Renderer2 },
2568 { type: NbStatusService }
2569 ]; };
2570 NbIconComponent.propDecorators = {
2571 html: [{ type: i0.HostBinding, args: ['innerHtml',] }],
2572 primary: [{ type: i0.HostBinding, args: ['class.status-primary',] }],
2573 info: [{ type: i0.HostBinding, args: ['class.status-info',] }],
2574 success: [{ type: i0.HostBinding, args: ['class.status-success',] }],
2575 warning: [{ type: i0.HostBinding, args: ['class.status-warning',] }],
2576 danger: [{ type: i0.HostBinding, args: ['class.status-danger',] }],
2577 basic: [{ type: i0.HostBinding, args: ['class.status-basic',] }],
2578 control: [{ type: i0.HostBinding, args: ['class.status-control',] }],
2579 additionalClasses: [{ type: i0.HostBinding, args: ['class',] }],
2580 icon: [{ type: i0.Input }],
2581 pack: [{ type: i0.Input }],
2582 options: [{ type: i0.Input }],
2583 status: [{ type: i0.Input }],
2584 config: [{ type: i0.Input }]
2585 };
2586 return NbIconComponent;
2587}());
2588
2589/**
2590 * @license
2591 * Copyright Akveo. All Rights Reserved.
2592 * Licensed under the MIT License. See License.txt in the project root for license information.
2593 */
2594var NbIconModule = /** @class */ (function () {
2595 function NbIconModule(iconsLibrary) {
2596 this.iconsLibrary = iconsLibrary;
2597 this.essentialsPackName = 'nebular-essentials';
2598 // in case of consequent calls we don't need to enable `nebular-essentials` pack again
2599 if (this.iconsLibrary.getPack(this.essentialsPackName)) {
2600 return;
2601 }
2602 // tslint:disable:max-line-length
2603 this.iconsLibrary.registerSvgPack(this.essentialsPackName, {
2604 'chevron-down-outline': '<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" width="100%" height="100%" viewBox="0 0 24 24"><g data-name="Layer 2"><g data-name="chevron-down"><rect width="24" height="24" opacity="0"/><path d="M12 15.5a1 1 0 0 1-.71-.29l-4-4a1 1 0 1 1 1.42-1.42L12 13.1l3.3-3.18a1 1 0 1 1 1.38 1.44l-4 3.86a1 1 0 0 1-.68.28z"/></g></g></svg>',
2605 'chevron-up-outline': '<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" width="100%" height="100%" viewBox="0 0 24 24"><g data-name="Layer 2"><g data-name="chevron-up"><rect width="24" height="24" transform="rotate(180 12 12)" opacity="0"/><path d="M16 14.5a1 1 0 0 1-.71-.29L12 10.9l-3.3 3.18a1 1 0 0 1-1.41 0 1 1 0 0 1 0-1.42l4-3.86a1 1 0 0 1 1.4 0l4 4a1 1 0 0 1 0 1.42 1 1 0 0 1-.69.28z"/></g></g></svg>',
2606 'chevron-left-outline': '<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" width="100%" height="100%" viewBox="0 0 24 24"><g data-name="Layer 2"><g data-name="chevron-left"><rect width="24" height="24" transform="rotate(90 12 12)" opacity="0"/><path d="M13.36 17a1 1 0 0 1-.72-.31l-3.86-4a1 1 0 0 1 0-1.4l4-4a1 1 0 1 1 1.42 1.42L10.9 12l3.18 3.3a1 1 0 0 1 0 1.41 1 1 0 0 1-.72.29z"/></g></g></svg>',
2607 'chevron-right-outline': '<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" width="100%" height="100%" viewBox="0 0 24 24"><g data-name="Layer 2"><g data-name="chevron-right"><rect width="24" height="24" transform="rotate(-90 12 12)" opacity="0"/><path d="M10.5 17a1 1 0 0 1-.71-.29 1 1 0 0 1 0-1.42L13.1 12 9.92 8.69a1 1 0 0 1 0-1.41 1 1 0 0 1 1.42 0l3.86 4a1 1 0 0 1 0 1.4l-4 4a1 1 0 0 1-.7.32z"/></g></g></svg>',
2608 'checkmark-outline': '<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" width="100%" height="100%" viewBox="0 0 24 24"><g data-name="Layer 2"><g data-name="checkmark"><rect width="24" height="24" opacity="0"/><path d="M9.86 18a1 1 0 0 1-.73-.32l-4.86-5.17a1 1 0 1 1 1.46-1.37l4.12 4.39 8.41-9.2a1 1 0 1 1 1.48 1.34l-9.14 10a1 1 0 0 1-.73.33z"/></g></g></svg>',
2609 'paper-plane-outline': '<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" width="100%" height="100%" viewBox="0 0 24 24"><g data-name="Layer 2"><g data-name="paper-plane"><rect width="24" height="24" opacity="0"/><path d="M21 4a1.31 1.31 0 0 0-.06-.27v-.09a1 1 0 0 0-.2-.3 1 1 0 0 0-.29-.19h-.09a.86.86 0 0 0-.31-.15H20a1 1 0 0 0-.3 0l-18 6a1 1 0 0 0 0 1.9l8.53 2.84 2.84 8.53a1 1 0 0 0 1.9 0l6-18A1 1 0 0 0 21 4zm-4.7 2.29l-5.57 5.57L5.16 10zM14 18.84l-1.86-5.57 5.57-5.57z"/></g></g></svg>',
2610 'file-text-outline': '<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" width="100%" height="100%" viewBox="0 0 24 24"><g data-name="Layer 2"><g data-name="file-text"><rect width="24" height="24" opacity="0"/><path d="M15 16H9a1 1 0 0 0 0 2h6a1 1 0 0 0 0-2z"/><path d="M9 14h3a1 1 0 0 0 0-2H9a1 1 0 0 0 0 2z"/><path d="M19.74 8.33l-5.44-6a1 1 0 0 0-.74-.33h-7A2.53 2.53 0 0 0 4 4.5v15A2.53 2.53 0 0 0 6.56 22h10.88A2.53 2.53 0 0 0 20 19.5V9a1 1 0 0 0-.26-.67zM14 5l2.74 3h-2a.79.79 0 0 1-.74-.85zm3.44 15H6.56a.53.53 0 0 1-.56-.5v-15a.53.53 0 0 1 .56-.5H12v3.15A2.79 2.79 0 0 0 14.71 10H18v9.5a.53.53 0 0 1-.56.5z"/></g></g></svg>',
2611 'alert-triangle-outline': '<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" width="100%" height="100%" viewBox="0 0 24 24"><g data-name="Layer 2"><g data-name="alert-triangle"><rect width="24" height="24" transform="rotate(90 12 12)" opacity="0"/><path d="M22.56 16.3L14.89 3.58a3.43 3.43 0 0 0-5.78 0L1.44 16.3a3 3 0 0 0-.05 3A3.37 3.37 0 0 0 4.33 21h15.34a3.37 3.37 0 0 0 2.94-1.66 3 3 0 0 0-.05-3.04zm-1.7 2.05a1.31 1.31 0 0 1-1.19.65H4.33a1.31 1.31 0 0 1-1.19-.65 1 1 0 0 1 0-1l7.68-12.73a1.48 1.48 0 0 1 2.36 0l7.67 12.72a1 1 0 0 1 .01 1.01z"/><circle cx="12" cy="16" r="1"/><path d="M12 8a1 1 0 0 0-1 1v4a1 1 0 0 0 2 0V9a1 1 0 0 0-1-1z"/></g></g></svg>',
2612 'question-mark-outline': '<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" width="100%" height="100%" viewBox="0 0 24 24"><g data-name="Layer 2"><g data-name="question-mark"><rect width="24" height="24" transform="rotate(180 12 12)" opacity="0"/><path d="M17 9A5 5 0 0 0 7 9a1 1 0 0 0 2 0 3 3 0 1 1 3 3 1 1 0 0 0-1 1v2a1 1 0 0 0 2 0v-1.1A5 5 0 0 0 17 9z"/><circle cx="12" cy="19" r="1"/></g></g></svg>',
2613 'email-outline': '<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" width="100%" height="100%" viewBox="0 0 24 24"><g data-name="Layer 2"><g data-name="email"><rect width="24" height="24" opacity="0"/><path d="M19 4H5a3 3 0 0 0-3 3v10a3 3 0 0 0 3 3h14a3 3 0 0 0 3-3V7a3 3 0 0 0-3-3zm-.67 2L12 10.75 5.67 6zM19 18H5a1 1 0 0 1-1-1V7.25l7.4 5.55a1 1 0 0 0 .6.2 1 1 0 0 0 .6-.2L20 7.25V17a1 1 0 0 1-1 1z"/></g></g></svg>',
2614 'flash-outline': '<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" width="100%" height="100%" viewBox="0 0 24 24"><g data-name="Layer 2"><g data-name="flash"><rect width="24" height="24" opacity="0"/><path d="M11.11 23a1 1 0 0 1-.34-.06 1 1 0 0 1-.65-1.05l.77-7.09H5a1 1 0 0 1-.83-1.56l7.89-11.8a1 1 0 0 1 1.17-.38 1 1 0 0 1 .65 1l-.77 7.14H19a1 1 0 0 1 .83 1.56l-7.89 11.8a1 1 0 0 1-.83.44zM6.87 12.8H12a1 1 0 0 1 .74.33 1 1 0 0 1 .25.78l-.45 4.15 4.59-6.86H12a1 1 0 0 1-1-1.11l.45-4.15z"/></g></g></svg>',
2615 'search-outline': '<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" width="100%" height="100%" viewBox="0 0 24 24"><g data-name="Layer 2"><g data-name="search"><rect width="24" height="24" opacity="0"/><path d="M20.71 19.29l-3.4-3.39A7.92 7.92 0 0 0 19 11a8 8 0 1 0-8 8 7.92 7.92 0 0 0 4.9-1.69l3.39 3.4a1 1 0 0 0 1.42 0 1 1 0 0 0 0-1.42zM5 11a6 6 0 1 1 6 6 6 6 0 0 1-6-6z"/></g></g></svg>',
2616 'close-outline': '<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" width="100%" height="100%" viewBox="0 0 24 24"><g data-name="Layer 2"><g data-name="close"><rect width="24" height="24" transform="rotate(180 12 12)" opacity="0"/><path d="M13.41 12l4.3-4.29a1 1 0 1 0-1.42-1.42L12 10.59l-4.29-4.3a1 1 0 0 0-1.42 1.42l4.3 4.29-4.3 4.29a1 1 0 0 0 0 1.42 1 1 0 0 0 1.42 0l4.29-4.3 4.29 4.3a1 1 0 0 0 1.42 0 1 1 0 0 0 0-1.42z"/></g></g></svg>',
2617 'collapse-outline': '<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" width="100%" height="100%" viewBox="0 0 24 24"><g data-name="Layer 2"><g data-name="collapse"><rect width="24" height="24" transform="rotate(180 12 12)" opacity="0"/><path d="M19 9h-2.58l3.29-3.29a1 1 0 1 0-1.42-1.42L15 7.57V5a1 1 0 0 0-1-1 1 1 0 0 0-1 1v5a1 1 0 0 0 1 1h5a1 1 0 0 0 0-2z"/><path d="M10 13H5a1 1 0 0 0 0 2h2.57l-3.28 3.29a1 1 0 0 0 0 1.42 1 1 0 0 0 1.42 0L9 16.42V19a1 1 0 0 0 1 1 1 1 0 0 0 1-1v-5a1 1 0 0 0-1-1z"/></g></g></svg>',
2618 'expand-outline': '<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" width="100%" height="100%" viewBox="0 0 24 24"><g data-name="Layer 2"><g data-name="expand"><rect width="24" height="24" transform="rotate(180 12 12)" opacity="0"/><path d="M20 5a1 1 0 0 0-1-1h-5a1 1 0 0 0 0 2h2.57l-3.28 3.29a1 1 0 0 0 0 1.42 1 1 0 0 0 1.42 0L18 7.42V10a1 1 0 0 0 1 1 1 1 0 0 0 1-1z"/><path d="M10.71 13.29a1 1 0 0 0-1.42 0L6 16.57V14a1 1 0 0 0-1-1 1 1 0 0 0-1 1v5a1 1 0 0 0 1 1h5a1 1 0 0 0 0-2H7.42l3.29-3.29a1 1 0 0 0 0-1.42z"/></g></g></svg>',
2619 'minus-outline': '<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" width="100%" height="100%" viewBox="0 0 24 24"><g data-name="Layer 2"><g data-name="minus"><rect width="24" height="24" transform="rotate(180 12 12)" opacity="0"/><path d="M19 13H5a1 1 0 0 1 0-2h14a1 1 0 0 1 0 2z"/></g></g></svg>',
2620 'minus-bold-outline': '<svg xmlns:xlink="http://www.w3.org/1999/xlink" fill="currentColor" viewBox="0 0 8 2" width="100%" height="100%"><defs><rect id="nb-mbo" y="3" width="8" height="2" rx="1"/></defs><use xlink:href="#nb-mbo" transform="translate(0 -3)" fill-rule="evenodd"/></svg>',
2621 'checkmark-bold-outline': '<svg xmlns:xlink="http://www.w3.org/1999/xlink" fill="currentColor" viewBox="0 0 8 7" width="100%" height="100%"><defs><path id="nb-cbo" d="M6.039 1.43a1.11 1.11 0 0 1 1.517-.228c.483.342.588.998.234 1.466L4.431 7.1a1 1 0 0 1-1.492.115L.317 4.677a1.023 1.023 0 0 1 .002-1.483 1.113 1.113 0 0 1 1.535.002l1.641 1.59L6.04 1.428z"/></defs><use xlink:href="#nb-cbo" transform="translate(0 -1)" fill-rule="evenodd"/></svg>',
2622 'arrow-back': '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><g data-name="Layer 2"><g data-name="arrow-back"><rect width="24" height="24" transform="rotate(90 12 12)" opacity="0"/><path d="M19 11H7.14l3.63-4.36a1 1 0 1 0-1.54-1.28l-5 6a1.19 1.19 0 0 0-.09.15c0 .05 0 .08-.07.13A1 1 0 0 0 4 12a1 1 0 0 0 .07.36c0 .05 0 .08.07.13a1.19 1.19 0 0 0 .09.15l5 6A1 1 0 0 0 10 19a1 1 0 0 0 .64-.23 1 1 0 0 0 .13-1.41L7.14 13H19a1 1 0 0 0 0-2z"/></g></g></svg>',
2623 });
2624 // tslint:enable:max-line-length
2625 }
2626 NbIconModule.decorators = [
2627 { type: i0.NgModule, args: [{
2628 imports: [
2629 _angular_common.CommonModule,
2630 ],
2631 declarations: [
2632 NbIconComponent,
2633 ],
2634 exports: [
2635 NbIconComponent,
2636 ],
2637 },] }
2638 ];
2639 NbIconModule.ctorParameters = function () { return [
2640 { type: NbIconLibraries }
2641 ]; };
2642 return NbIconModule;
2643}());
2644
2645/**
2646 * @license
2647 * Copyright Akveo. All Rights Reserved.
2648 * Licensed under the MIT License. See License.txt in the project root for license information.
2649 */
2650/**
2651 * Component intended to be used within the `<nb-card>` component.
2652 * It adds styles for a preset header section.
2653 *
2654 * @styles
2655 *
2656 * card-header-text-color:
2657 * card-header-text-font-family:
2658 * card-header-text-font-size:
2659 * card-header-text-font-weight:
2660 * card-header-text-line-height:
2661 * card-header-basic-background-color:
2662 * card-header-basic-text-color:
2663 * card-header-primary-background-color:
2664 * card-header-primary-text-color:
2665 * card-header-info-background-color:
2666 * card-header-info-text-color:
2667 * card-header-success-background-color:
2668 * card-header-success-text-color:
2669 * card-header-warning-background-color:
2670 * card-header-warning-text-color:
2671 * card-header-danger-background-color:
2672 * card-header-danger-text-color:
2673 * card-header-control-background-color:
2674 * card-header-control-text-color:
2675 */
2676var NbCardHeaderComponent = /** @class */ (function () {
2677 function NbCardHeaderComponent() {
2678 }
2679 NbCardHeaderComponent.decorators = [
2680 { type: i0.Component, args: [{
2681 selector: 'nb-card-header',
2682 template: "<ng-content></ng-content>"
2683 },] }
2684 ];
2685 return NbCardHeaderComponent;
2686}());
2687/**
2688 * Component intended to be used within the `<nb-card>` component.
2689 * Adds styles for a preset body section.
2690 */
2691var NbCardBodyComponent = /** @class */ (function () {
2692 function NbCardBodyComponent() {
2693 }
2694 NbCardBodyComponent.decorators = [
2695 { type: i0.Component, args: [{
2696 selector: 'nb-card-body',
2697 template: "<ng-content></ng-content>"
2698 },] }
2699 ];
2700 return NbCardBodyComponent;
2701}());
2702/**
2703 * Component intended to be used within the `<nb-card>` component.
2704 * Adds styles for a preset footer section.
2705 */
2706var NbCardFooterComponent = /** @class */ (function () {
2707 function NbCardFooterComponent() {
2708 }
2709 NbCardFooterComponent.decorators = [
2710 { type: i0.Component, args: [{
2711 selector: 'nb-card-footer',
2712 template: "<ng-content></ng-content>"
2713 },] }
2714 ];
2715 return NbCardFooterComponent;
2716}());
2717/**
2718 * Basic content container component.
2719 *
2720 * Basic card example:
2721 * @stacked-example(Showcase, card/card-showcase.component)
2722 *
2723 * Basic card configuration:
2724 *
2725 * ```html
2726 * <nb-card>
2727 * <nb-card-body>
2728 * Card
2729 * </nb-card-body>
2730 * </nb-card>
2731 * ```
2732 *
2733 * ### Installation
2734 *
2735 * Import `NbCardModule` to your feature module.
2736 * ```ts
2737 * @NgModule({
2738 * imports: [
2739 * // ...
2740 * NbCardModule,
2741 * ],
2742 * })
2743 * export class PageModule { }
2744 * ```
2745 * ### Usage
2746 *
2747 * Card with header and footer:
2748 * @stacked-example(With Header & Footer, card/card-full.component)
2749 *
2750 * Most of the time main card content goes to `nb-card-body`,
2751 * so it is styled and aligned in accordance with the header and footer.
2752 * In case you need a higher level of control, you can pass contend directly to `nb-card`,
2753 * so `nb-card-body` styling will not be applied.
2754 *
2755 * Consider an example with `nb-list` component:
2756 * @stacked-example(Card with list, card/card-without-body.component)
2757 *
2758 * Colored cards could be simply configured by providing a `status` property:
2759 * @stacked-example(Colored Card, card/card-colors.component)
2760 *
2761 * It is also possible to assign an `accent` property for a slight card highlight
2762 * as well as combine it with `status`:
2763 * @stacked-example(Accent Card, card/card-accents.component)
2764 *
2765 * Cards of smaller sizes could be combined and put on the same row with a bigger card so they have the same heights.
2766 * @stacked-example(Card sizes combinations, card/card-sizes-combinations.component)
2767 *
2768 * @additional-example(Multiple Sizes, card/card-sizes.component)
2769 *
2770 * @styles
2771 *
2772 * card-background-color:
2773 * card-text-color:
2774 * card-text-font-family:
2775 * card-text-font-size:
2776 * card-text-font-weight:
2777 * card-text-line-height:
2778 * card-border-width:
2779 * card-border-style:
2780 * card-border-color:
2781 * card-border-radius:
2782 * card-padding:
2783 * card-shadow:
2784 * card-divider-color:
2785 * card-divider-style:
2786 * card-divider-width:
2787 * card-height-tiny:
2788 * card-height-small:
2789 * card-height-medium:
2790 * card-height-large:
2791 * card-height-giant:
2792 * card-margin-bottom:
2793 * card-scrollbar-color:
2794 * card-scrollbar-background-color:
2795 * card-scrollbar-width:
2796 */
2797var NbCardComponent = /** @class */ (function () {
2798 function NbCardComponent(statusService) {
2799 this.statusService = statusService;
2800 this._size = '';
2801 /**
2802 * Card status:
2803 * `basic`, `primary`, `info`, `success`, `warning`, `danger`, `control`
2804 */
2805 this.status = '';
2806 /**
2807 * Card accent (color of the top border):
2808 * `basic`, `primary`, `info`, `success`, `warning`, `danger`, `control`
2809 */
2810 this.accent = '';
2811 }
2812 Object.defineProperty(NbCardComponent.prototype, "size", {
2813 /**
2814 * Card size, available sizes:
2815 * tiny, small, medium, large, giant
2816 */
2817 get: function () {
2818 return this._size;
2819 },
2820 set: function (value) {
2821 this._size = value;
2822 },
2823 enumerable: false,
2824 configurable: true
2825 });
2826 Object.defineProperty(NbCardComponent.prototype, "tiny", {
2827 get: function () {
2828 return this.size === 'tiny';
2829 },
2830 enumerable: false,
2831 configurable: true
2832 });
2833 Object.defineProperty(NbCardComponent.prototype, "small", {
2834 get: function () {
2835 return this.size === 'small';
2836 },
2837 enumerable: false,
2838 configurable: true
2839 });
2840 Object.defineProperty(NbCardComponent.prototype, "medium", {
2841 get: function () {
2842 return this.size === 'medium';
2843 },
2844 enumerable: false,
2845 configurable: true
2846 });
2847 Object.defineProperty(NbCardComponent.prototype, "large", {
2848 get: function () {
2849 return this.size === 'large';
2850 },
2851 enumerable: false,
2852 configurable: true
2853 });
2854 Object.defineProperty(NbCardComponent.prototype, "giant", {
2855 get: function () {
2856 return this.size === 'giant';
2857 },
2858 enumerable: false,
2859 configurable: true
2860 });
2861 Object.defineProperty(NbCardComponent.prototype, "primary", {
2862 get: function () {
2863 return this.status === 'primary';
2864 },
2865 enumerable: false,
2866 configurable: true
2867 });
2868 Object.defineProperty(NbCardComponent.prototype, "info", {
2869 get: function () {
2870 return this.status === 'info';
2871 },
2872 enumerable: false,
2873 configurable: true
2874 });
2875 Object.defineProperty(NbCardComponent.prototype, "success", {
2876 get: function () {
2877 return this.status === 'success';
2878 },
2879 enumerable: false,
2880 configurable: true
2881 });
2882 Object.defineProperty(NbCardComponent.prototype, "warning", {
2883 get: function () {
2884 return this.status === 'warning';
2885 },
2886 enumerable: false,
2887 configurable: true
2888 });
2889 Object.defineProperty(NbCardComponent.prototype, "danger", {
2890 get: function () {
2891 return this.status === 'danger';
2892 },
2893 enumerable: false,
2894 configurable: true
2895 });
2896 Object.defineProperty(NbCardComponent.prototype, "basic", {
2897 get: function () {
2898 return this.status === 'basic';
2899 },
2900 enumerable: false,
2901 configurable: true
2902 });
2903 Object.defineProperty(NbCardComponent.prototype, "control", {
2904 get: function () {
2905 return this.status === 'control';
2906 },
2907 enumerable: false,
2908 configurable: true
2909 });
2910 Object.defineProperty(NbCardComponent.prototype, "hasAccent", {
2911 get: function () {
2912 return this.accent;
2913 },
2914 enumerable: false,
2915 configurable: true
2916 });
2917 Object.defineProperty(NbCardComponent.prototype, "primaryAccent", {
2918 get: function () {
2919 return this.accent === 'primary';
2920 },
2921 enumerable: false,
2922 configurable: true
2923 });
2924 Object.defineProperty(NbCardComponent.prototype, "infoAccent", {
2925 get: function () {
2926 return this.accent === 'info';
2927 },
2928 enumerable: false,
2929 configurable: true
2930 });
2931 Object.defineProperty(NbCardComponent.prototype, "successAccent", {
2932 get: function () {
2933 return this.accent === 'success';
2934 },
2935 enumerable: false,
2936 configurable: true
2937 });
2938 Object.defineProperty(NbCardComponent.prototype, "warningAccent", {
2939 get: function () {
2940 return this.accent === 'warning';
2941 },
2942 enumerable: false,
2943 configurable: true
2944 });
2945 Object.defineProperty(NbCardComponent.prototype, "dangerAccent", {
2946 get: function () {
2947 return this.accent === 'danger';
2948 },
2949 enumerable: false,
2950 configurable: true
2951 });
2952 Object.defineProperty(NbCardComponent.prototype, "basicAccent", {
2953 get: function () {
2954 return this.accent === 'basic';
2955 },
2956 enumerable: false,
2957 configurable: true
2958 });
2959 Object.defineProperty(NbCardComponent.prototype, "controlAccent", {
2960 get: function () {
2961 return this.accent === 'control';
2962 },
2963 enumerable: false,
2964 configurable: true
2965 });
2966 Object.defineProperty(NbCardComponent.prototype, "additionalClasses", {
2967 get: function () {
2968 if (this.statusService.isCustomStatus(this.status)) {
2969 return [this.statusService.getStatusClass(this.status)];
2970 }
2971 return [];
2972 },
2973 enumerable: false,
2974 configurable: true
2975 });
2976 NbCardComponent.decorators = [
2977 { type: i0.Component, args: [{
2978 selector: 'nb-card',
2979 template: "\n <ng-content select=\"nb-card-header\"></ng-content>\n <ng-content select=\"nb-card-body\"></ng-content>\n <ng-content></ng-content>\n <ng-content select=\"nb-card-footer\"></ng-content>\n ",
2980 styles: [":host{display:flex;flex-direction:column}\n"]
2981 },] }
2982 ];
2983 NbCardComponent.ctorParameters = function () { return [
2984 { type: NbStatusService }
2985 ]; };
2986 NbCardComponent.propDecorators = {
2987 size: [{ type: i0.Input }],
2988 status: [{ type: i0.Input }],
2989 accent: [{ type: i0.Input }],
2990 tiny: [{ type: i0.HostBinding, args: ['class.size-tiny',] }],
2991 small: [{ type: i0.HostBinding, args: ['class.size-small',] }],
2992 medium: [{ type: i0.HostBinding, args: ['class.size-medium',] }],
2993 large: [{ type: i0.HostBinding, args: ['class.size-large',] }],
2994 giant: [{ type: i0.HostBinding, args: ['class.size-giant',] }],
2995 primary: [{ type: i0.HostBinding, args: ['class.status-primary',] }],
2996 info: [{ type: i0.HostBinding, args: ['class.status-info',] }],
2997 success: [{ type: i0.HostBinding, args: ['class.status-success',] }],
2998 warning: [{ type: i0.HostBinding, args: ['class.status-warning',] }],
2999 danger: [{ type: i0.HostBinding, args: ['class.status-danger',] }],
3000 basic: [{ type: i0.HostBinding, args: ['class.status-basic',] }],
3001 control: [{ type: i0.HostBinding, args: ['class.status-control',] }],
3002 hasAccent: [{ type: i0.HostBinding, args: ['class.accent',] }],
3003 primaryAccent: [{ type: i0.HostBinding, args: ['class.accent-primary',] }],
3004 infoAccent: [{ type: i0.HostBinding, args: ['class.accent-info',] }],
3005 successAccent: [{ type: i0.HostBinding, args: ['class.accent-success',] }],
3006 warningAccent: [{ type: i0.HostBinding, args: ['class.accent-warning',] }],
3007 dangerAccent: [{ type: i0.HostBinding, args: ['class.accent-danger',] }],
3008 basicAccent: [{ type: i0.HostBinding, args: ['class.accent-basic',] }],
3009 controlAccent: [{ type: i0.HostBinding, args: ['class.accent-control',] }],
3010 additionalClasses: [{ type: i0.HostBinding, args: ['class',] }]
3011 };
3012 return NbCardComponent;
3013}());
3014
3015/**
3016 *
3017 * Reveal card example:
3018 * @stacked-example(My example, reveal-card/reveal-card-showcase.component)
3019 *
3020 * As a content Reveal card accepts two instances of `nb-card` - for front and back sides.
3021 *
3022 * Basic reveal card configuration:
3023 *
3024 * ```html
3025 * <nb-reveal-card>
3026 * <nb-card-front>
3027 * <nb-card>
3028 * <nb-card-body>
3029 * Front
3030 * </nb-card-body>
3031 * </nb-card>
3032 * </nb-card-front>
3033 * <nb-card-back>
3034 * <nb-card>
3035 * <nb-card-body>
3036 * Back
3037 * </nb-card-body>
3038 * </nb-card>
3039 * </nb-card-back>
3040 * </nb-reveal-card>
3041 * ```
3042 *
3043 * ### Installation
3044 *
3045 * Import `NbCardModule` to your feature module.
3046 * ```ts
3047 * @NgModule({
3048 * imports: [
3049 * // ...
3050 * NbCardModule,
3051 * ],
3052 * })
3053 * export class PageModule { }
3054 * ```
3055 * ### Usage
3056 *
3057 * Reveal Card with header and footer:
3058 * @stacked-example(With Header & Footer, reveal-card/reveal-card-full.component)
3059 *
3060 * Colored reveal-cards could be simply configured by providing a `status` property:
3061 * @stacked-example(Colored Card, reveal-card/reveal-card-colors.component)
3062 *
3063 * It is also possible to assign an `accent` property for a slight card highlight
3064 * as well as combine it with `status`:
3065 * @stacked-example(Accent Card, reveal-card/reveal-card-accents.component)
3066 *
3067 * @additional-example(Multiple Sizes, reveal-card/reveal-card-sizes.component)
3068 */
3069var NbRevealCardComponent = /** @class */ (function () {
3070 function NbRevealCardComponent() {
3071 /**
3072 * Reveal state
3073 * @type boolean
3074 */
3075 this.revealed = false;
3076 /**
3077 * Show/hide toggle button to be able to control toggle from your code
3078 * @type {boolean}
3079 */
3080 this.showToggleButton = true;
3081 }
3082 NbRevealCardComponent.prototype.toggle = function () {
3083 this.revealed = !this.revealed;
3084 };
3085 NbRevealCardComponent.decorators = [
3086 { type: i0.Component, args: [{
3087 selector: 'nb-reveal-card',
3088 template: "\n <ng-content select=\"nb-card-front\"></ng-content>\n <div class=\"second-card-container\">\n <ng-content select=\"nb-card-back\"></ng-content>\n </div>\n <a *ngIf=\"showToggleButton\" class=\"reveal-button\" (click)=\"toggle()\">\n <nb-icon icon=\"chevron-down-outline\" pack=\"nebular-essentials\" aria-hidden=\"true\"></nb-icon>\n </a>\n ",
3089 styles: [":host{display:block;position:relative;overflow:hidden}:host .second-card-container{position:absolute;top:100%;right:0;left:0;overflow:hidden;transition:top 0s 0.5s}:host ::ng-deep nb-card-front nb-card,:host ::ng-deep nb-card-back nb-card{box-shadow:none;margin:0}:host ::ng-deep nb-card-front{display:block;height:100%}:host ::ng-deep nb-card-back{position:absolute;left:0;top:100%;width:100%;transition:top 0.5s}:host .reveal-button{cursor:pointer;position:absolute;right:0;bottom:0;transform:rotate(180deg);transition:transform 0.3s}:host(.revealed) .second-card-container{top:0;transition:none}:host(.revealed) .second-card-container ::ng-deep nb-card-back{top:0}:host(.revealed) .reveal-button{transform:none}\n"]
3090 },] }
3091 ];
3092 NbRevealCardComponent.propDecorators = {
3093 revealed: [{ type: i0.Input }, { type: i0.HostBinding, args: ['class.revealed',] }],
3094 showToggleButton: [{ type: i0.Input }]
3095 };
3096 return NbRevealCardComponent;
3097}());
3098
3099/**
3100 *
3101 * Flip card example:
3102 * @stacked-example(Showcase, flip-card/flip-card-showcase.component)
3103 *
3104 * As a content Flip card accepts two instances of `nb-card` - for front and back sides.
3105 *
3106 * Basic flip card configuration:
3107 *
3108 * ```html
3109 * <nb-flip-card>
3110 * <nb-card-front>
3111 * <nb-card>
3112 * <nb-card-body>
3113 * Front
3114 * </nb-card-body>
3115 * </nb-card>
3116 * </nb-card-front>
3117 * <nb-card-back>
3118 * <nb-card>
3119 * <nb-card-body>
3120 * Back
3121 * </nb-card-body>
3122 * </nb-card>
3123 * </nb-card-back>
3124 * </nb-flip-card>
3125 * ```
3126 *
3127 * ### Installation
3128 *
3129 * Import `NbCardModule` to your feature module.
3130 * ```ts
3131 * @NgModule({
3132 * imports: [
3133 * // ...
3134 * NbCardModule,
3135 * ],
3136 * })
3137 * export class PageModule { }
3138 * ```
3139 * ### Usage
3140 *
3141 * Flip Card with header and footer:
3142 * @stacked-example(With Header & Footer, flip-card/flip-card-full.component.ts)
3143 *
3144 * Colored flip-cards could be simply configured by providing a `status` property:
3145 * @stacked-example(Colored Card, flip-card/flip-card-colors.component)
3146 *
3147 * It is also possible to assign an `accent` property for a slight card highlight
3148 * as well as combine it with `status`:
3149 * @stacked-example(Accent Card, flip-card/flip-card-accents.component)
3150 *
3151 * @additional-example(Multiple Sizes, flip-card/flip-card-sizes.component)
3152 *
3153 */
3154var NbFlipCardComponent = /** @class */ (function () {
3155 function NbFlipCardComponent() {
3156 /**
3157 * Flip state
3158 * @type boolean
3159 */
3160 this.flipped = false;
3161 /**
3162 * Show/hide toggle button to be able to control toggle from your code
3163 * @type {boolean}
3164 */
3165 this.showToggleButton = true;
3166 }
3167 NbFlipCardComponent.prototype.toggle = function () {
3168 this.flipped = !this.flipped;
3169 };
3170 NbFlipCardComponent.decorators = [
3171 { type: i0.Component, args: [{
3172 selector: 'nb-flip-card',
3173 template: "\n <div class=\"flipcard-body\">\n <div class=\"front-container\">\n <ng-content select=\"nb-card-front\"></ng-content>\n <a *ngIf=\"showToggleButton\" class=\"flip-button\" (click)=\"toggle()\">\n <nb-icon icon=\"chevron-left-outline\" pack=\"nebular-essentials\" aria-hidden=\"true\"></nb-icon>\n </a>\n </div>\n <div class=\"back-container\">\n <ng-content select=\"nb-card-back\"></ng-content>\n <a *ngIf=\"showToggleButton\" class=\"flip-button\" (click)=\"toggle()\">\n <nb-icon icon=\"chevron-left-outline\" pack=\"nebular-essentials\" aria-hidden=\"true\"></nb-icon>\n </a>\n </div>\n </div>\n ",
3174 styles: [":host{display:block;perspective:1200px;position:relative}:host-context(.flipped) .flipcard-body{transform:rotateY(-180deg)}:host-context(.flipped) .flipcard-body .front-container{opacity:0;transition:opacity 0s 0.25s;backface-visibility:hidden;-webkit-backface-visibility:hidden}:host-context(.flipped) .flipcard-body .front-container .flip-button{opacity:0;z-index:-1}:host-context(.flipped) .flipcard-body .back-container{backface-visibility:visible;-webkit-backface-visibility:visible}.flipcard-body{display:flex;transition:transform 0.5s;transform-style:preserve-3d}.flipcard-body .front-container,.flipcard-body .back-container{flex:1}.flipcard-body .front-container .flip-button,.flipcard-body .back-container .flip-button{cursor:pointer;position:absolute;right:0;bottom:0;opacity:1;transition:opacity 0s 0.15s}.flipcard-body .front-container{backface-visibility:visible;-webkit-backface-visibility:visible;transition:opacity 0s 0.2s}.flipcard-body .back-container{backface-visibility:hidden;-webkit-backface-visibility:hidden;transform:rotateY(180deg)}\n"]
3175 },] }
3176 ];
3177 NbFlipCardComponent.propDecorators = {
3178 flipped: [{ type: i0.Input }, { type: i0.HostBinding, args: ['class.flipped',] }],
3179 showToggleButton: [{ type: i0.Input }]
3180 };
3181 return NbFlipCardComponent;
3182}());
3183
3184/**
3185 * Component intended to be used within the `<nb-flip-card>` and `<nb-reveal-card>` components.
3186 *
3187 * Use it as a container for the front card.
3188 */
3189var NbCardFrontComponent = /** @class */ (function () {
3190 function NbCardFrontComponent() {
3191 }
3192 NbCardFrontComponent.decorators = [
3193 { type: i0.Component, args: [{
3194 selector: 'nb-card-front',
3195 template: '<ng-content select="nb-card"></ng-content>'
3196 },] }
3197 ];
3198 return NbCardFrontComponent;
3199}());
3200/**
3201 * Component intended to be used within the `<nb-flip-card>` and `<nb-reveal-card>` components.
3202 *
3203 * Use it as a container for the back card.
3204 */
3205var NbCardBackComponent = /** @class */ (function () {
3206 function NbCardBackComponent() {
3207 }
3208 NbCardBackComponent.decorators = [
3209 { type: i0.Component, args: [{
3210 selector: 'nb-card-back',
3211 template: '<ng-content select="nb-card"></ng-content>'
3212 },] }
3213 ];
3214 return NbCardBackComponent;
3215}());
3216
3217/**
3218 * @license
3219 * Copyright Akveo. All Rights Reserved.
3220 * Licensed under the MIT License. See License.txt in the project root for license information.
3221 */
3222var NB_CARD_COMPONENTS = [
3223 NbCardComponent,
3224 NbCardBodyComponent,
3225 NbCardFooterComponent,
3226 NbCardHeaderComponent,
3227 NbRevealCardComponent,
3228 NbFlipCardComponent,
3229 NbCardFrontComponent,
3230 NbCardBackComponent,
3231];
3232var NbCardModule = /** @class */ (function () {
3233 function NbCardModule() {
3234 }
3235 NbCardModule.decorators = [
3236 { type: i0.NgModule, args: [{
3237 imports: [
3238 NbSharedModule,
3239 NbIconModule,
3240 ],
3241 declarations: tslib.__spreadArray([], NB_CARD_COMPONENTS),
3242 exports: tslib.__spreadArray([], NB_CARD_COMPONENTS),
3243 },] }
3244 ];
3245 return NbCardModule;
3246}());
3247
3248/**
3249 * @license
3250 * Copyright Akveo. All Rights Reserved.
3251 * Licensed under the MIT License. See License.txt in the project root for license information.
3252 */
3253
3254(function (NbCalendarViewMode) {
3255 NbCalendarViewMode["YEAR"] = "year";
3256 NbCalendarViewMode["MONTH"] = "month";
3257 NbCalendarViewMode["DATE"] = "date";
3258})(exports.NbCalendarViewMode || (exports.NbCalendarViewMode = {}));
3259
3260(function (NbCalendarSize) {
3261 NbCalendarSize["MEDIUM"] = "medium";
3262 NbCalendarSize["LARGE"] = "large";
3263})(exports.NbCalendarSize || (exports.NbCalendarSize = {}));
3264
3265/**
3266 * @license
3267 * Copyright Akveo. All Rights Reserved.
3268 * Licensed under the MIT License. See License.txt in the project root for license information.
3269 */
3270function convertToBoolProperty(val) {
3271 if (typeof val === 'string') {
3272 val = val.toLowerCase().trim();
3273 return (val === 'true' || val === '');
3274 }
3275 return !!val;
3276}
3277
3278function firstChildNotComment(node) {
3279 var children = Array
3280 .from(node.childNodes)
3281 .filter(function (child) { return child.nodeType !== Node.COMMENT_NODE; });
3282 return children[0];
3283}
3284function lastChildNotComment(node) {
3285 var children = Array
3286 .from(node.childNodes)
3287 .filter(function (child) { return child.nodeType !== Node.COMMENT_NODE; });
3288 return children[children.length - 1];
3289}
3290
3291/**
3292 * @license
3293 * Copyright Akveo. All Rights Reserved.
3294 * Licensed under the MIT License. See License.txt in the project root for license information.
3295 */
3296/**
3297 * Calendar component provides a capability to choose a date.
3298 *
3299 * ```html
3300 * <nb-calendar [(date)]="date"></nb-calendar>
3301 * <nb-calendar [date]="date" (dateChange)="handleDateChange($event)"></nb-calendar>
3302 * ```
3303 *
3304 * Basic usage example
3305 * @stacked-example(Showcase, calendar/calendar-showcase.component)
3306 *
3307 * ### Installation
3308 *
3309 * Import `NbCalendarModule` to your feature module.
3310 * ```ts
3311 * @NgModule({
3312 * imports: [
3313 * // ...
3314 * NbCalendarModule,
3315 * ],
3316 * })
3317 * export class PageModule { }
3318 * ```
3319 * ### Usage
3320 *
3321 * If you want to select ranges you can use `NbCalendarRangeComponent`.
3322 *
3323 * ```html
3324 * <nb-calendar-range [(range)]="range"></nb-calendar-range>
3325 * <nb-calendar-range [range]="range" (rangeChange)="handleRangeChange($event)"></nb-calendar-range>
3326 * ```
3327 *
3328 * In order to use it, you have to import `NbCalendarRangeModule`.
3329 * @stacked-example(Range, calendar/calendar-range-showcase.component)
3330 *
3331 * The calendar component is supplied with a calendar navigation that contains navigate buttons.
3332 * If you do not want to use it you can hide calendar navigation using `showNavigation` property.
3333 * @stacked-example(Without navigation, calendar/calendar-without-navigation.component)
3334 *
3335 * As you can see in the basic usage example calendar contains previous and next month days
3336 * which can be disabled using `boundingMonth` property.
3337 * @stacked-example(Bounding months, calendar/calendar-bounding-month.component)
3338 *
3339 * You can define starting view of the calendar by setting `startView` property.
3340 * Available values: year, month and date.
3341 * @stacked-example(Start view, calendar/calendar-start-view.component)
3342 *
3343 * You can use a larger version of the calendar by defining size property.
3344 * Available values: medium(which is default) and large.
3345 * @stacked-example(Size, calendar/calendar-size.component)
3346 *
3347 * Calendar supports min and max dates which disables values out of min-max range.
3348 * @stacked-example(Borders, calendar/calendar-min-max.component)
3349 *
3350 * Also, you can define custom filter property that should be predicate which receives
3351 * date and returns false if this date has to be disabled. In this example, we provide the filter
3352 * which disables weekdays.
3353 * @stacked-example(Filter, calendar/calendar-filter.component)
3354 *
3355 * Week numbers column could be enabled via `showWeekNumber` binding:
3356 * @stacked-example(Week number, calendar/calendar-week-number.component)
3357 *
3358 * If you need create custom cells you can easily provide custom components for
3359 * calendar. For examples if you want to show any average price under each date you can
3360 * just provide custom `dayCellComponent`. Custom cells for month and year can be provided
3361 * the same way, check API reference.
3362 * @stacked-example(Custom day cell, calendar/calendar-custom-day-cell-showcase.component)
3363 *
3364 * @styles
3365 *
3366 * calendar-width:
3367 * calendar-background-color:
3368 * calendar-border-color:
3369 * calendar-border-style:
3370 * calendar-border-width:
3371 * calendar-border-radius:
3372 * calendar-text-color:
3373 * calendar-text-font-family:
3374 * calendar-text-font-size:
3375 * calendar-text-font-weight:
3376 * calendar-text-line-height:
3377 * calendar-picker-padding-top:
3378 * calendar-picker-padding-bottom:
3379 * calendar-picker-padding-start:
3380 * calendar-picker-padding-end:
3381 * calendar-navigation-text-color:
3382 * calendar-navigation-text-font-family:
3383 * calendar-navigation-title-text-font-size:
3384 * calendar-navigation-title-text-font-weight:
3385 * calendar-navigation-title-text-line-height:
3386 * calendar-navigation-padding:
3387 * calendar-cell-inactive-text-color:
3388 * calendar-cell-disabled-text-color:
3389 * calendar-cell-hover-background-color:
3390 * calendar-cell-hover-border-color:
3391 * calendar-cell-hover-text-color:
3392 * calendar-cell-hover-text-font-size:
3393 * calendar-cell-hover-text-font-weight:
3394 * calendar-cell-hover-text-line-height:
3395 * calendar-cell-active-background-color:
3396 * calendar-cell-active-border-color:
3397 * calendar-cell-active-text-color:
3398 * calendar-cell-active-text-font-size:
3399 * calendar-cell-active-text-font-weight:
3400 * calendar-cell-active-text-line-height:
3401 * calendar-cell-today-background-color:
3402 * calendar-cell-today-border-color:
3403 * calendar-cell-today-text-color:
3404 * calendar-cell-today-text-font-size:
3405 * calendar-cell-today-text-font-weight:
3406 * calendar-cell-today-text-line-height:
3407 * calendar-cell-today-hover-background-color:
3408 * calendar-cell-today-hover-border-color:
3409 * calendar-cell-today-active-background-color:
3410 * calendar-cell-today-active-border-color:
3411 * calendar-cell-today-disabled-border-color:
3412 * calendar-cell-today-selected-background-color:
3413 * calendar-cell-today-selected-border-color:
3414 * calendar-cell-today-selected-text-color:
3415 * calendar-cell-today-selected-hover-background-color:
3416 * calendar-cell-today-selected-hover-border-color:
3417 * calendar-cell-today-selected-active-background-color:
3418 * calendar-cell-today-selected-active-border-color:
3419 * calendar-cell-today-in-range-background-color:
3420 * calendar-cell-today-in-range-border-color:
3421 * calendar-cell-today-in-range-text-color:
3422 * calendar-cell-today-in-range-hover-background-color:
3423 * calendar-cell-today-in-range-hover-border-color:
3424 * calendar-cell-today-in-range-active-background-color:
3425 * calendar-cell-today-in-range-active-border-color:
3426 * calendar-cell-selected-background-color:
3427 * calendar-cell-selected-border-color:
3428 * calendar-cell-selected-text-color:
3429 * calendar-cell-selected-text-font-size:
3430 * calendar-cell-selected-text-font-weight:
3431 * calendar-cell-selected-text-line-height:
3432 * calendar-cell-selected-hover-background-color:
3433 * calendar-cell-selected-hover-border-color:
3434 * calendar-cell-selected-active-background-color:
3435 * calendar-cell-selected-active-border-color:
3436 * calendar-day-cell-width:
3437 * calendar-day-cell-height:
3438 * calendar-month-cell-width:
3439 * calendar-month-cell-height:
3440 * calendar-year-cell-width:
3441 * calendar-year-cell-height:
3442 * calendar-weekday-background:
3443 * calendar-weekday-divider-color:
3444 * calendar-weekday-divider-width:
3445 * calendar-weekday-text-color:
3446 * calendar-weekday-text-font-size:
3447 * calendar-weekday-text-font-weight:
3448 * calendar-weekday-text-line-height:
3449 * calendar-weekday-holiday-text-color:
3450 * calendar-weekday-height:
3451 * calendar-weekday-width:
3452 * calendar-weeknumber-background:
3453 * calendar-weeknumber-divider-color:
3454 * calendar-weeknumber-divider-width:
3455 * calendar-weeknumber-text-color:
3456 * calendar-weeknumber-text-font-size:
3457 * calendar-weeknumber-text-font-weight:
3458 * calendar-weeknumber-text-line-height:
3459 * calendar-weeknumber-height:
3460 * calendar-weeknumber-width:
3461 * calendar-large-width:
3462 * calendar-day-cell-large-width:
3463 * calendar-day-cell-large-height:
3464 * calendar-weekday-large-height:
3465 * calendar-weekday-large-width:
3466 * calendar-weeknumber-large-height:
3467 * calendar-weeknumber-large-width:
3468 * calendar-month-cell-large-width:
3469 * calendar-month-cell-large-height:
3470 * calendar-year-cell-large-width:
3471 * calendar-year-cell-large-height:
3472 * */
3473var NbCalendarComponent = /** @class */ (function () {
3474 function NbCalendarComponent() {
3475 /**
3476 * Defines if we should render previous and next months
3477 * in the current month view.
3478 * */
3479 this.boundingMonth = true;
3480 /**
3481 * Defines starting view for calendar.
3482 * */
3483 this.startView = exports.NbCalendarViewMode.DATE;
3484 /**
3485 * Size of the calendar and entire components.
3486 * Can be 'medium' which is default or 'large'.
3487 * */
3488 this.size = exports.NbCalendarSize.MEDIUM;
3489 /**
3490 * Determines should we show calendars navigation or not.
3491 * */
3492 this.showNavigation = true;
3493 this._showWeekNumber = false;
3494 /**
3495 * Sets symbol used as a header for week numbers column
3496 * */
3497 this.weekNumberSymbol = '#';
3498 /**
3499 * Emits date when selected.
3500 * */
3501 this.dateChange = new i0.EventEmitter();
3502 }
3503 Object.defineProperty(NbCalendarComponent.prototype, "showWeekNumber", {
3504 /**
3505 * Determines should we show week numbers column.
3506 * False by default.
3507 * */
3508 get: function () {
3509 return this._showWeekNumber;
3510 },
3511 set: function (value) {
3512 this._showWeekNumber = convertToBoolProperty(value);
3513 },
3514 enumerable: false,
3515 configurable: true
3516 });
3517 NbCalendarComponent.decorators = [
3518 { type: i0.Component, args: [{
3519 selector: 'nb-calendar',
3520 template: "\n <nb-base-calendar\n [boundingMonth]=\"boundingMonth\"\n [startView]=\"startView\"\n [date]=\"date\"\n [min]=\"min\"\n [max]=\"max\"\n [filter]=\"filter\"\n [dayCellComponent]=\"dayCellComponent\"\n [monthCellComponent]=\"monthCellComponent\"\n [yearCellComponent]=\"yearCellComponent\"\n [size]=\"size\"\n [visibleDate]=\"visibleDate\"\n [showNavigation]=\"showNavigation\"\n [showWeekNumber]=\"showWeekNumber\"\n [weekNumberSymbol]=\"weekNumberSymbol\"\n (dateChange)=\"dateChange.emit($event)\"\n ></nb-base-calendar>\n "
3521 },] }
3522 ];
3523 NbCalendarComponent.propDecorators = {
3524 boundingMonth: [{ type: i0.Input }],
3525 startView: [{ type: i0.Input }],
3526 min: [{ type: i0.Input }],
3527 max: [{ type: i0.Input }],
3528 filter: [{ type: i0.Input }],
3529 dayCellComponent: [{ type: i0.Input }],
3530 monthCellComponent: [{ type: i0.Input }],
3531 yearCellComponent: [{ type: i0.Input }],
3532 size: [{ type: i0.Input }],
3533 visibleDate: [{ type: i0.Input }],
3534 showNavigation: [{ type: i0.Input }],
3535 date: [{ type: i0.Input }],
3536 showWeekNumber: [{ type: i0.Input }],
3537 weekNumberSymbol: [{ type: i0.Input }],
3538 dateChange: [{ type: i0.Output }]
3539 };
3540 return NbCalendarComponent;
3541}());
3542
3543var NbButton = /** @class */ (function () {
3544 function NbButton(renderer, hostElement, cd, zone, statusService) {
3545 this.renderer = renderer;
3546 this.hostElement = hostElement;
3547 this.cd = cd;
3548 this.zone = zone;
3549 this.statusService = statusService;
3550 /**
3551 * Button size, available sizes:
3552 * `tiny`, `small`, `medium`, `large`, `giant`
3553 */
3554 this.size = 'medium';
3555 /**
3556 * Button status (adds specific styles):
3557 * `primary`, `info`, `success`, `warning`, `danger`
3558 */
3559 this.status = 'basic';
3560 /**
3561 * Button shapes: `rectangle`, `round`, `semi-round`
3562 */
3563 this.shape = 'rectangle';
3564 /**
3565 * Button appearance: `filled`, `outline`, `ghost`, `hero`
3566 */
3567 this.appearance = 'filled';
3568 this._fullWidth = false;
3569 this._disabled = false;
3570 }
3571 Object.defineProperty(NbButton.prototype, "filled", {
3572 /**
3573 * Sets `filled` appearance
3574 */
3575 get: function () {
3576 return this.appearance === 'filled';
3577 },
3578 set: function (value) {
3579 if (convertToBoolProperty(value)) {
3580 this.appearance = 'filled';
3581 }
3582 },
3583 enumerable: false,
3584 configurable: true
3585 });
3586 Object.defineProperty(NbButton.prototype, "outline", {
3587 /**
3588 * Sets `outline` appearance
3589 */
3590 get: function () {
3591 return this.appearance === 'outline';
3592 },
3593 set: function (value) {
3594 if (convertToBoolProperty(value)) {
3595 this.appearance = 'outline';
3596 }
3597 },
3598 enumerable: false,
3599 configurable: true
3600 });
3601 Object.defineProperty(NbButton.prototype, "ghost", {
3602 /**
3603 * Sets `ghost` appearance
3604 */
3605 get: function () {
3606 return this.appearance === 'ghost';
3607 },
3608 set: function (value) {
3609 if (convertToBoolProperty(value)) {
3610 this.appearance = 'ghost';
3611 }
3612 },
3613 enumerable: false,
3614 configurable: true
3615 });
3616 Object.defineProperty(NbButton.prototype, "fullWidth", {
3617 /**
3618 * If set element will fill its container
3619 */
3620 get: function () {
3621 return this._fullWidth;
3622 },
3623 set: function (value) {
3624 this._fullWidth = convertToBoolProperty(value);
3625 },
3626 enumerable: false,
3627 configurable: true
3628 });
3629 Object.defineProperty(NbButton.prototype, "disabled", {
3630 /**
3631 * Disables the button
3632 */
3633 get: function () {
3634 return this._disabled;
3635 },
3636 set: function (value) {
3637 if (this.disabled !== convertToBoolProperty(value)) {
3638 this._disabled = !this.disabled;
3639 this.renderer.setProperty(this.hostElement.nativeElement, 'disabled', this.disabled);
3640 }
3641 },
3642 enumerable: false,
3643 configurable: true
3644 });
3645 Object.defineProperty(NbButton.prototype, "tabbable", {
3646 // issue #794
3647 get: function () {
3648 if (this.disabled) {
3649 return '-1';
3650 }
3651 if (this.tabIndex == null) {
3652 return '0';
3653 }
3654 return this.tabIndex.toString();
3655 },
3656 enumerable: false,
3657 configurable: true
3658 });
3659 Object.defineProperty(NbButton.prototype, "tiny", {
3660 get: function () {
3661 return this.size === 'tiny';
3662 },
3663 enumerable: false,
3664 configurable: true
3665 });
3666 Object.defineProperty(NbButton.prototype, "small", {
3667 get: function () {
3668 return this.size === 'small';
3669 },
3670 enumerable: false,
3671 configurable: true
3672 });
3673 Object.defineProperty(NbButton.prototype, "medium", {
3674 get: function () {
3675 return this.size === 'medium';
3676 },
3677 enumerable: false,
3678 configurable: true
3679 });
3680 Object.defineProperty(NbButton.prototype, "large", {
3681 get: function () {
3682 return this.size === 'large';
3683 },
3684 enumerable: false,
3685 configurable: true
3686 });
3687 Object.defineProperty(NbButton.prototype, "giant", {
3688 get: function () {
3689 return this.size === 'giant';
3690 },
3691 enumerable: false,
3692 configurable: true
3693 });
3694 Object.defineProperty(NbButton.prototype, "rectangle", {
3695 get: function () {
3696 return this.shape === 'rectangle';
3697 },
3698 enumerable: false,
3699 configurable: true
3700 });
3701 Object.defineProperty(NbButton.prototype, "round", {
3702 get: function () {
3703 return this.shape === 'round';
3704 },
3705 enumerable: false,
3706 configurable: true
3707 });
3708 Object.defineProperty(NbButton.prototype, "semiRound", {
3709 get: function () {
3710 return this.shape === 'semi-round';
3711 },
3712 enumerable: false,
3713 configurable: true
3714 });
3715 Object.defineProperty(NbButton.prototype, "iconLeft", {
3716 get: function () {
3717 var el = this.hostElement.nativeElement;
3718 var icon = this.iconElement;
3719 return !!(icon && firstChildNotComment(el) === icon);
3720 },
3721 enumerable: false,
3722 configurable: true
3723 });
3724 Object.defineProperty(NbButton.prototype, "iconRight", {
3725 get: function () {
3726 var el = this.hostElement.nativeElement;
3727 var icon = this.iconElement;
3728 return !!(icon && lastChildNotComment(el) === icon);
3729 },
3730 enumerable: false,
3731 configurable: true
3732 });
3733 Object.defineProperty(NbButton.prototype, "additionalClasses", {
3734 get: function () {
3735 if (this.statusService.isCustomStatus(this.status)) {
3736 return [this.statusService.getStatusClass(this.status)];
3737 }
3738 return [];
3739 },
3740 enumerable: false,
3741 configurable: true
3742 });
3743 NbButton.prototype.ngAfterViewInit = function () {
3744 var _this = this;
3745 // TODO: #2254
3746 this.zone.runOutsideAngular(function () { return setTimeout(function () {
3747 _this.renderer.addClass(_this.hostElement.nativeElement, 'nb-transition');
3748 }); });
3749 };
3750 /**
3751 * @docs-private
3752 **/
3753 NbButton.prototype.updateProperties = function (config) {
3754 var isPropertyChanged = false;
3755 for (var key in config) {
3756 if (config.hasOwnProperty(key) && this[key] !== config[key]) {
3757 this[key] = config[key];
3758 isPropertyChanged = true;
3759 }
3760 }
3761 if (isPropertyChanged) {
3762 this.cd.markForCheck();
3763 }
3764 };
3765 Object.defineProperty(NbButton.prototype, "iconElement", {
3766 get: function () {
3767 var el = this.hostElement.nativeElement;
3768 return el.querySelector('nb-icon');
3769 },
3770 enumerable: false,
3771 configurable: true
3772 });
3773 NbButton.decorators = [
3774 { type: i0.Directive }
3775 ];
3776 NbButton.ctorParameters = function () { return [
3777 { type: i0.Renderer2 },
3778 { type: i0.ElementRef },
3779 { type: i0.ChangeDetectorRef },
3780 { type: i0.NgZone },
3781 { type: NbStatusService }
3782 ]; };
3783 NbButton.propDecorators = {
3784 size: [{ type: i0.Input }],
3785 status: [{ type: i0.Input }],
3786 shape: [{ type: i0.Input }],
3787 appearance: [{ type: i0.Input }],
3788 filled: [{ type: i0.Input }, { type: i0.HostBinding, args: ['class.appearance-filled',] }],
3789 outline: [{ type: i0.Input }, { type: i0.HostBinding, args: ['class.appearance-outline',] }],
3790 ghost: [{ type: i0.Input }, { type: i0.HostBinding, args: ['class.appearance-ghost',] }],
3791 fullWidth: [{ type: i0.Input }, { type: i0.HostBinding, args: ['class.full-width',] }],
3792 disabled: [{ type: i0.Input }, { type: i0.HostBinding, args: ['attr.aria-disabled',] }, { type: i0.HostBinding, args: ['class.btn-disabled',] }],
3793 tabIndex: [{ type: i0.Input }],
3794 tabbable: [{ type: i0.HostBinding, args: ['attr.tabindex',] }],
3795 tiny: [{ type: i0.HostBinding, args: ['class.size-tiny',] }],
3796 small: [{ type: i0.HostBinding, args: ['class.size-small',] }],
3797 medium: [{ type: i0.HostBinding, args: ['class.size-medium',] }],
3798 large: [{ type: i0.HostBinding, args: ['class.size-large',] }],
3799 giant: [{ type: i0.HostBinding, args: ['class.size-giant',] }],
3800 rectangle: [{ type: i0.HostBinding, args: ['class.shape-rectangle',] }],
3801 round: [{ type: i0.HostBinding, args: ['class.shape-round',] }],
3802 semiRound: [{ type: i0.HostBinding, args: ['class.shape-semi-round',] }],
3803 iconLeft: [{ type: i0.HostBinding, args: ['class.icon-start',] }],
3804 iconRight: [{ type: i0.HostBinding, args: ['class.icon-end',] }],
3805 additionalClasses: [{ type: i0.HostBinding, args: ['class',] }]
3806 };
3807 return NbButton;
3808}());
3809
3810/**
3811 * @license
3812 * Copyright Akveo. All Rights Reserved.
3813 * Licensed under the MIT License. See License.txt in the project root for license information.
3814 */
3815/**
3816 * Basic button component.
3817 *
3818 * Default button size is `medium` and status color is `basic`:
3819 * @stacked-example(Button Showcase, button/button-showcase.component)
3820 *
3821 * ```html
3822 * <button nbButton></button>
3823 * ```
3824 * ### Installation
3825 *
3826 * Import `NbButtonModule` to your feature module.
3827 * ```ts
3828 * @NgModule({
3829 * imports: [
3830 * // ...
3831 * NbButtonModule,
3832 * ],
3833 * })
3834 * export class PageModule { }
3835 * ```
3836 * ### Usage
3837 *
3838 * Buttons are available in multiple colors using `status` property:
3839 * @stacked-example(Button Colors, button/button-colors.component.html)
3840 *
3841 * There are three button sizes:
3842 *
3843 * @stacked-example(Button Sizes, button/button-sizes.component.html)
3844 *
3845 * And two additional style types - `outline`:
3846 *
3847 * @stacked-example(Outline Buttons, button/button-outline.component.html)
3848 *
3849 * and `hero`:
3850 *
3851 * @stacked-example(Button Hero, button/button-hero.component.html)
3852 *
3853 * Buttons available in different shapes, which could be combined with the other properties:
3854 * @stacked-example(Button Shapes, button/button-shapes.component)
3855 *
3856 * `nbButton` could be applied to the following selectors - `button`, `input[type="button"]`, `input[type="submit"]`
3857 * and `a`:
3858 * @stacked-example(Button Elements, button/button-types.component.html)
3859 *
3860 * Button can be made `fullWidth`:
3861 * @stacked-example(Full Width Button, button/button-full-width.component.html)
3862 *
3863 * Icon can be placed inside of a button as a child element:
3864 * @stacked-example(Icon Button, button/button-icon.component.html)
3865 *
3866 * @additional-example(Interactive example, button/button-interactive.component)
3867 *
3868 * @styles
3869 *
3870 * button-cursor:
3871 * button-outline-width:
3872 * button-outline-color:
3873 * button-text-font-family:
3874 * button-text-font-weight:
3875 * button-disabled-cursor:
3876 * button-tiny-text-font-size:
3877 * button-tiny-text-line-height:
3878 * button-tiny-icon-size:
3879 * button-tiny-icon-vertical-margin:
3880 * button-tiny-icon-offset:
3881 * button-small-text-font-size:
3882 * button-small-text-line-height:
3883 * button-small-icon-size:
3884 * button-small-icon-vertical-margin:
3885 * button-small-icon-offset:
3886 * button-medium-text-font-size:
3887 * button-medium-text-line-height:
3888 * button-medium-icon-size:
3889 * button-medium-icon-vertical-margin:
3890 * button-medium-icon-offset:
3891 * button-large-text-font-size:
3892 * button-large-text-line-height:
3893 * button-large-icon-size:
3894 * button-large-icon-vertical-margin:
3895 * button-large-icon-offset:
3896 * button-giant-text-font-size:
3897 * button-giant-text-line-height:
3898 * button-giant-icon-size:
3899 * button-giant-icon-vertical-margin:
3900 * button-giant-icon-offset:
3901 * button-rectangle-border-radius:
3902 * button-semi-round-border-radius:
3903 * button-round-border-radius:
3904 * button-filled-border-style:
3905 * button-filled-border-width:
3906 * button-filled-text-transform:
3907 * button-filled-tiny-padding:
3908 * button-filled-small-padding:
3909 * button-filled-medium-padding:
3910 * button-filled-large-padding:
3911 * button-filled-giant-padding:
3912 * button-filled-basic-background-color:
3913 * button-filled-basic-border-color:
3914 * button-filled-basic-text-color:
3915 * button-filled-basic-focus-background-color:
3916 * button-filled-basic-focus-border-color:
3917 * button-filled-basic-hover-background-color:
3918 * button-filled-basic-hover-border-color:
3919 * button-filled-basic-active-background-color:
3920 * button-filled-basic-active-border-color:
3921 * button-filled-basic-disabled-background-color:
3922 * button-filled-basic-disabled-border-color:
3923 * button-filled-basic-disabled-text-color:
3924 * button-filled-primary-background-color:
3925 * button-filled-primary-border-color:
3926 * button-filled-primary-text-color:
3927 * button-filled-primary-focus-background-color:
3928 * button-filled-primary-focus-border-color:
3929 * button-filled-primary-hover-background-color:
3930 * button-filled-primary-hover-border-color:
3931 * button-filled-primary-active-background-color:
3932 * button-filled-primary-active-border-color:
3933 * button-filled-primary-disabled-background-color:
3934 * button-filled-primary-disabled-border-color:
3935 * button-filled-primary-disabled-text-color:
3936 * button-filled-success-background-color:
3937 * button-filled-success-border-color:
3938 * button-filled-success-text-color:
3939 * button-filled-success-focus-background-color:
3940 * button-filled-success-focus-border-color:
3941 * button-filled-success-hover-background-color:
3942 * button-filled-success-hover-border-color:
3943 * button-filled-success-active-background-color:
3944 * button-filled-success-active-border-color:
3945 * button-filled-success-disabled-background-color:
3946 * button-filled-success-disabled-border-color:
3947 * button-filled-success-disabled-text-color:
3948 * button-filled-info-background-color:
3949 * button-filled-info-border-color:
3950 * button-filled-info-text-color:
3951 * button-filled-info-focus-background-color:
3952 * button-filled-info-focus-border-color:
3953 * button-filled-info-hover-background-color:
3954 * button-filled-info-hover-border-color:
3955 * button-filled-info-active-background-color:
3956 * button-filled-info-active-border-color:
3957 * button-filled-info-disabled-background-color:
3958 * button-filled-info-disabled-border-color:
3959 * button-filled-info-disabled-text-color:
3960 * button-filled-warning-background-color:
3961 * button-filled-warning-border-color:
3962 * button-filled-warning-text-color:
3963 * button-filled-warning-focus-background-color:
3964 * button-filled-warning-focus-border-color:
3965 * button-filled-warning-hover-background-color:
3966 * button-filled-warning-hover-border-color:
3967 * button-filled-warning-active-background-color:
3968 * button-filled-warning-active-border-color:
3969 * button-filled-warning-disabled-background-color:
3970 * button-filled-warning-disabled-border-color:
3971 * button-filled-warning-disabled-text-color:
3972 * button-filled-danger-background-color:
3973 * button-filled-danger-border-color:
3974 * button-filled-danger-text-color:
3975 * button-filled-danger-focus-background-color:
3976 * button-filled-danger-focus-border-color:
3977 * button-filled-danger-hover-background-color:
3978 * button-filled-danger-hover-border-color:
3979 * button-filled-danger-active-background-color:
3980 * button-filled-danger-active-border-color:
3981 * button-filled-danger-disabled-background-color:
3982 * button-filled-danger-disabled-border-color:
3983 * button-filled-danger-disabled-text-color:
3984 * button-filled-control-background-color:
3985 * button-filled-control-border-color:
3986 * button-filled-control-text-color:
3987 * button-filled-control-focus-background-color:
3988 * button-filled-control-focus-border-color:
3989 * button-filled-control-hover-background-color:
3990 * button-filled-control-hover-border-color:
3991 * button-filled-control-active-background-color:
3992 * button-filled-control-active-border-color:
3993 * button-filled-control-disabled-background-color:
3994 * button-filled-control-disabled-border-color:
3995 * button-filled-control-disabled-text-color:
3996 * button-outline-border-style:
3997 * button-outline-border-width:
3998 * button-outline-text-transform:
3999 * button-outline-focus-inset-shadow-length:
4000 * button-outline-tiny-padding:
4001 * button-outline-small-padding:
4002 * button-outline-medium-padding:
4003 * button-outline-large-padding:
4004 * button-outline-giant-padding:
4005 * button-outline-basic-background-color:
4006 * button-outline-basic-border-color:
4007 * button-outline-basic-text-color:
4008 * button-outline-basic-focus-background-color:
4009 * button-outline-basic-focus-border-color:
4010 * button-outline-basic-focus-text-color:
4011 * button-outline-basic-hover-background-color:
4012 * button-outline-basic-hover-border-color:
4013 * button-outline-basic-hover-text-color:
4014 * button-outline-basic-active-background-color:
4015 * button-outline-basic-active-border-color:
4016 * button-outline-basic-active-text-color:
4017 * button-outline-basic-disabled-background-color:
4018 * button-outline-basic-disabled-border-color:
4019 * button-outline-basic-disabled-text-color:
4020 * button-outline-primary-background-color:
4021 * button-outline-primary-border-color:
4022 * button-outline-primary-text-color:
4023 * button-outline-primary-focus-background-color:
4024 * button-outline-primary-focus-border-color:
4025 * button-outline-primary-focus-text-color:
4026 * button-outline-primary-hover-background-color:
4027 * button-outline-primary-hover-border-color:
4028 * button-outline-primary-hover-text-color:
4029 * button-outline-primary-active-background-color:
4030 * button-outline-primary-active-border-color:
4031 * button-outline-primary-active-text-color:
4032 * button-outline-primary-disabled-background-color:
4033 * button-outline-primary-disabled-border-color:
4034 * button-outline-primary-disabled-text-color:
4035 * button-outline-success-background-color:
4036 * button-outline-success-border-color:
4037 * button-outline-success-text-color:
4038 * button-outline-success-focus-background-color:
4039 * button-outline-success-focus-border-color:
4040 * button-outline-success-focus-text-color:
4041 * button-outline-success-hover-background-color:
4042 * button-outline-success-hover-border-color:
4043 * button-outline-success-hover-text-color:
4044 * button-outline-success-active-background-color:
4045 * button-outline-success-active-border-color:
4046 * button-outline-success-active-text-color:
4047 * button-outline-success-disabled-background-color:
4048 * button-outline-success-disabled-border-color:
4049 * button-outline-success-disabled-text-color:
4050 * button-outline-info-background-color:
4051 * button-outline-info-border-color:
4052 * button-outline-info-text-color:
4053 * button-outline-info-focus-background-color:
4054 * button-outline-info-focus-border-color:
4055 * button-outline-info-focus-text-color:
4056 * button-outline-info-hover-background-color:
4057 * button-outline-info-hover-border-color:
4058 * button-outline-info-hover-text-color:
4059 * button-outline-info-active-background-color:
4060 * button-outline-info-active-border-color:
4061 * button-outline-info-active-text-color:
4062 * button-outline-info-disabled-background-color:
4063 * button-outline-info-disabled-border-color:
4064 * button-outline-info-disabled-text-color:
4065 * button-outline-warning-background-color:
4066 * button-outline-warning-border-color:
4067 * button-outline-warning-text-color:
4068 * button-outline-warning-focus-background-color:
4069 * button-outline-warning-focus-border-color:
4070 * button-outline-warning-focus-text-color:
4071 * button-outline-warning-hover-background-color:
4072 * button-outline-warning-hover-border-color:
4073 * button-outline-warning-hover-text-color:
4074 * button-outline-warning-active-background-color:
4075 * button-outline-warning-active-border-color:
4076 * button-outline-warning-active-text-color:
4077 * button-outline-warning-disabled-background-color:
4078 * button-outline-warning-disabled-border-color:
4079 * button-outline-warning-disabled-text-color:
4080 * button-outline-danger-background-color:
4081 * button-outline-danger-border-color:
4082 * button-outline-danger-text-color:
4083 * button-outline-danger-focus-background-color:
4084 * button-outline-danger-focus-border-color:
4085 * button-outline-danger-focus-text-color:
4086 * button-outline-danger-hover-background-color:
4087 * button-outline-danger-hover-border-color:
4088 * button-outline-danger-hover-text-color:
4089 * button-outline-danger-active-background-color:
4090 * button-outline-danger-active-border-color:
4091 * button-outline-danger-active-text-color:
4092 * button-outline-danger-disabled-background-color:
4093 * button-outline-danger-disabled-border-color:
4094 * button-outline-danger-disabled-text-color:
4095 * button-outline-control-background-color:
4096 * button-outline-control-border-color:
4097 * button-outline-control-text-color:
4098 * button-outline-control-focus-background-color:
4099 * button-outline-control-focus-border-color:
4100 * button-outline-control-focus-text-color:
4101 * button-outline-control-hover-background-color:
4102 * button-outline-control-hover-border-color:
4103 * button-outline-control-hover-text-color:
4104 * button-outline-control-active-background-color:
4105 * button-outline-control-active-border-color:
4106 * button-outline-control-active-text-color:
4107 * button-outline-control-disabled-background-color:
4108 * button-outline-control-disabled-border-color:
4109 * button-outline-control-disabled-text-color:
4110 * button-ghost-background-color:
4111 * button-ghost-border-color:
4112 * button-ghost-border-style:
4113 * button-ghost-border-width:
4114 * button-ghost-text-transform:
4115 * button-ghost-focus-inset-shadow-length:
4116 * button-ghost-tiny-padding:
4117 * button-ghost-small-padding:
4118 * button-ghost-medium-padding:
4119 * button-ghost-large-padding:
4120 * button-ghost-giant-padding:
4121 * button-ghost-basic-text-color:
4122 * button-ghost-basic-focus-background-color:
4123 * button-ghost-basic-focus-border-color:
4124 * button-ghost-basic-focus-text-color:
4125 * button-ghost-basic-hover-background-color:
4126 * button-ghost-basic-hover-border-color:
4127 * button-ghost-basic-hover-text-color:
4128 * button-ghost-basic-active-background-color:
4129 * button-ghost-basic-active-border-color:
4130 * button-ghost-basic-active-text-color:
4131 * button-ghost-basic-disabled-background-color:
4132 * button-ghost-basic-disabled-border-color:
4133 * button-ghost-basic-disabled-text-color:
4134 * button-ghost-primary-text-color:
4135 * button-ghost-primary-focus-background-color:
4136 * button-ghost-primary-focus-border-color:
4137 * button-ghost-primary-focus-text-color:
4138 * button-ghost-primary-hover-background-color:
4139 * button-ghost-primary-hover-border-color:
4140 * button-ghost-primary-hover-text-color:
4141 * button-ghost-primary-active-background-color:
4142 * button-ghost-primary-active-border-color:
4143 * button-ghost-primary-active-text-color:
4144 * button-ghost-primary-disabled-background-color:
4145 * button-ghost-primary-disabled-border-color:
4146 * button-ghost-primary-disabled-text-color:
4147 * button-ghost-success-text-color:
4148 * button-ghost-success-focus-background-color:
4149 * button-ghost-success-focus-border-color:
4150 * button-ghost-success-focus-text-color:
4151 * button-ghost-success-hover-background-color:
4152 * button-ghost-success-hover-border-color:
4153 * button-ghost-success-hover-text-color:
4154 * button-ghost-success-active-background-color:
4155 * button-ghost-success-active-border-color:
4156 * button-ghost-success-active-text-color:
4157 * button-ghost-success-disabled-background-color:
4158 * button-ghost-success-disabled-border-color:
4159 * button-ghost-success-disabled-text-color:
4160 * button-ghost-info-text-color:
4161 * button-ghost-info-focus-background-color:
4162 * button-ghost-info-focus-border-color:
4163 * button-ghost-info-focus-text-color:
4164 * button-ghost-info-hover-background-color:
4165 * button-ghost-info-hover-border-color:
4166 * button-ghost-info-hover-text-color:
4167 * button-ghost-info-active-background-color:
4168 * button-ghost-info-active-border-color:
4169 * button-ghost-info-active-text-color:
4170 * button-ghost-info-disabled-background-color:
4171 * button-ghost-info-disabled-border-color:
4172 * button-ghost-info-disabled-text-color:
4173 * button-ghost-warning-text-color:
4174 * button-ghost-warning-focus-background-color:
4175 * button-ghost-warning-focus-border-color:
4176 * button-ghost-warning-focus-text-color:
4177 * button-ghost-warning-hover-background-color:
4178 * button-ghost-warning-hover-border-color:
4179 * button-ghost-warning-hover-text-color:
4180 * button-ghost-warning-active-background-color:
4181 * button-ghost-warning-active-border-color:
4182 * button-ghost-warning-active-text-color:
4183 * button-ghost-warning-disabled-background-color:
4184 * button-ghost-warning-disabled-border-color:
4185 * button-ghost-warning-disabled-text-color:
4186 * button-ghost-danger-text-color:
4187 * button-ghost-danger-focus-background-color:
4188 * button-ghost-danger-focus-border-color:
4189 * button-ghost-danger-focus-text-color:
4190 * button-ghost-danger-hover-background-color:
4191 * button-ghost-danger-hover-border-color:
4192 * button-ghost-danger-hover-text-color:
4193 * button-ghost-danger-active-background-color:
4194 * button-ghost-danger-active-border-color:
4195 * button-ghost-danger-active-text-color:
4196 * button-ghost-danger-disabled-background-color:
4197 * button-ghost-danger-disabled-border-color:
4198 * button-ghost-danger-disabled-text-color:
4199 * button-ghost-control-text-color:
4200 * button-ghost-control-focus-background-color:
4201 * button-ghost-control-focus-border-color:
4202 * button-ghost-control-focus-text-color:
4203 * button-ghost-control-hover-background-color:
4204 * button-ghost-control-hover-border-color:
4205 * button-ghost-control-hover-text-color:
4206 * button-ghost-control-active-background-color:
4207 * button-ghost-control-active-border-color:
4208 * button-ghost-control-active-text-color:
4209 * button-ghost-control-disabled-background-color:
4210 * button-ghost-control-disabled-border-color:
4211 * button-ghost-control-disabled-text-color:
4212 * button-hero-border-color:
4213 * button-hero-border-style:
4214 * button-hero-border-width:
4215 * button-hero-text-transform:
4216 * button-hero-tiny-padding:
4217 * button-hero-small-padding:
4218 * button-hero-medium-padding:
4219 * button-hero-large-padding:
4220 * button-hero-giant-padding:
4221 * button-hero-shadow:
4222 * button-hero-text-shadow:
4223 * button-hero-bevel-size:
4224 * button-hero-glow-size:
4225 * button-hero-outline-color:
4226 * button-hero-outline-width:
4227 * button-hero-basic-text-color:
4228 * button-hero-basic-bevel-color:
4229 * button-hero-basic-glow-color:
4230 * button-hero-basic-left-background-color:
4231 * button-hero-basic-right-background-color:
4232 * button-hero-basic-focus-left-background-color:
4233 * button-hero-basic-focus-right-background-color:
4234 * button-hero-basic-hover-left-background-color:
4235 * button-hero-basic-hover-right-background-color:
4236 * button-hero-basic-active-left-background-color:
4237 * button-hero-basic-active-right-background-color:
4238 * button-hero-basic-disabled-background-color:
4239 * button-hero-basic-disabled-text-color:
4240 * button-hero-primary-text-color:
4241 * button-hero-primary-bevel-color:
4242 * button-hero-primary-glow-color:
4243 * button-hero-primary-left-background-color:
4244 * button-hero-primary-right-background-color:
4245 * button-hero-primary-focus-left-background-color:
4246 * button-hero-primary-focus-right-background-color:
4247 * button-hero-primary-hover-left-background-color:
4248 * button-hero-primary-hover-right-background-color:
4249 * button-hero-primary-active-left-background-color:
4250 * button-hero-primary-active-right-background-color:
4251 * button-hero-primary-disabled-background-color:
4252 * button-hero-primary-disabled-text-color:
4253 * button-hero-success-text-color:
4254 * button-hero-success-bevel-color:
4255 * button-hero-success-glow-color:
4256 * button-hero-success-left-background-color:
4257 * button-hero-success-right-background-color:
4258 * button-hero-success-focus-left-background-color:
4259 * button-hero-success-focus-right-background-color:
4260 * button-hero-success-hover-left-background-color:
4261 * button-hero-success-hover-right-background-color:
4262 * button-hero-success-active-left-background-color:
4263 * button-hero-success-active-right-background-color:
4264 * button-hero-success-disabled-background-color:
4265 * button-hero-success-disabled-text-color:
4266 * button-hero-info-text-color:
4267 * button-hero-info-bevel-color:
4268 * button-hero-info-glow-color:
4269 * button-hero-info-left-background-color:
4270 * button-hero-info-right-background-color:
4271 * button-hero-info-focus-left-background-color:
4272 * button-hero-info-focus-right-background-color:
4273 * button-hero-info-hover-left-background-color:
4274 * button-hero-info-hover-right-background-color:
4275 * button-hero-info-active-left-background-color:
4276 * button-hero-info-active-right-background-color:
4277 * button-hero-info-disabled-background-color:
4278 * button-hero-info-disabled-text-color:
4279 * button-hero-warning-text-color:
4280 * button-hero-warning-bevel-color:
4281 * button-hero-warning-glow-color:
4282 * button-hero-warning-left-background-color:
4283 * button-hero-warning-right-background-color:
4284 * button-hero-warning-focus-left-background-color:
4285 * button-hero-warning-focus-right-background-color:
4286 * button-hero-warning-hover-left-background-color:
4287 * button-hero-warning-hover-right-background-color:
4288 * button-hero-warning-active-left-background-color:
4289 * button-hero-warning-active-right-background-color:
4290 * button-hero-warning-disabled-background-color:
4291 * button-hero-warning-disabled-text-color:
4292 * button-hero-danger-text-color:
4293 * button-hero-danger-bevel-color:
4294 * button-hero-danger-glow-color:
4295 * button-hero-danger-left-background-color:
4296 * button-hero-danger-right-background-color:
4297 * button-hero-danger-focus-left-background-color:
4298 * button-hero-danger-focus-right-background-color:
4299 * button-hero-danger-hover-left-background-color:
4300 * button-hero-danger-hover-right-background-color:
4301 * button-hero-danger-active-left-background-color:
4302 * button-hero-danger-active-right-background-color:
4303 * button-hero-danger-disabled-background-color:
4304 * button-hero-danger-disabled-text-color:
4305 * button-hero-control-text-color:
4306 * button-hero-control-bevel-color:
4307 * button-hero-control-glow-color:
4308 * button-hero-control-left-background-color:
4309 * button-hero-control-right-background-color:
4310 * button-hero-control-focus-left-background-color:
4311 * button-hero-control-focus-right-background-color:
4312 * button-hero-control-hover-left-background-color:
4313 * button-hero-control-hover-right-background-color:
4314 * button-hero-control-active-left-background-color:
4315 * button-hero-control-active-right-background-color:
4316 * button-hero-control-disabled-background-color:
4317 * button-hero-control-disabled-text-color:
4318 */
4319var NbButtonComponent = /** @class */ (function (_super) {
4320 tslib.__extends(NbButtonComponent, _super);
4321 function NbButtonComponent(renderer, hostElement, cd, zone, statusService) {
4322 var _this = _super.call(this, renderer, hostElement, cd, zone, statusService) || this;
4323 _this.renderer = renderer;
4324 _this.hostElement = hostElement;
4325 _this.cd = cd;
4326 _this.zone = zone;
4327 _this.statusService = statusService;
4328 return _this;
4329 }
4330 Object.defineProperty(NbButtonComponent.prototype, "hero", {
4331 /**
4332 * Sets `hero` appearance
4333 */
4334 get: function () {
4335 return this.appearance === 'hero';
4336 },
4337 set: function (value) {
4338 if (convertToBoolProperty(value)) {
4339 this.appearance = 'hero';
4340 }
4341 },
4342 enumerable: false,
4343 configurable: true
4344 });
4345 Object.defineProperty(NbButtonComponent.prototype, "primary", {
4346 get: function () {
4347 return this.status === 'primary';
4348 },
4349 enumerable: false,
4350 configurable: true
4351 });
4352 Object.defineProperty(NbButtonComponent.prototype, "info", {
4353 get: function () {
4354 return this.status === 'info';
4355 },
4356 enumerable: false,
4357 configurable: true
4358 });
4359 Object.defineProperty(NbButtonComponent.prototype, "success", {
4360 get: function () {
4361 return this.status === 'success';
4362 },
4363 enumerable: false,
4364 configurable: true
4365 });
4366 Object.defineProperty(NbButtonComponent.prototype, "warning", {
4367 get: function () {
4368 return this.status === 'warning';
4369 },
4370 enumerable: false,
4371 configurable: true
4372 });
4373 Object.defineProperty(NbButtonComponent.prototype, "danger", {
4374 get: function () {
4375 return this.status === 'danger';
4376 },
4377 enumerable: false,
4378 configurable: true
4379 });
4380 Object.defineProperty(NbButtonComponent.prototype, "basic", {
4381 get: function () {
4382 return this.status === 'basic';
4383 },
4384 enumerable: false,
4385 configurable: true
4386 });
4387 Object.defineProperty(NbButtonComponent.prototype, "control", {
4388 get: function () {
4389 return this.status === 'control';
4390 },
4391 enumerable: false,
4392 configurable: true
4393 });
4394 /**
4395 * @private
4396 * Keep this handler to partially support anchor disabling.
4397 * Unlike button, anchor doesn't have 'disabled' DOM property,
4398 * so handler will be called anyway. We preventing navigation and bubbling.
4399 * Disabling is partial due to click handlers precedence. Consider example:
4400 * <a nbButton [disabled]="true" (click)="clickHandler()">...</a>
4401 * 'clickHandler' will be called before our host listener below. We can't prevent
4402 * such handlers call.
4403 */
4404 NbButtonComponent.prototype.onClick = function (event) {
4405 if (this.disabled) {
4406 event.preventDefault();
4407 event.stopImmediatePropagation();
4408 }
4409 };
4410 NbButtonComponent.decorators = [
4411 { type: i0.Component, args: [{
4412 selector: 'button[nbButton],a[nbButton],input[type="button"][nbButton],input[type="submit"][nbButton]',
4413 template: "\n <ng-content></ng-content>\n ",
4414 providers: [
4415 { provide: NbButton, useExisting: NbButtonComponent },
4416 ],
4417 changeDetection: i0.ChangeDetectionStrategy.OnPush
4418 },] }
4419 ];
4420 NbButtonComponent.ctorParameters = function () { return [
4421 { type: i0.Renderer2 },
4422 { type: i0.ElementRef },
4423 { type: i0.ChangeDetectorRef },
4424 { type: i0.NgZone },
4425 { type: NbStatusService }
4426 ]; };
4427 NbButtonComponent.propDecorators = {
4428 hero: [{ type: i0.Input }, { type: i0.HostBinding, args: ['class.appearance-hero',] }],
4429 primary: [{ type: i0.HostBinding, args: ['class.status-primary',] }],
4430 info: [{ type: i0.HostBinding, args: ['class.status-info',] }],
4431 success: [{ type: i0.HostBinding, args: ['class.status-success',] }],
4432 warning: [{ type: i0.HostBinding, args: ['class.status-warning',] }],
4433 danger: [{ type: i0.HostBinding, args: ['class.status-danger',] }],
4434 basic: [{ type: i0.HostBinding, args: ['class.status-basic',] }],
4435 control: [{ type: i0.HostBinding, args: ['class.status-control',] }],
4436 onClick: [{ type: i0.HostListener, args: ['click', ['$event'],] }]
4437 };
4438 return NbButtonComponent;
4439}(NbButton));
4440
4441/**
4442 * @license
4443 * Copyright Akveo. All Rights Reserved.
4444 * Licensed under the MIT License. See License.txt in the project root for license information.
4445 */
4446var NB_BUTTON_COMPONENTS = [
4447 NbButtonComponent,
4448];
4449var NbButtonModule = /** @class */ (function () {
4450 function NbButtonModule() {
4451 }
4452 NbButtonModule.decorators = [
4453 { type: i0.NgModule, args: [{
4454 imports: [
4455 NbSharedModule,
4456 ],
4457 declarations: tslib.__spreadArray([], NB_BUTTON_COMPONENTS),
4458 exports: tslib.__spreadArray([], NB_BUTTON_COMPONENTS),
4459 },] }
4460 ];
4461 return NbButtonModule;
4462}());
4463
4464/*
4465 * @license
4466 * Copyright Akveo. All Rights Reserved.
4467 * Licensed under the MIT License. See License.txt in the project root for license information.
4468 */
4469var NbDateService = /** @class */ (function () {
4470 function NbDateService() {
4471 this.DAYS_IN_WEEK = 7;
4472 /**
4473 * Number of hours in AM/PM day periods.
4474 **/
4475 this.HOURS_IN_DAY_PERIOD = 12;
4476 }
4477 NbDateService.prototype.setLocale = function (locale) {
4478 this.locale = locale;
4479 };
4480 /**
4481 * Checks if the date is between the start date and the end date.
4482 * */
4483 NbDateService.prototype.isBetween = function (date, start, end) {
4484 return this.compareDates(date, start) > 0 && this.compareDates(date, end) < 0;
4485 };
4486
4487 /**
4488 * Checks is two dates have the same day.
4489 * */
4490 NbDateService.prototype.isSameDaySafe = function (date1, date2) {
4491 return date1 && date2 && this.isSameDay(date1, date2);
4492 };
4493
4494 /**
4495 * Checks is two dates have the same month.
4496 * */
4497 NbDateService.prototype.isSameMonthSafe = function (date1, date2) {
4498 return date1 && date2 && this.isSameMonth(date1, date2);
4499 };
4500 /**
4501 * Checks is two dates have the same year.
4502 * */
4503 NbDateService.prototype.isSameYearSafe = function (date1, date2) {
4504 return date1 && date2 && this.isSameYear(date1, date2);
4505 };
4506 NbDateService.prototype.isSameHourAndMinute = function (date1, date2) {
4507 return this.isSameHour(date1, date2) && this.isSameMinute(date1, date2);
4508 };
4509 NbDateService.prototype.isSameHour = function (date1, date2) {
4510 return this.getHours(date1) === this.getHours(date2);
4511 };
4512 NbDateService.prototype.isSameMinute = function (date1, date2) {
4513 return this.getMinutes(date1) === this.getMinutes(date2);
4514 };
4515 NbDateService.prototype.getTwentyFourHoursFormat = function () {
4516 return 'HH:mm';
4517 };
4518 NbDateService.prototype.getTwentyFourHoursFormatWithSeconds = function () {
4519 return 'HH:mm:ss';
4520 };
4521 NbDateService.prototype.getTwelveHoursFormatWithSeconds = function () {
4522 return 'hh:mm:ss a';
4523 };
4524 NbDateService.prototype.getDayPeriod = function (date) {
4525 var isFirstDayPeriod = this.getHours(date) < this.HOURS_IN_DAY_PERIOD;
4526 if (isFirstDayPeriod) {
4527 return "AM" /* AM */;
4528 }
4529 else {
4530 return "PM" /* PM */;
4531 }
4532 };
4533 return NbDateService;
4534}());
4535
4536/**
4537 * @license
4538 * Copyright Akveo. All Rights Reserved.
4539 * Licensed under the MIT License. See License.txt in the project root for license information.
4540 */
4541var batch = function (target, batchSize, offset) {
4542 if (offset === void 0) { offset = 0; }
4543 return target.reduce(function (res, item, index) {
4544 var chunkIndex = Math.floor((index + offset) / batchSize);
4545 if (!res[chunkIndex]) {
4546 res[chunkIndex] = [];
4547 }
4548 res[chunkIndex].push(item);
4549 return res;
4550 }, []);
4551};
4552/**
4553 * returns array with numbers from first argument to bound.
4554 * */
4555var rangeFromTo = function (from$$1, to, producer) {
4556 if (to === void 0) { to = 0; }
4557 if (producer === void 0) { producer = function (i) { return i; }; }
4558 var arr = [];
4559 for (var i = from$$1; i < to; i++) {
4560 arr.push(producer(i));
4561 }
4562 return arr;
4563};
4564/**
4565 * returns array with numbers from zero to bound.
4566 * */
4567var range = function (bound, producer) {
4568 if (producer === void 0) { producer = function (i) { return i; }; }
4569 return rangeFromTo(0, bound, producer);
4570};
4571
4572/**
4573 * @license
4574 * Copyright Akveo. All Rights Reserved.
4575 * Licensed under the MIT License. See License.txt in the project root for license information.
4576 */
4577var NbCalendarMonthModelService = /** @class */ (function () {
4578 function NbCalendarMonthModelService(dateService) {
4579 this.dateService = dateService;
4580 }
4581 NbCalendarMonthModelService.prototype.createDaysGrid = function (activeMonth, boundingMonth) {
4582 if (boundingMonth === void 0) { boundingMonth = true; }
4583 var weeks = this.createDates(activeMonth);
4584 return this.withBoundingMonths(weeks, activeMonth, boundingMonth);
4585 };
4586 NbCalendarMonthModelService.prototype.createDates = function (activeMonth) {
4587 var days = this.createDateRangeForMonth(activeMonth);
4588 var startOfWeekDayDiff = this.getStartOfWeekDayDiff(activeMonth);
4589 return batch(days, this.dateService.DAYS_IN_WEEK, startOfWeekDayDiff);
4590 };
4591 NbCalendarMonthModelService.prototype.withBoundingMonths = function (weeks, activeMonth, boundingMonth) {
4592 var withBoundingMonths = weeks;
4593 if (this.isShouldAddPrevBoundingMonth(withBoundingMonths)) {
4594 withBoundingMonths = this.addPrevBoundingMonth(withBoundingMonths, activeMonth, boundingMonth);
4595 }
4596 if (this.isShouldAddNextBoundingMonth(withBoundingMonths)) {
4597 withBoundingMonths = this.addNextBoundingMonth(withBoundingMonths, activeMonth, boundingMonth);
4598 }
4599 return withBoundingMonths;
4600 };
4601 NbCalendarMonthModelService.prototype.addPrevBoundingMonth = function (weeks, activeMonth, boundingMonth) {
4602 var firstWeek = weeks.shift();
4603 var requiredItems = this.dateService.DAYS_IN_WEEK - firstWeek.length;
4604 firstWeek.unshift.apply(firstWeek, this.createPrevBoundingDays(activeMonth, boundingMonth, requiredItems));
4605 return tslib.__spreadArray([firstWeek], weeks);
4606 };
4607 NbCalendarMonthModelService.prototype.addNextBoundingMonth = function (weeks, activeMonth, boundingMonth) {
4608 var lastWeek = weeks.pop();
4609 var requiredItems = this.dateService.DAYS_IN_WEEK - lastWeek.length;
4610 lastWeek.push.apply(lastWeek, this.createNextBoundingDays(activeMonth, boundingMonth, requiredItems));
4611 return tslib.__spreadArray(tslib.__spreadArray([], weeks), [lastWeek]);
4612 };
4613 NbCalendarMonthModelService.prototype.createPrevBoundingDays = function (activeMonth, boundingMonth, requiredItems) {
4614 var month = this.dateService.addMonth(activeMonth, -1);
4615 var daysInMonth = this.dateService.getNumberOfDaysInMonth(month);
4616 return this.createDateRangeForMonth(month)
4617 .slice(daysInMonth - requiredItems)
4618 .map(function (date) { return boundingMonth ? date : null; });
4619 };
4620 NbCalendarMonthModelService.prototype.createNextBoundingDays = function (activeMonth, boundingMonth, requiredItems) {
4621 var month = this.dateService.addMonth(activeMonth, 1);
4622 return this.createDateRangeForMonth(month)
4623 .slice(0, requiredItems)
4624 .map(function (date) { return boundingMonth ? date : null; });
4625 };
4626 NbCalendarMonthModelService.prototype.getStartOfWeekDayDiff = function (date) {
4627 var startOfMonth = this.dateService.getMonthStart(date);
4628 return this.getWeekStartDiff(startOfMonth);
4629 };
4630 NbCalendarMonthModelService.prototype.getWeekStartDiff = function (date) {
4631 return (7 - this.dateService.getFirstDayOfWeek() + this.dateService.getDayOfWeek(date)) % 7;
4632 };
4633 NbCalendarMonthModelService.prototype.isShouldAddPrevBoundingMonth = function (weeks) {
4634 return weeks[0].length < this.dateService.DAYS_IN_WEEK;
4635 };
4636 NbCalendarMonthModelService.prototype.isShouldAddNextBoundingMonth = function (weeks) {
4637 return weeks[weeks.length - 1].length < this.dateService.DAYS_IN_WEEK;
4638 };
4639 NbCalendarMonthModelService.prototype.createDateRangeForMonth = function (date) {
4640 var _this = this;
4641 var daysInMonth = this.dateService.getNumberOfDaysInMonth(date);
4642 return range(daysInMonth, function (i) {
4643 var year = _this.dateService.getYear(date);
4644 var month = _this.dateService.getMonth(date);
4645 return _this.dateService.createDate(year, month, i + 1);
4646 });
4647 };
4648 NbCalendarMonthModelService.decorators = [
4649 { type: i0.Injectable }
4650 ];
4651 NbCalendarMonthModelService.ctorParameters = function () { return [
4652 { type: NbDateService }
4653 ]; };
4654 return NbCalendarMonthModelService;
4655}());
4656
4657/**
4658 * @license
4659 * Copyright Akveo. All Rights Reserved.
4660 * Licensed under the MIT License. See License.txt in the project root for license information.
4661 */
4662var NbCalendarDayCellComponent = /** @class */ (function () {
4663 function NbCalendarDayCellComponent(dateService) {
4664 this.dateService = dateService;
4665 this.size = exports.NbCalendarSize.MEDIUM;
4666 this.select = new i0.EventEmitter(true);
4667 this.dayCellClass = true;
4668 }
4669 Object.defineProperty(NbCalendarDayCellComponent.prototype, "today", {
4670 get: function () {
4671 return this.dateService.isSameDaySafe(this.date, this.dateService.today());
4672 },
4673 enumerable: false,
4674 configurable: true
4675 });
4676 Object.defineProperty(NbCalendarDayCellComponent.prototype, "boundingMonth", {
4677 get: function () {
4678 return !this.dateService.isSameMonthSafe(this.date, this.visibleDate);
4679 },
4680 enumerable: false,
4681 configurable: true
4682 });
4683 Object.defineProperty(NbCalendarDayCellComponent.prototype, "selected", {
4684 get: function () {
4685 return this.dateService.isSameDaySafe(this.date, this.selectedValue);
4686 },
4687 enumerable: false,
4688 configurable: true
4689 });
4690 Object.defineProperty(NbCalendarDayCellComponent.prototype, "empty", {
4691 get: function () {
4692 return !this.date;
4693 },
4694 enumerable: false,
4695 configurable: true
4696 });
4697 Object.defineProperty(NbCalendarDayCellComponent.prototype, "disabled", {
4698 get: function () {
4699 return this.smallerThanMin() || this.greaterThanMax() || this.dontFitFilter();
4700 },
4701 enumerable: false,
4702 configurable: true
4703 });
4704 Object.defineProperty(NbCalendarDayCellComponent.prototype, "isLarge", {
4705 get: function () {
4706 return this.size === exports.NbCalendarSize.LARGE;
4707 },
4708 enumerable: false,
4709 configurable: true
4710 });
4711 Object.defineProperty(NbCalendarDayCellComponent.prototype, "day", {
4712 get: function () {
4713 return this.date && this.dateService.getDate(this.date);
4714 },
4715 enumerable: false,
4716 configurable: true
4717 });
4718 NbCalendarDayCellComponent.prototype.onClick = function () {
4719 if (this.disabled || this.empty) {
4720 return;
4721 }
4722 this.select.emit(this.date);
4723 };
4724 NbCalendarDayCellComponent.prototype.smallerThanMin = function () {
4725 return this.date && this.min && this.dateService.compareDates(this.date, this.min) < 0;
4726 };
4727 NbCalendarDayCellComponent.prototype.greaterThanMax = function () {
4728 return this.date && this.max && this.dateService.compareDates(this.date, this.max) > 0;
4729 };
4730 NbCalendarDayCellComponent.prototype.dontFitFilter = function () {
4731 return this.date && this.filter && !this.filter(this.date);
4732 };
4733 NbCalendarDayCellComponent.decorators = [
4734 { type: i0.Component, args: [{
4735 selector: 'nb-calendar-day-cell',
4736 template: "\n <div class=\"cell-content\">\n {{ day }}\n </div>\n ",
4737 changeDetection: i0.ChangeDetectionStrategy.OnPush
4738 },] }
4739 ];
4740 NbCalendarDayCellComponent.ctorParameters = function () { return [
4741 { type: NbDateService }
4742 ]; };
4743 NbCalendarDayCellComponent.propDecorators = {
4744 date: [{ type: i0.Input }],
4745 selectedValue: [{ type: i0.Input }],
4746 visibleDate: [{ type: i0.Input }],
4747 min: [{ type: i0.Input }],
4748 max: [{ type: i0.Input }],
4749 filter: [{ type: i0.Input }],
4750 size: [{ type: i0.Input }],
4751 select: [{ type: i0.Output }],
4752 today: [{ type: i0.HostBinding, args: ['class.today',] }],
4753 boundingMonth: [{ type: i0.HostBinding, args: ['class.bounding-month',] }],
4754 selected: [{ type: i0.HostBinding, args: ['class.selected',] }],
4755 empty: [{ type: i0.HostBinding, args: ['class.empty',] }],
4756 disabled: [{ type: i0.HostBinding, args: ['class.disabled',] }],
4757 isLarge: [{ type: i0.HostBinding, args: ['class.size-large',] }],
4758 dayCellClass: [{ type: i0.HostBinding, args: ['class.day-cell',] }],
4759 onClick: [{ type: i0.HostListener, args: ['click',] }]
4760 };
4761 return NbCalendarDayCellComponent;
4762}());
4763
4764/**
4765 * @license
4766 * Copyright Akveo. All Rights Reserved.
4767 * Licensed under the MIT License. See License.txt in the project root for license information.
4768 */
4769/**
4770 * Provides capability pick days.
4771 * */
4772var NbCalendarDayPickerComponent = /** @class */ (function () {
4773 function NbCalendarDayPickerComponent(monthModel) {
4774 this.monthModel = monthModel;
4775 /**
4776 * Defines if we should render previous and next months
4777 * in the current month view.
4778 * */
4779 this.boundingMonths = true;
4780 this.cellComponent = NbCalendarDayCellComponent;
4781 /**
4782 * Size of the component.
4783 * Can be 'medium' which is default or 'large'.
4784 * */
4785 this.size = exports.NbCalendarSize.MEDIUM;
4786 this._showWeekNumber = false;
4787 /**
4788 * Fires newly selected date.
4789 * */
4790 this.dateChange = new i0.EventEmitter();
4791 }
4792 Object.defineProperty(NbCalendarDayPickerComponent.prototype, "setCellComponent", {
4793 /**
4794 * Custom day cell component. Have to implement `NbCalendarCell` interface.
4795 * */
4796 set: function (cellComponent) {
4797 if (cellComponent) {
4798 this.cellComponent = cellComponent;
4799 }
4800 },
4801 enumerable: false,
4802 configurable: true
4803 });
4804 Object.defineProperty(NbCalendarDayPickerComponent.prototype, "showWeekNumber", {
4805 /**
4806 * Determines should we show week numbers column.
4807 * False by default.
4808 * */
4809 get: function () {
4810 return this._showWeekNumber;
4811 },
4812 set: function (value) {
4813 this._showWeekNumber = convertToBoolProperty(value);
4814 },
4815 enumerable: false,
4816 configurable: true
4817 });
4818 Object.defineProperty(NbCalendarDayPickerComponent.prototype, "large", {
4819 get: function () {
4820 return this.size === exports.NbCalendarSize.LARGE;
4821 },
4822 enumerable: false,
4823 configurable: true
4824 });
4825 NbCalendarDayPickerComponent.prototype.ngOnChanges = function (_a) {
4826 var visibleDate = _a.visibleDate, boundingMonths = _a.boundingMonths;
4827 if (visibleDate || boundingMonths) {
4828 this.weeks = this.monthModel.createDaysGrid(this.visibleDate, this.boundingMonths);
4829 }
4830 };
4831 NbCalendarDayPickerComponent.prototype.onSelect = function (day) {
4832 this.dateChange.emit(day);
4833 };
4834 NbCalendarDayPickerComponent.decorators = [
4835 { type: i0.Component, args: [{
4836 selector: 'nb-calendar-day-picker',
4837 template: "\n <nb-calendar-week-numbers *ngIf=\"showWeekNumber\"\n [weeks]=\"weeks\"\n [size]=\"size\"\n [weekNumberSymbol]=\"weekNumberSymbol\">\n </nb-calendar-week-numbers>\n <div class=\"days-container\">\n <nb-calendar-days-names [size]=\"size\"></nb-calendar-days-names>\n <nb-calendar-picker\n [data]=\"weeks\"\n [visibleDate]=\"visibleDate\"\n [selectedValue]=\"date\"\n [cellComponent]=\"cellComponent\"\n [min]=\"min\"\n [max]=\"max\"\n [filter]=\"filter\"\n [size]=\"size\"\n (select)=\"onSelect($event)\">\n </nb-calendar-picker>\n </div>\n ",
4838 changeDetection: i0.ChangeDetectionStrategy.OnPush,
4839 styles: [":host{display:flex}.days-container{width:100%}\n"]
4840 },] }
4841 ];
4842 NbCalendarDayPickerComponent.ctorParameters = function () { return [
4843 { type: NbCalendarMonthModelService }
4844 ]; };
4845 NbCalendarDayPickerComponent.propDecorators = {
4846 visibleDate: [{ type: i0.Input }],
4847 boundingMonths: [{ type: i0.Input }],
4848 min: [{ type: i0.Input }],
4849 max: [{ type: i0.Input }],
4850 filter: [{ type: i0.Input }],
4851 setCellComponent: [{ type: i0.Input, args: ['cellComponent',] }],
4852 size: [{ type: i0.Input }],
4853 date: [{ type: i0.Input }],
4854 showWeekNumber: [{ type: i0.Input }],
4855 weekNumberSymbol: [{ type: i0.Input }],
4856 dateChange: [{ type: i0.Output }],
4857 large: [{ type: i0.HostBinding, args: ['class.size-large',] }]
4858 };
4859 return NbCalendarDayPickerComponent;
4860}());
4861
4862/**
4863 * @license
4864 * Copyright Akveo. All Rights Reserved.
4865 * Licensed under the MIT License. See License.txt in the project root for license information.
4866 */
4867var NbCalendarDaysNamesComponent = /** @class */ (function () {
4868 function NbCalendarDaysNamesComponent(dateService) {
4869 this.dateService = dateService;
4870 }
4871 Object.defineProperty(NbCalendarDaysNamesComponent.prototype, "isLarge", {
4872 get: function () {
4873 return this.size === exports.NbCalendarSize.LARGE;
4874 },
4875 enumerable: false,
4876 configurable: true
4877 });
4878 NbCalendarDaysNamesComponent.prototype.ngOnInit = function () {
4879 var days = this.createDaysNames();
4880 this.days = this.shiftStartOfWeek(days);
4881 };
4882 NbCalendarDaysNamesComponent.prototype.createDaysNames = function () {
4883 return this.dateService.getDayOfWeekNames()
4884 .map(this.markIfHoliday);
4885 };
4886 NbCalendarDaysNamesComponent.prototype.shiftStartOfWeek = function (days) {
4887 for (var i = 0; i < this.dateService.getFirstDayOfWeek(); i++) {
4888 days.push(days.shift());
4889 }
4890 return days;
4891 };
4892 NbCalendarDaysNamesComponent.prototype.markIfHoliday = function (name, i) {
4893 return { name: name, isHoliday: i % 6 === 0 };
4894 };
4895 NbCalendarDaysNamesComponent.decorators = [
4896 { type: i0.Component, args: [{
4897 selector: 'nb-calendar-days-names',
4898 template: "\n <div class=\"day\" *ngFor=\"let day of days\" [class.holiday]=\"day.isHoliday\">{{ day.name }}</div>\n ",
4899 changeDetection: i0.ChangeDetectionStrategy.OnPush,
4900 styles: [":host{display:flex;justify-content:space-between}:host .day{display:flex;align-items:center;justify-content:center}\n"]
4901 },] }
4902 ];
4903 NbCalendarDaysNamesComponent.ctorParameters = function () { return [
4904 { type: NbDateService }
4905 ]; };
4906 NbCalendarDaysNamesComponent.propDecorators = {
4907 size: [{ type: i0.Input }],
4908 isLarge: [{ type: i0.HostBinding, args: ['class.size-large',] }]
4909 };
4910 return NbCalendarDaysNamesComponent;
4911}());
4912
4913/**
4914 * @license
4915 * Copyright Akveo. All Rights Reserved.
4916 * Licensed under the MIT License. See License.txt in the project root for license information.
4917 */
4918var NbCalendarMonthCellComponent = /** @class */ (function () {
4919 function NbCalendarMonthCellComponent(dateService) {
4920 this.dateService = dateService;
4921 this.size = exports.NbCalendarSize.MEDIUM;
4922 this.select = new i0.EventEmitter(true);
4923 this.monthCellClass = true;
4924 }
4925 Object.defineProperty(NbCalendarMonthCellComponent.prototype, "selected", {
4926 get: function () {
4927 return this.dateService.isSameMonthSafe(this.date, this.selectedValue);
4928 },
4929 enumerable: false,
4930 configurable: true
4931 });
4932 Object.defineProperty(NbCalendarMonthCellComponent.prototype, "today", {
4933 get: function () {
4934 return this.dateService.isSameMonthSafe(this.date, this.dateService.today());
4935 },
4936 enumerable: false,
4937 configurable: true
4938 });
4939 Object.defineProperty(NbCalendarMonthCellComponent.prototype, "disabled", {
4940 get: function () {
4941 return this.smallerThanMin() || this.greaterThanMax();
4942 },
4943 enumerable: false,
4944 configurable: true
4945 });
4946 Object.defineProperty(NbCalendarMonthCellComponent.prototype, "isLarge", {
4947 get: function () {
4948 return this.size === exports.NbCalendarSize.LARGE;
4949 },
4950 enumerable: false,
4951 configurable: true
4952 });
4953 Object.defineProperty(NbCalendarMonthCellComponent.prototype, "month", {
4954 get: function () {
4955 return this.dateService.getMonthName(this.date);
4956 },
4957 enumerable: false,
4958 configurable: true
4959 });
4960 NbCalendarMonthCellComponent.prototype.onClick = function () {
4961 if (this.disabled) {
4962 return;
4963 }
4964 this.select.emit(this.date);
4965 };
4966 NbCalendarMonthCellComponent.prototype.smallerThanMin = function () {
4967 return this.date && this.min && this.dateService.compareDates(this.monthEnd(), this.min) < 0;
4968 };
4969 NbCalendarMonthCellComponent.prototype.greaterThanMax = function () {
4970 return this.date && this.max && this.dateService.compareDates(this.monthStart(), this.max) > 0;
4971 };
4972 NbCalendarMonthCellComponent.prototype.monthStart = function () {
4973 return this.dateService.getMonthStart(this.date);
4974 };
4975 NbCalendarMonthCellComponent.prototype.monthEnd = function () {
4976 return this.dateService.getMonthEnd(this.date);
4977 };
4978 NbCalendarMonthCellComponent.decorators = [
4979 { type: i0.Component, args: [{
4980 selector: 'nb-calendar-month-cell',
4981 template: "\n <div class=\"cell-content\">\n {{ month }}\n </div>\n ",
4982 changeDetection: i0.ChangeDetectionStrategy.OnPush
4983 },] }
4984 ];
4985 NbCalendarMonthCellComponent.ctorParameters = function () { return [
4986 { type: NbDateService }
4987 ]; };
4988 NbCalendarMonthCellComponent.propDecorators = {
4989 date: [{ type: i0.Input }],
4990 selectedValue: [{ type: i0.Input }],
4991 min: [{ type: i0.Input }],
4992 max: [{ type: i0.Input }],
4993 size: [{ type: i0.Input }],
4994 select: [{ type: i0.Output }],
4995 selected: [{ type: i0.HostBinding, args: ['class.selected',] }],
4996 today: [{ type: i0.HostBinding, args: ['class.today',] }],
4997 disabled: [{ type: i0.HostBinding, args: ['class.disabled',] }],
4998 isLarge: [{ type: i0.HostBinding, args: ['class.size-large',] }],
4999 monthCellClass: [{ type: i0.HostBinding, args: ['class.month-cell',] }],
5000 onClick: [{ type: i0.HostListener, args: ['click',] }]
5001 };
5002 return NbCalendarMonthCellComponent;
5003}());
5004
5005/**
5006 * @license
5007 * Copyright Akveo. All Rights Reserved.
5008 * Licensed under the MIT License. See License.txt in the project root for license information.
5009 */
5010var MONTHS_IN_VIEW = 12;
5011var MONTHS_IN_COLUMN = 4;
5012var NbCalendarMonthPickerComponent = /** @class */ (function () {
5013 function NbCalendarMonthPickerComponent(dateService) {
5014 this.dateService = dateService;
5015 this.size = exports.NbCalendarSize.MEDIUM;
5016 this.monthChange = new i0.EventEmitter();
5017 this.cellComponent = NbCalendarMonthCellComponent;
5018 }
5019 Object.defineProperty(NbCalendarMonthPickerComponent.prototype, "_cellComponent", {
5020 set: function (cellComponent) {
5021 if (cellComponent) {
5022 this.cellComponent = cellComponent;
5023 }
5024 },
5025 enumerable: false,
5026 configurable: true
5027 });
5028 Object.defineProperty(NbCalendarMonthPickerComponent.prototype, "large", {
5029 get: function () {
5030 return this.size === exports.NbCalendarSize.LARGE;
5031 },
5032 enumerable: false,
5033 configurable: true
5034 });
5035 NbCalendarMonthPickerComponent.prototype.ngOnChanges = function (changes) {
5036 if (changes.month) {
5037 this.initMonths();
5038 }
5039 };
5040 NbCalendarMonthPickerComponent.prototype.initMonths = function () {
5041 var date = this.dateService.getDate(this.month);
5042 var year = this.dateService.getYear(this.month);
5043 var firstMonth = this.dateService.createDate(year, 0, date);
5044 var months = [firstMonth];
5045 for (var monthIndex = 1; monthIndex < MONTHS_IN_VIEW; monthIndex++) {
5046 months.push(this.dateService.addMonth(firstMonth, monthIndex));
5047 }
5048 this.months = batch(months, MONTHS_IN_COLUMN);
5049 };
5050 NbCalendarMonthPickerComponent.prototype.onSelect = function (month) {
5051 this.monthChange.emit(month);
5052 };
5053 NbCalendarMonthPickerComponent.decorators = [
5054 { type: i0.Component, args: [{
5055 selector: 'nb-calendar-month-picker',
5056 template: "\n <nb-calendar-picker\n [data]=\"months\"\n [min]=\"min\"\n [max]=\"max\"\n [filter]=\"filter\"\n [selectedValue]=\"date\"\n [visibleDate]=\"month\"\n [cellComponent]=\"cellComponent\"\n [size]=\"size\"\n (select)=\"onSelect($event)\">\n </nb-calendar-picker>\n ",
5057 changeDetection: i0.ChangeDetectionStrategy.OnPush
5058 },] }
5059 ];
5060 NbCalendarMonthPickerComponent.ctorParameters = function () { return [
5061 { type: NbDateService }
5062 ]; };
5063 NbCalendarMonthPickerComponent.propDecorators = {
5064 min: [{ type: i0.Input }],
5065 max: [{ type: i0.Input }],
5066 filter: [{ type: i0.Input }],
5067 size: [{ type: i0.Input }],
5068 month: [{ type: i0.Input }],
5069 date: [{ type: i0.Input }],
5070 monthChange: [{ type: i0.Output }],
5071 _cellComponent: [{ type: i0.Input, args: ['cellComponent',] }],
5072 large: [{ type: i0.HostBinding, args: ['class.size-large',] }]
5073 };
5074 return NbCalendarMonthPickerComponent;
5075}());
5076
5077/*
5078 * @license
5079 * Copyright Akveo. All Rights Reserved.
5080 * Licensed under the MIT License. See License.txt in the project root for license information.
5081 */
5082var NbCalendarYearModelService = /** @class */ (function () {
5083 function NbCalendarYearModelService(dateService) {
5084 this.dateService = dateService;
5085 this.yearsInView = 12;
5086 this.yearsInRow = 4;
5087 }
5088 NbCalendarYearModelService.prototype.getYearsInView = function () {
5089 return this.yearsInView;
5090 };
5091 NbCalendarYearModelService.prototype.getYearsInRow = function () {
5092 return this.yearsInRow;
5093 };
5094 NbCalendarYearModelService.prototype.getViewYears = function (viewYear) {
5095 var _this = this;
5096 var year = this.dateService.getYear(viewYear);
5097 var viewStartYear;
5098 if (year >= 0) {
5099 viewStartYear = year - (year % this.yearsInView);
5100 }
5101 else {
5102 viewStartYear = year - (year % this.yearsInView + this.yearsInView);
5103 }
5104 var years = range(this.yearsInView).map(function (i) { return _this.copyWithYear(viewStartYear + i, viewYear); });
5105 return batch(years, this.yearsInRow);
5106 };
5107 NbCalendarYearModelService.prototype.copyWithYear = function (year, date) {
5108 return this.dateService.createDate(year, this.dateService.getMonth(date), this.dateService.getDate(date));
5109 };
5110 NbCalendarYearModelService.decorators = [
5111 { type: i0.Injectable }
5112 ];
5113 NbCalendarYearModelService.ctorParameters = function () { return [
5114 { type: NbDateService }
5115 ]; };
5116 return NbCalendarYearModelService;
5117}());
5118
5119/**
5120 * @license
5121 * Copyright Akveo. All Rights Reserved.
5122 * Licensed under the MIT License. See License.txt in the project root for license information.
5123 */
5124var NbCalendarViewModeComponent = /** @class */ (function () {
5125 function NbCalendarViewModeComponent(dateService, yearModelService) {
5126 this.dateService = dateService;
5127 this.yearModelService = yearModelService;
5128 this.viewMode = exports.NbCalendarViewMode.DATE;
5129 this.changeMode = new i0.EventEmitter(true);
5130 }
5131 NbCalendarViewModeComponent.prototype.getText = function () {
5132 if (!this.date) {
5133 return '';
5134 }
5135 switch (this.viewMode) {
5136 case exports.NbCalendarViewMode.DATE: {
5137 var month = this.dateService.getMonthName(this.date, _angular_common.TranslationWidth.Wide);
5138 var year = this.dateService.getYear(this.date);
5139 return month + " " + year;
5140 }
5141 case exports.NbCalendarViewMode.MONTH:
5142 return "" + this.dateService.getYear(this.date);
5143 case exports.NbCalendarViewMode.YEAR:
5144 return this.getFirstYear() + " - " + this.getLastYear();
5145 }
5146 };
5147 NbCalendarViewModeComponent.prototype.getIcon = function () {
5148 if (this.viewMode === exports.NbCalendarViewMode.DATE) {
5149 return 'chevron-down-outline';
5150 }
5151 return 'chevron-up-outline';
5152 };
5153 NbCalendarViewModeComponent.prototype.getFirstYear = function () {
5154 var years = this.yearModelService.getViewYears(this.date);
5155 return this.dateService.getYear(years[0][0]).toString();
5156 };
5157 NbCalendarViewModeComponent.prototype.getLastYear = function () {
5158 var years = this.yearModelService.getViewYears(this.date);
5159 var lastRow = years[years.length - 1];
5160 var lastYear = lastRow[lastRow.length - 1];
5161 return this.dateService.getYear(lastYear).toString();
5162 };
5163 NbCalendarViewModeComponent.decorators = [
5164 { type: i0.Component, args: [{
5165 selector: 'nb-calendar-view-mode',
5166 template: "\n <button nbButton (click)=\"changeMode.emit()\" ghost status=\"basic\">\n {{ getText() }}\n <nb-icon [icon]=\"getIcon()\" pack=\"nebular-essentials\"></nb-icon>\n </button>\n ",
5167 changeDetection: i0.ChangeDetectionStrategy.OnPush
5168 },] }
5169 ];
5170 NbCalendarViewModeComponent.ctorParameters = function () { return [
5171 { type: NbDateService },
5172 { type: NbCalendarYearModelService }
5173 ]; };
5174 NbCalendarViewModeComponent.propDecorators = {
5175 date: [{ type: i0.Input }],
5176 viewMode: [{ type: i0.Input }],
5177 changeMode: [{ type: i0.Output }]
5178 };
5179 return NbCalendarViewModeComponent;
5180}());
5181
5182/**
5183 * @license
5184 * Copyright Akveo. All Rights Reserved.
5185 * Licensed under the MIT License. See License.txt in the project root for license information.
5186 */
5187var NbCalendarPageableNavigationComponent = /** @class */ (function () {
5188 function NbCalendarPageableNavigationComponent(directionService) {
5189 this.directionService = directionService;
5190 this.next = new i0.EventEmitter();
5191 this.prev = new i0.EventEmitter();
5192 }
5193 Object.defineProperty(NbCalendarPageableNavigationComponent.prototype, "isLtr", {
5194 get: function () {
5195 return this.directionService.isLtr();
5196 },
5197 enumerable: false,
5198 configurable: true
5199 });
5200 NbCalendarPageableNavigationComponent.decorators = [
5201 { type: i0.Component, args: [{
5202 selector: 'nb-calendar-pageable-navigation',
5203 template: "\n <button nbButton (click)=\"prev.emit()\" ghost status=\"basic\" class=\"prev-month\">\n <nb-icon [icon]=\"isLtr ? 'chevron-left-outline' : 'chevron-right-outline'\" pack=\"nebular-essentials\"></nb-icon>\n </button>\n <button nbButton (click)=\"next.emit()\" ghost status=\"basic\" class=\"next-month\">\n <nb-icon [icon]=\"isLtr ? 'chevron-right-outline' : 'chevron-left-outline'\" pack=\"nebular-essentials\"></nb-icon>\n </button>\n ",
5204 styles: [":host{display:flex;align-items:center;justify-content:flex-start}\n"]
5205 },] }
5206 ];
5207 NbCalendarPageableNavigationComponent.ctorParameters = function () { return [
5208 { type: NbLayoutDirectionService }
5209 ]; };
5210 NbCalendarPageableNavigationComponent.propDecorators = {
5211 next: [{ type: i0.Output }],
5212 prev: [{ type: i0.Output }]
5213 };
5214 return NbCalendarPageableNavigationComponent;
5215}());
5216
5217/**
5218 * @license
5219 * Copyright Akveo. All Rights Reserved.
5220 * Licensed under the MIT License. See License.txt in the project root for license information.
5221 */
5222var NbCalendarPickerComponent = /** @class */ (function () {
5223 function NbCalendarPickerComponent() {
5224 this.size = exports.NbCalendarSize.MEDIUM;
5225 this.select = new i0.EventEmitter();
5226 }
5227 Object.defineProperty(NbCalendarPickerComponent.prototype, "isLarge", {
5228 get: function () {
5229 return this.size === exports.NbCalendarSize.LARGE;
5230 },
5231 enumerable: false,
5232 configurable: true
5233 });
5234 NbCalendarPickerComponent.decorators = [
5235 { type: i0.Component, args: [{
5236 selector: 'nb-calendar-picker',
5237 template: "\n <nb-calendar-picker-row\n *ngFor=\"let row of data\"\n [row]=\"row\"\n [visibleDate]=\"visibleDate\"\n [selectedValue]=\"selectedValue\"\n [component]=\"cellComponent\"\n [min]=\"min\"\n [max]=\"max\"\n [filter]=\"filter\"\n [size]=\"size\"\n (select)=\"select.emit($event)\">\n </nb-calendar-picker-row>\n ",
5238 changeDetection: i0.ChangeDetectionStrategy.OnPush
5239 },] }
5240 ];
5241 NbCalendarPickerComponent.propDecorators = {
5242 data: [{ type: i0.Input }],
5243 visibleDate: [{ type: i0.Input }],
5244 selectedValue: [{ type: i0.Input }],
5245 cellComponent: [{ type: i0.Input }],
5246 min: [{ type: i0.Input }],
5247 max: [{ type: i0.Input }],
5248 filter: [{ type: i0.Input }],
5249 size: [{ type: i0.Input }],
5250 select: [{ type: i0.Output }],
5251 isLarge: [{ type: i0.HostBinding, args: ['class.size-large',] }]
5252 };
5253 return NbCalendarPickerComponent;
5254}());
5255
5256/**
5257 * @license
5258 * Copyright Akveo. All Rights Reserved.
5259 * Licensed under the MIT License. See License.txt in the project root for license information.
5260 */
5261var NbCalendarPickerRowComponent = /** @class */ (function () {
5262 function NbCalendarPickerRowComponent(cfr) {
5263 this.cfr = cfr;
5264 this.size = exports.NbCalendarSize.MEDIUM;
5265 this.select = new i0.EventEmitter();
5266 }
5267 NbCalendarPickerRowComponent.prototype.ngOnChanges = function () {
5268 var _this = this;
5269 var factory = this.cfr.resolveComponentFactory(this.component);
5270 this.containerRef.clear();
5271 this.row.forEach(function (date) {
5272 var component = _this.containerRef.createComponent(factory);
5273 _this.patchWithContext(component.instance, date);
5274 component.changeDetectorRef.detectChanges();
5275 });
5276 };
5277 NbCalendarPickerRowComponent.prototype.patchWithContext = function (component, date) {
5278 component.visibleDate = this.visibleDate;
5279 component.selectedValue = this.selectedValue;
5280 component.date = date;
5281 component.min = this.min;
5282 component.max = this.max;
5283 component.filter = this.filter;
5284 component.size = this.size;
5285 component.select.subscribe(this.select.emit.bind(this.select));
5286 };
5287 NbCalendarPickerRowComponent.decorators = [
5288 { type: i0.Component, args: [{
5289 selector: 'nb-calendar-picker-row',
5290 template: '<ng-template></ng-template>',
5291 changeDetection: i0.ChangeDetectionStrategy.OnPush,
5292 styles: ["\n :host {\n display: flex;\n justify-content: space-between;\n }\n "]
5293 },] }
5294 ];
5295 NbCalendarPickerRowComponent.ctorParameters = function () { return [
5296 { type: i0.ComponentFactoryResolver }
5297 ]; };
5298 NbCalendarPickerRowComponent.propDecorators = {
5299 row: [{ type: i0.Input }],
5300 selectedValue: [{ type: i0.Input }],
5301 visibleDate: [{ type: i0.Input }],
5302 component: [{ type: i0.Input }],
5303 min: [{ type: i0.Input }],
5304 max: [{ type: i0.Input }],
5305 filter: [{ type: i0.Input }],
5306 size: [{ type: i0.Input }],
5307 select: [{ type: i0.Output }],
5308 containerRef: [{ type: i0.ViewChild, args: [i0.TemplateRef, { read: i0.ViewContainerRef, static: true },] }]
5309 };
5310 return NbCalendarPickerRowComponent;
5311}());
5312
5313/**
5314 * @license
5315 * Copyright Akveo. All Rights Reserved.
5316 * Licensed under the MIT License. See License.txt in the project root for license information.
5317 */
5318var NbCalendarYearCellComponent = /** @class */ (function () {
5319 function NbCalendarYearCellComponent(dateService) {
5320 this.dateService = dateService;
5321 this.size = exports.NbCalendarSize.MEDIUM;
5322 this.select = new i0.EventEmitter(true);
5323 this.yearCellClass = true;
5324 }
5325 Object.defineProperty(NbCalendarYearCellComponent.prototype, "selected", {
5326 get: function () {
5327 return this.dateService.isSameYearSafe(this.date, this.selectedValue);
5328 },
5329 enumerable: false,
5330 configurable: true
5331 });
5332 Object.defineProperty(NbCalendarYearCellComponent.prototype, "today", {
5333 get: function () {
5334 return this.dateService.isSameYearSafe(this.date, this.dateService.today());
5335 },
5336 enumerable: false,
5337 configurable: true
5338 });
5339 Object.defineProperty(NbCalendarYearCellComponent.prototype, "disabled", {
5340 get: function () {
5341 return this.smallerThanMin() || this.greaterThanMax();
5342 },
5343 enumerable: false,
5344 configurable: true
5345 });
5346 Object.defineProperty(NbCalendarYearCellComponent.prototype, "isLarge", {
5347 get: function () {
5348 return this.size === exports.NbCalendarSize.LARGE;
5349 },
5350 enumerable: false,
5351 configurable: true
5352 });
5353 Object.defineProperty(NbCalendarYearCellComponent.prototype, "year", {
5354 get: function () {
5355 return this.dateService.getYear(this.date);
5356 },
5357 enumerable: false,
5358 configurable: true
5359 });
5360 NbCalendarYearCellComponent.prototype.onClick = function () {
5361 if (this.disabled) {
5362 return;
5363 }
5364 this.select.emit(this.date);
5365 };
5366 NbCalendarYearCellComponent.prototype.smallerThanMin = function () {
5367 return this.date && this.min && this.dateService.compareDates(this.yearEnd(), this.min) < 0;
5368 };
5369 NbCalendarYearCellComponent.prototype.greaterThanMax = function () {
5370 return this.date && this.max && this.dateService.compareDates(this.yearStart(), this.max) > 0;
5371 };
5372 NbCalendarYearCellComponent.prototype.yearStart = function () {
5373 return this.dateService.getYearStart(this.date);
5374 };
5375 NbCalendarYearCellComponent.prototype.yearEnd = function () {
5376 return this.dateService.getYearEnd(this.date);
5377 };
5378 NbCalendarYearCellComponent.decorators = [
5379 { type: i0.Component, args: [{
5380 selector: 'nb-calendar-year-cell',
5381 template: "\n <div class=\"cell-content\">\n {{ year }}\n </div>\n ",
5382 changeDetection: i0.ChangeDetectionStrategy.OnPush
5383 },] }
5384 ];
5385 NbCalendarYearCellComponent.ctorParameters = function () { return [
5386 { type: NbDateService }
5387 ]; };
5388 NbCalendarYearCellComponent.propDecorators = {
5389 date: [{ type: i0.Input }],
5390 min: [{ type: i0.Input }],
5391 max: [{ type: i0.Input }],
5392 selectedValue: [{ type: i0.Input }],
5393 size: [{ type: i0.Input }],
5394 select: [{ type: i0.Output }],
5395 selected: [{ type: i0.HostBinding, args: ['class.selected',] }],
5396 today: [{ type: i0.HostBinding, args: ['class.today',] }],
5397 disabled: [{ type: i0.HostBinding, args: ['class.disabled',] }],
5398 isLarge: [{ type: i0.HostBinding, args: ['class.size-large',] }],
5399 yearCellClass: [{ type: i0.HostBinding, args: ['class.year-cell',] }],
5400 onClick: [{ type: i0.HostListener, args: ['click',] }]
5401 };
5402 return NbCalendarYearCellComponent;
5403}());
5404
5405/**
5406 * @license
5407 * Copyright Akveo. All Rights Reserved.
5408 * Licensed under the MIT License. See License.txt in the project root for license information.
5409 */
5410var NbCalendarYearPickerComponent = /** @class */ (function () {
5411 function NbCalendarYearPickerComponent(dateService, yearModelService) {
5412 this.dateService = dateService;
5413 this.yearModelService = yearModelService;
5414 this.cellComponent = NbCalendarYearCellComponent;
5415 this.size = exports.NbCalendarSize.MEDIUM;
5416 this.yearChange = new i0.EventEmitter();
5417 }
5418 Object.defineProperty(NbCalendarYearPickerComponent.prototype, "_cellComponent", {
5419 set: function (cellComponent) {
5420 if (cellComponent) {
5421 this.cellComponent = cellComponent;
5422 }
5423 },
5424 enumerable: false,
5425 configurable: true
5426 });
5427 Object.defineProperty(NbCalendarYearPickerComponent.prototype, "large", {
5428 get: function () {
5429 return this.size === exports.NbCalendarSize.LARGE;
5430 },
5431 enumerable: false,
5432 configurable: true
5433 });
5434 NbCalendarYearPickerComponent.prototype.ngOnChanges = function () {
5435 this.years = this.yearModelService.getViewYears(this.year);
5436 };
5437 NbCalendarYearPickerComponent.prototype.onSelect = function (year) {
5438 this.yearChange.emit(year);
5439 };
5440 NbCalendarYearPickerComponent.decorators = [
5441 { type: i0.Component, args: [{
5442 selector: 'nb-calendar-year-picker',
5443 template: "\n <nb-calendar-picker\n [data]=\"years\"\n [min]=\"min\"\n [max]=\"max\"\n [filter]=\"filter\"\n [selectedValue]=\"date\"\n [visibleDate]=\"year\"\n [cellComponent]=\"cellComponent\"\n [size]=\"size\"\n (select)=\"onSelect($event)\">\n </nb-calendar-picker>\n ",
5444 changeDetection: i0.ChangeDetectionStrategy.OnPush
5445 },] }
5446 ];
5447 NbCalendarYearPickerComponent.ctorParameters = function () { return [
5448 { type: NbDateService },
5449 { type: NbCalendarYearModelService }
5450 ]; };
5451 NbCalendarYearPickerComponent.propDecorators = {
5452 date: [{ type: i0.Input }],
5453 min: [{ type: i0.Input }],
5454 max: [{ type: i0.Input }],
5455 filter: [{ type: i0.Input }],
5456 _cellComponent: [{ type: i0.Input, args: ['cellComponent',] }],
5457 size: [{ type: i0.Input }],
5458 year: [{ type: i0.Input }],
5459 yearChange: [{ type: i0.Output }],
5460 large: [{ type: i0.HostBinding, args: ['class.size-large',] }]
5461 };
5462 return NbCalendarYearPickerComponent;
5463}());
5464
5465/*
5466 * @license
5467 * Copyright Akveo. All Rights Reserved.
5468 * Licensed under the MIT License. See License.txt in the project root for license information.
5469 */
5470var NbCalendarWeekNumberComponent = /** @class */ (function () {
5471 function NbCalendarWeekNumberComponent(dateService) {
5472 this.dateService = dateService;
5473 }
5474 Object.defineProperty(NbCalendarWeekNumberComponent.prototype, "isLarge", {
5475 get: function () {
5476 return this.size === exports.NbCalendarSize.LARGE;
5477 },
5478 enumerable: false,
5479 configurable: true
5480 });
5481 NbCalendarWeekNumberComponent.prototype.ngOnChanges = function (changes) {
5482 if (changes.weeks) {
5483 this.weekNumbers = this.getWeeks();
5484 }
5485 };
5486 NbCalendarWeekNumberComponent.prototype.getWeeks = function () {
5487 var _this = this;
5488 return this.weeks.map(function (week) {
5489 // Find last defined day as week could contain null days in case
5490 // boundingMonth set to false
5491 var lastDay = tslib.__spreadArray([], week).reverse().find(function (day) { return !!day; });
5492 // Use last day of the week to determine week number.
5493 // This way weeks which span between sibling years is marked first
5494 return _this.dateService.getWeekNumber(lastDay);
5495 });
5496 };
5497 NbCalendarWeekNumberComponent.decorators = [
5498 { type: i0.Component, args: [{
5499 selector: 'nb-calendar-week-numbers',
5500 template: "\n <div class=\"sign-container\">\n <div class=\"sign\">{{ weekNumberSymbol }}</div>\n </div>\n <div class=\"week-number\" *ngFor=\"let weekNumber of weekNumbers\">{{ weekNumber }}</div>\n ",
5501 changeDetection: i0.ChangeDetectionStrategy.OnPush,
5502 styles: [":host{display:flex;flex-direction:column}\n"]
5503 },] }
5504 ];
5505 NbCalendarWeekNumberComponent.ctorParameters = function () { return [
5506 { type: NbDateService }
5507 ]; };
5508 NbCalendarWeekNumberComponent.propDecorators = {
5509 weeks: [{ type: i0.Input }],
5510 size: [{ type: i0.Input }],
5511 weekNumberSymbol: [{ type: i0.Input }],
5512 isLarge: [{ type: i0.HostBinding, args: ['class.size-large',] }]
5513 };
5514 return NbCalendarWeekNumberComponent;
5515}());
5516
5517/**
5518 * @license
5519 * Copyright Akveo. All Rights Reserved.
5520 * Licensed under the MIT License. See License.txt in the project root for license information.
5521 */
5522/**
5523 * The `NbNativeDateService` is basic implementation of `NbDateService` using
5524 * native js date objects and angular localization services.
5525 * */
5526var NbNativeDateService = /** @class */ (function (_super) {
5527 tslib.__extends(NbNativeDateService, _super);
5528 function NbNativeDateService(locale) {
5529 var _this = _super.call(this) || this;
5530 _this.setLocale(locale);
5531 return _this;
5532 }
5533 NbNativeDateService.prototype.setLocale = function (locale) {
5534 _super.prototype.setLocale.call(this, locale);
5535 this.datePipe = new _angular_common.DatePipe(locale);
5536 };
5537 NbNativeDateService.prototype.setHours = function (date, hour) {
5538 var result = this.clone(date);
5539 result.setHours(hour);
5540 return result;
5541 };
5542 NbNativeDateService.prototype.setMinutes = function (date, minute) {
5543 var result = this.clone(date);
5544 result.setMinutes(minute);
5545 return result;
5546 };
5547 NbNativeDateService.prototype.setSeconds = function (date, second) {
5548 var result = this.clone(date);
5549 result.setSeconds(second);
5550 return result;
5551 };
5552 NbNativeDateService.prototype.setMilliseconds = function (date, second) {
5553 var result = this.clone(date);
5554 result.setMilliseconds(second);
5555 return result;
5556 };
5557 NbNativeDateService.prototype.isValidDateString = function (date, format) {
5558 return !isNaN(this.parse(date, format).getTime());
5559 };
5560 NbNativeDateService.prototype.isValidTimeString = function (date, format) {
5561 return this.isValidDateString(date, format);
5562 };
5563 NbNativeDateService.prototype.today = function () {
5564 return new Date();
5565 };
5566 NbNativeDateService.prototype.getLocaleTimeFormat = function () {
5567 return _angular_common.getLocaleTimeFormat(this.locale, _angular_common.FormatWidth.Short);
5568 };
5569 NbNativeDateService.prototype.getDate = function (date) {
5570 return date.getDate();
5571 };
5572 NbNativeDateService.prototype.getMonth = function (date) {
5573 return date.getMonth();
5574 };
5575 NbNativeDateService.prototype.getYear = function (date) {
5576 return date.getFullYear();
5577 };
5578 NbNativeDateService.prototype.getDayOfWeek = function (date) {
5579 return date.getDay();
5580 };
5581 /**
5582 * returns first day of the week, it can be 1 if week starts from monday
5583 * and 0 if from sunday and so on.
5584 * */
5585 NbNativeDateService.prototype.getFirstDayOfWeek = function () {
5586 return _angular_common.getLocaleFirstDayOfWeek(this.locale);
5587 };
5588 NbNativeDateService.prototype.getMonthName = function (date, style$$1) {
5589 if (style$$1 === void 0) { style$$1 = _angular_common.TranslationWidth.Abbreviated; }
5590 var index = date.getMonth();
5591 return this.getMonthNameByIndex(index, style$$1);
5592 };
5593 NbNativeDateService.prototype.getMonthNameByIndex = function (index, style$$1) {
5594 if (style$$1 === void 0) { style$$1 = _angular_common.TranslationWidth.Abbreviated; }
5595 return _angular_common.getLocaleMonthNames(this.locale, _angular_common.FormStyle.Format, style$$1)[index];
5596 };
5597 NbNativeDateService.prototype.getDayOfWeekNames = function () {
5598 return tslib.__spreadArray([], _angular_common.getLocaleDayNames(this.locale, _angular_common.FormStyle.Format, _angular_common.TranslationWidth.Short));
5599 };
5600 NbNativeDateService.prototype.format = function (date, format) {
5601 return this.datePipe.transform(date, format);
5602 };
5603 /**
5604 * We haven't got capability to parse date using formatting without third party libraries.
5605 * */
5606 NbNativeDateService.prototype.parse = function (date, format) {
5607 return new Date(Date.parse(date));
5608 };
5609 NbNativeDateService.prototype.addDay = function (date, num) {
5610 return this.createDate(date.getFullYear(), date.getMonth(), date.getDate() + num);
5611 };
5612 NbNativeDateService.prototype.addMonth = function (date, num) {
5613 var month = this.createDate(date.getFullYear(), date.getMonth() + num, 1);
5614 // In case of date has more days than calculated month js Date will change that month to the next one
5615 // because of the date overflow.
5616 month.setDate(Math.min(date.getDate(), this.getMonthEnd(month).getDate()));
5617 return month;
5618 };
5619 NbNativeDateService.prototype.addMinutes = function (date, minute) {
5620 var result = new Date(date);
5621 result.setMinutes(date.getMinutes() + minute);
5622 return result;
5623 };
5624 NbNativeDateService.prototype.addHours = function (date, hour) {
5625 var result = new Date(date);
5626 result.setHours(date.getHours() + hour);
5627 return result;
5628 };
5629 NbNativeDateService.prototype.getHours = function (date) {
5630 return date.getHours();
5631 };
5632 NbNativeDateService.prototype.getMinutes = function (date) {
5633 return date.getMinutes();
5634 };
5635 NbNativeDateService.prototype.getSeconds = function (date) {
5636 return date.getSeconds();
5637 };
5638 NbNativeDateService.prototype.getMilliseconds = function (date) {
5639 return date.getMilliseconds();
5640 };
5641 NbNativeDateService.prototype.addYear = function (date, num) {
5642 return this.createDate(date.getFullYear() + num, date.getMonth(), date.getDate());
5643 };
5644 NbNativeDateService.prototype.clone = function (date) {
5645 return new Date(date.getTime());
5646 };
5647 NbNativeDateService.prototype.compareDates = function (date1, date2) {
5648 return date1.getTime() - date2.getTime();
5649 };
5650 NbNativeDateService.prototype.createDate = function (year, month, date) {
5651 var result = new Date(year, month, date);
5652 // We need to correct for the fact that JS native Date treats years in range [0, 99] as
5653 // abbreviations for 19xx.
5654 if (year >= 0 && year < 100) {
5655 result.setFullYear(result.getFullYear() - 1900);
5656 }
5657 return result;
5658 };
5659 NbNativeDateService.prototype.getMonthEnd = function (date) {
5660 return this.createDate(date.getFullYear(), date.getMonth() + 1, 0);
5661 };
5662 NbNativeDateService.prototype.getMonthStart = function (date) {
5663 return this.createDate(date.getFullYear(), date.getMonth(), 1);
5664 };
5665 NbNativeDateService.prototype.getNumberOfDaysInMonth = function (date) {
5666 return this.getMonthEnd(date).getDate();
5667 };
5668 NbNativeDateService.prototype.getYearEnd = function (date) {
5669 return this.createDate(date.getFullYear(), 11, 31);
5670 };
5671 NbNativeDateService.prototype.getYearStart = function (date) {
5672 return this.createDate(date.getFullYear(), 0, 1);
5673 };
5674 NbNativeDateService.prototype.valueOf = function (date) {
5675 return date.valueOf();
5676 };
5677 NbNativeDateService.prototype.isSameDay = function (date1, date2) {
5678 return this.isSameMonth(date1, date2) &&
5679 date1.getDate() === date2.getDate();
5680 };
5681 NbNativeDateService.prototype.isSameMonth = function (date1, date2) {
5682 return this.isSameYear(date1, date2) &&
5683 date1.getMonth() === date2.getMonth();
5684 };
5685 NbNativeDateService.prototype.isSameYear = function (date1, date2) {
5686 return date1.getFullYear() === date2.getFullYear();
5687 };
5688 NbNativeDateService.prototype.getId = function () {
5689 return 'native';
5690 };
5691 NbNativeDateService.prototype.getWeekNumber = function (date) {
5692 return parseInt(this.datePipe.transform(date, 'w'), 10);
5693 };
5694 NbNativeDateService.prototype.getDateFormat = function () {
5695 return 'yyyy-MM-dd';
5696 };
5697 NbNativeDateService.prototype.getTwelveHoursFormat = function () {
5698 return 'hh:mm a';
5699 };
5700 NbNativeDateService.decorators = [
5701 { type: i0.Injectable }
5702 ];
5703 NbNativeDateService.ctorParameters = function () { return [
5704 { type: String, decorators: [{ type: i0.Inject, args: [i0.LOCALE_ID,] }] }
5705 ]; };
5706 return NbNativeDateService;
5707}(NbDateService));
5708
5709var NbCalendarTimeModelService = /** @class */ (function () {
5710 function NbCalendarTimeModelService(dateService) {
5711 this.dateService = dateService;
5712 this.MINUTES_AND_SECONDS = 60;
5713 }
5714 NbCalendarTimeModelService.prototype.getHoursRange = function (step) {
5715 if (step === void 0) { step = this.MINUTES_AND_SECONDS; }
5716 var date = this.getResetTime();
5717 var endDate = this.dateService.addDay(date, 1);
5718 var result = [];
5719 while (this.dateService.compareDates(date, endDate) < 0) {
5720 result.push(date);
5721 date = this.dateService.addMinutes(date, step);
5722 }
5723 return result;
5724 };
5725 NbCalendarTimeModelService.prototype.getResetTime = function () {
5726 var today = this.dateService.today();
5727 today = this.dateService.setHours(today, 0);
5728 today = this.dateService.setMinutes(today, 0);
5729 today = this.dateService.setSeconds(today, 0);
5730 today = this.dateService.setMilliseconds(today, 0);
5731 return today;
5732 };
5733 NbCalendarTimeModelService.prototype.paddToTwoSymbols = function (n) {
5734 if (n < 10) {
5735 return '0' + n;
5736 }
5737 return n.toString();
5738 };
5739 NbCalendarTimeModelService.prototype.buildDateFormat = function (twelveHoursFormat, withSeconds) {
5740 if (withSeconds === void 0) { withSeconds = false; }
5741 if (twelveHoursFormat) {
5742 return this.dateService.getDateFormat() + " " + this.dateService.getTwelveHoursFormat();
5743 }
5744 if (withSeconds) {
5745 return this.dateService.getDateFormat() + " " + this.dateService.getTwentyFourHoursFormatWithSeconds();
5746 }
5747 return this.dateService.getDateFormat() + " " + this.dateService.getTwentyFourHoursFormat();
5748 };
5749 NbCalendarTimeModelService.decorators = [
5750 { type: i0.Injectable }
5751 ];
5752 NbCalendarTimeModelService.ctorParameters = function () { return [
5753 { type: NbDateService }
5754 ]; };
5755 return NbCalendarTimeModelService;
5756}());
5757
5758var NbCalendarActionsComponent = /** @class */ (function () {
5759 function NbCalendarActionsComponent() {
5760 this._applyButtonText = 'ok';
5761 this._currentTimeButtonText = 'now';
5762 this.setCurrentTime = new i0.EventEmitter();
5763 this.saveValue = new i0.EventEmitter();
5764 }
5765 Object.defineProperty(NbCalendarActionsComponent.prototype, "applyButtonText", {
5766 set: function (value) {
5767 if (value) {
5768 this._applyButtonText = value;
5769 }
5770 },
5771 enumerable: false,
5772 configurable: true
5773 });
5774
5775 Object.defineProperty(NbCalendarActionsComponent.prototype, "applyText", {
5776 get: function () {
5777 return this._applyButtonText;
5778 },
5779 enumerable: false,
5780 configurable: true
5781 });
5782
5783 Object.defineProperty(NbCalendarActionsComponent.prototype, "currentTimeButtonText", {
5784 set: function (value) {
5785 if (value) {
5786 this._currentTimeButtonText = value;
5787 }
5788 },
5789 enumerable: false,
5790 configurable: true
5791 });
5792 Object.defineProperty(NbCalendarActionsComponent.prototype, "currentTimeText", {
5793 get: function () {
5794 return this._currentTimeButtonText;
5795 },
5796 enumerable: false,
5797 configurable: true
5798 });
5799
5800 NbCalendarActionsComponent.decorators = [
5801 { type: i0.Component, args: [{
5802 selector: 'nb-calendar-actions',
5803 template: "\n <button\n nbButton\n ghost\n status=\"primary\"\n size=\"small\"\n (click)=\"setCurrentTime.emit()\">\n {{ currentTimeText }}</button>\n <button\n nbButton\n status=\"primary\"\n size=\"small\"\n (click)=\"saveValue.emit()\">\n {{ applyText }}</button>\n ",
5804 changeDetection: i0.ChangeDetectionStrategy.OnPush,
5805 styles: [":host{display:flex;justify-content:space-between}\n"]
5806 },] }
5807 ];
5808 NbCalendarActionsComponent.propDecorators = {
5809 applyButtonText: [{ type: i0.Input }],
5810 currentTimeButtonText: [{ type: i0.Input }],
5811 setCurrentTime: [{ type: i0.Output }],
5812 saveValue: [{ type: i0.Output }]
5813 };
5814 return NbCalendarActionsComponent;
5815}());
5816
5817/**
5818 * @license
5819 * Copyright Akveo. All Rights Reserved.
5820 * Licensed under the MIT License. See License.txt in the project root for license information.
5821 */
5822var SERVICES = [
5823 { provide: NbDateService, useClass: NbNativeDateService },
5824 _angular_common.DatePipe,
5825 NbCalendarMonthModelService,
5826 NbCalendarYearModelService,
5827 NbCalendarTimeModelService,
5828];
5829var COMPONENTS = [
5830 NbCalendarViewModeComponent,
5831 NbCalendarPageableNavigationComponent,
5832 NbCalendarDaysNamesComponent,
5833 NbCalendarYearPickerComponent,
5834 NbCalendarMonthPickerComponent,
5835 NbCalendarDayPickerComponent,
5836 NbCalendarDayCellComponent,
5837 NbCalendarActionsComponent,
5838 NbCalendarMonthCellComponent,
5839 NbCalendarYearCellComponent,
5840 NbCalendarPickerRowComponent,
5841 NbCalendarPickerComponent,
5842 NbCalendarWeekNumberComponent,
5843];
5844/**
5845 * `NbCalendarKitModule` is a module that contains multiple useful components for building custom calendars.
5846 * So if you think our calendars is not enough powerful for you just use calendar-kit and build your own calendar!
5847 *
5848 * Available components:
5849 * - `NbCalendarDayPicker`
5850 * - `NbCalendarDayCell`
5851 * - `NbCalendarMonthPicker`
5852 * - `NbCalendarMonthCell`
5853 * - `NbCalendarYearPicker`
5854 * - `NbCalendarYearCell`
5855 * - `NbCalendarViewModeComponent`
5856 * - `NbCalendarPageableNavigation`
5857 *
5858 * For example you can easily build full calendar:
5859 * @stacked-example(Full calendar, calendar-kit/calendar-kit-full-calendar.component)
5860 * */
5861var NbCalendarKitModule = /** @class */ (function () {
5862 function NbCalendarKitModule() {
5863 }
5864 NbCalendarKitModule.decorators = [
5865 { type: i0.NgModule, args: [{
5866 imports: [NbSharedModule, NbButtonModule, NbIconModule],
5867 exports: tslib.__spreadArray([], COMPONENTS),
5868 declarations: tslib.__spreadArray([], COMPONENTS),
5869 providers: tslib.__spreadArray([], SERVICES),
5870 entryComponents: [
5871 NbCalendarDayCellComponent,
5872 NbCalendarMonthCellComponent,
5873 NbCalendarYearCellComponent,
5874 ],
5875 },] }
5876 ];
5877 return NbCalendarKitModule;
5878}());
5879
5880/**
5881 * @license
5882 * Copyright Akveo. All Rights Reserved.
5883 * Licensed under the MIT License. See License.txt in the project root for license information.
5884 */
5885/**
5886 * The basis for calendar and range calendar components.
5887 * Encapsulates common behavior - store calendar state and perform navigation
5888 * between pickers.
5889 * */
5890var NbBaseCalendarComponent = /** @class */ (function () {
5891 function NbBaseCalendarComponent(dateService, yearModelService) {
5892 this.dateService = dateService;
5893 this.yearModelService = yearModelService;
5894 /**
5895 * Defines if we should render previous and next months
5896 * in the current month view.
5897 * */
5898 this.boundingMonth = true;
5899 /**
5900 * Defines active view for calendar.
5901 * */
5902 this.activeViewMode = exports.NbCalendarViewMode.DATE;
5903 /**
5904 * Size of the calendar and entire components.
5905 * Can be 'medium' which is default or 'large'.
5906 * */
5907 this.size = exports.NbCalendarSize.MEDIUM;
5908 /**
5909 * Determines whether we should show calendar navigation or not.
5910 * */
5911 this.showNavigation = true;
5912 this._showWeekNumber = false;
5913 /**
5914 * Emits date when selected.
5915 * */
5916 this.dateChange = new i0.EventEmitter();
5917 this.ViewMode = exports.NbCalendarViewMode;
5918 }
5919 Object.defineProperty(NbBaseCalendarComponent.prototype, "showWeekNumber", {
5920 /**
5921 * Determines should we show week numbers column.
5922 * False by default.
5923 * */
5924 get: function () {
5925 return this._showWeekNumber;
5926 },
5927 set: function (value) {
5928 this._showWeekNumber = convertToBoolProperty(value);
5929 },
5930 enumerable: false,
5931 configurable: true
5932 });
5933 NbBaseCalendarComponent.prototype.ngOnInit = function () {
5934 if (!this.visibleDate) {
5935 this.visibleDate = this.dateService.today();
5936 }
5937 };
5938 Object.defineProperty(NbBaseCalendarComponent.prototype, "large", {
5939 get: function () {
5940 return this.size === exports.NbCalendarSize.LARGE;
5941 },
5942 enumerable: false,
5943 configurable: true
5944 });
5945 NbBaseCalendarComponent.prototype.setViewMode = function (viewMode) {
5946 this.activeViewMode = viewMode;
5947 };
5948 NbBaseCalendarComponent.prototype.setVisibleDate = function (visibleDate) {
5949 this.visibleDate = visibleDate;
5950 };
5951 NbBaseCalendarComponent.prototype.prevMonth = function () {
5952 this.changeVisibleMonth(-1);
5953 };
5954 NbBaseCalendarComponent.prototype.nextMonth = function () {
5955 this.changeVisibleMonth(1);
5956 };
5957 NbBaseCalendarComponent.prototype.prevYear = function () {
5958 this.changeVisibleYear(-1);
5959 };
5960 NbBaseCalendarComponent.prototype.nextYear = function () {
5961 this.changeVisibleYear(1);
5962 };
5963 NbBaseCalendarComponent.prototype.prevYears = function () {
5964 this.changeVisibleYears(-1);
5965 };
5966 NbBaseCalendarComponent.prototype.nextYears = function () {
5967 this.changeVisibleYears(1);
5968 };
5969 NbBaseCalendarComponent.prototype.navigatePrev = function () {
5970 switch (this.activeViewMode) {
5971 case exports.NbCalendarViewMode.DATE:
5972 return this.prevMonth();
5973 case exports.NbCalendarViewMode.MONTH:
5974 return this.prevYear();
5975 case exports.NbCalendarViewMode.YEAR:
5976 return this.prevYears();
5977 }
5978 };
5979 NbBaseCalendarComponent.prototype.navigateNext = function () {
5980 switch (this.activeViewMode) {
5981 case exports.NbCalendarViewMode.DATE:
5982 return this.nextMonth();
5983 case exports.NbCalendarViewMode.MONTH:
5984 return this.nextYear();
5985 case exports.NbCalendarViewMode.YEAR:
5986 return this.nextYears();
5987 }
5988 };
5989 NbBaseCalendarComponent.prototype.onChangeViewMode = function () {
5990 if (this.activeViewMode === exports.NbCalendarViewMode.DATE) {
5991 return this.setViewMode(exports.NbCalendarViewMode.YEAR);
5992 }
5993 this.setViewMode(exports.NbCalendarViewMode.DATE);
5994 };
5995 NbBaseCalendarComponent.prototype.changeVisibleMonth = function (direction) {
5996 this.visibleDate = this.dateService.addMonth(this.visibleDate, direction);
5997 };
5998 NbBaseCalendarComponent.prototype.changeVisibleYear = function (direction) {
5999 this.visibleDate = this.dateService.addYear(this.visibleDate, direction);
6000 };
6001 NbBaseCalendarComponent.prototype.changeVisibleYears = function (direction) {
6002 this.visibleDate = this.dateService.addYear(this.visibleDate, direction * this.yearModelService.getYearsInView());
6003 };
6004 NbBaseCalendarComponent.decorators = [
6005 { type: i0.Component, args: [{
6006 selector: 'nb-base-calendar',
6007 template: "<nb-card>\n <nb-card-header *ngIf=\"showNavigation\" class=\"calendar-navigation\">\n <nb-calendar-view-mode [date]=\"visibleDate\"\n [viewMode]=\"activeViewMode\"\n (changeMode)=\"onChangeViewMode()\">\n </nb-calendar-view-mode>\n\n <nb-calendar-pageable-navigation (prev)=\"navigatePrev()\" (next)=\"navigateNext()\">\n </nb-calendar-pageable-navigation>\n </nb-card-header>\n\n <nb-card-body [ngSwitch]=\"activeViewMode\">\n\n <nb-calendar-day-picker *ngSwitchCase=\"ViewMode.DATE\"\n [boundingMonths]=\"boundingMonth\"\n [cellComponent]=\"dayCellComponent\"\n [min]=\"min\"\n [max]=\"max\"\n [filter]=\"filter\"\n [visibleDate]=\"visibleDate\"\n [size]=\"size\"\n [date]=\"date\"\n [showWeekNumber]=\"showWeekNumber\"\n (dateChange)=\"dateChange.emit($any($event))\"\n [weekNumberSymbol]=\"weekNumberSymbol\">\n </nb-calendar-day-picker>\n\n <nb-calendar-year-picker *ngSwitchCase=\"ViewMode.YEAR\"\n [cellComponent]=\"yearCellComponent\"\n [date]=\"$any(date)\"\n [min]=\"min\"\n [max]=\"max\"\n [filter]=\"filter\"\n [size]=\"size\"\n [year]=\"visibleDate\"\n (yearChange)=\"setVisibleDate($event); setViewMode(ViewMode.MONTH)\">\n </nb-calendar-year-picker>\n\n <nb-calendar-month-picker *ngSwitchCase=\"ViewMode.MONTH\"\n [cellComponent]=\"monthCellComponent\"\n [min]=\"min\"\n [max]=\"max\"\n [filter]=\"filter\"\n [size]=\"size\"\n [month]=\"visibleDate\"\n [date]=\"$any(date)\"\n (monthChange)=\"setVisibleDate($event); setViewMode(ViewMode.DATE)\">\n </nb-calendar-month-picker>\n\n </nb-card-body>\n\n</nb-card>\n"
6008 },] }
6009 ];
6010 NbBaseCalendarComponent.ctorParameters = function () { return [
6011 { type: NbDateService },
6012 { type: NbCalendarYearModelService }
6013 ]; };
6014 NbBaseCalendarComponent.propDecorators = {
6015 boundingMonth: [{ type: i0.Input }],
6016 activeViewMode: [{ type: i0.Input, args: ['startView',] }],
6017 min: [{ type: i0.Input }],
6018 max: [{ type: i0.Input }],
6019 filter: [{ type: i0.Input }],
6020 dayCellComponent: [{ type: i0.Input }],
6021 monthCellComponent: [{ type: i0.Input }],
6022 yearCellComponent: [{ type: i0.Input }],
6023 size: [{ type: i0.Input }],
6024 visibleDate: [{ type: i0.Input }],
6025 showNavigation: [{ type: i0.Input }, { type: i0.HostBinding, args: ['class.has-navigation',] }],
6026 date: [{ type: i0.Input }],
6027 showWeekNumber: [{ type: i0.Input }, { type: i0.HostBinding, args: ['class.has-week-number',] }],
6028 weekNumberSymbol: [{ type: i0.Input }],
6029 dateChange: [{ type: i0.Output }],
6030 large: [{ type: i0.HostBinding, args: ['class.size-large',] }]
6031 };
6032 return NbBaseCalendarComponent;
6033}());
6034
6035/**
6036 * @license
6037 * Copyright Akveo. All Rights Reserved.
6038 * Licensed under the MIT License. See License.txt in the project root for license information.
6039 */
6040var NbBaseCalendarModule = /** @class */ (function () {
6041 function NbBaseCalendarModule() {
6042 }
6043 NbBaseCalendarModule.decorators = [
6044 { type: i0.NgModule, args: [{
6045 imports: [NbCalendarKitModule, NbSharedModule, NbCardModule],
6046 exports: [NbBaseCalendarComponent],
6047 declarations: [NbBaseCalendarComponent],
6048 },] }
6049 ];
6050 return NbBaseCalendarModule;
6051}());
6052
6053/**
6054 * @license
6055 * Copyright Akveo. All Rights Reserved.
6056 * Licensed under the MIT License. See License.txt in the project root for license information.
6057 */
6058var NbCalendarModule = /** @class */ (function () {
6059 function NbCalendarModule() {
6060 }
6061 NbCalendarModule.decorators = [
6062 { type: i0.NgModule, args: [{
6063 imports: [NbBaseCalendarModule],
6064 exports: [NbCalendarComponent],
6065 declarations: [NbCalendarComponent],
6066 },] }
6067 ];
6068 return NbCalendarModule;
6069}());
6070
6071/**
6072 * @license
6073 * Copyright Akveo. All Rights Reserved.
6074 * Licensed under the MIT License. See License.txt in the project root for license information.
6075 */
6076var NbBaseCalendarRangeCell = /** @class */ (function () {
6077 function NbBaseCalendarRangeCell() {
6078 }
6079 Object.defineProperty(NbBaseCalendarRangeCell.prototype, "hasRange", {
6080 get: function () {
6081 return !!(this.selectedValue && this.selectedValue.start && this.selectedValue.end);
6082 },
6083 enumerable: false,
6084 configurable: true
6085 });
6086 return NbBaseCalendarRangeCell;
6087}());
6088
6089/**
6090 * @license
6091 * Copyright Akveo. All Rights Reserved.
6092 * Licensed under the MIT License. See License.txt in the project root for license information.
6093 */
6094var NbCalendarRangeDayCellComponent = /** @class */ (function (_super) {
6095 tslib.__extends(NbCalendarRangeDayCellComponent, _super);
6096 function NbCalendarRangeDayCellComponent(dateService) {
6097 var _this = _super.call(this) || this;
6098 _this.dateService = dateService;
6099 _this.size = exports.NbCalendarSize.MEDIUM;
6100 _this.select = new i0.EventEmitter(true);
6101 _this.rangeCellClass = true;
6102 _this.dayCellClass = true;
6103 return _this;
6104 }
6105 Object.defineProperty(NbCalendarRangeDayCellComponent.prototype, "inRange", {
6106 get: function () {
6107 if (this.date && this.hasRange) {
6108 return this.isInRange(this.date, this.selectedValue);
6109 }
6110 return false;
6111 },
6112 enumerable: false,
6113 configurable: true
6114 });
6115 Object.defineProperty(NbCalendarRangeDayCellComponent.prototype, "start", {
6116 get: function () {
6117 return this.date && this.hasRange && this.dateService.isSameDay(this.date, this.selectedValue.start);
6118 },
6119 enumerable: false,
6120 configurable: true
6121 });
6122 Object.defineProperty(NbCalendarRangeDayCellComponent.prototype, "end", {
6123 get: function () {
6124 return this.date && this.hasRange && this.dateService.isSameDay(this.date, this.selectedValue.end);
6125 },
6126 enumerable: false,
6127 configurable: true
6128 });
6129 Object.defineProperty(NbCalendarRangeDayCellComponent.prototype, "today", {
6130 get: function () {
6131 return this.date && this.dateService.isSameDay(this.date, this.dateService.today());
6132 },
6133 enumerable: false,
6134 configurable: true
6135 });
6136 Object.defineProperty(NbCalendarRangeDayCellComponent.prototype, "boundingMonth", {
6137 get: function () {
6138 return !this.dateService.isSameMonthSafe(this.date, this.visibleDate);
6139 },
6140 enumerable: false,
6141 configurable: true
6142 });
6143 Object.defineProperty(NbCalendarRangeDayCellComponent.prototype, "selected", {
6144 get: function () {
6145 if (this.inRange) {
6146 return true;
6147 }
6148 if (this.selectedValue) {
6149 return this.dateService.isSameDaySafe(this.date, this.selectedValue.start);
6150 }
6151 },
6152 enumerable: false,
6153 configurable: true
6154 });
6155 Object.defineProperty(NbCalendarRangeDayCellComponent.prototype, "empty", {
6156 get: function () {
6157 return !this.date;
6158 },
6159 enumerable: false,
6160 configurable: true
6161 });
6162 Object.defineProperty(NbCalendarRangeDayCellComponent.prototype, "disabled", {
6163 get: function () {
6164 return this.smallerThanMin() || this.greaterThanMax() || this.dontFitFilter();
6165 },
6166 enumerable: false,
6167 configurable: true
6168 });
6169 Object.defineProperty(NbCalendarRangeDayCellComponent.prototype, "isLarge", {
6170 get: function () {
6171 return this.size === exports.NbCalendarSize.LARGE;
6172 },
6173 enumerable: false,
6174 configurable: true
6175 });
6176 Object.defineProperty(NbCalendarRangeDayCellComponent.prototype, "day", {
6177 get: function () {
6178 return this.date && this.dateService.getDate(this.date);
6179 },
6180 enumerable: false,
6181 configurable: true
6182 });
6183 NbCalendarRangeDayCellComponent.prototype.onClick = function () {
6184 if (this.disabled || this.empty) {
6185 return;
6186 }
6187 this.select.emit(this.date);
6188 };
6189 NbCalendarRangeDayCellComponent.prototype.smallerThanMin = function () {
6190 return this.date && this.min && this.dateService.compareDates(this.date, this.min) < 0;
6191 };
6192 NbCalendarRangeDayCellComponent.prototype.greaterThanMax = function () {
6193 return this.date && this.max && this.dateService.compareDates(this.date, this.max) > 0;
6194 };
6195 NbCalendarRangeDayCellComponent.prototype.dontFitFilter = function () {
6196 return this.date && this.filter && !this.filter(this.date);
6197 };
6198 NbCalendarRangeDayCellComponent.prototype.isInRange = function (date, _a) {
6199 var start = _a.start, end = _a.end;
6200 var isGreaterThanStart = this.dateService.compareDates(this.date, start) >= 0;
6201 var isLessThanEnd = this.dateService.compareDates(this.date, end) <= 0;
6202 return isGreaterThanStart && isLessThanEnd;
6203 };
6204 NbCalendarRangeDayCellComponent.decorators = [
6205 { type: i0.Component, args: [{
6206 selector: 'nb-calendar-range-day-cell',
6207 template: "\n <div class=\"cell-content\">{{ day }}</div>\n ",
6208 changeDetection: i0.ChangeDetectionStrategy.OnPush
6209 },] }
6210 ];
6211 NbCalendarRangeDayCellComponent.ctorParameters = function () { return [
6212 { type: NbDateService }
6213 ]; };
6214 NbCalendarRangeDayCellComponent.propDecorators = {
6215 date: [{ type: i0.Input }],
6216 selectedValue: [{ type: i0.Input }],
6217 visibleDate: [{ type: i0.Input }],
6218 min: [{ type: i0.Input }],
6219 max: [{ type: i0.Input }],
6220 filter: [{ type: i0.Input }],
6221 size: [{ type: i0.Input }],
6222 select: [{ type: i0.Output }],
6223 inRange: [{ type: i0.HostBinding, args: ['class.in-range',] }],
6224 start: [{ type: i0.HostBinding, args: ['class.start',] }],
6225 end: [{ type: i0.HostBinding, args: ['class.end',] }],
6226 rangeCellClass: [{ type: i0.HostBinding, args: ['class.range-cell',] }],
6227 dayCellClass: [{ type: i0.HostBinding, args: ['class.day-cell',] }],
6228 today: [{ type: i0.HostBinding, args: ['class.today',] }],
6229 boundingMonth: [{ type: i0.HostBinding, args: ['class.bounding-month',] }],
6230 selected: [{ type: i0.HostBinding, args: ['class.selected',] }],
6231 empty: [{ type: i0.HostBinding, args: ['class.empty',] }],
6232 disabled: [{ type: i0.HostBinding, args: ['class.disabled',] }],
6233 isLarge: [{ type: i0.HostBinding, args: ['class.size-large',] }],
6234 onClick: [{ type: i0.HostListener, args: ['click',] }]
6235 };
6236 return NbCalendarRangeDayCellComponent;
6237}(NbBaseCalendarRangeCell));
6238
6239/**
6240 * @license
6241 * Copyright Akveo. All Rights Reserved.
6242 * Licensed under the MIT License. See License.txt in the project root for license information.
6243 */
6244var NbCalendarRangeYearCellComponent = /** @class */ (function (_super) {
6245 tslib.__extends(NbCalendarRangeYearCellComponent, _super);
6246 function NbCalendarRangeYearCellComponent(dateService) {
6247 var _this = _super.call(this) || this;
6248 _this.dateService = dateService;
6249 _this.size = exports.NbCalendarSize.MEDIUM;
6250 _this.select = new i0.EventEmitter(true);
6251 _this.yearCellClass = true;
6252 _this.rangeCellClass = true;
6253 return _this;
6254 }
6255 Object.defineProperty(NbCalendarRangeYearCellComponent.prototype, "inRange", {
6256 get: function () {
6257 return this.hasRange && this.isInRange(this.date, this.selectedValue);
6258 },
6259 enumerable: false,
6260 configurable: true
6261 });
6262 Object.defineProperty(NbCalendarRangeYearCellComponent.prototype, "rangeStart", {
6263 get: function () {
6264 return this.hasRange && this.dateService.isSameYear(this.date, this.selectedValue.start);
6265 },
6266 enumerable: false,
6267 configurable: true
6268 });
6269 Object.defineProperty(NbCalendarRangeYearCellComponent.prototype, "rangeEnd", {
6270 get: function () {
6271 return this.hasRange && this.dateService.isSameYear(this.date, this.selectedValue.end);
6272 },
6273 enumerable: false,
6274 configurable: true
6275 });
6276 Object.defineProperty(NbCalendarRangeYearCellComponent.prototype, "selected", {
6277 get: function () {
6278 if (this.inRange) {
6279 return true;
6280 }
6281 if (this.selectedValue) {
6282 return this.dateService.isSameYearSafe(this.date, this.selectedValue.start);
6283 }
6284 },
6285 enumerable: false,
6286 configurable: true
6287 });
6288 Object.defineProperty(NbCalendarRangeYearCellComponent.prototype, "today", {
6289 get: function () {
6290 return this.dateService.isSameYear(this.date, this.dateService.today());
6291 },
6292 enumerable: false,
6293 configurable: true
6294 });
6295 Object.defineProperty(NbCalendarRangeYearCellComponent.prototype, "disabled", {
6296 get: function () {
6297 return this.smallerThanMin() || this.greaterThanMax();
6298 },
6299 enumerable: false,
6300 configurable: true
6301 });
6302 Object.defineProperty(NbCalendarRangeYearCellComponent.prototype, "isLarge", {
6303 get: function () {
6304 return this.size === exports.NbCalendarSize.LARGE;
6305 },
6306 enumerable: false,
6307 configurable: true
6308 });
6309 Object.defineProperty(NbCalendarRangeYearCellComponent.prototype, "year", {
6310 get: function () {
6311 return this.dateService.getYear(this.date);
6312 },
6313 enumerable: false,
6314 configurable: true
6315 });
6316 NbCalendarRangeYearCellComponent.prototype.onClick = function () {
6317 if (this.disabled) {
6318 return;
6319 }
6320 this.select.emit(this.date);
6321 };
6322 NbCalendarRangeYearCellComponent.prototype.smallerThanMin = function () {
6323 return this.date && this.min && this.dateService.compareDates(this.yearEnd(), this.min) < 0;
6324 };
6325 NbCalendarRangeYearCellComponent.prototype.greaterThanMax = function () {
6326 return this.date && this.max && this.dateService.compareDates(this.yearStart(), this.max) > 0;
6327 };
6328 NbCalendarRangeYearCellComponent.prototype.yearStart = function () {
6329 return this.dateService.getYearStart(this.date);
6330 };
6331 NbCalendarRangeYearCellComponent.prototype.yearEnd = function () {
6332 return this.dateService.getYearEnd(this.date);
6333 };
6334 NbCalendarRangeYearCellComponent.prototype.isInRange = function (date, _a) {
6335 var start = _a.start, end = _a.end;
6336 if (start && end) {
6337 var cellYear = this.dateService.getYear(date);
6338 var startYear = this.dateService.getYear(start);
6339 var endYear = this.dateService.getYear(end);
6340 return cellYear >= startYear && cellYear <= endYear;
6341 }
6342 return this.dateService.isSameYear(date, start);
6343 };
6344 NbCalendarRangeYearCellComponent.decorators = [
6345 { type: i0.Component, args: [{
6346 selector: 'nb-calendar-range-year-cell',
6347 template: "\n <div class=\"cell-content\">\n {{ year }}\n </div>\n ",
6348 changeDetection: i0.ChangeDetectionStrategy.OnPush
6349 },] }
6350 ];
6351 NbCalendarRangeYearCellComponent.ctorParameters = function () { return [
6352 { type: NbDateService }
6353 ]; };
6354 NbCalendarRangeYearCellComponent.propDecorators = {
6355 date: [{ type: i0.Input }],
6356 min: [{ type: i0.Input }],
6357 max: [{ type: i0.Input }],
6358 selectedValue: [{ type: i0.Input }],
6359 size: [{ type: i0.Input }],
6360 select: [{ type: i0.Output }],
6361 inRange: [{ type: i0.HostBinding, args: ['class.in-range',] }],
6362 rangeStart: [{ type: i0.HostBinding, args: ['class.start',] }],
6363 rangeEnd: [{ type: i0.HostBinding, args: ['class.end',] }],
6364 selected: [{ type: i0.HostBinding, args: ['class.selected',] }],
6365 today: [{ type: i0.HostBinding, args: ['class.today',] }],
6366 disabled: [{ type: i0.HostBinding, args: ['class.disabled',] }],
6367 isLarge: [{ type: i0.HostBinding, args: ['class.size-large',] }],
6368 yearCellClass: [{ type: i0.HostBinding, args: ['class.year-cell',] }],
6369 rangeCellClass: [{ type: i0.HostBinding, args: ['class.range-cell',] }],
6370 onClick: [{ type: i0.HostListener, args: ['click',] }]
6371 };
6372 return NbCalendarRangeYearCellComponent;
6373}(NbBaseCalendarRangeCell));
6374
6375/**
6376 * @license
6377 * Copyright Akveo. All Rights Reserved.
6378 * Licensed under the MIT License. See License.txt in the project root for license information.
6379 */
6380var NbCalendarRangeMonthCellComponent = /** @class */ (function (_super) {
6381 tslib.__extends(NbCalendarRangeMonthCellComponent, _super);
6382 function NbCalendarRangeMonthCellComponent(dateService) {
6383 var _this = _super.call(this) || this;
6384 _this.dateService = dateService;
6385 _this.size = exports.NbCalendarSize.MEDIUM;
6386 _this.select = new i0.EventEmitter(true);
6387 _this.monthCellClass = true;
6388 _this.rangeCellClass = true;
6389 return _this;
6390 }
6391 Object.defineProperty(NbCalendarRangeMonthCellComponent.prototype, "month", {
6392 get: function () {
6393 return this.dateService.getMonthName(this.date);
6394 },
6395 enumerable: false,
6396 configurable: true
6397 });
6398 Object.defineProperty(NbCalendarRangeMonthCellComponent.prototype, "selected", {
6399 get: function () {
6400 if (this.inRange) {
6401 return true;
6402 }
6403 if (this.selectedValue) {
6404 return this.dateService.isSameMonthSafe(this.date, this.selectedValue.start);
6405 }
6406 },
6407 enumerable: false,
6408 configurable: true
6409 });
6410 Object.defineProperty(NbCalendarRangeMonthCellComponent.prototype, "inRange", {
6411 get: function () {
6412 if (this.hasRange) {
6413 return this.isInRage(this.date, this.selectedValue);
6414 }
6415 },
6416 enumerable: false,
6417 configurable: true
6418 });
6419 Object.defineProperty(NbCalendarRangeMonthCellComponent.prototype, "rangeStart", {
6420 get: function () {
6421 if (this.hasRange) {
6422 return this.dateService.isSameMonth(this.date, this.selectedValue.start);
6423 }
6424 },
6425 enumerable: false,
6426 configurable: true
6427 });
6428 Object.defineProperty(NbCalendarRangeMonthCellComponent.prototype, "rangeEnd", {
6429 get: function () {
6430 if (this.hasRange) {
6431 return this.dateService.isSameMonth(this.date, this.selectedValue.end);
6432 }
6433 },
6434 enumerable: false,
6435 configurable: true
6436 });
6437 Object.defineProperty(NbCalendarRangeMonthCellComponent.prototype, "today", {
6438 get: function () {
6439 return this.dateService.isSameMonthSafe(this.date, this.dateService.today());
6440 },
6441 enumerable: false,
6442 configurable: true
6443 });
6444 Object.defineProperty(NbCalendarRangeMonthCellComponent.prototype, "disabled", {
6445 get: function () {
6446 return this.smallerThanMin() || this.greaterThanMax();
6447 },
6448 enumerable: false,
6449 configurable: true
6450 });
6451 Object.defineProperty(NbCalendarRangeMonthCellComponent.prototype, "isLarge", {
6452 get: function () {
6453 return this.size === exports.NbCalendarSize.LARGE;
6454 },
6455 enumerable: false,
6456 configurable: true
6457 });
6458 NbCalendarRangeMonthCellComponent.prototype.onClick = function () {
6459 if (this.disabled) {
6460 return;
6461 }
6462 this.select.emit(this.date);
6463 };
6464 NbCalendarRangeMonthCellComponent.prototype.smallerThanMin = function () {
6465 return this.date && this.min && this.dateService.compareDates(this.monthEnd(), this.min) < 0;
6466 };
6467 NbCalendarRangeMonthCellComponent.prototype.greaterThanMax = function () {
6468 return this.date && this.max && this.dateService.compareDates(this.monthStart(), this.max) > 0;
6469 };
6470 NbCalendarRangeMonthCellComponent.prototype.monthStart = function () {
6471 return this.dateService.getMonthStart(this.date);
6472 };
6473 NbCalendarRangeMonthCellComponent.prototype.monthEnd = function () {
6474 return this.dateService.getMonthEnd(this.date);
6475 };
6476 NbCalendarRangeMonthCellComponent.prototype.isInRage = function (date, range) {
6477 if (range.start && range.end) {
6478 var cellDate = this.dateService.getMonthStart(date);
6479 var start = this.dateService.getMonthStart(range.start);
6480 var end = this.dateService.getMonthStart(range.end);
6481 var isGreaterThanStart = this.dateService.compareDates(cellDate, start) >= 0;
6482 var isLessThanEnd = this.dateService.compareDates(cellDate, end) <= 0;
6483 return isGreaterThanStart && isLessThanEnd;
6484 }
6485 return this.dateService.isSameMonth(date, range.start);
6486 };
6487 NbCalendarRangeMonthCellComponent.decorators = [
6488 { type: i0.Component, args: [{
6489 selector: 'nb-calendar-range-month-cell',
6490 template: "\n <div class=\"cell-content\">\n {{ month }}\n </div>\n ",
6491 changeDetection: i0.ChangeDetectionStrategy.OnPush
6492 },] }
6493 ];
6494 NbCalendarRangeMonthCellComponent.ctorParameters = function () { return [
6495 { type: NbDateService }
6496 ]; };
6497 NbCalendarRangeMonthCellComponent.propDecorators = {
6498 date: [{ type: i0.Input }],
6499 visibleDate: [{ type: i0.Input }],
6500 selectedValue: [{ type: i0.Input }],
6501 min: [{ type: i0.Input }],
6502 max: [{ type: i0.Input }],
6503 size: [{ type: i0.Input }],
6504 select: [{ type: i0.Output }],
6505 monthCellClass: [{ type: i0.HostBinding, args: ['class.month-cell',] }],
6506 rangeCellClass: [{ type: i0.HostBinding, args: ['class.range-cell',] }],
6507 selected: [{ type: i0.HostBinding, args: ['class.selected',] }],
6508 inRange: [{ type: i0.HostBinding, args: ['class.in-range',] }],
6509 rangeStart: [{ type: i0.HostBinding, args: ['class.start',] }],
6510 rangeEnd: [{ type: i0.HostBinding, args: ['class.end',] }],
6511 today: [{ type: i0.HostBinding, args: ['class.today',] }],
6512 disabled: [{ type: i0.HostBinding, args: ['class.disabled',] }],
6513 isLarge: [{ type: i0.HostBinding, args: ['class.size-large',] }],
6514 onClick: [{ type: i0.HostListener, args: ['click',] }]
6515 };
6516 return NbCalendarRangeMonthCellComponent;
6517}(NbBaseCalendarRangeCell));
6518
6519/**
6520 * @license
6521 * Copyright Akveo. All Rights Reserved.
6522 * Licensed under the MIT License. See License.txt in the project root for license information.
6523 */
6524/**
6525 * CalendarRange component provides a capability to choose a date range.
6526 *
6527 * ```html
6528 * <nb-calendar [(date)]="date"></nb-calendar>
6529 * <nb-calendar [date]="date" (dateChange)="handleDateChange($event)"></nb-calendar>
6530 * ```
6531 *
6532 * Basic usage example
6533 * @stacked-example(Range, calendar/calendar-range-showcase.component)
6534 *
6535 * ### Installation
6536 *
6537 * Import `NbCalendarRangeModule` to your feature module.
6538 * ```ts
6539 * @NgModule({
6540 * imports: [
6541 * // ...
6542 * NbCalendarRangeModule,
6543 * ],
6544 * })
6545 * export class PageModule { }
6546 * ```
6547 *
6548 * ### Usage
6549 *
6550 * CalendarRange component supports all of the Calendar component customization properties. More defails can be found
6551 * in the [Calendar component docs](docs/components/calendar).
6552 *
6553 * @styles
6554 *
6555 * calendar-width:
6556 * calendar-background-color:
6557 * calendar-border-color:
6558 * calendar-border-style:
6559 * calendar-border-width:
6560 * calendar-border-radius:
6561 * calendar-text-color:
6562 * calendar-text-font-family:
6563 * calendar-text-font-size:
6564 * calendar-text-font-weight:
6565 * calendar-text-line-height:
6566 * calendar-picker-padding-top:
6567 * calendar-picker-padding-bottom:
6568 * calendar-picker-padding-start:
6569 * calendar-picker-padding-end:
6570 * calendar-navigation-text-color:
6571 * calendar-navigation-text-font-family:
6572 * calendar-navigation-title-text-font-size:
6573 * calendar-navigation-title-text-font-weight:
6574 * calendar-navigation-title-text-line-height:
6575 * calendar-navigation-padding:
6576 * calendar-cell-inactive-text-color:
6577 * calendar-cell-disabled-text-color:
6578 * calendar-cell-hover-background-color:
6579 * calendar-cell-hover-border-color:
6580 * calendar-cell-hover-text-color:
6581 * calendar-cell-hover-text-font-size:
6582 * calendar-cell-hover-text-font-weight:
6583 * calendar-cell-hover-text-line-height:
6584 * calendar-cell-active-background-color:
6585 * calendar-cell-active-border-color:
6586 * calendar-cell-active-text-color:
6587 * calendar-cell-active-text-font-size:
6588 * calendar-cell-active-text-font-weight:
6589 * calendar-cell-active-text-line-height:
6590 * calendar-cell-today-background-color:
6591 * calendar-cell-today-border-color:
6592 * calendar-cell-today-text-color:
6593 * calendar-cell-today-text-font-size:
6594 * calendar-cell-today-text-font-weight:
6595 * calendar-cell-today-text-line-height:
6596 * calendar-cell-today-hover-background-color:
6597 * calendar-cell-today-hover-border-color:
6598 * calendar-cell-today-active-background-color:
6599 * calendar-cell-today-active-border-color:
6600 * calendar-cell-today-disabled-border-color:
6601 * calendar-cell-today-selected-background-color:
6602 * calendar-cell-today-selected-border-color:
6603 * calendar-cell-today-selected-text-color:
6604 * calendar-cell-today-selected-hover-background-color:
6605 * calendar-cell-today-selected-hover-border-color:
6606 * calendar-cell-today-selected-active-background-color:
6607 * calendar-cell-today-selected-active-border-color:
6608 * calendar-cell-today-in-range-background-color:
6609 * calendar-cell-today-in-range-border-color:
6610 * calendar-cell-today-in-range-text-color:
6611 * calendar-cell-today-in-range-hover-background-color:
6612 * calendar-cell-today-in-range-hover-border-color:
6613 * calendar-cell-today-in-range-active-background-color:
6614 * calendar-cell-today-in-range-active-border-color:
6615 * calendar-cell-selected-background-color:
6616 * calendar-cell-selected-border-color:
6617 * calendar-cell-selected-text-color:
6618 * calendar-cell-selected-text-font-size:
6619 * calendar-cell-selected-text-font-weight:
6620 * calendar-cell-selected-text-line-height:
6621 * calendar-cell-selected-hover-background-color:
6622 * calendar-cell-selected-hover-border-color:
6623 * calendar-cell-selected-active-background-color:
6624 * calendar-cell-selected-active-border-color:
6625 * calendar-day-cell-width:
6626 * calendar-day-cell-height:
6627 * calendar-month-cell-width:
6628 * calendar-month-cell-height:
6629 * calendar-year-cell-width:
6630 * calendar-year-cell-height:
6631 * calendar-weekday-background:
6632 * calendar-weekday-divider-color:
6633 * calendar-weekday-divider-width:
6634 * calendar-weekday-text-color:
6635 * calendar-weekday-text-font-size:
6636 * calendar-weekday-text-font-weight:
6637 * calendar-weekday-text-line-height:
6638 * calendar-weekday-holiday-text-color:
6639 * calendar-weekday-height:
6640 * calendar-weekday-width:
6641 * calendar-weeknumber-background:
6642 * calendar-weeknumber-divider-color:
6643 * calendar-weeknumber-divider-width:
6644 * calendar-weeknumber-text-color:
6645 * calendar-weeknumber-text-font-size:
6646 * calendar-weeknumber-text-font-weight:
6647 * calendar-weeknumber-text-line-height:
6648 * calendar-weeknumber-height:
6649 * calendar-weeknumber-width:
6650 * calendar-large-width:
6651 * calendar-day-cell-large-width:
6652 * calendar-day-cell-large-height:
6653 * calendar-weekday-large-height:
6654 * calendar-weekday-large-width:
6655 * calendar-weeknumber-large-height:
6656 * calendar-weeknumber-large-width:
6657 * calendar-month-cell-large-width:
6658 * calendar-month-cell-large-height:
6659 * calendar-year-cell-large-width:
6660 * calendar-year-cell-large-height:
6661 * */
6662var NbCalendarRangeComponent = /** @class */ (function () {
6663 function NbCalendarRangeComponent(dateService) {
6664 this.dateService = dateService;
6665 /**
6666 * Defines if we should render previous and next months
6667 * in the current month view.
6668 * */
6669 this.boundingMonth = true;
6670 /**
6671 * Defines starting view for the calendar.
6672 * */
6673 this.startView = exports.NbCalendarViewMode.DATE;
6674 this.dayCellComponent = NbCalendarRangeDayCellComponent;
6675 this.monthCellComponent = NbCalendarRangeMonthCellComponent;
6676 this.yearCellComponent = NbCalendarRangeYearCellComponent;
6677 /**
6678 * Size of the calendar and entire components.
6679 * Can be 'medium' which is default or 'large'.
6680 * */
6681 this.size = exports.NbCalendarSize.MEDIUM;
6682 /**
6683 * Determines should we show calendars navigation or not.
6684 * */
6685 this.showNavigation = true;
6686 this._showWeekNumber = false;
6687 /**
6688 * Sets symbol used as a header for week numbers column
6689 * */
6690 this.weekNumberSymbol = '#';
6691 /**
6692 * Emits range when start selected and emits again when end selected.
6693 * */
6694 this.rangeChange = new i0.EventEmitter();
6695 }
6696 Object.defineProperty(NbCalendarRangeComponent.prototype, "_cellComponent", {
6697 /**
6698 * Custom day cell component. Have to implement `NbCalendarCell` interface.
6699 * */
6700 set: function (cellComponent) {
6701 if (cellComponent) {
6702 this.dayCellComponent = cellComponent;
6703 }
6704 },
6705 enumerable: false,
6706 configurable: true
6707 });
6708 Object.defineProperty(NbCalendarRangeComponent.prototype, "_monthCellComponent", {
6709 /**
6710 * Custom month cell component. Have to implement `NbCalendarCell` interface.
6711 * */
6712 set: function (cellComponent) {
6713 if (cellComponent) {
6714 this.monthCellComponent = cellComponent;
6715 }
6716 },
6717 enumerable: false,
6718 configurable: true
6719 });
6720 Object.defineProperty(NbCalendarRangeComponent.prototype, "_yearCellComponent", {
6721 /**
6722 * Custom year cell component. Have to implement `NbCalendarCell` interface.
6723 * */
6724 set: function (cellComponent) {
6725 if (cellComponent) {
6726 this.yearCellComponent = cellComponent;
6727 }
6728 },
6729 enumerable: false,
6730 configurable: true
6731 });
6732 Object.defineProperty(NbCalendarRangeComponent.prototype, "showWeekNumber", {
6733 /**
6734 * Determines should we show week numbers column.
6735 * False by default.
6736 * */
6737 get: function () {
6738 return this._showWeekNumber;
6739 },
6740 set: function (value) {
6741 this._showWeekNumber = convertToBoolProperty(value);
6742 },
6743 enumerable: false,
6744 configurable: true
6745 });
6746 NbCalendarRangeComponent.prototype.onChange = function (date) {
6747 this.initDateIfNull();
6748 this.handleSelected(date);
6749 };
6750 NbCalendarRangeComponent.prototype.initDateIfNull = function () {
6751 if (!this.range) {
6752 this.range = { start: null, end: null };
6753 }
6754 };
6755 NbCalendarRangeComponent.prototype.handleSelected = function (date) {
6756 if (this.selectionStarted()) {
6757 this.selectEnd(date);
6758 }
6759 else {
6760 this.selectStart(date);
6761 }
6762 };
6763 NbCalendarRangeComponent.prototype.selectionStarted = function () {
6764 var _a = this.range, start = _a.start, end = _a.end;
6765 return start && !end;
6766 };
6767 NbCalendarRangeComponent.prototype.selectStart = function (start) {
6768 this.selectRange({ start: start });
6769 };
6770 NbCalendarRangeComponent.prototype.selectEnd = function (date) {
6771 var start = this.range.start;
6772 if (this.dateService.compareDates(date, start) > 0) {
6773 this.selectRange({ start: start, end: date });
6774 }
6775 else {
6776 this.selectRange({ start: date, end: start });
6777 }
6778 };
6779 NbCalendarRangeComponent.prototype.selectRange = function (range) {
6780 this.range = range;
6781 this.rangeChange.emit(range);
6782 };
6783 NbCalendarRangeComponent.decorators = [
6784 { type: i0.Component, args: [{
6785 selector: 'nb-calendar-range',
6786 template: "\n <nb-base-calendar\n [date]=\"range\"\n (dateChange)=\"onChange($any($event))\"\n [min]=\"min\"\n [max]=\"max\"\n [filter]=\"filter\"\n [startView]=\"startView\"\n [boundingMonth]=\"boundingMonth\"\n [dayCellComponent]=\"dayCellComponent\"\n [monthCellComponent]=\"monthCellComponent\"\n [yearCellComponent]=\"yearCellComponent\"\n [visibleDate]=\"visibleDate\"\n [showNavigation]=\"showNavigation\"\n [size]=\"size\"\n [showWeekNumber]=\"showWeekNumber\"\n [weekNumberSymbol]=\"weekNumberSymbol\"\n ></nb-base-calendar>\n "
6787 },] }
6788 ];
6789 NbCalendarRangeComponent.ctorParameters = function () { return [
6790 { type: NbDateService }
6791 ]; };
6792 NbCalendarRangeComponent.propDecorators = {
6793 boundingMonth: [{ type: i0.Input }],
6794 startView: [{ type: i0.Input }],
6795 min: [{ type: i0.Input }],
6796 max: [{ type: i0.Input }],
6797 filter: [{ type: i0.Input }],
6798 _cellComponent: [{ type: i0.Input, args: ['dayCellComponent',] }],
6799 _monthCellComponent: [{ type: i0.Input, args: ['monthCellComponent',] }],
6800 monthCellComponent: [{ type: i0.Input }],
6801 _yearCellComponent: [{ type: i0.Input, args: ['yearCellComponent',] }],
6802 size: [{ type: i0.Input }],
6803 visibleDate: [{ type: i0.Input }],
6804 showNavigation: [{ type: i0.Input }],
6805 range: [{ type: i0.Input }],
6806 showWeekNumber: [{ type: i0.Input }],
6807 weekNumberSymbol: [{ type: i0.Input }],
6808 rangeChange: [{ type: i0.Output }]
6809 };
6810 return NbCalendarRangeComponent;
6811}());
6812
6813/**
6814 * @license
6815 * Copyright Akveo. All Rights Reserved.
6816 * Licensed under the MIT License. See License.txt in the project root for license information.
6817 */
6818var NbCalendarRangeModule = /** @class */ (function () {
6819 function NbCalendarRangeModule() {
6820 }
6821 NbCalendarRangeModule.decorators = [
6822 { type: i0.NgModule, args: [{
6823 imports: [NbBaseCalendarModule],
6824 exports: [NbCalendarRangeComponent],
6825 declarations: [
6826 NbCalendarRangeComponent,
6827 NbCalendarRangeDayCellComponent,
6828 NbCalendarRangeYearCellComponent,
6829 NbCalendarRangeMonthCellComponent,
6830 ],
6831 entryComponents: [
6832 NbCalendarRangeDayCellComponent,
6833 NbCalendarRangeMonthCellComponent,
6834 NbCalendarRangeYearCellComponent,
6835 ],
6836 },] }
6837 ];
6838 return NbCalendarRangeModule;
6839}());
6840
6841/**
6842 * @license
6843 * Copyright Akveo. All Rights Reserved.
6844 * Licensed under the MIT License. See License.txt in the project root for license information.
6845 */
6846var NB_TIME_PICKER_CONFIG = new i0.InjectionToken('NB_TIME_PICKER_CONFIG');
6847var NB_DEFAULT_TIMEPICKER_LOCALIZATION_CONFIG = {
6848 hoursText: 'Hr',
6849 minutesText: 'Min',
6850 secondsText: 'Sec',
6851 ampmText: 'Am/Pm',
6852};
6853
6854/**
6855 * The TimePicker components itself.
6856 * Provides a proxy to `TimePicker` options as well as custom picker options.
6857 */
6858var NbTimePickerComponent = /** @class */ (function () {
6859 function NbTimePickerComponent(config, platformService, locale, cd, calendarTimeModelService, dateService) {
6860 this.config = config;
6861 this.platformService = platformService;
6862 this.cd = cd;
6863 this.calendarTimeModelService = calendarTimeModelService;
6864 this.dateService = dateService;
6865 this.blur$ = new rxjs.Subject();
6866 this.dayPeriodColumnOptions = ["AM" /* AM */, "PM" /* PM */];
6867 this.isAM = true;
6868 /**
6869 * In timepicker value should be always true
6870 * In calendar-with-time.component should set to false
6871 * @docs-private
6872 */
6873 this.showFooter = true;
6874 /**
6875 * Emits date when selected.
6876 * */
6877 this.onSelectTime = new i0.EventEmitter();
6878 this.initFromConfig(this.config);
6879 }
6880 Object.defineProperty(NbTimePickerComponent.prototype, "blur", {
6881 /**
6882 * Emits when timepicker looses focus.
6883 */
6884 get: function () {
6885 return this.blur$.asObservable();
6886 },
6887 enumerable: false,
6888 configurable: true
6889 });
6890 Object.defineProperty(NbTimePickerComponent.prototype, "timeFormat", {
6891 /**
6892 * Defines time format string.
6893 * */
6894 get: function () {
6895 return this._timeFormat;
6896 },
6897 set: function (timeFormat) {
6898 this._timeFormat = timeFormat;
6899 },
6900 enumerable: false,
6901 configurable: true
6902 });
6903 Object.defineProperty(NbTimePickerComponent.prototype, "twelveHoursFormat", {
6904 /**
6905 * Defines 12 hours format .
6906 * */
6907 get: function () {
6908 return this._twelveHoursFormat;
6909 },
6910 set: function (value) {
6911 this._twelveHoursFormat = convertToBoolProperty(value);
6912 },
6913 enumerable: false,
6914 configurable: true
6915 });
6916
6917 Object.defineProperty(NbTimePickerComponent.prototype, "withSeconds", {
6918 /**
6919 * Show seconds in timepicker.
6920 * Ignored when singleColumn is true
6921 * */
6922 get: function () {
6923 return this._withSeconds;
6924 },
6925 set: function (value) {
6926 this._withSeconds = convertToBoolProperty(value);
6927 },
6928 enumerable: false,
6929 configurable: true
6930 });
6931
6932 Object.defineProperty(NbTimePickerComponent.prototype, "singleColumn", {
6933 /**
6934 * Show timepicker values in one column with 60 minutes step by default.
6935 * */
6936 get: function () {
6937 return this._singleColumn;
6938 },
6939 set: function (value) {
6940 this._singleColumn = convertToBoolProperty(value);
6941 },
6942 enumerable: false,
6943 configurable: true
6944 });
6945 Object.defineProperty(NbTimePickerComponent.prototype, "step", {
6946 get: function () {
6947 return this._step;
6948 },
6949 /**
6950 * Defines minutes offset for options, when timepicker is in single column mode.
6951 * By default it’s 60 minutes: '12:00, 13:00: 14:00, 15:00...'
6952 * */
6953 set: function (step) {
6954 this._step = step;
6955 },
6956 enumerable: false,
6957 configurable: true
6958 });
6959 Object.defineProperty(NbTimePickerComponent.prototype, "date", {
6960 get: function () {
6961 return this._date;
6962 },
6963 /**
6964 * Date which will be rendered as selected.
6965 * */
6966 set: function (date) {
6967 this._date = date;
6968 this.isAM = this.dateService.getDayPeriod(this.date) === "AM" /* AM */;
6969 this.buildColumnOptions();
6970 this.cd.markForCheck();
6971 },
6972 enumerable: false,
6973 configurable: true
6974 });
6975 NbTimePickerComponent.prototype.ngOnInit = function () {
6976 this.timeFormat = this.setupTimeFormat();
6977 };
6978 NbTimePickerComponent.prototype.ngOnChanges = function (_a) {
6979 var step = _a.step, twelveHoursFormat = _a.twelveHoursFormat, withSeconds = _a.withSeconds, singleColumn = _a.singleColumn;
6980 this.timeFormat = this.setupTimeFormat();
6981 var isConfigChanged = step || twelveHoursFormat || withSeconds || singleColumn;
6982 if (isConfigChanged || !this.fullTimeOptions) {
6983 this.buildColumnOptions();
6984 }
6985 };
6986 NbTimePickerComponent.prototype.setHost = function (hostRef) {
6987 this.hostRef = hostRef;
6988 };
6989 NbTimePickerComponent.prototype.attach = function (hostRef) {
6990 this.hostRef = hostRef;
6991 };
6992 NbTimePickerComponent.prototype.setCurrentTime = function () {
6993 this.date = this.dateService.today();
6994 this.onSelectTime.emit({
6995 time: this.date,
6996 save: true,
6997 });
6998 };
6999 NbTimePickerComponent.prototype.setHour = function (value) {
7000 this.updateValue(this.dateService.setHours(this.date, value));
7001 };
7002 NbTimePickerComponent.prototype.setMinute = function (value) {
7003 this.updateValue(this.dateService.setMinutes(this.date, value));
7004 };
7005 NbTimePickerComponent.prototype.setSecond = function (value) {
7006 this.updateValue(this.dateService.setSeconds(this.date, value));
7007 };
7008 NbTimePickerComponent.prototype.selectFullTime = function (value) {
7009 this.updateValue(value);
7010 };
7011 NbTimePickerComponent.prototype.changeDayPeriod = function (dayPeriodToSet) {
7012 if (this.dateService.getDayPeriod(this.date) === dayPeriodToSet) {
7013 return;
7014 }
7015 // Subtract hours when switching to AM (before midday, 0-11 in 24-hour) from PM (after midday, 12-24 in 24-hour),
7016 // otherwise add hours because switching to PM from AM.
7017 var direction = dayPeriodToSet === "AM" /* AM */ ? -1 : 1;
7018 var increment = direction * this.dateService.HOURS_IN_DAY_PERIOD;
7019 this.updateValue(this.dateService.addHours(this.date, increment));
7020 };
7021 NbTimePickerComponent.prototype.updateValue = function (date) {
7022 this.onSelectTime.emit({ time: date });
7023 };
7024 NbTimePickerComponent.prototype.saveValue = function () {
7025 this.onSelectTime.emit({
7026 time: this.date,
7027 save: true,
7028 });
7029 };
7030 NbTimePickerComponent.prototype.trackByTimeValues = function (index, item) {
7031 return item.value;
7032 };
7033 NbTimePickerComponent.prototype.trackBySingleColumnValue = function (index, item) {
7034 return this.dateService.valueOf(item);
7035 };
7036 NbTimePickerComponent.prototype.trackByDayPeriod = function (index, item) {
7037 return item;
7038 };
7039 NbTimePickerComponent.prototype.showSeconds = function () {
7040 return this.withSeconds && !this.singleColumn;
7041 };
7042 NbTimePickerComponent.prototype.isSelectedHour = function (val) {
7043 if (this.date) {
7044 return this.dateService.getHours(this.date) === val;
7045 }
7046 return false;
7047 };
7048 NbTimePickerComponent.prototype.isSelectedMinute = function (val) {
7049 if (this.date) {
7050 return this.dateService.getMinutes(this.date) === val;
7051 }
7052 return false;
7053 };
7054 NbTimePickerComponent.prototype.isSelectedSecond = function (val) {
7055 if (this.date) {
7056 return this.dateService.getSeconds(this.date) === val;
7057 }
7058 return false;
7059 };
7060 NbTimePickerComponent.prototype.isSelectedDayPeriod = function (dayPeriod) {
7061 if (this.date) {
7062 return dayPeriod === this.dateService.getDayPeriod(this.date);
7063 }
7064 return false;
7065 };
7066 NbTimePickerComponent.prototype.getFullTimeString = function (item) {
7067 return this.dateService.format(item, this.timeFormat).toUpperCase();
7068 };
7069 NbTimePickerComponent.prototype.isSelectedFullTimeValue = function (value) {
7070 if (this.date) {
7071 return this.dateService.isSameHourAndMinute(value, this.date);
7072 }
7073 return false;
7074 };
7075 NbTimePickerComponent.prototype.buildColumnOptions = function () {
7076 this.timeFormat = this.setupTimeFormat();
7077 this.fullTimeOptions = this.singleColumn
7078 ? this.calendarTimeModelService.getHoursRange(this.step)
7079 : [];
7080 this.hoursColumnOptions = this.generateHours();
7081 this.minutesColumnOptions = this.generateMinutesOrSeconds();
7082 this.secondsColumnOptions = this.withSeconds ? this.generateMinutesOrSeconds() : [];
7083 };
7084 /**
7085 * @docs-private
7086 */
7087 NbTimePickerComponent.prototype.isFirefox = function () {
7088 return this.platformService.FIREFOX;
7089 };
7090 NbTimePickerComponent.prototype.generateHours = function () {
7091 var _this = this;
7092 if (!this.twelveHoursFormat) {
7093 return range(24, function (v) {
7094 return { value: v, text: _this.calendarTimeModelService.paddToTwoSymbols(v) };
7095 });
7096 }
7097 if (this.isAM) {
7098 return (range(12, function (v) {
7099 var text = v === 0 ? 12 : v;
7100 return { value: v, text: _this.calendarTimeModelService.paddToTwoSymbols(text) };
7101 }));
7102 }
7103 return (rangeFromTo(12, 24, function (v) {
7104 var text = v === 12 ? 12 : (v - 12);
7105 return { value: v, text: _this.calendarTimeModelService.paddToTwoSymbols(text) };
7106 }));
7107 };
7108 NbTimePickerComponent.prototype.generateMinutesOrSeconds = function () {
7109 var _this = this;
7110 return range(60, function (v) {
7111 return { value: v, text: _this.calendarTimeModelService.paddToTwoSymbols(v) };
7112 });
7113 };
7114 NbTimePickerComponent.prototype.setupTimeFormat = function () {
7115 if (!this.timeFormat) {
7116 return this.config.format || this.buildTimeFormat();
7117 }
7118 return this.timeFormat;
7119 };
7120 /**
7121 * @docs-private
7122 */
7123 NbTimePickerComponent.prototype.buildTimeFormat = function () {
7124 if (this.twelveHoursFormat) {
7125 return "" + (this.withSeconds && !this.singleColumn ? this.dateService.getTwelveHoursFormatWithSeconds()
7126 : this.dateService.getTwelveHoursFormat());
7127 }
7128 else {
7129 return "" + (this.withSeconds && !this.singleColumn ? this.dateService.getTwentyFourHoursFormatWithSeconds()
7130 : this.dateService.getTwentyFourHoursFormat());
7131 }
7132 };
7133 NbTimePickerComponent.prototype.initFromConfig = function (config) {
7134 var _a;
7135 if (config) {
7136 this.twelveHoursFormat = config.twelveHoursFormat;
7137 }
7138 else {
7139 this.twelveHoursFormat = this.dateService.getLocaleTimeFormat().includes('h');
7140 }
7141 var localeConfig = tslib.__assign(tslib.__assign({}, NB_DEFAULT_TIMEPICKER_LOCALIZATION_CONFIG), (_a = config === null || config === void 0 ? void 0 : config.localization) !== null && _a !== void 0 ? _a : {});
7142 this.hoursText = localeConfig.hoursText;
7143 this.minutesText = localeConfig.minutesText;
7144 this.secondsText = localeConfig.secondsText;
7145 this.ampmText = localeConfig.ampmText;
7146 };
7147 NbTimePickerComponent.decorators = [
7148 { type: i0.Component, args: [{
7149 selector: 'nb-timepicker',
7150 template: "<nb-card *nbPortal\n [class.supports-scrollbar-theming]=\"!isFirefox()\"\n class=\"nb-timepicker-container\">\n <nb-card-header class=\"column-header\">\n <ng-container *ngIf=\"singleColumn; else fullTimeHeadersBlock\">\n <div class=\"header-cell\">Time</div>\n </ng-container>\n <ng-template #fullTimeHeadersBlock>\n <div class=\"header-cell\">{{ hoursText }}</div>\n <div class=\"header-cell\">{{ minutesText }}</div>\n <div *ngIf=\"withSeconds\" class=\"header-cell\">{{ secondsText }}</div>\n <div *ngIf=\"twelveHoursFormat\" class=\"header-cell\">{{ ampmText }}</div>\n </ng-template>\n </nb-card-header>\n\n <div class=\"picker-body\">\n <ng-container *ngIf=\"singleColumn; else fullTimeColumnBlock\">\n <nb-list class=\"values-list\">\n <nb-list-item\n class=\"list-item\"\n [class.selected]=\"isSelectedFullTimeValue(item)\"\n *ngFor=\"let item of fullTimeOptions; trackBy: trackBySingleColumnValue.bind(this)\">\n <nb-timepicker-cell\n [value]=\"getFullTimeString(item)\"\n [selected]=\"isSelectedFullTimeValue(item)\"\n (select)=\"selectFullTime(item)\">\n </nb-timepicker-cell>\n </nb-list-item>\n </nb-list>\n </ng-container>\n\n <ng-template #fullTimeColumnBlock>\n <nb-list class=\"values-list\">\n <nb-list-item\n class=\"list-item\"\n [class.selected]=\"isSelectedHour(item.value)\"\n *ngFor=\"let item of hoursColumnOptions; trackBy: trackByTimeValues\">\n <nb-timepicker-cell\n [value]=\"item.text\"\n [selected]=\"isSelectedHour(item.value)\"\n (select)=\"setHour(item.value)\">\n </nb-timepicker-cell>\n </nb-list-item>\n </nb-list>\n <nb-list class=\"values-list\">\n <nb-list-item\n class=\"list-item\"\n [class.selected]=\"isSelectedMinute(item.value)\"\n *ngFor=\"let item of minutesColumnOptions; trackBy: trackByTimeValues\">\n <nb-timepicker-cell\n [value]=\"item.text\"\n [selected]=\"isSelectedMinute(item.value)\"\n (select)=\"setMinute(item.value)\">\n </nb-timepicker-cell>\n </nb-list-item>\n </nb-list>\n <nb-list *ngIf=\"showSeconds()\" class=\"values-list\">\n <nb-list-item\n class=\"list-item\"\n [class.selected]=\"isSelectedSecond(item.value)\"\n *ngFor=\"let item of secondsColumnOptions; trackBy: trackByTimeValues\">\n <nb-timepicker-cell\n [value]=\"item.text\"\n [selected]=\"isSelectedSecond(item.value)\"\n (select)=\"setSecond(item.value)\">\n </nb-timepicker-cell>\n </nb-list-item>\n </nb-list>\n <nb-list *ngIf=\"twelveHoursFormat\" class=\"values-list\">\n <nb-list-item\n class=\"list-item am-pm-item\"\n [class.selected]=\"isSelectedDayPeriod(dayPeriod)\"\n *ngFor=\"let dayPeriod of dayPeriodColumnOptions; trackBy: trackByDayPeriod\">\n <nb-timepicker-cell\n [value]=\"dayPeriod\"\n [selected]=\"isSelectedDayPeriod(dayPeriod)\"\n (select)=\"changeDayPeriod(dayPeriod)\">\n </nb-timepicker-cell>\n </nb-list-item>\n </nb-list>\n </ng-template>\n </div>\n\n <nb-card-footer *ngIf=\"showFooter\" class=\"actions-footer\">\n <nb-calendar-actions\n [applyButtonText]=\"applyButtonText\"\n [currentTimeButtonText]=\"currentTimeButtonText\"\n (setCurrentTime)=\"setCurrentTime()\"\n (saveValue)=\"saveValue()\"\n ></nb-calendar-actions>\n </nb-card-footer>\n</nb-card>\n",
7151 exportAs: 'nbTimepicker',
7152 changeDetection: i0.ChangeDetectionStrategy.OnPush,
7153 styles: [".nb-timepicker-container{overflow:hidden;margin-bottom:0}.values-list{width:100%;overflow:hidden;scroll-snap-type:y proximity}.values-list:hover{overflow-y:auto}.list-item{border:0;padding:0;cursor:pointer}.picker-body{display:flex;width:100%;flex:1 0 0;overflow:hidden}.column-header{width:100%;display:flex;justify-content:space-between;padding:0}.header-cell{width:100%;display:flex;align-items:center;justify-content:center}.actions-footer{width:100%}nb-card-header,nb-card-footer{flex:0 0 auto}\n"]
7154 },] }
7155 ];
7156 NbTimePickerComponent.ctorParameters = function () { return [
7157 { type: undefined, decorators: [{ type: i0.Inject, args: [NB_TIME_PICKER_CONFIG,] }] },
7158 { type: NbPlatform },
7159 { type: String, decorators: [{ type: i0.Inject, args: [i0.LOCALE_ID,] }] },
7160 { type: i0.ChangeDetectorRef },
7161 { type: NbCalendarTimeModelService },
7162 { type: NbDateService }
7163 ]; };
7164 NbTimePickerComponent.propDecorators = {
7165 timeFormat: [{ type: i0.Input }],
7166 twelveHoursFormat: [{ type: i0.Input }],
7167 withSeconds: [{ type: i0.Input }],
7168 singleColumn: [{ type: i0.Input }],
7169 step: [{ type: i0.Input }],
7170 date: [{ type: i0.Input }],
7171 showFooter: [{ type: i0.Input }],
7172 applyButtonText: [{ type: i0.Input }],
7173 hoursText: [{ type: i0.Input }],
7174 minutesText: [{ type: i0.Input }],
7175 secondsText: [{ type: i0.Input }],
7176 ampmText: [{ type: i0.Input }],
7177 currentTimeButtonText: [{ type: i0.Input }],
7178 onSelectTime: [{ type: i0.Output }],
7179 portal: [{ type: i0.ViewChild, args: [NbPortalDirective, { static: true },] }]
7180 };
7181 return NbTimePickerComponent;
7182}());
7183
7184var NbCalendarWithTimeComponent = /** @class */ (function (_super) {
7185 tslib.__extends(NbCalendarWithTimeComponent, _super);
7186 function NbCalendarWithTimeComponent(dateService, cd, calendarTimeModelService) {
7187 var _this = _super.call(this) || this;
7188 _this.dateService = dateService;
7189 _this.cd = cd;
7190 _this.calendarTimeModelService = calendarTimeModelService;
7191 return _this;
7192 }
7193 NbCalendarWithTimeComponent.prototype.ngOnInit = function () {
7194 if (!this.date) {
7195 this.date = this.calendarTimeModelService.getResetTime();
7196 }
7197 };
7198 NbCalendarWithTimeComponent.prototype.ngAfterViewInit = function () {
7199 this.portalOutlet.attachTemplatePortal(this.timepicker.portal);
7200 };
7201 NbCalendarWithTimeComponent.prototype.onDateValueChange = function (date) {
7202 var hours = this.dateService.getHours(this.date);
7203 var minutes = this.dateService.getMinutes(this.date);
7204 var seconds = this.dateService.getSeconds(this.date);
7205 var milliseconds = this.dateService.getMilliseconds(this.date);
7206 var newDate = this.dateService.setHours(date, hours);
7207 newDate = this.dateService.setMinutes(newDate, minutes);
7208 newDate = this.dateService.setMinutes(newDate, minutes);
7209 newDate = this.dateService.setSeconds(newDate, seconds);
7210 newDate = this.dateService.setMilliseconds(newDate, milliseconds);
7211 this.date = newDate;
7212 };
7213 NbCalendarWithTimeComponent.prototype.onTimeChange = function (selectedTime) {
7214 var newDate = this.dateService.clone(this.date);
7215 newDate = this.dateService.setHours(newDate, this.dateService.getHours(selectedTime.time));
7216 newDate = this.dateService.setMinutes(newDate, this.dateService.getMinutes(selectedTime.time));
7217 newDate = this.dateService.setSeconds(newDate, this.dateService.getSeconds(selectedTime.time));
7218 newDate = this.dateService.setMilliseconds(newDate, this.dateService.getMilliseconds(selectedTime.time));
7219 this.date = newDate;
7220 };
7221 NbCalendarWithTimeComponent.prototype.saveValue = function () {
7222 this.dateChange.emit(this.date);
7223 };
7224 NbCalendarWithTimeComponent.prototype.saveCurrentTime = function () {
7225 this.dateChange.emit(this.dateService.today());
7226 };
7227 /**
7228 * We don't show seconds with twelve hours format
7229 * */
7230 NbCalendarWithTimeComponent.prototype.showSeconds = function () {
7231 return this.withSeconds && !this.twelveHoursFormat;
7232 };
7233 NbCalendarWithTimeComponent.prototype.isLarge = function () {
7234 return this.size === exports.NbCalendarSize.LARGE;
7235 };
7236 NbCalendarWithTimeComponent.decorators = [
7237 { type: i0.Component, args: [{
7238 selector: 'nb-calendar-with-time',
7239 template: "\n <nb-card class=\"calendar-with-time\">\n <nb-card-body class=\"picker-body\">\n <nb-base-calendar\n [boundingMonth]=\"boundingMonth\"\n [startView]=\"startView\"\n [date]=\"date\"\n [min]=\"min\"\n [max]=\"max\"\n [filter]=\"filter\"\n [dayCellComponent]=\"dayCellComponent\"\n [monthCellComponent]=\"monthCellComponent\"\n [yearCellComponent]=\"yearCellComponent\"\n [size]=\"size\"\n [visibleDate]=\"visibleDate\"\n [showNavigation]=\"showNavigation\"\n [showWeekNumber]=\"showWeekNumber\"\n [weekNumberSymbol]=\"weekNumberSymbol\"\n (dateChange)=\"onDateValueChange($event)\">\n </nb-base-calendar>\n <div class=\"timepicker-section\"\n [class.size-large]=\"isLarge()\"\n [class.timepicker-single-column-width]=\"singleColumn\"\n [class.timepicker-multiple-column-width]=\"!singleColumn\">\n <div class=\"picker-title\">{{ title }}</div>\n <nb-timepicker\n (onSelectTime)=\"onTimeChange($event)\"\n [date]=\"date\"\n [twelveHoursFormat]=\"twelveHoursFormat\"\n [withSeconds]=\"showSeconds()\"\n [showFooter]=\"false\"\n [singleColumn]=\"singleColumn\"\n [step]=\"step\">\n </nb-timepicker>\n <ng-container nbPortalOutlet></ng-container>\n </div>\n </nb-card-body>\n <nb-card-footer class=\"picker-footer\">\n <nb-calendar-actions\n [applyButtonText]=\"applyButtonText\"\n [currentTimeButtonText]=\"currentTimeButtonText\"\n (setCurrentTime)=\"saveCurrentTime()\"\n (saveValue)=\"saveValue()\"\n ></nb-calendar-actions>\n </nb-card-footer>\n </nb-card>\n ",
7240 changeDetection: i0.ChangeDetectionStrategy.OnPush,
7241 styles: [":host ::ng-deep nb-card.nb-timepicker-container{flex:1 0 0;border-radius:0;width:auto;border-right:0;border-bottom:0}[dir=ltr] :host .picker-footer{padding-left:.625rem}[dir=rtl] :host .picker-footer{padding-right:.625rem}.picker-body{align-items:stretch;display:flex;padding:0}.picker-body nb-base-calendar ::ng-deep nb-card{border-radius:0}.calendar-with-time{overflow:hidden}.timepicker-section{display:flex;flex-direction:column}\n"]
7242 },] }
7243 ];
7244 NbCalendarWithTimeComponent.ctorParameters = function () { return [
7245 { type: NbDateService },
7246 { type: i0.ChangeDetectorRef },
7247 { type: NbCalendarTimeModelService }
7248 ]; };
7249 NbCalendarWithTimeComponent.propDecorators = {
7250 visibleDate: [{ type: i0.Input }],
7251 twelveHoursFormat: [{ type: i0.Input }],
7252 withSeconds: [{ type: i0.Input }],
7253 singleColumn: [{ type: i0.Input }],
7254 step: [{ type: i0.Input }],
7255 timeFormat: [{ type: i0.Input }],
7256 title: [{ type: i0.Input }],
7257 applyButtonText: [{ type: i0.Input }],
7258 currentTimeButtonText: [{ type: i0.Input }],
7259 portalOutlet: [{ type: i0.ViewChild, args: [NbPortalOutletDirective,] }],
7260 timepicker: [{ type: i0.ViewChild, args: [NbTimePickerComponent,] }]
7261 };
7262 return NbCalendarWithTimeComponent;
7263}(NbCalendarComponent));
7264
7265/*
7266 * @license
7267 * Copyright Akveo. All Rights Reserved.
7268 * Licensed under the MIT License. See License.txt in the project root for license information.
7269 */
7270var NbDatepickerContainerComponent = /** @class */ (function (_super) {
7271 tslib.__extends(NbDatepickerContainerComponent, _super);
7272 function NbDatepickerContainerComponent() {
7273 return _super !== null && _super.apply(this, arguments) || this;
7274 }
7275 NbDatepickerContainerComponent.prototype.attach = function (portal) {
7276 return this.overlayContainer.attachComponentPortal(portal);
7277 };
7278 NbDatepickerContainerComponent.decorators = [
7279 { type: i0.Component, args: [{
7280 selector: 'nb-datepicker-container',
7281 template: "\n <nb-overlay-container></nb-overlay-container>\n "
7282 },] }
7283 ];
7284 NbDatepickerContainerComponent.propDecorators = {
7285 overlayContainer: [{ type: i0.ViewChild, args: [NbOverlayContainerComponent, { static: true },] }]
7286 };
7287 return NbDatepickerContainerComponent;
7288}(NbPositionedContainerComponent));
7289
7290/*
7291 * @license
7292 * Copyright Akveo. All Rights Reserved.
7293 * Licensed under the MIT License. See License.txt in the project root for license information.
7294 */
7295/**
7296 * The `NbDatepickerAdapter` instances provide way how to parse, format and validate
7297 * different date types.
7298 * */
7299var NbDatepickerAdapter = /** @class */ (function () {
7300 function NbDatepickerAdapter() {
7301 }
7302 return NbDatepickerAdapter;
7303}());
7304/**
7305 * Datepicker is an control that can pick any values anyway.
7306 * It has to be bound to the datepicker directive through nbDatepicker input.
7307 * */
7308var NbDatepicker = /** @class */ (function () {
7309 function NbDatepicker() {
7310 }
7311 return NbDatepicker;
7312}());
7313var NB_DATE_ADAPTER = new i0.InjectionToken('Datepicker Adapter');
7314var NB_DATE_SERVICE_OPTIONS = new i0.InjectionToken('Date service options');
7315/**
7316 * The `NbDatepickerDirective` is form control that gives you ability to select dates and ranges. The datepicker
7317 * is shown when input receives a `focus` event.
7318 *
7319 * ```html
7320 * <input [nbDatepicker]="datepicker">
7321 * <nb-datepicker #datepicker></nb-datepicker>
7322 * ```
7323 *
7324 * @stacked-example(Showcase, datepicker/datepicker-showcase.component)
7325 *
7326 * ### Installation
7327 *
7328 * Import `NbDatepickerModule.forRoot()` to your root module.
7329 * ```ts
7330 * @NgModule({
7331 * imports: [
7332 * // ...
7333 * NbDatepickerModule.forRoot(),
7334 * ],
7335 * })
7336 * export class AppModule { }
7337 * ```
7338 * And `NbDatepickerModule` to your feature module.
7339 * ```ts
7340 * @NgModule({
7341 * imports: [
7342 * // ...
7343 * NbDatepickerModule,
7344 * ],
7345 * })
7346 *
7347 * export class PageModule { }
7348 * ```
7349 * ### Usage
7350 *
7351 * If you want to use range selection, you have to use `NbRangepickerComponent` instead:
7352 *
7353 * ```html
7354 * <input [nbDatepicker]="rangepicker">
7355 * <nb-rangepicker #rangepicker></nb-rangepicker>
7356 * ```
7357 *
7358 * Both range and date pickers support all parameters as calendar, so, check `NbCalendarComponent` for additional
7359 * info.
7360 *
7361 * @stacked-example(Range showcase, datepicker/rangepicker-showcase.component)
7362 *
7363 * Datepicker is the form control so it can be bound with angular forms through ngModel and form controls.
7364 *
7365 * @stacked-example(Forms, datepicker/datepicker-forms.component)
7366 *
7367 * `NbDatepickerDirective` may be validated using `min` and `max` dates passed to the datepicker.
7368 * And `filter` predicate that receives date object and has to return a boolean value.
7369 *
7370 * @stacked-example(Validation, datepicker/datepicker-validation.component)
7371 *
7372 * If you need to pick a time along with the date, you can use nb-date-timepicker
7373 *
7374 * ```html
7375 * <input nbInput placeholder="Pick Date" [nbDatepicker]="dateTimePicker">
7376 * <nb-date-timepicker withSeconds #dateTimePicker></nb-date-timepicker>
7377 * ```
7378 * @stacked-example(Date timepicker, datepicker/date-timepicker-showcase.component)
7379 *
7380 * A single column picker with options value as time and minute, so users won’t be able to pick
7381 * hours and minutes individually.
7382 *
7383 * @stacked-example(Date timepicker single column, datepicker/date-timepicker-single-column.component)
7384
7385 * The `NbDatepickerComponent` supports date formatting:
7386 *
7387 * ```html
7388 * <input [nbDatepicker]="datepicker">
7389 * <nb-datepicker #datepicker format="MM\dd\yyyy"></nb-datepicker>
7390 * ```
7391 * <span id="formatting-issue"></span>
7392 * ## Formatting Issue
7393 *
7394 * By default, datepicker uses angulars `LOCALE_ID` token for localization and `DatePipe` for dates formatting.
7395 * And native `Date.parse(...)` for dates parsing. But native `Date.parse` function doesn't support formats.
7396 * To provide custom formatting you have to use one of the following packages:
7397 *
7398 * - `@nebular/moment` - provides moment date adapter that uses moment for date objects. This means datepicker than
7399 * will operate only moment date objects. If you want to use it you have to install it: `npm i @nebular/moment`, and
7400 * import `NbMomentDateModule` from this package.
7401 *
7402 * - `@nebular/date-fns` - adapter for popular date-fns library. This way is preferred if you need only date formatting.
7403 * Because date-fns is treeshakable, tiny and operates native date objects. If you want to use it you have to
7404 * install it: `npm i @nebular/date-fns`, and import `NbDateFnsDateModule` from this package.
7405 *
7406 * ### NbDateFnsDateModule
7407 *
7408 * Format is required when using `NbDateFnsDateModule`. You can set it via `format` input on datepicker component:
7409 * ```html
7410 * <nb-datepicker format="dd.MM.yyyy"></nb-datepicker>
7411 * ```
7412 * Also format can be set globally with `NbDateFnsDateModule.forRoot({ format: 'dd.MM.yyyy' })` and
7413 * `NbDateFnsDateModule.forChild({ format: 'dd.MM.yyyy' })` methods.
7414 *
7415 * Please note to use some of the formatting tokens you also need to pass
7416 * `{ useAdditionalWeekYearTokens: true, useAdditionalDayOfYearTokens: true }` to date-fns parse and format functions.
7417 * You can configure options passed this functions by setting `formatOptions` and
7418 * `parseOptions` of options object passed to `NbDateFnsDateModule.forRoot` and `NbDateFnsDateModule.forChild` methods.
7419 * ```ts
7420 * NbDateFnsDateModule.forRoot({
7421 * parseOptions: { useAdditionalWeekYearTokens: true, useAdditionalDayOfYearTokens: true },
7422 * formatOptions: { useAdditionalWeekYearTokens: true, useAdditionalDayOfYearTokens: true },
7423 * })
7424 * ```
7425 * Further info on `date-fns` formatting tokens could be found at
7426 * [date-fns docs](https://date-fns.org/v2.0.0-alpha.27/docs/Unicode-Tokens).
7427 *
7428 * You can also use `parseOptions` and `formatOptions` to provide locale.
7429 * ```ts
7430 * import { eo } from 'date-fns/locale';
7431 *
7432 * @NgModule({
7433 * imports: [
7434 * NbDateFnsDateModule.forRoot({
7435 * parseOptions: { locale: eo },
7436 * formatOptions: { locale: eo },
7437 * }),
7438 * ],
7439 * })
7440 * ```
7441 *
7442 * @styles
7443 *
7444 * datepicker-background-color:
7445 * datepicker-border-color:
7446 * datepicker-border-style:
7447 * datepicker-border-width:
7448 * datepicker-border-radius:
7449 * datepicker-shadow:
7450 * */
7451var NbDatepickerDirective = /** @class */ (function () {
7452 function NbDatepickerDirective(document, datepickerAdapters, hostRef, dateService, changeDetector) {
7453 var _this = this;
7454 this.document = document;
7455 this.datepickerAdapters = datepickerAdapters;
7456 this.hostRef = hostRef;
7457 this.dateService = dateService;
7458 this.changeDetector = changeDetector;
7459 this.destroy$ = new rxjs.Subject();
7460 this.isDatepickerReady = false;
7461 this.onChange = function () { };
7462 this.onTouched = function () { };
7463 /**
7464 * Form control validators will be called in validators context, so, we need to bind them.
7465 * */
7466 this.validator = _angular_forms.Validators.compose([
7467 this.parseValidator,
7468 this.minValidator,
7469 this.maxValidator,
7470 this.filterValidator,
7471 ].map(function (fn) { return fn.bind(_this); }));
7472 this.subscribeOnInputChange();
7473 }
7474 Object.defineProperty(NbDatepickerDirective.prototype, "setPicker", {
7475 /**
7476 * Provides datepicker component.
7477 * */
7478 set: function (picker) {
7479 this.picker = picker;
7480 this.setupPicker();
7481 },
7482 enumerable: false,
7483 configurable: true
7484 });
7485 Object.defineProperty(NbDatepickerDirective.prototype, "input", {
7486 /**
7487 * Returns html input element.
7488 * */
7489 get: function () {
7490 return this.hostRef.nativeElement;
7491 },
7492 enumerable: false,
7493 configurable: true
7494 });
7495 Object.defineProperty(NbDatepickerDirective.prototype, "inputValue", {
7496 /**
7497 * Returns host input value.
7498 * */
7499 get: function () {
7500 return this.input.value;
7501 },
7502 enumerable: false,
7503 configurable: true
7504 });
7505 NbDatepickerDirective.prototype.ngOnDestroy = function () {
7506 this.destroy$.next();
7507 this.destroy$.complete();
7508 };
7509 /**
7510 * Writes value in picker and html input element.
7511 * */
7512 NbDatepickerDirective.prototype.writeValue = function (value) {
7513 if (this.isDatepickerReady) {
7514 this.writePicker(value);
7515 this.writeInput(value);
7516 }
7517 else {
7518 this.queue = value;
7519 }
7520 };
7521 NbDatepickerDirective.prototype.registerOnChange = function (fn) {
7522 this.onChange = fn;
7523 };
7524 NbDatepickerDirective.prototype.registerOnTouched = function (fn) {
7525 this.onTouched = fn;
7526 };
7527 NbDatepickerDirective.prototype.setDisabledState = function (isDisabled) {
7528 this.input.disabled = isDisabled;
7529 };
7530 /**
7531 * Form control validation based on picker validator config.
7532 * */
7533 NbDatepickerDirective.prototype.validate = function () {
7534 return this.validator(null);
7535 };
7536 /**
7537 * Hides picker, focuses the input
7538 */
7539 NbDatepickerDirective.prototype.hidePicker = function () {
7540 this.input.focus();
7541 this.picker.hide();
7542 };
7543 /**
7544 * Validates that we can parse value correctly.
7545 * */
7546 NbDatepickerDirective.prototype.parseValidator = function () {
7547 /**
7548 * Date services treat empty string as invalid date.
7549 * That's why we're getting invalid formControl in case of empty input which is not required.
7550 * */
7551 if (this.inputValue === '') {
7552 return null;
7553 }
7554 var isValid = this.datepickerAdapter.isValid(this.inputValue, this.picker.format);
7555 return isValid ? null : { nbDatepickerParse: { value: this.inputValue } };
7556 };
7557 /**
7558 * Validates passed value is greater than min.
7559 * */
7560 NbDatepickerDirective.prototype.minValidator = function () {
7561 var config = this.picker.getValidatorConfig();
7562 var date = this.datepickerAdapter.parse(this.inputValue, this.picker.format);
7563 return (!config.min || !date || this.dateService.compareDates(config.min, date) <= 0) ?
7564 null : { nbDatepickerMin: { min: config.min, actual: date } };
7565 };
7566 /**
7567 * Validates passed value is smaller than max.
7568 * */
7569 NbDatepickerDirective.prototype.maxValidator = function () {
7570 var config = this.picker.getValidatorConfig();
7571 var date = this.datepickerAdapter.parse(this.inputValue, this.picker.format);
7572 return (!config.max || !date || this.dateService.compareDates(config.max, date) >= 0) ?
7573 null : { nbDatepickerMax: { max: config.max, actual: date } };
7574 };
7575 /**
7576 * Validates passed value satisfy the filter.
7577 * */
7578 NbDatepickerDirective.prototype.filterValidator = function () {
7579 var config = this.picker.getValidatorConfig();
7580 var date = this.datepickerAdapter.parse(this.inputValue, this.picker.format);
7581 return (!config.filter || !date || config.filter(date)) ?
7582 null : { nbDatepickerFilter: true };
7583 };
7584 /**
7585 * Chooses datepicker adapter based on passed picker component.
7586 * */
7587 NbDatepickerDirective.prototype.chooseDatepickerAdapter = function () {
7588 var _this = this;
7589 this.datepickerAdapter = this.datepickerAdapters.find(function (_a) {
7590 var picker = _a.picker;
7591 return _this.picker instanceof picker;
7592 });
7593 if (this.noDatepickerAdapterProvided()) {
7594 throw new Error('No datepickerAdapter provided for picker');
7595 }
7596 };
7597 /**
7598 * Attaches picker to the host input element and subscribes on value changes.
7599 * */
7600 NbDatepickerDirective.prototype.setupPicker = function () {
7601 var _this = this;
7602 this.chooseDatepickerAdapter();
7603 this.picker.attach(this.hostRef);
7604 if (this.inputValue) {
7605 this.picker.value = this.datepickerAdapter.parse(this.inputValue, this.picker.format);
7606 }
7607 // In case datepicker component placed after the input with datepicker directive,
7608 // we can't read `this.picker.format` on first change detection run,
7609 // since it's not bound yet, so we have to wait for datepicker component initialization.
7610 if (!this.isDatepickerReady) {
7611 this.picker.init
7612 .pipe(rxjs_operators.take(1), rxjs_operators.tap(function () { return _this.isDatepickerReady = true; }), rxjs_operators.filter(function () { return !!_this.queue; }), rxjs_operators.takeUntil(this.destroy$))
7613 .subscribe(function () {
7614 _this.writeValue(_this.queue);
7615 _this.onChange(_this.queue);
7616 _this.changeDetector.detectChanges();
7617 _this.queue = undefined;
7618 });
7619 }
7620 this.picker.valueChange
7621 .pipe(rxjs_operators.takeUntil(this.destroy$))
7622 .subscribe(function (value) {
7623 _this.writePicker(value);
7624 _this.writeInput(value);
7625 _this.onChange(value);
7626 if (_this.picker.shouldHide()) {
7627 _this.hidePicker();
7628 }
7629 });
7630 rxjs.merge(this.picker.blur, rxjs.fromEvent(this.input, 'blur').pipe(rxjs_operators.filter(function () { return !_this.picker.isShown && _this.document.activeElement !== _this.input; }))).pipe(rxjs_operators.takeUntil(this.destroy$))
7631 .subscribe(function () { return _this.onTouched(); });
7632 };
7633 NbDatepickerDirective.prototype.writePicker = function (value) {
7634 this.picker.value = value;
7635 };
7636 NbDatepickerDirective.prototype.writeInput = function (value) {
7637 var stringRepresentation = this.datepickerAdapter.format(value, this.picker.format);
7638 this.hostRef.nativeElement.value = stringRepresentation;
7639 };
7640 /**
7641 * Validates if no datepicker adapter provided.
7642 * */
7643 NbDatepickerDirective.prototype.noDatepickerAdapterProvided = function () {
7644 return !this.datepickerAdapter || !(this.datepickerAdapter instanceof NbDatepickerAdapter);
7645 };
7646 NbDatepickerDirective.prototype.subscribeOnInputChange = function () {
7647 var _this = this;
7648 rxjs.fromEvent(this.input, 'input')
7649 .pipe(rxjs_operators.map(function () { return _this.inputValue; }), rxjs_operators.takeUntil(this.destroy$))
7650 .subscribe(function (value) { return _this.handleInputChange(value); });
7651 };
7652 /**
7653 * Parses input value and write if it isn't null.
7654 * */
7655 NbDatepickerDirective.prototype.handleInputChange = function (value) {
7656 var date = this.parseInputValue(value);
7657 this.onChange(date);
7658 this.writePicker(date);
7659 };
7660 NbDatepickerDirective.prototype.parseInputValue = function (value) {
7661 if (this.datepickerAdapter.isValid(value, this.picker.format)) {
7662 return this.datepickerAdapter.parse(value, this.picker.format);
7663 }
7664 return null;
7665 };
7666 NbDatepickerDirective.decorators = [
7667 { type: i0.Directive, args: [{
7668 selector: 'input[nbDatepicker]',
7669 providers: [
7670 {
7671 provide: _angular_forms.NG_VALUE_ACCESSOR,
7672 useExisting: i0.forwardRef(function () { return NbDatepickerDirective; }),
7673 multi: true,
7674 },
7675 {
7676 provide: _angular_forms.NG_VALIDATORS,
7677 useExisting: i0.forwardRef(function () { return NbDatepickerDirective; }),
7678 multi: true,
7679 },
7680 ],
7681 },] }
7682 ];
7683 NbDatepickerDirective.ctorParameters = function () { return [
7684 { type: undefined, decorators: [{ type: i0.Inject, args: [NB_DOCUMENT,] }] },
7685 { type: Array, decorators: [{ type: i0.Inject, args: [NB_DATE_ADAPTER,] }] },
7686 { type: i0.ElementRef },
7687 { type: NbDateService },
7688 { type: i0.ChangeDetectorRef }
7689 ]; };
7690 NbDatepickerDirective.propDecorators = {
7691 setPicker: [{ type: i0.Input, args: ['nbDatepicker',] }]
7692 };
7693 return NbDatepickerDirective;
7694}());
7695
7696/*
7697 * @license
7698 * Copyright Akveo. All Rights Reserved.
7699 * Licensed under the MIT License. See License.txt in the project root for license information.
7700 */
7701/**
7702 * The `NbBasePicker` component concentrates overlay manipulation logic.
7703 * */
7704var NbBasePicker = /** @class */ (function (_super) {
7705 tslib.__extends(NbBasePicker, _super);
7706 function NbBasePicker(overlay, positionBuilder, triggerStrategyBuilder, cfr, dateService, dateServiceOptions) {
7707 var _this = _super.call(this) || this;
7708 _this.overlay = overlay;
7709 _this.positionBuilder = positionBuilder;
7710 _this.triggerStrategyBuilder = triggerStrategyBuilder;
7711 _this.cfr = cfr;
7712 _this.dateService = dateService;
7713 _this.dateServiceOptions = dateServiceOptions;
7714 _this.init$ = new rxjs.ReplaySubject();
7715 /**
7716 * Stream of picker changes. Required to be the subject because picker hides and shows and picker
7717 * change stream becomes recreated.
7718 * */
7719 _this.onChange$ = new rxjs.Subject();
7720 _this.overlayOffset = 8;
7721 _this.destroy$ = new rxjs.Subject();
7722 _this.blur$ = new rxjs.Subject();
7723 return _this;
7724 }
7725 Object.defineProperty(NbBasePicker.prototype, "picker", {
7726 /**
7727 * Returns picker instance.
7728 * */
7729 get: function () {
7730 return this.pickerRef && this.pickerRef.instance;
7731 },
7732 enumerable: false,
7733 configurable: true
7734 });
7735 Object.defineProperty(NbBasePicker.prototype, "valueChange", {
7736 /**
7737 * Stream of picker value changes.
7738 * */
7739 get: function () {
7740 return this.onChange$.asObservable();
7741 },
7742 enumerable: false,
7743 configurable: true
7744 });
7745 Object.defineProperty(NbBasePicker.prototype, "isShown", {
7746 get: function () {
7747 return this.ref && this.ref.hasAttached();
7748 },
7749 enumerable: false,
7750 configurable: true
7751 });
7752 Object.defineProperty(NbBasePicker.prototype, "init", {
7753 get: function () {
7754 return this.init$.asObservable();
7755 },
7756 enumerable: false,
7757 configurable: true
7758 });
7759 Object.defineProperty(NbBasePicker.prototype, "blur", {
7760 /**
7761 * Emits when datepicker looses focus.
7762 */
7763 get: function () {
7764 return this.blur$.asObservable();
7765 },
7766 enumerable: false,
7767 configurable: true
7768 });
7769 /**
7770 * Datepicker knows nothing about host html input element.
7771 * So, attach method attaches datepicker to the host input element.
7772 * */
7773 NbBasePicker.prototype.attach = function (hostRef) {
7774 this.hostRef = hostRef;
7775 this.subscribeOnTriggers();
7776 };
7777 NbBasePicker.prototype.getValidatorConfig = function () {
7778 return { min: this.min, max: this.max, filter: this.filter };
7779 };
7780 NbBasePicker.prototype.show = function () {
7781 if (!this.ref) {
7782 this.createOverlay();
7783 }
7784 this.openDatepicker();
7785 };
7786 NbBasePicker.prototype.shouldHide = function () {
7787 return this.hideOnSelect && !!this.value;
7788 };
7789 NbBasePicker.prototype.hide = function () {
7790 if (this.ref) {
7791 this.ref.detach();
7792 }
7793 // save current value if picker was rendered
7794 if (this.picker) {
7795 this.queue = this.value;
7796 this.pickerRef.destroy();
7797 this.pickerRef = null;
7798 this.container = null;
7799 }
7800 };
7801 NbBasePicker.prototype.createOverlay = function () {
7802 this.positionStrategy = this.createPositionStrategy();
7803 this.ref = this.overlay.create({
7804 positionStrategy: this.positionStrategy,
7805 scrollStrategy: this.overlay.scrollStrategies.reposition(),
7806 });
7807 this.subscribeOnPositionChange();
7808 };
7809 NbBasePicker.prototype.openDatepicker = function () {
7810 this.container = this.ref.attach(new NbComponentPortal(NbDatepickerContainerComponent, null, null, this.cfr));
7811 this.instantiatePicker();
7812 this.subscribeOnValueChange();
7813 this.writeQueue();
7814 this.patchWithInputs();
7815 this.pickerRef.changeDetectorRef.markForCheck();
7816 };
7817 NbBasePicker.prototype.createPositionStrategy = function () {
7818 return this.positionBuilder
7819 .connectedTo(this.hostRef)
7820 .position(exports.NbPosition.BOTTOM)
7821 .offset(this.overlayOffset)
7822 .adjustment(exports.NbAdjustment.COUNTERCLOCKWISE);
7823 };
7824 NbBasePicker.prototype.subscribeOnPositionChange = function () {
7825 var _this = this;
7826 this.positionStrategy.positionChange
7827 .pipe(rxjs_operators.takeUntil(this.destroy$))
7828 .subscribe(function (position) { return patch(_this.container, { position: position }); });
7829 };
7830 NbBasePicker.prototype.createTriggerStrategy = function () {
7831 var _this = this;
7832 return this.triggerStrategyBuilder
7833 .trigger(exports.NbTrigger.FOCUS)
7834 .host(this.hostRef.nativeElement)
7835 .container(function () { return _this.container; })
7836 .build();
7837 };
7838 NbBasePicker.prototype.subscribeOnTriggers = function () {
7839 var _this = this;
7840 this.triggerStrategy = this.createTriggerStrategy();
7841 this.triggerStrategy.show$.subscribe(function () { return _this.show(); });
7842 this.triggerStrategy.hide$.subscribe(function () {
7843 _this.blur$.next();
7844 _this.hide();
7845 });
7846 };
7847 NbBasePicker.prototype.instantiatePicker = function () {
7848 this.pickerRef = this.container.instance.attach(new NbComponentPortal(this.pickerClass, null, null, this.cfr));
7849 };
7850 /**
7851 * Subscribes on picker value changes and emit data through this.onChange$ subject.
7852 * */
7853 NbBasePicker.prototype.subscribeOnValueChange = function () {
7854 var _this = this;
7855 this.pickerValueChange.subscribe(function (date) {
7856 _this.onChange$.next(date);
7857 });
7858 };
7859 NbBasePicker.prototype.patchWithInputs = function () {
7860 this.picker.boundingMonth = this.boundingMonth;
7861 this.picker.startView = this.startView;
7862 this.picker.min = this.min;
7863 this.picker.max = this.max;
7864 this.picker.filter = this.filter;
7865 this.picker._cellComponent = this.dayCellComponent;
7866 this.picker._monthCellComponent = this.monthCellComponent;
7867 this.picker._yearCellComponent = this.yearCellComponent;
7868 this.picker.size = this.size;
7869 this.picker.showNavigation = this.showNavigation;
7870 this.picker.visibleDate = this.visibleDate;
7871 this.picker.showWeekNumber = this.showWeekNumber;
7872 this.picker.weekNumberSymbol = this.weekNumberSymbol;
7873 };
7874 NbBasePicker.prototype.checkFormat = function () {
7875 if (this.dateService.getId() === 'native' && this.format) {
7876 throw new Error('Can\'t format native date. To use custom formatting you have to install @nebular/moment or ' +
7877 '@nebular/date-fns package and import NbMomentDateModule or NbDateFnsDateModule accordingly.' +
7878 'More information at "Formatting issue" ' +
7879 'https://akveo.github.io/nebular/docs/components/datepicker/overview#nbdatepickercomponent');
7880 }
7881 var isFormatSet = this.format || (this.dateServiceOptions && this.dateServiceOptions.format);
7882 if (this.dateService.getId() === 'date-fns' && !isFormatSet) {
7883 throw new Error('format is required when using NbDateFnsDateModule');
7884 }
7885 };
7886 return NbBasePicker;
7887}(NbDatepicker));
7888var NbBasePickerComponent = /** @class */ (function (_super) {
7889 tslib.__extends(NbBasePickerComponent, _super);
7890 function NbBasePickerComponent(document, positionBuilder, triggerStrategyBuilder, overlay, cfr, dateService, dateServiceOptions) {
7891 var _this = _super.call(this, overlay, positionBuilder, triggerStrategyBuilder, cfr, dateService, dateServiceOptions) || this;
7892 /**
7893 * Defines if we should render previous and next months
7894 * in the current month view.
7895 * */
7896 _this.boundingMonth = true;
7897 /**
7898 * Defines starting view for calendar.
7899 * */
7900 _this.startView = exports.NbCalendarViewMode.DATE;
7901 /**
7902 * Size of the calendar and entire components.
7903 * Can be 'medium' which is default or 'large'.
7904 * */
7905 _this.size = exports.NbCalendarSize.MEDIUM;
7906 /**
7907 * Hide picker when a date or a range is selected, `true` by default
7908 * @type {boolean}
7909 */
7910 _this.hideOnSelect = true;
7911 /**
7912 * Determines should we show calendars navigation or not.
7913 * @type {boolean}
7914 */
7915 _this.showNavigation = true;
7916 /**
7917 * Sets symbol used as a header for week numbers column
7918 * */
7919 _this.weekNumberSymbol = '#';
7920 _this._showWeekNumber = false;
7921 /**
7922 * Determines picker overlay offset (in pixels).
7923 * */
7924 _this.overlayOffset = 8;
7925 return _this;
7926 }
7927 Object.defineProperty(NbBasePickerComponent.prototype, "showWeekNumber", {
7928 /**
7929 * Determines should we show week numbers column.
7930 * False by default.
7931 * */
7932 get: function () {
7933 return this._showWeekNumber;
7934 },
7935 set: function (value) {
7936 this._showWeekNumber = convertToBoolProperty(value);
7937 },
7938 enumerable: false,
7939 configurable: true
7940 });
7941 NbBasePickerComponent.prototype.ngOnInit = function () {
7942 this.checkFormat();
7943 };
7944 NbBasePickerComponent.prototype.ngOnChanges = function (changes) {
7945 if (changes.format && !changes.format.isFirstChange()) {
7946 this.checkFormat();
7947 }
7948 };
7949 NbBasePickerComponent.prototype.ngAfterViewInit = function () {
7950 this.init$.next();
7951 };
7952 NbBasePickerComponent.prototype.ngOnDestroy = function () {
7953 this.destroy$.next();
7954 this.destroy$.complete();
7955 this.hide();
7956 this.init$.complete();
7957 if (this.ref) {
7958 this.ref.dispose();
7959 }
7960 if (this.triggerStrategy) {
7961 this.triggerStrategy.destroy();
7962 }
7963 };
7964 Object.defineProperty(NbBasePickerComponent.prototype, "pickerValueChange", {
7965 get: function () {
7966 return;
7967 },
7968 enumerable: false,
7969 configurable: true
7970 });
7971 Object.defineProperty(NbBasePickerComponent.prototype, "value", {
7972 get: function () {
7973 return undefined;
7974 },
7975 set: function (value) { },
7976 enumerable: false,
7977 configurable: true
7978 });
7979 NbBasePickerComponent.prototype.writeQueue = function () {
7980 };
7981 NbBasePickerComponent.decorators = [
7982 { type: i0.Component, args: [{
7983 template: ''
7984 },] }
7985 ];
7986 NbBasePickerComponent.ctorParameters = function () { return [
7987 { type: undefined, decorators: [{ type: i0.Inject, args: [NB_DOCUMENT,] }] },
7988 { type: NbPositionBuilderService },
7989 { type: NbTriggerStrategyBuilderService },
7990 { type: NbOverlayService },
7991 { type: i0.ComponentFactoryResolver },
7992 { type: NbDateService },
7993 { type: undefined, decorators: [{ type: i0.Optional }, { type: i0.Inject, args: [NB_DATE_SERVICE_OPTIONS,] }] }
7994 ]; };
7995 NbBasePickerComponent.propDecorators = {
7996 format: [{ type: i0.Input }],
7997 boundingMonth: [{ type: i0.Input }],
7998 startView: [{ type: i0.Input }],
7999 min: [{ type: i0.Input }],
8000 max: [{ type: i0.Input }],
8001 filter: [{ type: i0.Input }],
8002 dayCellComponent: [{ type: i0.Input }],
8003 monthCellComponent: [{ type: i0.Input }],
8004 yearCellComponent: [{ type: i0.Input }],
8005 size: [{ type: i0.Input }],
8006 visibleDate: [{ type: i0.Input }],
8007 hideOnSelect: [{ type: i0.Input }],
8008 showNavigation: [{ type: i0.Input }],
8009 weekNumberSymbol: [{ type: i0.Input }],
8010 showWeekNumber: [{ type: i0.Input }],
8011 overlayOffset: [{ type: i0.Input }]
8012 };
8013 return NbBasePickerComponent;
8014}(NbBasePicker));
8015/**
8016 * The DatePicker components itself.
8017 * Provides a proxy to `NbCalendar` options as well as custom picker options.
8018 */
8019var NbDatepickerComponent = /** @class */ (function (_super) {
8020 tslib.__extends(NbDatepickerComponent, _super);
8021 function NbDatepickerComponent() {
8022 var _this = _super !== null && _super.apply(this, arguments) || this;
8023 _this.pickerClass = NbCalendarComponent;
8024 return _this;
8025 }
8026 Object.defineProperty(NbDatepickerComponent.prototype, "date", {
8027 /**
8028 * Date which will be rendered as selected.
8029 * */
8030 set: function (date) {
8031 this.value = date;
8032 },
8033 enumerable: false,
8034 configurable: true
8035 });
8036 Object.defineProperty(NbDatepickerComponent.prototype, "dateChange", {
8037 /**
8038 * Emits date when selected.
8039 * */
8040 get: function () {
8041 return this.valueChange;
8042 },
8043 enumerable: false,
8044 configurable: true
8045 });
8046 Object.defineProperty(NbDatepickerComponent.prototype, "value", {
8047 get: function () {
8048 return this.picker ? this.picker.date : undefined;
8049 },
8050 set: function (date) {
8051 if (!this.picker) {
8052 this.queue = date;
8053 return;
8054 }
8055 if (date) {
8056 this.visibleDate = date;
8057 this.picker.visibleDate = date;
8058 this.picker.date = date;
8059 }
8060 },
8061 enumerable: false,
8062 configurable: true
8063 });
8064 Object.defineProperty(NbDatepickerComponent.prototype, "pickerValueChange", {
8065 get: function () {
8066 return this.picker.dateChange;
8067 },
8068 enumerable: false,
8069 configurable: true
8070 });
8071 NbDatepickerComponent.prototype.writeQueue = function () {
8072 if (this.queue) {
8073 var date = this.queue;
8074 this.queue = null;
8075 this.value = date;
8076 }
8077 };
8078 NbDatepickerComponent.decorators = [
8079 { type: i0.Component, args: [{
8080 selector: 'nb-datepicker',
8081 template: ''
8082 },] }
8083 ];
8084 NbDatepickerComponent.propDecorators = {
8085 date: [{ type: i0.Input }],
8086 dateChange: [{ type: i0.Output }]
8087 };
8088 return NbDatepickerComponent;
8089}(NbBasePickerComponent));
8090/**
8091 * The RangeDatePicker components itself.
8092 * Provides a proxy to `NbCalendarRange` options as well as custom picker options.
8093 */
8094var NbRangepickerComponent = /** @class */ (function (_super) {
8095 tslib.__extends(NbRangepickerComponent, _super);
8096 function NbRangepickerComponent() {
8097 var _this = _super !== null && _super.apply(this, arguments) || this;
8098 _this.pickerClass = NbCalendarRangeComponent;
8099 return _this;
8100 }
8101 Object.defineProperty(NbRangepickerComponent.prototype, "range", {
8102 /**
8103 * Range which will be rendered as selected.
8104 * */
8105 set: function (range) {
8106 this.value = range;
8107 },
8108 enumerable: false,
8109 configurable: true
8110 });
8111 Object.defineProperty(NbRangepickerComponent.prototype, "rangeChange", {
8112 /**
8113 * Emits range when start selected and emits again when end selected.
8114 * */
8115 get: function () {
8116 return this.valueChange;
8117 },
8118 enumerable: false,
8119 configurable: true
8120 });
8121 Object.defineProperty(NbRangepickerComponent.prototype, "value", {
8122 get: function () {
8123 return this.picker ? this.picker.range : undefined;
8124 },
8125 set: function (range) {
8126 if (!this.picker) {
8127 this.queue = range;
8128 return;
8129 }
8130 if (range) {
8131 var visibleDate = range && range.start;
8132 this.visibleDate = visibleDate;
8133 this.picker.visibleDate = visibleDate;
8134 this.picker.range = range;
8135 }
8136 },
8137 enumerable: false,
8138 configurable: true
8139 });
8140 Object.defineProperty(NbRangepickerComponent.prototype, "pickerValueChange", {
8141 get: function () {
8142 return this.picker.rangeChange;
8143 },
8144 enumerable: false,
8145 configurable: true
8146 });
8147 NbRangepickerComponent.prototype.shouldHide = function () {
8148 return _super.prototype.shouldHide.call(this) && !!(this.value && this.value.start && this.value.end);
8149 };
8150 NbRangepickerComponent.prototype.writeQueue = function () {
8151 if (this.queue) {
8152 var range = this.queue;
8153 this.queue = null;
8154 this.value = range;
8155 }
8156 };
8157 NbRangepickerComponent.decorators = [
8158 { type: i0.Component, args: [{
8159 selector: 'nb-rangepicker',
8160 template: ''
8161 },] }
8162 ];
8163 NbRangepickerComponent.propDecorators = {
8164 range: [{ type: i0.Input }],
8165 rangeChange: [{ type: i0.Output }]
8166 };
8167 return NbRangepickerComponent;
8168}(NbBasePickerComponent));
8169
8170var NbDateTimePickerComponent = /** @class */ (function (_super) {
8171 tslib.__extends(NbDateTimePickerComponent, _super);
8172 function NbDateTimePickerComponent(document, positionBuilder, triggerStrategyBuilder, overlay, cfr, dateService, dateServiceOptions, calendarWithTimeModelService) {
8173 var _this = _super.call(this, document, positionBuilder, triggerStrategyBuilder, overlay, cfr, dateService, dateServiceOptions) || this;
8174 _this.calendarWithTimeModelService = calendarWithTimeModelService;
8175 _this.pickerClass = NbCalendarWithTimeComponent;
8176 return _this;
8177 }
8178 Object.defineProperty(NbDateTimePickerComponent.prototype, "value", {
8179 get: function () {
8180 return this.picker ? this.picker.date : undefined;
8181 },
8182 set: function (date) {
8183 if (!this.picker) {
8184 this.queue = date;
8185 return;
8186 }
8187 if (date) {
8188 this.visibleDate = date;
8189 this.picker.visibleDate = date;
8190 this.picker.date = date;
8191 this.picker.cd.markForCheck();
8192 }
8193 },
8194 enumerable: false,
8195 configurable: true
8196 });
8197 Object.defineProperty(NbDateTimePickerComponent.prototype, "twelveHoursFormat", {
8198 get: function () {
8199 return this._twelveHoursFormat;
8200 },
8201 set: function (value) {
8202 this._twelveHoursFormat = convertToBoolProperty(value);
8203 },
8204 enumerable: false,
8205 configurable: true
8206 });
8207 Object.defineProperty(NbDateTimePickerComponent.prototype, "withSeconds", {
8208 get: function () {
8209 return this._withSeconds;
8210 },
8211 set: function (value) {
8212 this._withSeconds = convertToBoolProperty(value);
8213 },
8214 enumerable: false,
8215 configurable: true
8216 });
8217 Object.defineProperty(NbDateTimePickerComponent.prototype, "singleColumn", {
8218 get: function () {
8219 return this._singleColumn;
8220 },
8221 set: function (value) {
8222 this._singleColumn = convertToBoolProperty(value);
8223 },
8224 enumerable: false,
8225 configurable: true
8226 });
8227 NbDateTimePickerComponent.prototype.ngOnInit = function () {
8228 this.format = this.format || this.buildTimeFormat();
8229 };
8230 NbDateTimePickerComponent.prototype.patchWithInputs = function () {
8231 this.picker.singleColumn = this.singleColumn;
8232 this.picker.twelveHoursFormat = this.twelveHoursFormat;
8233 this.picker.withSeconds = this.withSeconds;
8234 this.picker.step = this.step;
8235 this.picker.title = this.title;
8236 this.picker.applyButtonText = this.applyButtonText;
8237 this.picker.currentTimeButtonText = this.currentTimeButtonText;
8238 if (this.twelveHoursFormat) {
8239 this.picker.timeFormat = this.dateService.getTwelveHoursFormat();
8240 }
8241 else {
8242 this.picker.timeFormat = this.withSeconds ? this.dateService.getTwentyFourHoursFormatWithSeconds() :
8243 this.dateService.getTwentyFourHoursFormat();
8244 }
8245 _super.prototype.patchWithInputs.call(this);
8246 this.picker.cd.markForCheck();
8247 };
8248 Object.defineProperty(NbDateTimePickerComponent.prototype, "pickerValueChange", {
8249 get: function () {
8250 return this.picker.dateChange;
8251 },
8252 enumerable: false,
8253 configurable: true
8254 });
8255 NbDateTimePickerComponent.prototype.writeQueue = function () {
8256 if (this.queue) {
8257 var date = this.queue;
8258 this.queue = null;
8259 this.value = date;
8260 }
8261 };
8262 NbDateTimePickerComponent.prototype.buildTimeFormat = function () {
8263 if (this.singleColumn) {
8264 return this.calendarWithTimeModelService.buildDateFormat(this.twelveHoursFormat);
8265 }
8266 else {
8267 return this.calendarWithTimeModelService.buildDateFormat(this.twelveHoursFormat, this.withSeconds);
8268 }
8269 };
8270 NbDateTimePickerComponent.decorators = [
8271 { type: i0.Component, args: [{
8272 selector: 'nb-date-timepicker',
8273 template: '',
8274 changeDetection: i0.ChangeDetectionStrategy.OnPush
8275 },] }
8276 ];
8277 NbDateTimePickerComponent.ctorParameters = function () { return [
8278 { type: undefined, decorators: [{ type: i0.Inject, args: [NB_DOCUMENT,] }] },
8279 { type: NbPositionBuilderService },
8280 { type: NbTriggerStrategyBuilderService },
8281 { type: NbOverlayService },
8282 { type: i0.ComponentFactoryResolver },
8283 { type: NbDateService },
8284 { type: undefined, decorators: [{ type: i0.Optional }, { type: i0.Inject, args: [NB_DATE_SERVICE_OPTIONS,] }] },
8285 { type: NbCalendarTimeModelService }
8286 ]; };
8287 NbDateTimePickerComponent.propDecorators = {
8288 step: [{ type: i0.Input }],
8289 title: [{ type: i0.Input }],
8290 applyButtonText: [{ type: i0.Input }],
8291 currentTimeButtonText: [{ type: i0.Input }],
8292 twelveHoursFormat: [{ type: i0.Input }],
8293 withSeconds: [{ type: i0.Input }],
8294 singleColumn: [{ type: i0.Input }]
8295 };
8296 return NbDateTimePickerComponent;
8297}(NbBasePickerComponent));
8298
8299/**
8300 * @license
8301 * Copyright Akveo. All Rights Reserved.
8302 * Licensed under the MIT License. See License.txt in the project root for license information.
8303 */
8304function isUrlPathEqual(path, link) {
8305 var locationPath = getPathPartOfUrl(path);
8306 return link === locationPath;
8307}
8308function isUrlPathContain(path, link) {
8309 var locationPath = getPathPartOfUrl(path);
8310 var endOfUrlSegmentRegExp = /\/|^$/;
8311 return locationPath.startsWith(link) &&
8312 locationPath.slice(link.length).charAt(0).search(endOfUrlSegmentRegExp) !== -1;
8313}
8314function getPathPartOfUrl(url) {
8315 return url.match(/.*?(?=[?;#]|$)/)[0];
8316}
8317function getFragmentPartOfUrl(url) {
8318 var matched = url.match(/#(.+)/);
8319 return matched ? matched[1] : '';
8320}
8321function isFragmentEqual(path, fragment) {
8322 return getFragmentPartOfUrl(path) === fragment;
8323}
8324function isFragmentContain(path, fragment) {
8325 return getFragmentPartOfUrl(path).includes(fragment);
8326}
8327
8328/**
8329 * This service determines whether we should scroll the layout back to top.
8330 * This occurs when the page is changed, so when current url PATH is not equal to the previous one.
8331 *
8332 * TODO: this is most likely a temporary solutions as recently Angular introduces ViewportScroll
8333 * and scroll restoration process
8334 */
8335var NbRestoreScrollTopHelper = /** @class */ (function () {
8336 function NbRestoreScrollTopHelper(router) {
8337 this.router = router;
8338 }
8339 NbRestoreScrollTopHelper.prototype.shouldRestore = function () {
8340 var _this = this;
8341 return this.router.events
8342 .pipe(rxjs_operators.startWith(null), rxjs_operators.filter(function (event) { return event === null || event instanceof _angular_router.NavigationEnd; }), rxjs_operators.pairwise(), rxjs_operators.map(function (_a) {
8343 var prev = _a[0], current = _a[1];
8344 return _this.pageChanged(prev, current);
8345 }), rxjs_operators.filter(function (res) { return !!res; }));
8346 };
8347 NbRestoreScrollTopHelper.prototype.pageChanged = function (prev, current) {
8348 return !prev || getPathPartOfUrl(prev.url) !== getPathPartOfUrl(current.url);
8349 };
8350 NbRestoreScrollTopHelper.decorators = [
8351 { type: i0.Injectable }
8352 ];
8353 NbRestoreScrollTopHelper.ctorParameters = function () { return [
8354 { type: _angular_router.Router }
8355 ]; };
8356 return NbRestoreScrollTopHelper;
8357}());
8358
8359/**
8360 * @license
8361 * Copyright Akveo. All Rights Reserved.
8362 * Licensed under the MIT License. See License.txt in the project root for license information.
8363 */
8364/**
8365 * Layout container component.
8366 * When using with Nebular Theme System it is required that all child components should be placed inside.
8367 *
8368 * Basic example of two column layout with header:
8369 *
8370 * @stacked-example(Showcase, layout/layout-showcase.component)
8371 *
8372 * Can contain the following components inside:
8373 *
8374 * ```html
8375 * <nb-layout>
8376 * <nb-layout-header></nb-layout-header>
8377 * <nb-layout-footer></nb-layout-footer>
8378 * <nb-layout-column></nb-layout-column>
8379 * <nb-sidebar></nb-sidebar>
8380 * </nb-layout>
8381 * ```
8382 * ### Installation
8383 *
8384 * Import `NbLayoutModule` to your app module.
8385 * ```ts
8386 * @NgModule({
8387 * imports: [
8388 * // ...
8389 * NbLayoutModule,
8390 * ],
8391 * })
8392 * export class AppModule { }
8393 * ```
8394 * ### Usage
8395 * By default the layout fills up the whole view-port.
8396 * The window scrollbars are disabled on the body and moved inside of the nb-layout, so that the scrollbars
8397 * won't mess with the fixed nb-header.
8398 *
8399 * The child components are projected into a flexible layout structure allowing to adjust the layout behavior
8400 * based on the settings provided.
8401 *
8402 * The layout content (columns) becomes centered when the window width is more than
8403 * the value specified in the theme variable `layout-content-width`.
8404 *
8405 * The layout also contains the area on the very top (the first child of the nb-layout), which could be used
8406 * to dynamically append some components like modals or spinners/loaders
8407 * so that they are located on top of the elements hierarchy.
8408 * More details are under the `ThemeService` section.
8409 *
8410 * The layout component is also responsible for changing application themes.
8411 * It listens to the `themeChange` event and change a theme CSS class appended to body.
8412 * Based on the class appended, specific CSS-theme is applied to the application.
8413 * More details of the Theme System could be found here [Enabling Theme System](#/docs/concepts/theme-system)
8414 *
8415 * A simple layout with footer:
8416 *
8417 * @stacked-example(Layout With Footer, layout/layout-w-footer.component)
8418 *
8419 * It is possible to ask the layout to center the columns (notice: we added a `center` attribute
8420 * to the layout:
8421 *
8422 * ```html
8423 * <nb-layout center>
8424 * <nb-layout-header>Awesome Company</nb-layout-header>
8425 *
8426 * <nb-layout-column>
8427 * Hello World!
8428 * </nb-layout-column>
8429 *
8430 * <nb-layout-footer>Contact us</nb-layout-footer>
8431 * </nb-layout>
8432 * ```
8433 *
8434 * @styles
8435 *
8436 * layout-background-color:
8437 * layout-text-color:
8438 * layout-text-font-family:
8439 * layout-text-font-size:
8440 * layout-text-font-weight:
8441 * layout-text-line-height:
8442 * layout-min-height:
8443 * layout-content-width:
8444 * layout-window-mode-min-width:
8445 * layout-window-mode-max-width:
8446 * layout-window-mode-background-color:
8447 * layout-window-mode-padding-top:
8448 * layout-window-shadow:
8449 * layout-padding:
8450 * layout-medium-padding:
8451 * layout-small-padding:
8452 * layout-scrollbar-background-color:
8453 * layout-scrollbar-color:
8454 * layout-scrollbar-width:
8455 */
8456var NbLayoutComponent = /** @class */ (function () {
8457 function NbLayoutComponent(themeService, spinnerService, elementRef, renderer, window, document, platformId, layoutDirectionService, scrollService, rulerService, scrollTop, overlayContainer) {
8458 var _this = this;
8459 this.themeService = themeService;
8460 this.spinnerService = spinnerService;
8461 this.elementRef = elementRef;
8462 this.renderer = renderer;
8463 this.window = window;
8464 this.document = document;
8465 this.platformId = platformId;
8466 this.layoutDirectionService = layoutDirectionService;
8467 this.scrollService = scrollService;
8468 this.rulerService = rulerService;
8469 this.scrollTop = scrollTop;
8470 this.overlayContainer = overlayContainer;
8471 this.scrollBlockClass = 'nb-global-scrollblock';
8472 this.isScrollBlocked = false;
8473 this.centerValue = false;
8474 this.restoreScrollTopValue = true;
8475 this.windowModeValue = false;
8476 this.withScrollValue = false;
8477 this.withSubheader = false;
8478 this.afterViewInit$ = new rxjs.BehaviorSubject(null);
8479 this.destroy$ = new rxjs.Subject();
8480 this.registerAsOverlayContainer();
8481 this.themeService.onThemeChange()
8482 .pipe(rxjs_operators.takeUntil(this.destroy$))
8483 .subscribe(function (theme) {
8484 var body = _this.document.getElementsByTagName('body')[0];
8485 if (theme.previous) {
8486 _this.renderer.removeClass(body, "nb-theme-" + theme.previous);
8487 }
8488 _this.renderer.addClass(body, "nb-theme-" + theme.name);
8489 });
8490 this.themeService.onAppendLayoutClass()
8491 .pipe(rxjs_operators.takeUntil(this.destroy$))
8492 .subscribe(function (className) {
8493 _this.renderer.addClass(_this.elementRef.nativeElement, className);
8494 });
8495 this.themeService.onRemoveLayoutClass()
8496 .pipe(rxjs_operators.takeUntil(this.destroy$))
8497 .subscribe(function (className) {
8498 _this.renderer.removeClass(_this.elementRef.nativeElement, className);
8499 });
8500 this.spinnerService.registerLoader(new Promise(function (resolve) {
8501 _this.afterViewInit$
8502 .pipe(rxjs_operators.takeUntil(_this.destroy$))
8503 .subscribe(function (_) { return resolve(); });
8504 }));
8505 this.spinnerService.load();
8506 this.rulerService.onGetDimensions()
8507 .pipe(rxjs_operators.takeUntil(this.destroy$))
8508 .subscribe(function (_a) {
8509 var listener = _a.listener;
8510 listener.next(_this.getDimensions());
8511 listener.complete();
8512 });
8513 this.scrollService
8514 .onScrollableChange()
8515 .pipe(rxjs_operators.filter(function () { return _this.withScrollValue; }))
8516 .subscribe(function (scrollable) {
8517 /**
8518 * In case when Nebular Layout custom scroll `withScroll` mode is enabled
8519 * we need to disable default CDK scroll blocker (@link NbBlockScrollStrategyAdapter) on HTML element
8520 * so that it won't add additional positioning.
8521 */
8522 if (scrollable) {
8523 _this.enableScroll();
8524 }
8525 else {
8526 _this.blockScroll();
8527 }
8528 });
8529 if (_angular_common.isPlatformBrowser(this.platformId)) {
8530 // trigger first time so that after the change we have the initial value
8531 this.themeService.changeWindowWidth(this.window.innerWidth);
8532 }
8533 }
8534 Object.defineProperty(NbLayoutComponent.prototype, "center", {
8535 /**
8536 * Defines whether the layout columns will be centered after some width
8537 * @param {boolean} val
8538 */
8539 set: function (val) {
8540 this.centerValue = convertToBoolProperty(val);
8541 },
8542 enumerable: false,
8543 configurable: true
8544 });
8545 Object.defineProperty(NbLayoutComponent.prototype, "windowMode", {
8546 /**
8547 * Defines whether the layout enters a 'window' mode, when the layout content (including sidebars and fixed header)
8548 * becomes centered by width with a margin from the top of the screen, like a floating window.
8549 * Automatically enables `withScroll` mode, as in the window mode scroll must be inside the layout and cannot be on
8550 * window. (TODO: check this)
8551 * @param {boolean} val
8552 */
8553 set: function (val) {
8554 this.windowModeValue = convertToBoolProperty(val);
8555 this.withScroll = this.windowModeValue;
8556 },
8557 enumerable: false,
8558 configurable: true
8559 });
8560 Object.defineProperty(NbLayoutComponent.prototype, "withScroll", {
8561 /**
8562 * Defines whether to move the scrollbars to layout or leave it at the body level.
8563 * Automatically set to true when `windowMode` is enabled.
8564 * @param {boolean} val
8565 */
8566 set: function (val) {
8567 this.withScrollValue = convertToBoolProperty(val);
8568 // TODO: is this the best way of doing it? as we don't have access to body from theme styles
8569 // TODO: add e2e test
8570 var body = this.document.getElementsByTagName('body')[0];
8571 if (this.withScrollValue) {
8572 this.renderer.setStyle(body, 'overflow', 'hidden');
8573 }
8574 else {
8575 this.renderer.setStyle(body, 'overflow', 'initial');
8576 }
8577 },
8578 enumerable: false,
8579 configurable: true
8580 });
8581 Object.defineProperty(NbLayoutComponent.prototype, "restoreScrollTop", {
8582 /**
8583 * Restores scroll to the top of the page after navigation
8584 * @param {boolean} val
8585 */
8586 set: function (val) {
8587 this.restoreScrollTopValue = convertToBoolProperty(val);
8588 },
8589 enumerable: false,
8590 configurable: true
8591 });
8592 NbLayoutComponent.prototype.ngAfterViewInit = function () {
8593 var _this = this;
8594 this.scrollService.onGetPosition()
8595 .pipe(rxjs_operators.takeUntil(this.destroy$))
8596 .subscribe(function (_a) {
8597 var listener = _a.listener;
8598 listener.next(_this.getScrollPosition());
8599 listener.complete();
8600 });
8601 this.scrollTop.shouldRestore()
8602 .pipe(rxjs_operators.filter(function () { return _this.restoreScrollTopValue; }), rxjs_operators.takeUntil(this.destroy$))
8603 .subscribe(function () { return _this.scroll(0, 0); });
8604 this.layoutDirectionService.onDirectionChange()
8605 .pipe(rxjs_operators.takeUntil(this.destroy$))
8606 .subscribe(function (direction) { return _this.document.dir = direction; });
8607 this.scrollService.onManualScroll()
8608 .pipe(rxjs_operators.takeUntil(this.destroy$))
8609 .subscribe(function (_a) {
8610 var x = _a.x, y = _a.y;
8611 return _this.scroll(x, y);
8612 });
8613 this.afterViewInit$.next(true);
8614 };
8615 NbLayoutComponent.prototype.ngOnDestroy = function () {
8616 this.destroy$.next();
8617 this.destroy$.complete();
8618 this.unregisterAsOverlayContainer();
8619 };
8620 NbLayoutComponent.prototype.onScroll = function ($event) {
8621 this.scrollService.fireScrollChange($event);
8622 };
8623 NbLayoutComponent.prototype.onResize = function (event) {
8624 this.themeService.changeWindowWidth(event.target.innerWidth);
8625 };
8626 /**
8627 * Returns scroll and client height/width
8628 *
8629 * Depending on the current scroll mode (`withScroll=true`) returns sizes from the body element
8630 * or from the `.scrollable-container`
8631 * @returns {NbLayoutDimensions}
8632 */
8633 NbLayoutComponent.prototype.getDimensions = function () {
8634 var clientWidth, clientHeight, scrollWidth, scrollHeight = 0;
8635 if (this.withScrollValue) {
8636 var container = this.scrollableContainerRef.nativeElement;
8637 clientWidth = container.clientWidth;
8638 clientHeight = container.clientHeight;
8639 scrollWidth = container.scrollWidth;
8640 scrollHeight = container.scrollHeight;
8641 }
8642 else {
8643 var _a = this.document, documentElement = _a.documentElement, body = _a.body;
8644 clientWidth = documentElement.clientWidth || body.clientWidth;
8645 clientHeight = documentElement.clientHeight || body.clientHeight;
8646 scrollWidth = documentElement.scrollWidth || body.scrollWidth;
8647 scrollHeight = documentElement.scrollHeight || body.scrollHeight;
8648 }
8649 return {
8650 clientWidth: clientWidth,
8651 clientHeight: clientHeight,
8652 scrollWidth: scrollWidth,
8653 scrollHeight: scrollHeight,
8654 };
8655 };
8656 /**
8657 * Returns scroll position of current scroll container.
8658 *
8659 * If `withScroll` = true, returns scroll position of the `.scrollable-container` element,
8660 * otherwise - of the scrollable element of the window (which may be different depending of a browser)
8661 *
8662 * @returns {NbScrollPosition}
8663 */
8664 NbLayoutComponent.prototype.getScrollPosition = function () {
8665 if (!_angular_common.isPlatformBrowser(this.platformId)) {
8666 return { x: 0, y: 0 };
8667 }
8668 if (this.withScrollValue) {
8669 var container = this.scrollableContainerRef.nativeElement;
8670 return { x: container.scrollLeft, y: container.scrollTop };
8671 }
8672 var documentRect = this.document.documentElement.getBoundingClientRect();
8673 var x = -documentRect.left || this.document.body.scrollLeft || this.window.scrollX ||
8674 this.document.documentElement.scrollLeft || 0;
8675 var y = -documentRect.top || this.document.body.scrollTop || this.window.scrollY ||
8676 this.document.documentElement.scrollTop || 0;
8677 return { x: x, y: y };
8678 };
8679 NbLayoutComponent.prototype.registerAsOverlayContainer = function () {
8680 if (this.overlayContainer.setContainer) {
8681 this.overlayContainer.setContainer(this.elementRef.nativeElement);
8682 }
8683 };
8684 NbLayoutComponent.prototype.unregisterAsOverlayContainer = function () {
8685 if (this.overlayContainer.clearContainer) {
8686 this.overlayContainer.clearContainer();
8687 }
8688 };
8689 NbLayoutComponent.prototype.scroll = function (x, y) {
8690 if (x === void 0) { x = null; }
8691 if (y === void 0) { y = null; }
8692 var _a = this.getScrollPosition(), currentX = _a.x, currentY = _a.y;
8693 x = x == null ? currentX : x;
8694 y = y == null ? currentY : y;
8695 if (!_angular_common.isPlatformBrowser(this.platformId)) {
8696 return;
8697 }
8698 if (this.withScrollValue) {
8699 var scrollable = this.scrollableContainerRef.nativeElement;
8700 if (scrollable.scrollTo) {
8701 scrollable.scrollTo(x, y);
8702 }
8703 else {
8704 scrollable.scrollLeft = x;
8705 scrollable.scrollTop = y;
8706 }
8707 }
8708 else {
8709 this.window.scrollTo(x, y);
8710 }
8711 };
8712 // TODO: Extract into block scroll strategy
8713 NbLayoutComponent.prototype.blockScroll = function () {
8714 if (this.isScrollBlocked) {
8715 return;
8716 }
8717 this.isScrollBlocked = true;
8718 this.renderer.addClass(this.document.documentElement, this.scrollBlockClass);
8719 var scrollableContainerElement = this.scrollableContainerRef.nativeElement;
8720 var layoutElement = this.layoutContainerRef.nativeElement;
8721 var layoutWithScrollWidth = layoutElement.clientWidth;
8722 this.scrollableContainerOverflowOldValue = scrollableContainerElement.style.overflow;
8723 scrollableContainerElement.style.overflow = 'hidden';
8724 var layoutWithoutScrollWidth = layoutElement.clientWidth;
8725 var scrollWidth = layoutWithoutScrollWidth - layoutWithScrollWidth;
8726 if (!scrollWidth) {
8727 return;
8728 }
8729 this.layoutPaddingOldValue = {
8730 left: layoutElement.style.paddingLeft,
8731 right: layoutElement.style.paddingRight,
8732 };
8733 if (this.layoutDirectionService.isLtr()) {
8734 layoutElement.style.paddingRight = scrollWidth + "px";
8735 }
8736 else {
8737 layoutElement.style.paddingLeft = scrollWidth + "px";
8738 }
8739 };
8740 NbLayoutComponent.prototype.enableScroll = function () {
8741 if (this.isScrollBlocked) {
8742 this.isScrollBlocked = false;
8743 this.renderer.removeClass(this.document.documentElement, this.scrollBlockClass);
8744 this.scrollableContainerRef.nativeElement.style.overflow = this.scrollableContainerOverflowOldValue;
8745 if (this.layoutPaddingOldValue) {
8746 var layoutElement = this.layoutContainerRef.nativeElement;
8747 layoutElement.style.paddingLeft = this.layoutPaddingOldValue.left;
8748 layoutElement.style.paddingRight = this.layoutPaddingOldValue.right;
8749 this.layoutPaddingOldValue = null;
8750 }
8751 }
8752 };
8753 NbLayoutComponent.decorators = [
8754 { type: i0.Component, args: [{
8755 selector: 'nb-layout',
8756 template: "\n <div class=\"scrollable-container\" #scrollableContainer (scroll)=\"onScroll($event)\">\n <div class=\"layout\" #layoutContainer>\n <ng-content select=\"nb-layout-header:not([subheader])\"></ng-content>\n <div class=\"layout-container\">\n <ng-content select=\"nb-sidebar\"></ng-content>\n <div class=\"content\" [class.center]=\"centerValue\">\n <ng-content select=\"nb-layout-header[subheader]\"></ng-content>\n <div class=\"columns\">\n <ng-content select=\"nb-layout-column\"></ng-content>\n </div>\n <ng-content select=\"nb-layout-footer\"></ng-content>\n </div>\n </div>\n </div>\n </div>\n ",
8757 styles: [":host{-webkit-font-smoothing:antialiased}[dir=ltr] :host{text-align:left}[dir=rtl] :host{text-align:right}:host .layout{display:flex;flex-direction:column}:host ::ng-deep nb-layout-header{display:block}:host ::ng-deep nb-layout-header nav{align-items:center;justify-content:flex-start;display:flex}:host ::ng-deep nb-layout-header.fixed{position:fixed;top:0;left:0;right:0;z-index:1040}:host .layout-container{display:flex;flex:1;-ms-flex:1 1 auto;flex-direction:row}[dir=ltr] :host .layout-container ::ng-deep nb-sidebar.left{order:0}[dir=rtl] :host .layout-container ::ng-deep nb-sidebar.left{order:2}[dir=ltr] :host .layout-container ::ng-deep nb-sidebar.right{order:2}[dir=rtl] :host .layout-container ::ng-deep nb-sidebar.right{order:0}:host .layout-container ::ng-deep nb-sidebar.end{order:2}:host .layout-container ::ng-deep nb-sidebar .fixed{position:fixed;width:100%;overflow-y:auto;height:100%}:host .layout-container .content{display:flex;flex:1;-ms-flex:1 1 auto;flex-direction:column;min-width:0}:host .layout-container .content.center{max-width:100%;position:relative;margin-left:auto;margin-right:auto}:host .layout-container .content .columns{display:flex;flex:1;-ms-flex:1 1 auto;flex-direction:row;width:100%}:host .layout-container .content .columns ::ng-deep nb-layout-column{order:1;flex:1 0;min-width:0}[dir=ltr] :host .layout-container .content .columns ::ng-deep nb-layout-column.left{order:0}[dir=rtl] :host .layout-container .content .columns ::ng-deep nb-layout-column.left{order:2}:host .layout-container .content .columns ::ng-deep nb-layout-column.start{order:0}:host .layout-container .content ::ng-deep nb-layout-footer{display:block;margin-top:auto}:host .layout-container .content ::ng-deep nb-layout-footer nav{justify-content:center;display:flex}\n"]
8758 },] }
8759 ];
8760 NbLayoutComponent.ctorParameters = function () { return [
8761 { type: NbThemeService },
8762 { type: NbSpinnerService },
8763 { type: i0.ElementRef },
8764 { type: i0.Renderer2 },
8765 { type: undefined, decorators: [{ type: i0.Inject, args: [NB_WINDOW,] }] },
8766 { type: undefined, decorators: [{ type: i0.Inject, args: [NB_DOCUMENT,] }] },
8767 { type: Object, decorators: [{ type: i0.Inject, args: [i0.PLATFORM_ID,] }] },
8768 { type: NbLayoutDirectionService },
8769 { type: NbLayoutScrollService },
8770 { type: NbLayoutRulerService },
8771 { type: NbRestoreScrollTopHelper },
8772 { type: NbOverlayContainerAdapter }
8773 ]; };
8774 NbLayoutComponent.propDecorators = {
8775 windowModeValue: [{ type: i0.HostBinding, args: ['class.window-mode',] }],
8776 withScrollValue: [{ type: i0.HostBinding, args: ['class.with-scroll',] }],
8777 withSubheader: [{ type: i0.HostBinding, args: ['class.with-subheader',] }],
8778 center: [{ type: i0.Input }],
8779 windowMode: [{ type: i0.Input }],
8780 withScroll: [{ type: i0.Input }],
8781 restoreScrollTop: [{ type: i0.Input }],
8782 veryTopRef: [{ type: i0.ViewChild, args: ['layoutTopDynamicArea', { read: i0.ViewContainerRef },] }],
8783 scrollableContainerRef: [{ type: i0.ViewChild, args: ['scrollableContainer', { read: i0.ElementRef },] }],
8784 layoutContainerRef: [{ type: i0.ViewChild, args: ['layoutContainer', { read: i0.ElementRef },] }],
8785 onScroll: [{ type: i0.HostListener, args: ['window:scroll', ['$event'],] }],
8786 onResize: [{ type: i0.HostListener, args: ['window:resize', ['$event'],] }]
8787 };
8788 return NbLayoutComponent;
8789}());
8790/**
8791 * A container component which determines a content position inside of the layout.
8792 * The layout could contain unlimited columns (not including the sidebars).
8793 *
8794 * By default the columns are ordered from the left to the right,
8795 * but it's also possible to overwrite this behavior by setting a `left` attribute to the column,
8796 * moving it to the very first position:
8797 *
8798 * @stacked-example(Column Left, layout/layout-column-left.component)
8799 */
8800var NbLayoutColumnComponent = /** @class */ (function () {
8801 function NbLayoutColumnComponent() {
8802 }
8803 Object.defineProperty(NbLayoutColumnComponent.prototype, "left", {
8804 /**
8805 * Move the column to the very left position in the layout.
8806 * @param {boolean} val
8807 */
8808 set: function (val) {
8809 this.leftValue = convertToBoolProperty(val);
8810 this.startValue = false;
8811 },
8812 enumerable: false,
8813 configurable: true
8814 });
8815 Object.defineProperty(NbLayoutColumnComponent.prototype, "start", {
8816 /**
8817 * Make column first in the layout.
8818 * @param {boolean} val
8819 */
8820 set: function (val) {
8821 this.startValue = convertToBoolProperty(val);
8822 this.leftValue = false;
8823 },
8824 enumerable: false,
8825 configurable: true
8826 });
8827 NbLayoutColumnComponent.decorators = [
8828 { type: i0.Component, args: [{
8829 selector: 'nb-layout-column',
8830 template: "\n <ng-content></ng-content>\n "
8831 },] }
8832 ];
8833 NbLayoutColumnComponent.propDecorators = {
8834 leftValue: [{ type: i0.HostBinding, args: ['class.left',] }],
8835 startValue: [{ type: i0.HostBinding, args: ['class.start',] }],
8836 left: [{ type: i0.Input }],
8837 start: [{ type: i0.Input }]
8838 };
8839 return NbLayoutColumnComponent;
8840}());
8841/**
8842 * Page header component.
8843 * Located on top of the page above the layout columns and sidebars.
8844 * Could be made `fixed` by setting the corresponding property. In the fixed mode the header becomes
8845 * sticky to the top of the nb-layout (to of the page). Here's an example:
8846 *
8847 * @stacked-example(Fixed Header, layout/layout-fixed-header.component)
8848 *
8849 * In a pair with sidebar it is possible to setup a configuration when header is placed on a side of the sidebar
8850 * and not on top of it. To achieve this simply put a `subheader` property to the header like this:
8851 * ```html
8852 * <nb-layout-header subheader></nb-layout-header>
8853 * ```
8854 * @stacked-example(Subheader, layout/layout-sidebar-subheader.component)
8855 * Note that in such configuration sidebar shadow is removed and header cannot be make `fixed`.
8856 *
8857 * Same way you can put both `fixed` and `clipped` headers adding creating a sub-header for your app:
8858 *
8859 * @stacked-example(Subheader, layout/layout-subheader.component)
8860 *
8861 * @styles
8862 *
8863 * header-background-color:
8864 * header-text-color:
8865 * header-text-font-family:
8866 * header-text-font-size:
8867 * header-text-font-weight:
8868 * header-text-line-height:
8869 * header-height:
8870 * header-padding:
8871 * header-shadow:
8872 */
8873var NbLayoutHeaderComponent = /** @class */ (function () {
8874 function NbLayoutHeaderComponent(layout) {
8875 this.layout = layout;
8876 }
8877 Object.defineProperty(NbLayoutHeaderComponent.prototype, "fixed", {
8878 /**
8879 * Makes the header sticky to the top of the nb-layout.
8880 * @param {boolean} val
8881 */
8882 set: function (val) {
8883 this.fixedValue = convertToBoolProperty(val);
8884 },
8885 enumerable: false,
8886 configurable: true
8887 });
8888 Object.defineProperty(NbLayoutHeaderComponent.prototype, "subheader", {
8889 /**
8890 * Places header on a side of the sidebar, and not above.
8891 * Disables fixed mode for this header and remove a shadow from the sidebar.
8892 * @param {boolean} val
8893 */
8894 set: function (val) {
8895 this.subheaderValue = convertToBoolProperty(val);
8896 this.fixedValue = false;
8897 this.layout.withSubheader = this.subheaderValue;
8898 },
8899 enumerable: false,
8900 configurable: true
8901 });
8902 NbLayoutHeaderComponent.decorators = [
8903 { type: i0.Component, args: [{
8904 selector: 'nb-layout-header',
8905 template: "\n <nav [class.fixed]=\"fixedValue\">\n <ng-content></ng-content>\n </nav>\n "
8906 },] }
8907 ];
8908 NbLayoutHeaderComponent.ctorParameters = function () { return [
8909 { type: NbLayoutComponent }
8910 ]; };
8911 NbLayoutHeaderComponent.propDecorators = {
8912 fixedValue: [{ type: i0.HostBinding, args: ['class.fixed',] }],
8913 subheaderValue: [{ type: i0.HostBinding, args: ['class.subheader',] }],
8914 fixed: [{ type: i0.Input }],
8915 subheader: [{ type: i0.Input }]
8916 };
8917 return NbLayoutHeaderComponent;
8918}());
8919/**
8920 * Page footer.
8921 * Located under the nb-layout content (specifically, under the columns).
8922 * Could be made `fixed`, becoming sticky to the bottom of the view port (window).
8923 *
8924 * @styles
8925 *
8926 * footer-background-color:
8927 * footer-text-color:
8928 * footer-text-font-family:
8929 * footer-text-font-size:
8930 * footer-text-font-weight:
8931 * footer-text-line-height:
8932 * footer-text-highlight-color:
8933 * footer-height:
8934 * footer-padding:
8935 * footer-divider-color:
8936 * footer-divider-style:
8937 * footer-divider-width:
8938 * footer-shadow:
8939 */
8940var NbLayoutFooterComponent = /** @class */ (function () {
8941 function NbLayoutFooterComponent() {
8942 }
8943 Object.defineProperty(NbLayoutFooterComponent.prototype, "fixed", {
8944 /**
8945 * Makes the footer sticky to the bottom of the window.
8946 * @param {boolean} val
8947 */
8948 set: function (val) {
8949 this.fixedValue = convertToBoolProperty(val);
8950 },
8951 enumerable: false,
8952 configurable: true
8953 });
8954 NbLayoutFooterComponent.decorators = [
8955 { type: i0.Component, args: [{
8956 selector: 'nb-layout-footer',
8957 template: "\n <nav [class.fixed]=\"fixedValue\">\n <ng-content></ng-content>\n </nav>\n "
8958 },] }
8959 ];
8960 NbLayoutFooterComponent.propDecorators = {
8961 fixedValue: [{ type: i0.HostBinding, args: ['class.fixed',] }],
8962 fixed: [{ type: i0.Input }]
8963 };
8964 return NbLayoutFooterComponent;
8965}());
8966
8967/**
8968 * @license
8969 * Copyright Akveo. All Rights Reserved.
8970 * Licensed under the MIT License. See License.txt in the project root for license information.
8971 */
8972var NB_LAYOUT_COMPONENTS = [
8973 NbLayoutComponent,
8974 NbLayoutColumnComponent,
8975 NbLayoutFooterComponent,
8976 NbLayoutHeaderComponent,
8977];
8978var NbLayoutModule = /** @class */ (function () {
8979 function NbLayoutModule() {
8980 }
8981 NbLayoutModule.decorators = [
8982 { type: i0.NgModule, args: [{
8983 imports: [
8984 NbSharedModule,
8985 ],
8986 declarations: tslib.__spreadArray([], NB_LAYOUT_COMPONENTS),
8987 providers: [
8988 NbRestoreScrollTopHelper,
8989 ],
8990 exports: tslib.__spreadArray([], NB_LAYOUT_COMPONENTS),
8991 },] }
8992 ];
8993 return NbLayoutModule;
8994}());
8995
8996/**
8997 * @license
8998 * Copyright Akveo. All Rights Reserved.
8999 * Licensed under the MIT License. See License.txt in the project root for license information.
9000 */
9001var itemClick$ = new rxjs.Subject();
9002var addItems$ = new rxjs.ReplaySubject(1);
9003var navigateHome$ = new rxjs.ReplaySubject(1);
9004var getSelectedItem$ = new rxjs.ReplaySubject(1);
9005var itemSelect$ = new rxjs.ReplaySubject(1);
9006var itemHover$ = new rxjs.ReplaySubject(1);
9007var submenuToggle$ = new rxjs.ReplaySubject(1);
9008var collapseAll$ = new rxjs.ReplaySubject(1);
9009// TODO: check if we need both URL and LINK
9010/**
9011 *
9012 *
9013 * Menu Item options example
9014 * @stacked-example(Menu Link Parameters, menu/menu-link-params.component)
9015 *
9016 *
9017 */
9018var NbMenuItem = /** @class */ (function () {
9019 function NbMenuItem() {
9020 /**
9021 * Item is selected when partly or fully equal to the current url
9022 * @type {string}
9023 */
9024 this.pathMatch = 'full';
9025 }
9026 /**
9027 * @returns item parents in top-down order
9028 */
9029 NbMenuItem.getParents = function (item) {
9030 var parents = [];
9031 var parent = item.parent;
9032 while (parent) {
9033 parents.unshift(parent);
9034 parent = parent.parent;
9035 }
9036 return parents;
9037 };
9038 NbMenuItem.isParent = function (item, possibleChild) {
9039 return possibleChild.parent
9040 ? possibleChild.parent === item || this.isParent(item, possibleChild.parent)
9041 : false;
9042 };
9043 return NbMenuItem;
9044}());
9045// TODO: map select events to router change events
9046// TODO: review the interface
9047/**
9048 *
9049 *
9050 * Menu Service. Allows you to listen to menu events, or to interact with a menu.
9051 * @stacked-example(Menu Service, menu/menu-service.component)
9052 *
9053 *
9054 */
9055var NbMenuService = /** @class */ (function () {
9056 function NbMenuService() {
9057 }
9058 /**
9059 * Add items to the end of the menu items list
9060 * @param {List<NbMenuItem>} items
9061 * @param {string} tag
9062 */
9063 NbMenuService.prototype.addItems = function (items, tag) {
9064 addItems$.next({ tag: tag, items: items });
9065 };
9066 /**
9067 * Collapses all menu items
9068 * @param {string} tag
9069 */
9070 NbMenuService.prototype.collapseAll = function (tag) {
9071 collapseAll$.next({ tag: tag });
9072 };
9073 /**
9074 * Navigate to the home menu item
9075 * @param {string} tag
9076 */
9077 NbMenuService.prototype.navigateHome = function (tag) {
9078 navigateHome$.next({ tag: tag });
9079 };
9080 /**
9081 * Returns currently selected item. Won't subscribe to the future events.
9082 * @param {string} tag
9083 * @returns {Observable<{tag: string; item: NbMenuItem}>}
9084 */
9085 NbMenuService.prototype.getSelectedItem = function (tag) {
9086 var listener = new rxjs.BehaviorSubject(null);
9087 getSelectedItem$.next({ tag: tag, listener: listener });
9088 return listener.asObservable();
9089 };
9090 NbMenuService.prototype.onItemClick = function () {
9091 return itemClick$.pipe(rxjs_operators.share());
9092 };
9093 NbMenuService.prototype.onItemSelect = function () {
9094 return itemSelect$.pipe(rxjs_operators.share());
9095 };
9096 NbMenuService.prototype.onItemHover = function () {
9097 return itemHover$.pipe(rxjs_operators.share());
9098 };
9099 NbMenuService.prototype.onSubmenuToggle = function () {
9100 return submenuToggle$.pipe(rxjs_operators.share());
9101 };
9102 NbMenuService.decorators = [
9103 { type: i0.Injectable }
9104 ];
9105 return NbMenuService;
9106}());
9107var NbMenuInternalService = /** @class */ (function () {
9108 function NbMenuInternalService(location) {
9109 this.location = location;
9110 }
9111 NbMenuInternalService.prototype.prepareItems = function (items) {
9112 var _this = this;
9113 var defaultItem = new NbMenuItem();
9114 items.forEach(function (i) {
9115 _this.applyDefaults(i, defaultItem);
9116 _this.setParent(i);
9117 });
9118 };
9119 NbMenuInternalService.prototype.selectFromUrl = function (items, tag, collapseOther) {
9120 if (collapseOther === void 0) { collapseOther = false; }
9121 var selectedItem = this.findItemByUrl(items);
9122 if (selectedItem) {
9123 this.selectItem(selectedItem, items, collapseOther, tag);
9124 }
9125 };
9126 NbMenuInternalService.prototype.selectItem = function (item, items, collapseOther, tag) {
9127 if (collapseOther === void 0) { collapseOther = false; }
9128 var unselectedItems = this.resetSelection(items);
9129 var collapsedItems = collapseOther ? this.collapseItems(items) : [];
9130 for (var _i = 0, _a = NbMenuItem.getParents(item); _i < _a.length; _i++) {
9131 var parent_1 = _a[_i];
9132 parent_1.selected = true;
9133 // emit event only for items that weren't selected before ('unselectedItems' contains items that were selected)
9134 if (!unselectedItems.includes(parent_1)) {
9135 this.itemSelect(parent_1, tag);
9136 }
9137 var wasNotExpanded = !parent_1.expanded;
9138 parent_1.expanded = true;
9139 var i = collapsedItems.indexOf(parent_1);
9140 // emit event only for items that weren't expanded before.
9141 // 'collapsedItems' contains items that were expanded, so no need to emit event.
9142 // in case 'collapseOther' is false, 'collapsedItems' will be empty,
9143 // so also check if item isn't expanded already ('wasNotExpanded').
9144 if (i === -1 && wasNotExpanded) {
9145 this.submenuToggle(parent_1, tag);
9146 }
9147 else {
9148 collapsedItems.splice(i, 1);
9149 }
9150 }
9151 item.selected = true;
9152 // emit event only for items that weren't selected before ('unselectedItems' contains items that were selected)
9153 if (!unselectedItems.includes(item)) {
9154 this.itemSelect(item, tag);
9155 }
9156 // remaining items which wasn't expanded back after expanding all currently selected items
9157 for (var _b = 0, collapsedItems_1 = collapsedItems; _b < collapsedItems_1.length; _b++) {
9158 var collapsedItem = collapsedItems_1[_b];
9159 this.submenuToggle(collapsedItem, tag);
9160 }
9161 };
9162 NbMenuInternalService.prototype.collapseAll = function (items, tag, except) {
9163 var collapsedItems = this.collapseItems(items, except);
9164 for (var _i = 0, collapsedItems_2 = collapsedItems; _i < collapsedItems_2.length; _i++) {
9165 var item = collapsedItems_2[_i];
9166 this.submenuToggle(item, tag);
9167 }
9168 };
9169 NbMenuInternalService.prototype.onAddItem = function () {
9170 return addItems$.pipe(rxjs_operators.share());
9171 };
9172 NbMenuInternalService.prototype.onNavigateHome = function () {
9173 return navigateHome$.pipe(rxjs_operators.share());
9174 };
9175 NbMenuInternalService.prototype.onCollapseAll = function () {
9176 return collapseAll$.pipe(rxjs_operators.share());
9177 };
9178 NbMenuInternalService.prototype.onGetSelectedItem = function () {
9179 return getSelectedItem$.pipe(rxjs_operators.share());
9180 };
9181 NbMenuInternalService.prototype.itemHover = function (item, tag) {
9182 itemHover$.next({ tag: tag, item: item });
9183 };
9184 NbMenuInternalService.prototype.submenuToggle = function (item, tag) {
9185 submenuToggle$.next({ tag: tag, item: item });
9186 };
9187 NbMenuInternalService.prototype.itemSelect = function (item, tag) {
9188 itemSelect$.next({ tag: tag, item: item });
9189 };
9190 NbMenuInternalService.prototype.itemClick = function (item, tag) {
9191 itemClick$.next({ tag: tag, item: item });
9192 };
9193 /**
9194 * Unselect all given items deeply.
9195 * @param items array of items to unselect.
9196 * @returns items which selected value was changed.
9197 */
9198 NbMenuInternalService.prototype.resetSelection = function (items) {
9199 var unselectedItems = [];
9200 for (var _i = 0, items_1 = items; _i < items_1.length; _i++) {
9201 var item = items_1[_i];
9202 if (item.selected) {
9203 unselectedItems.push(item);
9204 }
9205 item.selected = false;
9206 if (item.children) {
9207 unselectedItems.push.apply(unselectedItems, this.resetSelection(item.children));
9208 }
9209 }
9210 return unselectedItems;
9211 };
9212 /**
9213 * Collapse all given items deeply.
9214 * @param items array of items to collapse.
9215 * @param except menu item which shouldn't be collapsed, also disables collapsing for parents of this item.
9216 * @returns items which expanded value was changed.
9217 */
9218 NbMenuInternalService.prototype.collapseItems = function (items, except) {
9219 var collapsedItems = [];
9220 for (var _i = 0, items_2 = items; _i < items_2.length; _i++) {
9221 var item = items_2[_i];
9222 if (except && (item === except || NbMenuItem.isParent(item, except))) {
9223 continue;
9224 }
9225 if (item.expanded) {
9226 collapsedItems.push(item);
9227 }
9228 item.expanded = false;
9229 if (item.children) {
9230 collapsedItems.push.apply(collapsedItems, this.collapseItems(item.children));
9231 }
9232 }
9233 return collapsedItems;
9234 };
9235 NbMenuInternalService.prototype.applyDefaults = function (item, defaultItem) {
9236 var _this = this;
9237 var menuItem = tslib.__assign({}, item);
9238 Object.assign(item, defaultItem, menuItem);
9239 item.children && item.children.forEach(function (child) {
9240 _this.applyDefaults(child, defaultItem);
9241 });
9242 };
9243 NbMenuInternalService.prototype.setParent = function (item) {
9244 var _this = this;
9245 item.children && item.children.forEach(function (child) {
9246 child.parent = item;
9247 _this.setParent(child);
9248 });
9249 };
9250 /**
9251 * Find deepest item which link matches current URL path.
9252 * @param items array of items to search in.
9253 * @returns found item of undefined.
9254 */
9255 NbMenuInternalService.prototype.findItemByUrl = function (items) {
9256 var _this = this;
9257 var selectedItem;
9258 items.some(function (item) {
9259 if (item.children) {
9260 selectedItem = _this.findItemByUrl(item.children);
9261 }
9262 if (!selectedItem && _this.isSelectedInUrl(item)) {
9263 selectedItem = item;
9264 }
9265 return selectedItem;
9266 });
9267 return selectedItem;
9268 };
9269 NbMenuInternalService.prototype.isSelectedInUrl = function (item) {
9270 var exact = item.pathMatch === 'full';
9271 var link = item.link;
9272 var isSelectedInPath = exact
9273 ? isUrlPathEqual(this.location.path(), link)
9274 : isUrlPathContain(this.location.path(), link);
9275 if (isSelectedInPath && item.fragment != null) {
9276 return exact
9277 ? isFragmentEqual(this.location.path(true), item.fragment)
9278 : isFragmentContain(this.location.path(true), item.fragment);
9279 }
9280 return isSelectedInPath;
9281 };
9282 NbMenuInternalService.decorators = [
9283 { type: i0.Injectable }
9284 ];
9285 NbMenuInternalService.ctorParameters = function () { return [
9286 { type: _angular_common.Location }
9287 ]; };
9288 return NbMenuInternalService;
9289}());
9290
9291/**
9292 * @license
9293 * Copyright Akveo. All Rights Reserved.
9294 * Licensed under the MIT License. See License.txt in the project root for license information.
9295 */
9296
9297(function (NbToggleStates) {
9298 NbToggleStates["Expanded"] = "expanded";
9299 NbToggleStates["Collapsed"] = "collapsed";
9300})(exports.NbToggleStates || (exports.NbToggleStates = {}));
9301var NbMenuItemComponent = /** @class */ (function () {
9302 function NbMenuItemComponent(menuService, directionService) {
9303 this.menuService = menuService;
9304 this.directionService = directionService;
9305 this.menuItem = null;
9306 this.hoverItem = new i0.EventEmitter();
9307 this.toggleSubMenu = new i0.EventEmitter();
9308 this.selectItem = new i0.EventEmitter();
9309 this.itemClick = new i0.EventEmitter();
9310 this.destroy$ = new rxjs.Subject();
9311 }
9312 NbMenuItemComponent.prototype.ngDoCheck = function () {
9313 this.toggleState = this.menuItem.expanded ? exports.NbToggleStates.Expanded : exports.NbToggleStates.Collapsed;
9314 };
9315 NbMenuItemComponent.prototype.ngAfterViewInit = function () {
9316 var _this = this;
9317 this.menuService.onSubmenuToggle()
9318 .pipe(rxjs_operators.filter(function (_a) {
9319 var item = _a.item;
9320 return item === _this.menuItem;
9321 }), rxjs_operators.map(function (_a) {
9322 var item = _a.item;
9323 return item.expanded;
9324 }), rxjs_operators.takeUntil(this.destroy$))
9325 .subscribe(function (isExpanded) { return _this.toggleState = isExpanded ? exports.NbToggleStates.Expanded : exports.NbToggleStates.Collapsed; });
9326 };
9327 NbMenuItemComponent.prototype.ngOnDestroy = function () {
9328 this.destroy$.next();
9329 this.destroy$.complete();
9330 };
9331 NbMenuItemComponent.prototype.onToggleSubMenu = function (item) {
9332 this.toggleSubMenu.emit(item);
9333 };
9334 NbMenuItemComponent.prototype.onHoverItem = function (item) {
9335 this.hoverItem.emit(item);
9336 };
9337 NbMenuItemComponent.prototype.onSelectItem = function (item) {
9338 this.selectItem.emit(item);
9339 };
9340 NbMenuItemComponent.prototype.onItemClick = function (item) {
9341 this.itemClick.emit(item);
9342 };
9343 NbMenuItemComponent.prototype.getExpandStateIcon = function () {
9344 if (this.menuItem.expanded) {
9345 return 'chevron-down-outline';
9346 }
9347 return this.directionService.isLtr()
9348 ? 'chevron-left-outline'
9349 : 'chevron-right-outline';
9350 };
9351 NbMenuItemComponent.decorators = [
9352 { type: i0.Component, args: [{
9353 selector: '[nbMenuItem]',
9354 template: "<span *ngIf=\"menuItem.group\">\n <nb-icon class=\"menu-icon\" [config]=\"menuItem.icon\" *ngIf=\"menuItem.icon\"></nb-icon>\n {{ menuItem.title }}\n</span>\n<a *ngIf=\"menuItem.link && !menuItem.url && !menuItem.children && !menuItem.group\"\n [routerLink]=\"menuItem.link\"\n [queryParams]=\"menuItem.queryParams\"\n [fragment]=\"menuItem.fragment\"\n [queryParamsHandling]=\"menuItem.queryParamsHandling\"\n [preserveFragment]=\"menuItem.preserveFragment\"\n [skipLocationChange]=\"menuItem.skipLocationChange\"\n [attr.target]=\"menuItem.target\"\n [attr.title]=\"menuItem.title\"\n [class.active]=\"menuItem.selected\"\n (mouseenter)=\"onHoverItem(menuItem)\"\n (click)=\"onItemClick(menuItem);\">\n <nb-icon class=\"menu-icon\" [config]=\"menuItem.icon\" *ngIf=\"menuItem.icon\"></nb-icon>\n <span class=\"menu-title\">{{ menuItem.title }}</span>\n <ng-container *ngIf=\"badge\" [ngTemplateOutlet]=\"badgeTemplate\"></ng-container>\n</a>\n<a *ngIf=\"menuItem.url && !menuItem.children && !menuItem.link && !menuItem.group\"\n [attr.href]=\"menuItem.url\"\n [attr.target]=\"menuItem.target\"\n [attr.title]=\"menuItem.title\"\n [class.active]=\"menuItem.selected\"\n (mouseenter)=\"onHoverItem(menuItem)\"\n (click)=\"onSelectItem(menuItem)\">\n <nb-icon class=\"menu-icon\" [config]=\"menuItem.icon\" *ngIf=\"menuItem.icon\"></nb-icon>\n <span class=\"menu-title\">{{ menuItem.title }}</span>\n <ng-container *ngIf=\"badge\" [ngTemplateOutlet]=\"badgeTemplate\"></ng-container>\n</a>\n<a *ngIf=\"!menuItem.children && !menuItem.link && !menuItem.url && !menuItem.group\"\n [attr.target]=\"menuItem.target\"\n [attr.title]=\"menuItem.title\"\n [class.active]=\"menuItem.selected\"\n (mouseenter)=\"onHoverItem(menuItem)\"\n (click)=\"$event.preventDefault(); onItemClick(menuItem);\">\n <nb-icon class=\"menu-icon\" [config]=\"menuItem.icon\" *ngIf=\"menuItem.icon\"></nb-icon>\n <span class=\"menu-title\">{{ menuItem.title }}</span>\n <ng-container *ngIf=\"badge\" [ngTemplateOutlet]=\"badgeTemplate\"></ng-container>\n</a>\n<a *ngIf=\"menuItem.children\"\n (click)=\"$event.preventDefault(); onToggleSubMenu(menuItem);\"\n [attr.target]=\"menuItem.target\"\n [attr.title]=\"menuItem.title\"\n [class.active]=\"menuItem.selected\"\n (mouseenter)=\"onHoverItem(menuItem)\"\n href=\"#\">\n <nb-icon class=\"menu-icon\" [config]=\"menuItem.icon\" *ngIf=\"menuItem.icon\"></nb-icon>\n <span class=\"menu-title\">{{ menuItem.title }}</span>\n <ng-container *ngIf=\"badge\" [ngTemplateOutlet]=\"badgeTemplate\"></ng-container>\n <nb-icon class=\"expand-state\" [icon]=\"getExpandStateIcon()\" pack=\"nebular-essentials\"></nb-icon>\n</a>\n<ul *ngIf=\"menuItem.children\"\n [class.collapsed]=\"!(menuItem.children && menuItem.expanded)\"\n [class.expanded]=\"menuItem.expanded\"\n [@toggle]=\"toggleState\"\n class=\"menu-items\">\n <ng-container *ngFor=\"let item of menuItem.children\">\n <li nbMenuItem *ngIf=\"!item.hidden\"\n [menuItem]=\"item\"\n [badge]=\"item.badge\"\n [class.menu-group]=\"item.group\"\n (hoverItem)=\"onHoverItem($event)\"\n (toggleSubMenu)=\"onToggleSubMenu($event)\"\n (selectItem)=\"onSelectItem($event)\"\n (itemClick)=\"onItemClick($event)\"\n class=\"menu-item\">\n </li>\n </ng-container>\n</ul>\n\n<ng-template #badgeTemplate>\n <nb-badge [text]=\"badge.text\" [dotMode]=\"badge.dotMode\" [status]=\"badge.status\">\n </nb-badge>\n</ng-template>\n",
9355 animations: [
9356 _angular_animations.trigger('toggle', [
9357 _angular_animations.state(exports.NbToggleStates.Collapsed, _angular_animations.style({ height: '0', margin: '0' })),
9358 _angular_animations.state(exports.NbToggleStates.Expanded, _angular_animations.style({ height: '*' })),
9359 _angular_animations.transition(exports.NbToggleStates.Collapsed + " <=> " + exports.NbToggleStates.Expanded, _angular_animations.animate(300)),
9360 ]),
9361 ]
9362 },] }
9363 ];
9364 NbMenuItemComponent.ctorParameters = function () { return [
9365 { type: NbMenuService },
9366 { type: NbLayoutDirectionService }
9367 ]; };
9368 NbMenuItemComponent.propDecorators = {
9369 menuItem: [{ type: i0.Input }],
9370 badge: [{ type: i0.Input }],
9371 hoverItem: [{ type: i0.Output }],
9372 toggleSubMenu: [{ type: i0.Output }],
9373 selectItem: [{ type: i0.Output }],
9374 itemClick: [{ type: i0.Output }]
9375 };
9376 return NbMenuItemComponent;
9377}());
9378/**
9379 * Vertical menu component.
9380 *
9381 * Accepts a list of menu items and renders them accordingly. Supports multi-level menus.
9382 *
9383 * Basic example
9384 * @stacked-example(Showcase, menu/menu-showcase.component)
9385 *
9386 * ```ts
9387 * // ...
9388 * items: NbMenuItem[] = [
9389 * {
9390 * title: home,
9391 * link: '/'
9392 * },
9393 * {
9394 * title: dashboard,
9395 * link: 'dashboard'
9396 * }
9397 * ];
9398 * // ...
9399 * <nb-menu [items]="items"></nb-menu>
9400 * ```
9401 * ### Installation
9402 *
9403 * Import `NbMenuModule.forRoot()` to your app module.
9404 * ```ts
9405 * @NgModule({
9406 * imports: [
9407 * // ...
9408 * NbMenuModule.forRoot(),
9409 * ],
9410 * })
9411 * export class AppModule { }
9412 * ```
9413 * and `NbMenuModule` to your feature module where the component should be shown:
9414 * ```ts
9415 * @NgModule({
9416 * imports: [
9417 * // ...
9418 * NbMenuModule,
9419 * ],
9420 * })
9421 * export class PageModule { }
9422 * ```
9423 * ### Usage
9424 *
9425 * Two-level menu example
9426 * @stacked-example(Two Levels, menu/menu-children.component)
9427 *
9428 *
9429 * Autocollapse menu example
9430 * @stacked-example(Autocollapse Menu, menu/menu-autocollapse.component)
9431 *
9432 * Menu badge
9433 * @stacked-example(Menu item badge, menu/menu-badge.component)
9434 *
9435 * @styles
9436 *
9437 * menu-background-color:
9438 * menu-text-color:
9439 * menu-text-font-family:
9440 * menu-text-font-size:
9441 * menu-text-font-weight:
9442 * menu-text-line-height:
9443 * menu-group-text-color:
9444 * menu-item-border-radius:
9445 * menu-item-padding:
9446 * menu-item-hover-background-color:
9447 * menu-item-hover-cursor:
9448 * menu-item-hover-text-color:
9449 * menu-item-icon-hover-color:
9450 * menu-item-active-background-color:
9451 * menu-item-active-text-color:
9452 * menu-item-icon-active-color:
9453 * menu-item-icon-color:
9454 * menu-item-icon-margin:
9455 * menu-item-icon-width:
9456 * menu-item-divider-color:
9457 * menu-item-divider-style:
9458 * menu-item-divider-width:
9459 * menu-submenu-background-color:
9460 * menu-submenu-text-color:
9461 * menu-submenu-margin:
9462 * menu-submenu-padding:
9463 * menu-submenu-item-border-color:
9464 * menu-submenu-item-border-style:
9465 * menu-submenu-item-border-width:
9466 * menu-submenu-item-border-radius:
9467 * menu-submenu-item-padding:
9468 * menu-submenu-item-hover-background-color:
9469 * menu-submenu-item-hover-border-color:
9470 * menu-submenu-item-hover-text-color:
9471 * menu-submenu-item-icon-hover-color:
9472 * menu-submenu-item-active-background-color:
9473 * menu-submenu-item-active-border-color:
9474 * menu-submenu-item-active-text-color:
9475 * menu-submenu-item-icon-active-color:
9476 * menu-submenu-item-active-hover-background-color:
9477 * menu-submenu-item-active-hover-border-color:
9478 * menu-submenu-item-active-hover-text-color:
9479 * menu-submenu-item-icon-active-hover-color:
9480 */
9481var NbMenuComponent = /** @class */ (function () {
9482 function NbMenuComponent(window, platformId, menuInternalService, router) {
9483 this.window = window;
9484 this.platformId = platformId;
9485 this.menuInternalService = menuInternalService;
9486 this.router = router;
9487 this._autoCollapse = false;
9488 this.destroy$ = new rxjs.Subject();
9489 }
9490 Object.defineProperty(NbMenuComponent.prototype, "autoCollapse", {
9491 /**
9492 * Collapse all opened submenus on the toggle event
9493 * Default value is "false"
9494 * @type boolean
9495 */
9496 get: function () {
9497 return this._autoCollapse;
9498 },
9499 set: function (value) {
9500 this._autoCollapse = convertToBoolProperty(value);
9501 },
9502 enumerable: false,
9503 configurable: true
9504 });
9505 NbMenuComponent.prototype.ngOnInit = function () {
9506 var _this = this;
9507 this.menuInternalService.prepareItems(this.items);
9508 this.menuInternalService
9509 .onAddItem()
9510 .pipe(rxjs_operators.filter(function (data) { return _this.compareTag(data.tag); }), rxjs_operators.takeUntil(this.destroy$))
9511 .subscribe(function (data) { return _this.onAddItem(data); });
9512 this.menuInternalService
9513 .onNavigateHome()
9514 .pipe(rxjs_operators.filter(function (data) { return _this.compareTag(data.tag); }), rxjs_operators.takeUntil(this.destroy$))
9515 .subscribe(function () { return _this.navigateHome(); });
9516 this.menuInternalService
9517 .onGetSelectedItem()
9518 .pipe(rxjs_operators.filter(function (data) { return _this.compareTag(data.tag); }), rxjs_operators.takeUntil(this.destroy$))
9519 .subscribe(function (data) {
9520 data.listener.next({ tag: _this.tag, item: _this.getSelectedItem(_this.items) });
9521 });
9522 this.menuInternalService
9523 .onCollapseAll()
9524 .pipe(rxjs_operators.filter(function (data) { return _this.compareTag(data.tag); }), rxjs_operators.takeUntil(this.destroy$))
9525 .subscribe(function () { return _this.collapseAll(); });
9526 this.router.events
9527 .pipe(rxjs_operators.filter(function (event) { return event instanceof _angular_router.NavigationEnd; }), rxjs_operators.takeUntil(this.destroy$))
9528 .subscribe(function () {
9529 _this.menuInternalService.selectFromUrl(_this.items, _this.tag, _this.autoCollapse);
9530 });
9531 };
9532 NbMenuComponent.prototype.ngAfterViewInit = function () {
9533 var _this = this;
9534 setTimeout(function () { return _this.menuInternalService.selectFromUrl(_this.items, _this.tag, _this.autoCollapse); });
9535 };
9536 NbMenuComponent.prototype.onAddItem = function (data) {
9537 var _a;
9538 (_a = this.items).push.apply(_a, data.items);
9539 this.menuInternalService.prepareItems(this.items);
9540 this.menuInternalService.selectFromUrl(this.items, this.tag, this.autoCollapse);
9541 };
9542 NbMenuComponent.prototype.onHoverItem = function (item) {
9543 this.menuInternalService.itemHover(item, this.tag);
9544 };
9545 NbMenuComponent.prototype.onToggleSubMenu = function (item) {
9546 if (this.autoCollapse) {
9547 this.menuInternalService.collapseAll(this.items, this.tag, item);
9548 }
9549 item.expanded = !item.expanded;
9550 this.menuInternalService.submenuToggle(item, this.tag);
9551 };
9552 // TODO: is not fired on page reload
9553 NbMenuComponent.prototype.onSelectItem = function (item) {
9554 this.menuInternalService.selectItem(item, this.items, this.autoCollapse, this.tag);
9555 };
9556 NbMenuComponent.prototype.onItemClick = function (item) {
9557 this.menuInternalService.itemClick(item, this.tag);
9558 };
9559 NbMenuComponent.prototype.ngOnDestroy = function () {
9560 this.destroy$.next();
9561 this.destroy$.complete();
9562 };
9563 NbMenuComponent.prototype.navigateHome = function () {
9564 var homeItem = this.getHomeItem(this.items);
9565 if (homeItem) {
9566 if (homeItem.link) {
9567 var extras = {
9568 queryParams: homeItem.queryParams,
9569 queryParamsHandling: homeItem.queryParamsHandling,
9570 fragment: homeItem.fragment,
9571 preserveFragment: homeItem.preserveFragment,
9572 };
9573 this.router.navigate([homeItem.link], extras);
9574 }
9575 if (homeItem.url && _angular_common.isPlatformBrowser(this.platformId)) {
9576 this.window.location.href = homeItem.url;
9577 }
9578 }
9579 };
9580 NbMenuComponent.prototype.collapseAll = function () {
9581 this.menuInternalService.collapseAll(this.items, this.tag);
9582 };
9583 NbMenuComponent.prototype.getHomeItem = function (items) {
9584 for (var _i = 0, items_1 = items; _i < items_1.length; _i++) {
9585 var item = items_1[_i];
9586 if (item.home) {
9587 return item;
9588 }
9589 var homeItem = item.children && this.getHomeItem(item.children);
9590 if (homeItem) {
9591 return homeItem;
9592 }
9593 }
9594 };
9595 NbMenuComponent.prototype.compareTag = function (tag) {
9596 return !tag || tag === this.tag;
9597 };
9598 NbMenuComponent.prototype.getSelectedItem = function (items) {
9599 var _this = this;
9600 var selected = null;
9601 items.forEach(function (item) {
9602 if (item.selected) {
9603 selected = item;
9604 }
9605 if (item.selected && item.children && item.children.length > 0) {
9606 selected = _this.getSelectedItem(item.children);
9607 }
9608 });
9609 return selected;
9610 };
9611 NbMenuComponent.decorators = [
9612 { type: i0.Component, args: [{
9613 selector: 'nb-menu',
9614 template: "\n <ul class=\"menu-items\">\n <ng-container *ngFor=\"let item of items\">\n <li nbMenuItem *ngIf=\"!item.hidden\"\n [menuItem]=\"item\"\n [badge]=\"item.badge\"\n [class.menu-group]=\"item.group\"\n (hoverItem)=\"onHoverItem($event)\"\n (toggleSubMenu)=\"onToggleSubMenu($event)\"\n (selectItem)=\"onSelectItem($event)\"\n (itemClick)=\"onItemClick($event)\"\n class=\"menu-item\">\n </li>\n </ng-container>\n </ul>\n ",
9615 styles: [":host ::ng-deep{display:block}:host ::ng-deep .menu-items,:host ::ng-deep .menu-item>.menu-items{list-style-type:none;overflow:hidden}:host ::ng-deep .menu-item a{display:flex;text-decoration:none;align-items:center}:host ::ng-deep .menu-item a .menu-title{flex:1 0 auto}[dir=rtl] :host ::ng-deep .menu-item a .menu-title{text-align:right}:host ::ng-deep .menu-item nb-badge{position:static}:host ::ng-deep .menu-group span{display:flex}\n"]
9616 },] }
9617 ];
9618 NbMenuComponent.ctorParameters = function () { return [
9619 { type: undefined, decorators: [{ type: i0.Inject, args: [NB_WINDOW,] }] },
9620 { type: undefined, decorators: [{ type: i0.Inject, args: [i0.PLATFORM_ID,] }] },
9621 { type: NbMenuInternalService },
9622 { type: _angular_router.Router }
9623 ]; };
9624 NbMenuComponent.propDecorators = {
9625 tag: [{ type: i0.Input }],
9626 items: [{ type: i0.Input }],
9627 autoCollapse: [{ type: i0.Input }]
9628 };
9629 return NbMenuComponent;
9630}());
9631
9632/**
9633 * @license
9634 * Copyright Akveo. All Rights Reserved.
9635 * Licensed under the MIT License. See License.txt in the project root for license information.
9636 */
9637/**
9638 * Badge is a simple labeling component.
9639 * It can be used to add additional information to any content or highlight unread items.
9640 *
9641 * Element is absolute positioned, so parent should be
9642 * [positioned element](https://developer.mozilla.org/en-US/docs/Web/CSS/position).
9643 * It means parent `position` should be set to anything except `static`, e.g. `relative`,
9644 * `absolute`, `fixed`, or `sticky`.
9645 *
9646 * ### Installation
9647 *
9648 * Import `NbBadgeModule` to your feature module.
9649 * ```ts
9650 * @NgModule({
9651 * imports: [
9652 * // ...
9653 * NbBadgeModule,
9654 * ],
9655 * })
9656 * export class PageModule { }
9657 * ```
9658 * ### Usage
9659 *
9660 * Badge with default position and status(color):
9661 *
9662 * ```html
9663 * <nb-badge text="badgeText"></nb-badge>
9664 * ```
9665 *
9666 * For example, badge can be placed into nb-card header:
9667 * @stacked-example(Showcase, badge/badge-showcase.component)
9668 *
9669 * Badge located on the bottom right with warning status:
9670 *
9671 * ```html
9672 * <nb-badge text="badgeText" status="warning" position="bottom right">
9673 * </nb-badge>
9674 * ```
9675 *
9676 * @styles
9677 *
9678 * badge-border-radius:
9679 * badge-text-font-family:
9680 * badge-text-font-size:
9681 * badge-text-font-weight:
9682 * badge-text-line-height:
9683 * badge-padding:
9684 * badge-basic-background-color:
9685 * badge-basic-text-color:
9686 * badge-primary-background-color:
9687 * badge-primary-text-color:
9688 * badge-success-background-color:
9689 * badge-success-text-color:
9690 * badge-info-background-color:
9691 * badge-info-text-color:
9692 * badge-warning-background-color:
9693 * badge-warning-text-color:
9694 * badge-danger-background-color:
9695 * badge-danger-text-color:
9696 * badge-control-background-color:
9697 * badge-control-text-color:
9698 */
9699var NbBadgeComponent = /** @class */ (function () {
9700 function NbBadgeComponent(statusService) {
9701 this.statusService = statusService;
9702 /**
9703 * Text to display
9704 * @type string
9705 */
9706 this.text = '';
9707 this._defaultPosition = 'top right';
9708 this._position = this._defaultPosition;
9709 /**
9710 * Badge status (adds specific styles):
9711 * 'basic', 'primary', 'info', 'success', 'warning', 'danger', 'control'
9712 */
9713 this.status = 'basic';
9714 }
9715 Object.defineProperty(NbBadgeComponent.prototype, "position", {
9716 /**
9717 * Badge position
9718 *
9719 * Can be set to any class or to one of predefined positions:
9720 * 'top left', 'top right', 'bottom left', 'bottom right',
9721 * 'top start', 'top end', 'bottom start', 'bottom end'
9722 * @type string
9723 */
9724 get: function () {
9725 return this._position;
9726 },
9727 set: function (value) {
9728 this._position = value || this._defaultPosition;
9729 },
9730 enumerable: false,
9731 configurable: true
9732 });
9733 Object.defineProperty(NbBadgeComponent.prototype, "dotMode", {
9734 /**
9735 * Shows badge as a dot. No text is shown.
9736 * @type boolean
9737 */
9738 get: function () {
9739 return this._dotMode;
9740 },
9741 set: function (value) {
9742 this._dotMode = convertToBoolProperty(value);
9743 },
9744 enumerable: false,
9745 configurable: true
9746 });
9747 Object.defineProperty(NbBadgeComponent.prototype, "additionalClasses", {
9748 get: function () {
9749 if (this.statusService.isCustomStatus(this.status)) {
9750 return [this.statusService.getStatusClass(this.status)];
9751 }
9752 return [];
9753 },
9754 enumerable: false,
9755 configurable: true
9756 });
9757 Object.defineProperty(NbBadgeComponent.prototype, "primary", {
9758 get: function () {
9759 return this.status === 'primary';
9760 },
9761 enumerable: false,
9762 configurable: true
9763 });
9764 Object.defineProperty(NbBadgeComponent.prototype, "success", {
9765 get: function () {
9766 return this.status === 'success';
9767 },
9768 enumerable: false,
9769 configurable: true
9770 });
9771 Object.defineProperty(NbBadgeComponent.prototype, "info", {
9772 get: function () {
9773 return this.status === 'info';
9774 },
9775 enumerable: false,
9776 configurable: true
9777 });
9778 Object.defineProperty(NbBadgeComponent.prototype, "warning", {
9779 get: function () {
9780 return this.status === 'warning';
9781 },
9782 enumerable: false,
9783 configurable: true
9784 });
9785 Object.defineProperty(NbBadgeComponent.prototype, "danger", {
9786 get: function () {
9787 return this.status === 'danger';
9788 },
9789 enumerable: false,
9790 configurable: true
9791 });
9792 Object.defineProperty(NbBadgeComponent.prototype, "basic", {
9793 get: function () {
9794 return this.status === 'basic';
9795 },
9796 enumerable: false,
9797 configurable: true
9798 });
9799 Object.defineProperty(NbBadgeComponent.prototype, "control", {
9800 get: function () {
9801 return this.status === 'control';
9802 },
9803 enumerable: false,
9804 configurable: true
9805 });
9806 Object.defineProperty(NbBadgeComponent.prototype, "top", {
9807 get: function () {
9808 return this.position.includes('top');
9809 },
9810 enumerable: false,
9811 configurable: true
9812 });
9813 Object.defineProperty(NbBadgeComponent.prototype, "right", {
9814 get: function () {
9815 return this.position.includes('right');
9816 },
9817 enumerable: false,
9818 configurable: true
9819 });
9820 Object.defineProperty(NbBadgeComponent.prototype, "bottom", {
9821 get: function () {
9822 return this.position.includes('bottom');
9823 },
9824 enumerable: false,
9825 configurable: true
9826 });
9827 Object.defineProperty(NbBadgeComponent.prototype, "left", {
9828 get: function () {
9829 return this.position.includes('left');
9830 },
9831 enumerable: false,
9832 configurable: true
9833 });
9834 Object.defineProperty(NbBadgeComponent.prototype, "start", {
9835 get: function () {
9836 return this.position.includes('start');
9837 },
9838 enumerable: false,
9839 configurable: true
9840 });
9841 Object.defineProperty(NbBadgeComponent.prototype, "end", {
9842 get: function () {
9843 return this.position.includes('end');
9844 },
9845 enumerable: false,
9846 configurable: true
9847 });
9848 Object.defineProperty(NbBadgeComponent.prototype, "center", {
9849 get: function () {
9850 return this.position.includes('center');
9851 },
9852 enumerable: false,
9853 configurable: true
9854 });
9855 NbBadgeComponent.decorators = [
9856 { type: i0.Component, args: [{
9857 selector: 'nb-badge',
9858 template: "{{dotMode ? '' : text}}",
9859 styles: [":host{position:absolute;text-align:center;white-space:nowrap;vertical-align:baseline}:host(.position-top){top:0}:host(.position-right){right:0}:host(.position-bottom){bottom:0}:host(.position-left){left:0}:host(.position-center){top:50%;transform:translateY(-50%)}[dir=ltr] :host(.position-start){left:0}[dir=rtl] :host(.position-start){right:0}[dir=ltr] :host(.position-end){right:0}[dir=rtl] :host(.position-end){left:0}\n"]
9860 },] }
9861 ];
9862 NbBadgeComponent.ctorParameters = function () { return [
9863 { type: NbStatusService }
9864 ]; };
9865 NbBadgeComponent.propDecorators = {
9866 text: [{ type: i0.Input }],
9867 position: [{ type: i0.Input }],
9868 dotMode: [{ type: i0.Input }, { type: i0.HostBinding, args: ['class.dot-mode',] }],
9869 status: [{ type: i0.Input }],
9870 additionalClasses: [{ type: i0.HostBinding, args: ['class',] }],
9871 primary: [{ type: i0.HostBinding, args: ['class.status-primary',] }],
9872 success: [{ type: i0.HostBinding, args: ['class.status-success',] }],
9873 info: [{ type: i0.HostBinding, args: ['class.status-info',] }],
9874 warning: [{ type: i0.HostBinding, args: ['class.status-warning',] }],
9875 danger: [{ type: i0.HostBinding, args: ['class.status-danger',] }],
9876 basic: [{ type: i0.HostBinding, args: ['class.status-basic',] }],
9877 control: [{ type: i0.HostBinding, args: ['class.status-control',] }],
9878 top: [{ type: i0.HostBinding, args: ['class.position-top',] }],
9879 right: [{ type: i0.HostBinding, args: ['class.position-right',] }],
9880 bottom: [{ type: i0.HostBinding, args: ['class.position-bottom',] }],
9881 left: [{ type: i0.HostBinding, args: ['class.position-left',] }],
9882 start: [{ type: i0.HostBinding, args: ['class.position-start',] }],
9883 end: [{ type: i0.HostBinding, args: ['class.position-end',] }],
9884 center: [{ type: i0.HostBinding, args: ['class.position-center',] }]
9885 };
9886 return NbBadgeComponent;
9887}());
9888
9889/**
9890 * @license
9891 * Copyright Akveo. All Rights Reserved.
9892 * Licensed under the MIT License. See License.txt in the project root for license information.
9893 */
9894var NbBadgeModule = /** @class */ (function () {
9895 function NbBadgeModule() {
9896 }
9897 NbBadgeModule.decorators = [
9898 { type: i0.NgModule, args: [{
9899 exports: [NbBadgeComponent],
9900 declarations: [NbBadgeComponent],
9901 },] }
9902 ];
9903 return NbBadgeModule;
9904}());
9905
9906/**
9907 * @license
9908 * Copyright Akveo. All Rights Reserved.
9909 * Licensed under the MIT License. See License.txt in the project root for license information.
9910 */
9911var nbMenuComponents = [NbMenuComponent, NbMenuItemComponent];
9912var NB_MENU_PROVIDERS = [NbMenuService, NbMenuInternalService];
9913var NbMenuModule = /** @class */ (function () {
9914 function NbMenuModule() {
9915 }
9916 NbMenuModule.forRoot = function () {
9917 return {
9918 ngModule: NbMenuModule,
9919 providers: tslib.__spreadArray([], NB_MENU_PROVIDERS),
9920 };
9921 };
9922 NbMenuModule.decorators = [
9923 { type: i0.NgModule, args: [{
9924 imports: [
9925 NbSharedModule,
9926 NbIconModule,
9927 NbBadgeModule,
9928 ],
9929 declarations: tslib.__spreadArray([], nbMenuComponents),
9930 exports: tslib.__spreadArray([], nbMenuComponents),
9931 },] }
9932 ];
9933 return NbMenuModule;
9934}());
9935
9936/**
9937 * @license
9938 * Copyright Akveo. All Rights Reserved.
9939 * Licensed under the MIT License. See License.txt in the project root for license information.
9940 */
9941/**
9942 * Route tabset components.
9943 * Renders tabs inside of a router-outlet.
9944 *
9945 * ```ts
9946 * tabs = [
9947 * {
9948 * title: 'Route tab #1',
9949 * route: '/pages/description',
9950 * icon: 'home',
9951 * responsive: true, // hide title before `route-tabs-icon-only-max-width` value
9952 * },
9953 * {
9954 * title: 'Route tab #2',
9955 * route: '/pages/images',
9956 * }
9957 * ];
9958 *
9959 * <nb-route-tabset [tabs]="tabs"></nb-route-tabset>
9960 * ```
9961 * ### Installation
9962 *
9963 * Import `NbRouteTabsetModule` to your feature module.
9964 * ```ts
9965 * @NgModule({
9966 * imports: [
9967 * // ...
9968 * NbRouteTabsetModule,
9969 * ],
9970 * })
9971 * export class PageModule { }
9972 * ```
9973 *
9974 * @stacked-example(Route Tabset, tabset/route-tabset-showcase.component)
9975 *
9976 * @styles
9977 *
9978 * route-tabset-background-color:
9979 * route-tabset-border-radius:
9980 * route-tabset-shadow:
9981 * route-tabset-tab-background-color:
9982 * route-tabset-tab-padding:
9983 * route-tabset-tab-text-color:
9984 * route-tabset-tab-text-font-family:
9985 * route-tabset-tab-text-font-size:
9986 * route-tabset-tab-text-font-weight:
9987 * route-tabset-tab-text-line-height:
9988 * route-tabset-tab-text-transform:
9989 * route-tabset-tab-underline-width:
9990 * route-tabset-tab-underline-color:
9991 * route-tabset-tab-active-background-color:
9992 * route-tabset-tab-active-text-color:
9993 * route-tabset-tab-active-underline-color:
9994 * route-tabset-tab-focus-background-color:
9995 * route-tabset-tab-focus-text-color:
9996 * route-tabset-tab-focus-underline-color:
9997 * route-tabset-tab-hover-background-color:
9998 * route-tabset-tab-hover-text-color:
9999 * route-tabset-tab-hover-underline-color:
10000 * route-tabset-tab-disabled-background-color:
10001 * route-tabset-tab-disabled-text-color:
10002 * route-tabset-tab-disabled-underline-color:
10003 * route-tabset-divider-color:
10004 * route-tabset-divider-style:
10005 * route-tabset-divider-width:
10006 * route-tabset-scrollbar-color:
10007 * route-tabset-scrollbar-background-color:
10008 * route-tabset-scrollbar-width:
10009 * route-tabset-tab-text-hide-breakpoint:
10010 */
10011var NbRouteTabsetComponent = /** @class */ (function () {
10012 function NbRouteTabsetComponent() {
10013 this.fullWidthValue = false;
10014 /**
10015 * Options passed to `routerLinkActiveOptions` directive which set on tab links.
10016 * `{ exact: true }` by default.
10017 */
10018 this.activeLinkOptions = { exact: true };
10019 /**
10020 * Emits when tab is selected
10021 * @type {EventEmitter<any>}
10022 */
10023 this.changeTab = new i0.EventEmitter();
10024 }
10025 Object.defineProperty(NbRouteTabsetComponent.prototype, "fullWidth", {
10026 /**
10027 * Take full width of a parent
10028 * @param {boolean} val
10029 */
10030 set: function (val) {
10031 this.fullWidthValue = convertToBoolProperty(val);
10032 },
10033 enumerable: false,
10034 configurable: true
10035 });
10036 NbRouteTabsetComponent.prototype.selectTab = function (tab) {
10037 this.changeTab.emit(tab);
10038 };
10039 NbRouteTabsetComponent.decorators = [
10040 { type: i0.Component, args: [{
10041 selector: 'nb-route-tabset',
10042 template: "\n <ul class=\"route-tabset\">\n <ng-container *ngFor=\"let tab of tabs\">\n <li *ngIf=\"tab.disabled; else enabled\"\n [class.responsive]=\"tab.responsive\"\n class=\"route-tab disabled\"\n tabindex=\"-1\">\n <a tabindex=\"-1\" class=\"tab-link\">\n <nb-icon *ngIf=\"tab.icon\" [config]=\"tab.icon\"></nb-icon>\n <span *ngIf=\"tab.title\" class=\"tab-text\">{{ tab.title }}</span>\n </a>\n </li>\n\n <ng-template #enabled>\n <li (click)=\"$event.preventDefault(); selectTab(tab)\"\n [routerLink]=\"tab.route\"\n routerLinkActive=\"active\"\n [routerLinkActiveOptions]=\"activeLinkOptions\"\n [class.responsive]=\"tab.responsive\"\n [queryParams]=\"tab.queryParams\"\n [queryParamsHandling]=\"tab.queryParamsHandling\"\n [fragment]=\"tab.fragment\"\n [preserveFragment]=\"tab.preserveFragment\"\n [skipLocationChange]=\"tab.skipLocationChange\"\n [replaceUrl]=\"tab.replaceUrl\"\n [state]=\"tab.state\"\n tabindex=\"0\"\n class=\"route-tab\">\n <a tabindex=\"-1\" class=\"tab-link\">\n <nb-icon *ngIf=\"tab.icon\" [icon]=\"tab.icon\"></nb-icon>\n <span *ngIf=\"tab.title\" class=\"tab-text\">{{ tab.title }}</span>\n </a>\n </li>\n </ng-template>\n </ng-container>\n </ul>\n <router-outlet></router-outlet>\n ",
10043 styles: [".route-tabset{display:flex;flex-direction:row;list-style-type:none;margin:0;padding:0}.route-tabset .route-tab{margin-bottom:-1px;text-align:center;padding:0}.route-tabset .route-tab.active a::before{display:block}.route-tabset .route-tab a{position:relative;text-decoration:none;display:inline-block}.route-tabset .route-tab a::before{position:absolute;content:'';width:100%;border-radius:3px;bottom:-2px;left:0}.route-tabset .route-tab a nb-icon{vertical-align:middle}[dir=ltr] :host .tab-link nb-icon+span{margin-left:.5rem}[dir=rtl] :host .tab-link nb-icon+span{margin-right:.5rem}:host(.full-width) .route-tabset{justify-content:space-around}\n"]
10044 },] }
10045 ];
10046 NbRouteTabsetComponent.propDecorators = {
10047 fullWidthValue: [{ type: i0.HostBinding, args: ['class.full-width',] }],
10048 tabs: [{ type: i0.Input }],
10049 activeLinkOptions: [{ type: i0.Input }],
10050 fullWidth: [{ type: i0.Input }],
10051 changeTab: [{ type: i0.Output }]
10052 };
10053 return NbRouteTabsetComponent;
10054}());
10055
10056/**
10057 * @license
10058 * Copyright Akveo. All Rights Reserved.
10059 * Licensed under the MIT License. See License.txt in the project root for license information.
10060 */
10061var NbRouteTabsetModule = /** @class */ (function () {
10062 function NbRouteTabsetModule() {
10063 }
10064 NbRouteTabsetModule.decorators = [
10065 { type: i0.NgModule, args: [{
10066 imports: [
10067 NbSharedModule,
10068 NbIconModule,
10069 ],
10070 declarations: [
10071 NbRouteTabsetComponent,
10072 ],
10073 exports: [
10074 NbRouteTabsetComponent,
10075 ],
10076 },] }
10077 ];
10078 return NbRouteTabsetModule;
10079}());
10080
10081/**
10082 * @license
10083 * Copyright Akveo. All Rights Reserved.
10084 * Licensed under the MIT License. See License.txt in the project root for license information.
10085 */
10086var getSidebarState$ = new rxjs.Subject();
10087var getSidebarResponsiveState$ = new rxjs.Subject();
10088/**
10089 * Sidebar service.
10090 *
10091 * Root module service to control the sidebar from any part of the app.
10092 *
10093 * Allows you to change sidebar state dynamically from any part of the app:
10094 * @stacked-example(Sidebar State, sidebar/sidebar-toggle.component)
10095 */
10096var NbSidebarService = /** @class */ (function () {
10097 function NbSidebarService() {
10098 this.toggle$ = new rxjs.Subject();
10099 this.expand$ = new rxjs.Subject();
10100 this.collapse$ = new rxjs.Subject();
10101 this.compact$ = new rxjs.Subject();
10102 }
10103 /**
10104 * Subscribe to toggle events
10105 *
10106 * @returns Observable<{ compact: boolean, tag: string }>
10107 */
10108 NbSidebarService.prototype.onToggle = function () {
10109 return this.toggle$.pipe(rxjs_operators.share());
10110 };
10111 /**
10112 * Subscribe to expand events
10113 * @returns Observable<{ tag: string }>
10114 */
10115 NbSidebarService.prototype.onExpand = function () {
10116 return this.expand$.pipe(rxjs_operators.share());
10117 };
10118 /**
10119 * Subscribe to collapse evens
10120 * @returns Observable<{ tag: string }>
10121 */
10122 NbSidebarService.prototype.onCollapse = function () {
10123 return this.collapse$.pipe(rxjs_operators.share());
10124 };
10125 /**
10126 * Subscribe to compact evens
10127 * @returns Observable<{ tag: string }>
10128 */
10129 NbSidebarService.prototype.onCompact = function () {
10130 return this.compact$.pipe(rxjs_operators.share());
10131 };
10132 /**
10133 * Toggle a sidebar
10134 * @param {boolean} compact
10135 * @param {string} tag If you have multiple sidebars on the page, mark them with `tag` input property and pass it here
10136 * to specify which sidebar you want to control
10137 */
10138 NbSidebarService.prototype.toggle = function (compact, tag) {
10139 if (compact === void 0) { compact = false; }
10140 this.toggle$.next({ compact: compact, tag: tag });
10141 };
10142 /**
10143 * Expands a sidebar
10144 * @param {string} tag If you have multiple sidebars on the page, mark them with `tag` input property and pass it here
10145 * to specify which sidebar you want to control
10146 */
10147 NbSidebarService.prototype.expand = function (tag) {
10148 this.expand$.next({ tag: tag });
10149 };
10150 /**
10151 * Collapses a sidebar
10152 * @param {string} tag If you have multiple sidebars on the page, mark them with `tag` input property and pass it here
10153 * to specify which sidebar you want to control
10154 */
10155 NbSidebarService.prototype.collapse = function (tag) {
10156 this.collapse$.next({ tag: tag });
10157 };
10158 /**
10159 * Makes sidebar compact
10160 * @param {string} tag If you have multiple sidebars on the page, mark them with `tag` input property and pass it here
10161 * to specify which sidebar you want to control
10162 */
10163 NbSidebarService.prototype.compact = function (tag) {
10164 this.compact$.next({ tag: tag });
10165 };
10166 /**
10167 * Returns sidebar state observable which emits once
10168 * @param {string} tag If you have multiple sidebars on the page, mark them with `tag` input property and pass it here
10169 * to specify which sidebar state you need
10170 */
10171 NbSidebarService.prototype.getSidebarState = function (tag) {
10172 var observer = new rxjs.ReplaySubject(1);
10173 getSidebarState$.next({ observer: observer, tag: tag });
10174 return observer.pipe(rxjs_operators.publish(), rxjs_operators.refCount());
10175 };
10176 /**
10177 * Returns sidebar state observable which emits once
10178 * @param {string} tag If you have multiple sidebars on the page, mark them with `tag` input property and pass it here
10179 * to specify which sidebar responsive state you need
10180 */
10181 NbSidebarService.prototype.getSidebarResponsiveState = function (tag) {
10182 var observer = new rxjs.ReplaySubject();
10183 getSidebarResponsiveState$.next({ observer: observer, tag: tag });
10184 return observer.pipe(rxjs_operators.publish(), rxjs_operators.refCount());
10185 };
10186 NbSidebarService.decorators = [
10187 { type: i0.Injectable }
10188 ];
10189 return NbSidebarService;
10190}());
10191
10192/**
10193 * @license
10194 * Copyright Akveo. All Rights Reserved.
10195 * Licensed under the MIT License. See License.txt in the project root for license information.
10196 */
10197/**
10198 * Sidebar header container.
10199 *
10200 * Placeholder which contains a sidebar header content,
10201 * placed at the very top of the sidebar outside of the scroll area.
10202 */
10203var NbSidebarHeaderComponent = /** @class */ (function () {
10204 function NbSidebarHeaderComponent() {
10205 }
10206 NbSidebarHeaderComponent.decorators = [
10207 { type: i0.Component, args: [{
10208 selector: 'nb-sidebar-header',
10209 template: "\n <ng-content></ng-content>\n "
10210 },] }
10211 ];
10212 return NbSidebarHeaderComponent;
10213}());
10214/**
10215 * Sidebar footer container.
10216 *
10217 * Placeholder which contains a sidebar footer content,
10218 * placed at the very bottom of the sidebar outside of the scroll area.
10219 */
10220var NbSidebarFooterComponent = /** @class */ (function () {
10221 function NbSidebarFooterComponent() {
10222 }
10223 NbSidebarFooterComponent.decorators = [
10224 { type: i0.Component, args: [{
10225 selector: 'nb-sidebar-footer',
10226 template: "\n <ng-content></ng-content>\n "
10227 },] }
10228 ];
10229 return NbSidebarFooterComponent;
10230}());
10231/**
10232 * Layout sidebar component.
10233 *
10234 * @stacked-example(Showcase, sidebar/sidebar-showcase.component)
10235 *
10236 * ### Installation
10237 *
10238 * Import `NbSidebarModule.forRoot()` to your app module.
10239 * ```ts
10240 * @NgModule({
10241 * imports: [
10242 * // ...
10243 * NbSidebarModule.forRoot(),
10244 * ],
10245 * })
10246 * export class AppModule { }
10247 * ```
10248 * and `NbSidebarModule` to your feature module where the component should be shown:
10249 * ```ts
10250 * @NgModule({
10251 * imports: [
10252 * // ...
10253 * NbSidebarModule,
10254 * ],
10255 * })
10256 * export class PageModule { }
10257 * ```
10258 * ### Usage
10259 *
10260 * Sidebar can be placed on the left or the right side of the layout,
10261 * or on start/end position of layout (depends on document direction, left to right or right to left)
10262 * It can be fixed (shown above the content) or can push the layout when opened.
10263 *
10264 * There are three states - `expanded`, `collapsed`, `compacted`.
10265 * By default sidebar content is fixed and saves its position while the page is being scrolled.
10266 *
10267 * Compacted sidebar example:
10268 * @stacked-example(Compacted Sidebar, sidebar/sidebar-compacted.component)
10269 *
10270 * Sidebar also supports a `responsive` behavior, listening to window size change and changing its size respectably.
10271 *
10272 * In a pair with header it is possible to setup a configuration when header is placed on a side of the sidebar
10273 * and not on top of it. To achieve this simply put a `subheader` property to the header like this:
10274 * ```html
10275 * <nb-layout-header subheader></nb-layout-header>
10276 * ```
10277 * @stacked-example(Subheader, layout/layout-sidebar-subheader.component)
10278 * Note that in such configuration sidebar shadow is removed and header cannot be make `fixed`.
10279 *
10280 * @additional-example(Right Sidebar, sidebar/sidebar-right.component)
10281 * @additional-example(Fixed Sidebar, sidebar/sidebar-fixed.component)
10282 *
10283 * @styles
10284 *
10285 * sidebar-background-color:
10286 * sidebar-text-color:
10287 * sidebar-text-font-family:
10288 * sidebar-text-font-size:
10289 * sidebar-text-font-weight:
10290 * sidebar-text-line-height:
10291 * sidebar-height:
10292 * sidebar-width:
10293 * sidebar-width-compact:
10294 * sidebar-padding:
10295 * sidebar-header-height:
10296 * sidebar-footer-height:
10297 * sidebar-shadow:
10298 * sidebar-menu-item-highlight-color:
10299 * sidebar-scrollbar-background-color:
10300 * sidebar-scrollbar-color:
10301 * sidebar-scrollbar-width:
10302 */
10303var NbSidebarComponent = /** @class */ (function () {
10304 function NbSidebarComponent(sidebarService, themeService, element, cd) {
10305 this.sidebarService = sidebarService;
10306 this.themeService = themeService;
10307 this.element = element;
10308 this.cd = cd;
10309 this.responsiveValueChange$ = new rxjs.Subject();
10310 this.responsiveState = 'pc';
10311 this.destroy$ = new rxjs.Subject();
10312 this.containerFixedValue = true;
10313 this.fixedValue = false;
10314 this.rightValue = false;
10315 this.leftValue = true;
10316 this.startValue = false;
10317 this.endValue = false;
10318 this._state = 'expanded';
10319 this._responsive = false;
10320 // TODO: get width by the key and define only max width for the tablets and mobiles
10321 /**
10322 * Controls on which screen sizes sidebar should be switched to compacted state.
10323 * Works only when responsive mode is on.
10324 * Default values are `['xs', 'is', 'sm', 'md', 'lg']`.
10325 *
10326 * @type string[]
10327 */
10328 this.compactedBreakpoints = ['xs', 'is', 'sm', 'md', 'lg'];
10329 /**
10330 * Controls on which screen sizes sidebar should be switched to collapsed state.
10331 * Works only when responsive mode is on.
10332 * Default values are `['xs', 'is']`.
10333 *
10334 * @type string[]
10335 */
10336 this.collapsedBreakpoints = ['xs', 'is'];
10337 /**
10338 * Emits whenever sidebar state change.
10339 */
10340 this.stateChange = new i0.EventEmitter();
10341 /**
10342 * Emits whenever sidebar responsive state change.
10343 */
10344 this.responsiveStateChange = new i0.EventEmitter();
10345 }
10346 Object.defineProperty(NbSidebarComponent.prototype, "expanded", {
10347 get: function () {
10348 return this.state === 'expanded';
10349 },
10350 enumerable: false,
10351 configurable: true
10352 });
10353 Object.defineProperty(NbSidebarComponent.prototype, "collapsed", {
10354 get: function () {
10355 return this.state === 'collapsed';
10356 },
10357 enumerable: false,
10358 configurable: true
10359 });
10360 Object.defineProperty(NbSidebarComponent.prototype, "compacted", {
10361 get: function () {
10362 return this.state === 'compacted';
10363 },
10364 enumerable: false,
10365 configurable: true
10366 });
10367 Object.defineProperty(NbSidebarComponent.prototype, "right", {
10368 /**
10369 * Places sidebar on the right side
10370 * @type {boolean}
10371 */
10372 set: function (val) {
10373 this.rightValue = convertToBoolProperty(val);
10374 this.leftValue = !this.rightValue;
10375 this.startValue = false;
10376 this.endValue = false;
10377 },
10378 enumerable: false,
10379 configurable: true
10380 });
10381 Object.defineProperty(NbSidebarComponent.prototype, "left", {
10382 /**
10383 * Places sidebar on the left side
10384 * @type {boolean}
10385 */
10386 set: function (val) {
10387 this.leftValue = convertToBoolProperty(val);
10388 this.rightValue = !this.leftValue;
10389 this.startValue = false;
10390 this.endValue = false;
10391 },
10392 enumerable: false,
10393 configurable: true
10394 });
10395 Object.defineProperty(NbSidebarComponent.prototype, "start", {
10396 /**
10397 * Places sidebar on the start edge of layout
10398 * @type {boolean}
10399 */
10400 set: function (val) {
10401 this.startValue = convertToBoolProperty(val);
10402 this.endValue = !this.startValue;
10403 this.leftValue = false;
10404 this.rightValue = false;
10405 },
10406 enumerable: false,
10407 configurable: true
10408 });
10409 Object.defineProperty(NbSidebarComponent.prototype, "end", {
10410 /**
10411 * Places sidebar on the end edge of layout
10412 * @type {boolean}
10413 */
10414 set: function (val) {
10415 this.endValue = convertToBoolProperty(val);
10416 this.startValue = !this.endValue;
10417 this.leftValue = false;
10418 this.rightValue = false;
10419 },
10420 enumerable: false,
10421 configurable: true
10422 });
10423 Object.defineProperty(NbSidebarComponent.prototype, "fixed", {
10424 /**
10425 * Makes sidebar fixed (shown above the layout content)
10426 * @type {boolean}
10427 */
10428 set: function (val) {
10429 this.fixedValue = convertToBoolProperty(val);
10430 },
10431 enumerable: false,
10432 configurable: true
10433 });
10434 Object.defineProperty(NbSidebarComponent.prototype, "containerFixed", {
10435 /**
10436 * Makes sidebar container fixed
10437 * @type {boolean}
10438 */
10439 set: function (val) {
10440 this.containerFixedValue = convertToBoolProperty(val);
10441 },
10442 enumerable: false,
10443 configurable: true
10444 });
10445 Object.defineProperty(NbSidebarComponent.prototype, "state", {
10446 /**
10447 * Initial sidebar state, `expanded`|`collapsed`|`compacted`
10448 * @type {string}
10449 */
10450 get: function () {
10451 return this._state;
10452 },
10453 set: function (value) {
10454 this._state = value;
10455 },
10456 enumerable: false,
10457 configurable: true
10458 });
10459 Object.defineProperty(NbSidebarComponent.prototype, "responsive", {
10460 /**
10461 * Makes sidebar listen to media query events and change its behaviour
10462 * @type {boolean}
10463 */
10464 get: function () {
10465 return this._responsive;
10466 },
10467 set: function (value) {
10468 if (this.responsive !== convertToBoolProperty(value)) {
10469 this._responsive = !this.responsive;
10470 this.responsiveValueChange$.next(this.responsive);
10471 }
10472 },
10473 enumerable: false,
10474 configurable: true
10475 });
10476 NbSidebarComponent.prototype.ngOnInit = function () {
10477 var _this = this;
10478 this.sidebarService.onToggle()
10479 .pipe(rxjs_operators.filter(function (_a) {
10480 var tag = _a.tag;
10481 return !_this.tag || _this.tag === tag;
10482 }), rxjs_operators.takeUntil(this.destroy$))
10483 .subscribe(function (_a) {
10484 var compact = _a.compact;
10485 return _this.toggle(compact);
10486 });
10487 this.sidebarService.onExpand()
10488 .pipe(rxjs_operators.filter(function (_a) {
10489 var tag = _a.tag;
10490 return !_this.tag || _this.tag === tag;
10491 }), rxjs_operators.takeUntil(this.destroy$))
10492 .subscribe(function () { return _this.expand(); });
10493 this.sidebarService.onCollapse()
10494 .pipe(rxjs_operators.filter(function (_a) {
10495 var tag = _a.tag;
10496 return !_this.tag || _this.tag === tag;
10497 }), rxjs_operators.takeUntil(this.destroy$))
10498 .subscribe(function () { return _this.collapse(); });
10499 this.sidebarService.onCompact()
10500 .pipe(rxjs_operators.filter(function (_a) {
10501 var tag = _a.tag;
10502 return !_this.tag || _this.tag === tag;
10503 }), rxjs_operators.takeUntil(this.destroy$))
10504 .subscribe(function () { return _this.compact(); });
10505 getSidebarState$
10506 .pipe(rxjs_operators.filter(function (_a) {
10507 var tag = _a.tag;
10508 return !_this.tag || _this.tag === tag;
10509 }), rxjs_operators.takeUntil(this.destroy$))
10510 .subscribe(function (_a) {
10511 var observer = _a.observer;
10512 return observer.next(_this.state);
10513 });
10514 getSidebarResponsiveState$
10515 .pipe(rxjs_operators.filter(function (_a) {
10516 var tag = _a.tag;
10517 return !_this.tag || _this.tag === tag;
10518 }), rxjs_operators.takeUntil(this.destroy$))
10519 .subscribe(function (_a) {
10520 var observer = _a.observer;
10521 return observer.next(_this.responsiveState);
10522 });
10523 this.responsiveValueChange$
10524 .pipe(rxjs_operators.filter(function (responsive) { return !responsive; }), rxjs_operators.takeUntil(this.destroy$))
10525 .subscribe(function () { return _this.expand(); });
10526 this.subscribeToMediaQueryChange();
10527 };
10528 NbSidebarComponent.prototype.ngOnDestroy = function () {
10529 this.destroy$.next();
10530 this.destroy$.complete();
10531 };
10532 // TODO: this is more of a workaround, should be a better way to make components communicate to each other
10533 NbSidebarComponent.prototype.onClick = function (event) {
10534 var menu = this.element.nativeElement.querySelector('nb-menu');
10535 if (menu && menu.contains(event.target)) {
10536 var link = this.getMenuLink(event.target);
10537 if (link && link.nextElementSibling && link.nextElementSibling.classList.contains('menu-items')) {
10538 this.sidebarService.expand(this.tag);
10539 }
10540 }
10541 };
10542 /**
10543 * Collapses the sidebar
10544 */
10545 NbSidebarComponent.prototype.collapse = function () {
10546 this.updateState('collapsed');
10547 };
10548 /**
10549 * Expands the sidebar
10550 */
10551 NbSidebarComponent.prototype.expand = function () {
10552 this.updateState('expanded');
10553 };
10554 /**
10555 * Compacts the sidebar (minimizes)
10556 */
10557 NbSidebarComponent.prototype.compact = function () {
10558 this.updateState('compacted');
10559 };
10560 /**
10561 * Toggles sidebar state (expanded|collapsed|compacted)
10562 * @param {boolean} compact If true, then sidebar state will be changed between expanded & compacted,
10563 * otherwise - between expanded & collapsed. False by default.
10564 *
10565 * Toggle sidebar state
10566 *
10567 * ```ts
10568 * this.sidebar.toggle(true);
10569 * ```
10570 */
10571 NbSidebarComponent.prototype.toggle = function (compact) {
10572 if (compact === void 0) { compact = false; }
10573 if (this.responsive) {
10574 if (this.responsiveState === 'mobile') {
10575 compact = false;
10576 }
10577 }
10578 if (this.state === 'compacted' || this.state === 'collapsed') {
10579 this.updateState('expanded');
10580 }
10581 else {
10582 this.updateState(compact ? 'compacted' : 'collapsed');
10583 }
10584 };
10585 NbSidebarComponent.prototype.subscribeToMediaQueryChange = function () {
10586 var _this = this;
10587 rxjs.combineLatest([
10588 this.responsiveValueChange$.pipe(rxjs_operators.startWith(this.responsive)),
10589 this.themeService.onMediaQueryChange(),
10590 ])
10591 .pipe(rxjs_operators.filter(function (_a) {
10592 var responsive = _a[0];
10593 return responsive;
10594 }), rxjs_operators.map(function (_a) {
10595 var breakpoints = _a[1];
10596 return breakpoints;
10597 }), rxjs_operators.takeUntil(this.destroy$))
10598 .subscribe(function (_a) {
10599 var prev = _a[0], current = _a[1];
10600 var isCollapsed = _this.collapsedBreakpoints.includes(current.name);
10601 var isCompacted = _this.compactedBreakpoints.includes(current.name);
10602 var newResponsiveState;
10603 if (isCompacted) {
10604 _this.fixed = _this.containerFixedValue;
10605 _this.compact();
10606 newResponsiveState = 'tablet';
10607 }
10608 if (isCollapsed) {
10609 _this.fixed = true;
10610 _this.collapse();
10611 newResponsiveState = 'mobile';
10612 }
10613 if (!isCollapsed && !isCompacted && (!prev.width || prev.width < current.width)) {
10614 _this.expand();
10615 _this.fixed = false;
10616 newResponsiveState = 'pc';
10617 }
10618 if (newResponsiveState && newResponsiveState !== _this.responsiveState) {
10619 _this.responsiveState = newResponsiveState;
10620 _this.responsiveStateChange.emit(_this.responsiveState);
10621 _this.cd.markForCheck();
10622 }
10623 });
10624 };
10625 NbSidebarComponent.prototype.getMenuLink = function (element) {
10626 if (!element || element.tagName.toLowerCase() === 'nb-menu') {
10627 return;
10628 }
10629 if (element.tagName.toLowerCase() === 'a') {
10630 return element;
10631 }
10632 return this.getMenuLink(element.parentElement);
10633 };
10634 NbSidebarComponent.prototype.updateState = function (state$$1) {
10635 if (this.state !== state$$1) {
10636 this.state = state$$1;
10637 this.stateChange.emit(this.state);
10638 this.cd.markForCheck();
10639 }
10640 };
10641 /**
10642 * @deprecated Use `responsive` property instead
10643 * @breaking-change Remove @8.0.0
10644 */
10645 NbSidebarComponent.prototype.toggleResponsive = function (enabled) {
10646 this.responsive = enabled;
10647 };
10648 /**
10649 * @deprecated Use NbSidebarState type instead
10650 * @breaking-change Remove @8.0.0
10651 */
10652 NbSidebarComponent.STATE_EXPANDED = 'expanded';
10653 /**
10654 * @deprecated Use NbSidebarState type instead
10655 * @breaking-change Remove @8.0.0
10656 */
10657 NbSidebarComponent.STATE_COLLAPSED = 'collapsed';
10658 /**
10659 * @deprecated Use NbSidebarState type instead
10660 * @breaking-change Remove @8.0.0
10661 */
10662 NbSidebarComponent.STATE_COMPACTED = 'compacted';
10663 /**
10664 * @deprecated Use NbSidebarResponsiveState type instead
10665 * @breaking-change Remove @8.0.0
10666 */
10667 NbSidebarComponent.RESPONSIVE_STATE_MOBILE = 'mobile';
10668 /**
10669 * @deprecated Use NbSidebarResponsiveState type instead
10670 * @breaking-change Remove @8.0.0
10671 */
10672 NbSidebarComponent.RESPONSIVE_STATE_TABLET = 'tablet';
10673 /**
10674 * @deprecated Use NbSidebarResponsiveState type instead
10675 * @breaking-change Remove @8.0.0
10676 */
10677 NbSidebarComponent.RESPONSIVE_STATE_PC = 'pc';
10678 NbSidebarComponent.decorators = [
10679 { type: i0.Component, args: [{
10680 selector: 'nb-sidebar',
10681 template: "\n <div class=\"main-container\"\n [class.main-container-fixed]=\"containerFixedValue\">\n <ng-content select=\"nb-sidebar-header\"></ng-content>\n <div class=\"scrollable\" (click)=\"onClick($event)\">\n <ng-content></ng-content>\n </div>\n <ng-content select=\"nb-sidebar-footer\"></ng-content>\n </div>\n ",
10682 changeDetection: i0.ChangeDetectionStrategy.OnPush,
10683 styles: [":host{display:flex;flex-direction:column;overflow:hidden;z-index:auto;order:0}:host .scrollable{overflow-y:auto;overflow-x:hidden;flex:1}:host .main-container{transform:translate3d(0, 0, 0);display:flex;flex-direction:column}:host .main-container-fixed{position:fixed}:host.right{margin-right:0;margin-left:auto}[dir=ltr] :host.right{order:4}[dir=rtl] :host.right{order:0}:host.end{order:4}[dir=ltr] :host.end{margin-right:0;margin-left:auto}[dir=rtl] :host.end{margin-left:0;margin-right:auto}:host.fixed{position:fixed;height:100%;z-index:999;top:0;bottom:0;left:0}:host.fixed.right{right:0}[dir=ltr] :host.fixed.start{left:0}[dir=rtl] :host.fixed.start{right:0}[dir=ltr] :host.fixed.end{right:0}[dir=rtl] :host.fixed.end{left:0}:host ::ng-deep nb-sidebar-footer{margin-top:auto;display:block}:host ::ng-deep nb-sidebar-header{display:block}\n"]
10684 },] }
10685 ];
10686 NbSidebarComponent.ctorParameters = function () { return [
10687 { type: NbSidebarService },
10688 { type: NbThemeService },
10689 { type: i0.ElementRef },
10690 { type: i0.ChangeDetectorRef }
10691 ]; };
10692 NbSidebarComponent.propDecorators = {
10693 fixedValue: [{ type: i0.HostBinding, args: ['class.fixed',] }],
10694 rightValue: [{ type: i0.HostBinding, args: ['class.right',] }],
10695 leftValue: [{ type: i0.HostBinding, args: ['class.left',] }],
10696 startValue: [{ type: i0.HostBinding, args: ['class.start',] }],
10697 endValue: [{ type: i0.HostBinding, args: ['class.end',] }],
10698 expanded: [{ type: i0.HostBinding, args: ['class.expanded',] }],
10699 collapsed: [{ type: i0.HostBinding, args: ['class.collapsed',] }],
10700 compacted: [{ type: i0.HostBinding, args: ['class.compacted',] }],
10701 right: [{ type: i0.Input }],
10702 left: [{ type: i0.Input }],
10703 start: [{ type: i0.Input }],
10704 end: [{ type: i0.Input }],
10705 fixed: [{ type: i0.Input }],
10706 containerFixed: [{ type: i0.Input }],
10707 state: [{ type: i0.Input }],
10708 responsive: [{ type: i0.Input }],
10709 tag: [{ type: i0.Input }],
10710 compactedBreakpoints: [{ type: i0.Input }],
10711 collapsedBreakpoints: [{ type: i0.Input }],
10712 stateChange: [{ type: i0.Output }],
10713 responsiveStateChange: [{ type: i0.Output }]
10714 };
10715 return NbSidebarComponent;
10716}());
10717
10718/**
10719 * @license
10720 * Copyright Akveo. All Rights Reserved.
10721 * Licensed under the MIT License. See License.txt in the project root for license information.
10722 */
10723var NB_SIDEBAR_COMPONENTS = [
10724 NbSidebarComponent,
10725 NbSidebarFooterComponent,
10726 NbSidebarHeaderComponent,
10727];
10728var NB_SIDEBAR_PROVIDERS = [
10729 NbSidebarService,
10730];
10731var NbSidebarModule = /** @class */ (function () {
10732 function NbSidebarModule() {
10733 }
10734 NbSidebarModule.forRoot = function () {
10735 return {
10736 ngModule: NbSidebarModule,
10737 providers: tslib.__spreadArray([], NB_SIDEBAR_PROVIDERS),
10738 };
10739 };
10740 NbSidebarModule.decorators = [
10741 { type: i0.NgModule, args: [{
10742 imports: [
10743 NbSharedModule,
10744 ],
10745 declarations: tslib.__spreadArray([], NB_SIDEBAR_COMPONENTS),
10746 exports: tslib.__spreadArray([], NB_SIDEBAR_COMPONENTS),
10747 },] }
10748 ];
10749 return NbSidebarModule;
10750}());
10751
10752/**
10753 * @license
10754 * Copyright Akveo. All Rights Reserved.
10755 * Licensed under the MIT License. See License.txt in the project root for license information.
10756 */
10757/**
10758 * Specific tab container.
10759 *
10760 * ```ts
10761 * <nb-tab tabTitle="Users"
10762 * badgeText="99+"
10763 * badgeStatus="danger">
10764 * <p>List of <strong>users</strong>.</p>
10765 * </nb-tab>
10766 ```
10767 */
10768var NbTabComponent = /** @class */ (function () {
10769 function NbTabComponent() {
10770 this.activeValue = false;
10771 this.responsiveValue = false;
10772 this.disabledValue = false;
10773 /**
10774 * Badge status (adds specific styles):
10775 * 'primary', 'info', 'success', 'warning', 'danger'
10776 * @param {string} val
10777 */
10778 this.badgeStatus = 'basic';
10779 this.init = false;
10780 }
10781 Object.defineProperty(NbTabComponent.prototype, "badgeDot", {
10782 /**
10783 * Use badge dot mode
10784 * @type {boolean}
10785 */
10786 get: function () {
10787 return this._badgeDot;
10788 },
10789 set: function (val) {
10790 this._badgeDot = convertToBoolProperty(val);
10791 },
10792 enumerable: false,
10793 configurable: true
10794 });
10795 Object.defineProperty(NbTabComponent.prototype, "disabled", {
10796 /**
10797 * Item is disabled and cannot be opened.
10798 * @type {boolean}
10799 */
10800 get: function () {
10801 return this.disabledValue;
10802 },
10803 set: function (val) {
10804 this.disabledValue = convertToBoolProperty(val);
10805 },
10806 enumerable: false,
10807 configurable: true
10808 });
10809 Object.defineProperty(NbTabComponent.prototype, "responsive", {
10810 get: function () {
10811 return this.responsiveValue;
10812 },
10813 /**
10814 * Show only icons when width is smaller than `tabs-icon-only-max-width`
10815 * @type {boolean}
10816 */
10817 set: function (val) {
10818 this.responsiveValue = convertToBoolProperty(val);
10819 },
10820 enumerable: false,
10821 configurable: true
10822 });
10823 Object.defineProperty(NbTabComponent.prototype, "active", {
10824 /**
10825 * Specifies active tab
10826 * @returns {boolean}
10827 */
10828 get: function () {
10829 return this.activeValue;
10830 },
10831 set: function (val) {
10832 this.activeValue = convertToBoolProperty(val);
10833 if (this.activeValue) {
10834 this.init = true;
10835 }
10836 },
10837 enumerable: false,
10838 configurable: true
10839 });
10840 Object.defineProperty(NbTabComponent.prototype, "lazyLoad", {
10841 /**
10842 * Lazy load content before tab selection
10843 * TODO: rename, as lazy is by default, and this is more `instant load`
10844 * @param {boolean} val
10845 */
10846 set: function (val) {
10847 this.init = convertToBoolProperty(val);
10848 },
10849 enumerable: false,
10850 configurable: true
10851 });
10852 NbTabComponent.decorators = [
10853 { type: i0.Component, args: [{
10854 selector: 'nb-tab',
10855 template: "\n <ng-container *ngIf=\"init\">\n <ng-content></ng-content>\n </ng-container>\n "
10856 },] }
10857 ];
10858 NbTabComponent.propDecorators = {
10859 tabTitle: [{ type: i0.Input }],
10860 tabId: [{ type: i0.Input }],
10861 badgeDot: [{ type: i0.Input }],
10862 tabIcon: [{ type: i0.Input }],
10863 disabled: [{ type: i0.Input, args: ['disabled',] }, { type: i0.HostBinding, args: ['class.disabled',] }],
10864 responsive: [{ type: i0.Input }],
10865 route: [{ type: i0.Input }],
10866 activeValue: [{ type: i0.HostBinding, args: ['class.content-active',] }],
10867 active: [{ type: i0.Input }],
10868 lazyLoad: [{ type: i0.Input }],
10869 badgeText: [{ type: i0.Input }],
10870 badgeStatus: [{ type: i0.Input }],
10871 badgePosition: [{ type: i0.Input }]
10872 };
10873 return NbTabComponent;
10874}());
10875// TODO: Combine tabset with route-tabset, so that we can:
10876// - have similar interface
10877// - easy to migrate from one to another
10878// - can mix them both (route/content tab)
10879/**
10880 *
10881 * Dynamic tabset component.
10882 * @stacked-example(Showcase, tabset/tabset-showcase.component)
10883 *
10884 * Basic tabset example
10885 *
10886 * ```html
10887 * <nb-tabset>
10888 * <nb-tab tabTitle="Simple Tab #1">
10889 * Tab content 1
10890 * </nb-tab>
10891 * <nb-tab tabTitle="Simple Tab #2">
10892 * Tab content 2
10893 * </nb-tab>
10894 * </nb-tabset>
10895 * ```
10896 *
10897 * ### Installation
10898 *
10899 * Import `NbTabsetModule` to your feature module.
10900 * ```ts
10901 * @NgModule({
10902 * imports: [
10903 * // ...
10904 * NbTabsetModule,
10905 * ],
10906 * })
10907 * export class PageModule { }
10908 * ```
10909 * ### Usage
10910 *
10911 * It is also possible to set a badge to a particular tab:
10912 * @stacked-example(Tab With Badge, tabset/tabset-badge.component)
10913 *
10914 * and we can set it to full a width of a parent component
10915 * @stacked-example(Full Width, tabset/tabset-width.component)
10916 *
10917 * `tabIcon` should be used to add an icon to the tab. Icon can also be combined with title.
10918 * `responsive` tab property if set allows you to hide the title on smaller screens
10919 * (`tabs-icon-only-max-width` property) for better responsive behaviour. You can open the following example and make
10920 * your screen smaller - titles will be hidden in the last tabset in the list:
10921 *
10922 * @stacked-example(Icon, tabset/tabset-icon.component)
10923 *
10924 * It is also possible to disable a tab using `disabled` property:
10925 * @stacked-example(Disabled Tab, tabset/tabset-disabled.component)
10926 *
10927 * @styles
10928 *
10929 * tabset-background-color:
10930 * tabset-border-radius:
10931 * tabset-shadow:
10932 * tabset-tab-background-color:
10933 * tabset-tab-padding:
10934 * tabset-tab-text-color:
10935 * tabset-tab-text-font-family:
10936 * tabset-tab-text-font-size:
10937 * tabset-tab-text-font-weight:
10938 * tabset-tab-text-line-height:
10939 * tabset-tab-text-transform:
10940 * tabset-tab-underline-width:
10941 * tabset-tab-underline-color:
10942 * tabset-tab-active-background-color:
10943 * tabset-tab-active-text-color:
10944 * tabset-tab-active-underline-color:
10945 * tabset-tab-focus-background-color:
10946 * tabset-tab-focus-text-color:
10947 * tabset-tab-focus-underline-color:
10948 * tabset-tab-hover-background-color:
10949 * tabset-tab-hover-text-color:
10950 * tabset-tab-hover-underline-color:
10951 * tabset-tab-disabled-background-color:
10952 * tabset-tab-disabled-text-color:
10953 * tabset-tab-disabled-underline-color:
10954 * tabset-divider-color:
10955 * tabset-divider-style:
10956 * tabset-divider-width:
10957 * tabset-content-background-color:
10958 * tabset-content-padding:
10959 * tabset-content-text-color:
10960 * tabset-content-text-font-family:
10961 * tabset-content-text-font-size:
10962 * tabset-content-text-font-weight:
10963 * tabset-content-text-line-height:
10964 * tabset-scrollbar-color:
10965 * tabset-scrollbar-background-color:
10966 * tabset-scrollbar-width:
10967 * tabset-tab-text-hide-breakpoint:
10968 */
10969var NbTabsetComponent = /** @class */ (function () {
10970 function NbTabsetComponent(route, changeDetectorRef) {
10971 this.route = route;
10972 this.changeDetectorRef = changeDetectorRef;
10973 this.fullWidthValue = false;
10974 /**
10975 * Emits when tab is selected
10976 * @type EventEmitter<any>
10977 */
10978 this.changeTab = new i0.EventEmitter();
10979 }
10980 Object.defineProperty(NbTabsetComponent.prototype, "fullWidth", {
10981 /**
10982 * Take full width of a parent
10983 * @param {boolean} val
10984 */
10985 set: function (val) {
10986 this.fullWidthValue = convertToBoolProperty(val);
10987 },
10988 enumerable: false,
10989 configurable: true
10990 });
10991 // TODO: refactoring this component, avoid change detection loop
10992 NbTabsetComponent.prototype.ngAfterContentInit = function () {
10993 var _this = this;
10994 this.route.params
10995 .pipe(rxjs_operators.map(function (params) {
10996 return _this.tabs.find(function (tab) { return _this.routeParam ? tab.route === params[_this.routeParam] : tab.active; });
10997 }), rxjs_operators.delay(0), rxjs_operators.map(function (tab) { return tab || _this.tabs.first; }), rxjs_operators.filter(function (tab) { return !!tab; }))
10998 .subscribe(function (tabToSelect) {
10999 _this.selectTab(tabToSelect);
11000 _this.changeDetectorRef.markForCheck();
11001 });
11002 };
11003 // TODO: navigate to routeParam
11004 NbTabsetComponent.prototype.selectTab = function (selectedTab) {
11005 if (!selectedTab.disabled) {
11006 this.tabs.forEach(function (tab) { return tab.active = tab === selectedTab; });
11007 this.changeTab.emit(selectedTab);
11008 }
11009 };
11010 NbTabsetComponent.decorators = [
11011 { type: i0.Component, args: [{
11012 selector: 'nb-tabset',
11013 template: "\n <ul class=\"tabset\">\n <li *ngFor=\"let tab of tabs\"\n (click)=\"selectTab(tab)\"\n (keyup.space)=\"selectTab(tab)\"\n (keyup.enter)=\"selectTab(tab)\"\n [class.responsive]=\"tab.responsive\"\n [class.active]=\"tab.active\"\n [class.disabled]=\"tab.disabled\"\n [attr.tabindex]=\"tab.disabled ? -1 : 0\"\n [attr.data-tab-id]=\"tab.tabId\"\n class=\"tab\">\n <a href (click)=\"$event.preventDefault()\" tabindex=\"-1\" class=\"tab-link\">\n <nb-icon *ngIf=\"tab.tabIcon\" [config]=\"tab.tabIcon\"></nb-icon>\n <span *ngIf=\"tab.tabTitle\" class=\"tab-text\">{{ tab.tabTitle }}</span>\n </a>\n <nb-badge *ngIf=\"tab.badgeText || tab.badgeDot\"\n [text]=\"tab.badgeText\"\n [dotMode]=\"tab.badgeDot\"\n [status]=\"tab.badgeStatus\"\n [position]=\"tab.badgePosition\">\n </nb-badge>\n </li>\n </ul>\n <ng-content select=\"nb-tab\"></ng-content>\n ",
11014 styles: [":host{display:block}:host.full-width .tabset{justify-content:space-around}:host ::ng-deep nb-tab{flex:1;-ms-flex:1 1 auto;overflow:auto;display:none}:host ::ng-deep nb-tab.content-active{display:block}:host .tabset{display:flex;flex-direction:row;list-style-type:none;margin:0;padding:0}:host .tabset .tab{margin-bottom:-1px;text-align:center;position:relative}:host .tabset .tab.active a::before{display:block}:host .tabset .tab a{display:flex;position:relative;text-decoration:none}:host .tabset .tab a::before{position:absolute;content:'';width:100%;border-radius:3px;bottom:-2px;left:0}:host .tabset .tab a nb-icon{vertical-align:middle}[dir=ltr] :host .tabset .tab a nb-icon+span{margin-left:.5rem}[dir=rtl] :host .tabset .tab a nb-icon+span{margin-right:.5rem}\n"]
11015 },] }
11016 ];
11017 NbTabsetComponent.ctorParameters = function () { return [
11018 { type: _angular_router.ActivatedRoute },
11019 { type: i0.ChangeDetectorRef }
11020 ]; };
11021 NbTabsetComponent.propDecorators = {
11022 tabs: [{ type: i0.ContentChildren, args: [NbTabComponent,] }],
11023 fullWidthValue: [{ type: i0.HostBinding, args: ['class.full-width',] }],
11024 fullWidth: [{ type: i0.Input }],
11025 routeParam: [{ type: i0.Input }],
11026 changeTab: [{ type: i0.Output }]
11027 };
11028 return NbTabsetComponent;
11029}());
11030
11031/**
11032 * @license
11033 * Copyright Akveo. All Rights Reserved.
11034 * Licensed under the MIT License. See License.txt in the project root for license information.
11035 */
11036var NB_TABSET_COMPONENTS = [
11037 NbTabsetComponent,
11038 NbTabComponent,
11039];
11040var NbTabsetModule = /** @class */ (function () {
11041 function NbTabsetModule() {
11042 }
11043 NbTabsetModule.decorators = [
11044 { type: i0.NgModule, args: [{
11045 imports: [
11046 NbSharedModule,
11047 NbBadgeModule,
11048 NbIconModule,
11049 ],
11050 declarations: tslib.__spreadArray([], NB_TABSET_COMPONENTS),
11051 exports: tslib.__spreadArray([], NB_TABSET_COMPONENTS),
11052 },] }
11053 ];
11054 return NbTabsetModule;
11055}());
11056
11057/**
11058 * @license
11059 * Copyright Akveo. All Rights Reserved.
11060 * Licensed under the MIT License. See License.txt in the project root for license information.
11061 */
11062/**
11063 * Represents a component showing a user avatar (picture) with a user name on the right.
11064 * @stacked-example(Showcase, user/user-showcase.component)
11065 *
11066 * ```ts
11067 * <nb-user name="John Doe" title="Engineer"></nb-user>
11068 * ```
11069 *
11070 * ### Installation
11071 *
11072 * Import `NbUserModule` to your feature module.
11073 * ```ts
11074 * @NgModule({
11075 * imports: [
11076 * // ...
11077 * NbUserModule,
11078 * ],
11079 * })
11080 * export class PageModule { }
11081 * ```
11082 * ### Usage
11083 *
11084 * Available in multiple sizes:
11085 * @stacked-example(Multiple Sizes, user/user-sizes.component)
11086 *
11087 *
11088 * You can hide unnecessary captions (name, title or both):
11089 * @stacked-example(Hide captions in user component, user/user-hide-captions.component)
11090 *
11091 *
11092 * You can set custom avatar background-color, user image (as link or BASE64 string) and disable user initials:
11093 * @stacked-example(Avatar image settings, user/user-avatar-settings.component)
11094 *
11095 * Component shape could be controlled with `shape` input.
11096 * @stacked-example(Shapes, user/user-shape.component)
11097 *
11098 * @styles
11099 *
11100 * user-picture-box-background-color:
11101 * user-picture-box-border-color:
11102 * user-picture-box-border-width:
11103 * user-initials-text-color:
11104 * user-initials-text-font-family:
11105 * user-initials-text-font-weight:
11106 * user-name-text-color:
11107 * user-name-text-font-family:
11108 * user-name-text-font-weight:
11109 * user-title-text-color:
11110 * user-title-text-font-family:
11111 * user-title-text-font-weight:
11112 * user-rectangle-border-radius:
11113 * user-semi-round-border-radius:
11114 * user-round-border-radius:
11115 * user-tiny-height:
11116 * user-tiny-width:
11117 * user-tiny-initials-text-font-size:
11118 * user-tiny-initials-text-line-height:
11119 * user-tiny-name-text-font-size:
11120 * user-tiny-name-text-line-height:
11121 * user-tiny-title-text-font-size:
11122 * user-tiny-title-text-line-height:
11123 * user-small-height:
11124 * user-small-width:
11125 * user-small-initials-text-font-size:
11126 * user-small-initials-text-line-height:
11127 * user-small-name-text-font-size:
11128 * user-small-name-text-line-height:
11129 * user-small-title-text-font-size:
11130 * user-small-title-text-line-height:
11131 * user-medium-height:
11132 * user-medium-width:
11133 * user-medium-initials-text-font-size:
11134 * user-medium-initials-text-line-height:
11135 * user-medium-name-text-font-size:
11136 * user-medium-name-text-line-height:
11137 * user-medium-title-text-font-size:
11138 * user-medium-title-text-line-height:
11139 * user-large-height:
11140 * user-large-width:
11141 * user-large-initials-text-font-size:
11142 * user-large-initials-text-line-height:
11143 * user-large-name-text-font-size:
11144 * user-large-name-text-line-height:
11145 * user-large-title-text-font-size:
11146 * user-large-title-text-line-height:
11147 * user-giant-height:
11148 * user-giant-width:
11149 * user-giant-initials-text-font-size:
11150 * user-giant-initials-text-line-height:
11151 * user-giant-name-text-font-size:
11152 * user-giant-name-text-line-height:
11153 * user-giant-title-text-font-size:
11154 * user-giant-title-text-line-height:
11155 */
11156var NbUserComponent = /** @class */ (function () {
11157 function NbUserComponent(domSanitizer) {
11158 this.domSanitizer = domSanitizer;
11159 /**
11160 * Specifies a name to be shown on the right of a user picture
11161 * @type string
11162 */
11163 this.name = 'Anonymous';
11164 /**
11165 * Size of the component.
11166 * Possible values: `tiny`, `small`, `medium` (default), `large`, 'giant'.
11167 */
11168 this.size = 'medium';
11169 /**
11170 * Shape of the picture box.
11171 * Possible values: `rectangle`, `semi-round`, `round`.
11172 */
11173 this.shape = 'round';
11174 this._showName = true;
11175 this._showTitle = true;
11176 this._showInitials = true;
11177 /**
11178 * Badge status (adds specific styles):
11179 * `primary`, `info`, `success`, `warning`, `danger`
11180 * @param {string} val
11181 */
11182 this.badgeStatus = 'basic';
11183 }
11184 Object.defineProperty(NbUserComponent.prototype, "picture", {
11185 /**
11186 * Absolute path to a user picture or base64 image.
11187 * User name initials will be shown if no picture specified (JD for John Doe).
11188 * @type string
11189 */
11190 set: function (value) {
11191 this.imageBackgroundStyle = value ? this.domSanitizer.bypassSecurityTrustStyle("url(" + value + ")") : null;
11192 },
11193 enumerable: false,
11194 configurable: true
11195 });
11196 Object.defineProperty(NbUserComponent.prototype, "showName", {
11197 /**
11198 * Whether to show a user name or not
11199 */
11200 get: function () {
11201 return this._showName;
11202 },
11203 set: function (val) {
11204 this._showName = convertToBoolProperty(val);
11205 },
11206 enumerable: false,
11207 configurable: true
11208 });
11209 Object.defineProperty(NbUserComponent.prototype, "showTitle", {
11210 /**
11211 * Whether to show a user title or not
11212 * @type boolean
11213 */
11214 get: function () {
11215 return this._showTitle;
11216 },
11217 set: function (val) {
11218 this._showTitle = convertToBoolProperty(val);
11219 },
11220 enumerable: false,
11221 configurable: true
11222 });
11223 Object.defineProperty(NbUserComponent.prototype, "showInitials", {
11224 /**
11225 * Whether to show a user initials (if no picture specified) or not
11226 * @type boolean
11227 */
11228 get: function () {
11229 return this._showInitials;
11230 },
11231 set: function (val) {
11232 this._showInitials = convertToBoolProperty(val);
11233 },
11234 enumerable: false,
11235 configurable: true
11236 });
11237 Object.defineProperty(NbUserComponent.prototype, "onlyPicture", {
11238 /**
11239 * Whether to show only a picture or also show the name and title
11240 * @type boolean
11241 */
11242 get: function () {
11243 return !this.showName && !this.showTitle;
11244 },
11245 set: function (val) {
11246 this.showName = this.showTitle = !convertToBoolProperty(val);
11247 },
11248 enumerable: false,
11249 configurable: true
11250 });
11251 Object.defineProperty(NbUserComponent.prototype, "tiny", {
11252 get: function () {
11253 return this.size === 'tiny';
11254 },
11255 enumerable: false,
11256 configurable: true
11257 });
11258 Object.defineProperty(NbUserComponent.prototype, "small", {
11259 get: function () {
11260 return this.size === 'small';
11261 },
11262 enumerable: false,
11263 configurable: true
11264 });
11265 Object.defineProperty(NbUserComponent.prototype, "medium", {
11266 get: function () {
11267 return this.size === 'medium';
11268 },
11269 enumerable: false,
11270 configurable: true
11271 });
11272 Object.defineProperty(NbUserComponent.prototype, "large", {
11273 get: function () {
11274 return this.size === 'large';
11275 },
11276 enumerable: false,
11277 configurable: true
11278 });
11279 Object.defineProperty(NbUserComponent.prototype, "giant", {
11280 get: function () {
11281 return this.size === 'giant';
11282 },
11283 enumerable: false,
11284 configurable: true
11285 });
11286 Object.defineProperty(NbUserComponent.prototype, "rectangle", {
11287 get: function () {
11288 return this.shape === 'rectangle';
11289 },
11290 enumerable: false,
11291 configurable: true
11292 });
11293 Object.defineProperty(NbUserComponent.prototype, "semiRound", {
11294 get: function () {
11295 return this.shape === 'semi-round';
11296 },
11297 enumerable: false,
11298 configurable: true
11299 });
11300 Object.defineProperty(NbUserComponent.prototype, "round", {
11301 get: function () {
11302 return this.shape === 'round';
11303 },
11304 enumerable: false,
11305 configurable: true
11306 });
11307 NbUserComponent.prototype.getInitials = function () {
11308 if (this.name) {
11309 var names = this.name.split(' ');
11310 return names.map(function (n) { return n.charAt(0); }).splice(0, 2).join('').toUpperCase();
11311 }
11312 return '';
11313 };
11314 NbUserComponent.decorators = [
11315 { type: i0.Component, args: [{
11316 selector: 'nb-user',
11317 template: "<div class=\"user-container\">\n <div *ngIf=\"imageBackgroundStyle\" class=\"user-picture image\" [style.background-image]=\"imageBackgroundStyle\">\n <nb-badge *ngIf=\"badgeText\" [text]=\"badgeText\" [status]=\"badgeStatus\" [position]=\"badgePosition\"></nb-badge>\n </div>\n <div *ngIf=\"!imageBackgroundStyle\" class=\"user-picture initials\" [style.background-color]=\"color\">\n <ng-container *ngIf=\"showInitials\">\n {{ getInitials() }}\n </ng-container>\n <nb-badge *ngIf=\"badgeText\" [text]=\"badgeText\" [status]=\"badgeStatus\" [position]=\"badgePosition\"></nb-badge>\n </div>\n\n <div class=\"info-container\">\n <div *ngIf=\"showName && name\" class=\"user-name\">{{ name }}</div>\n <div *ngIf=\"showTitle && title\" class=\"user-title\">{{ title }}</div>\n </div>\n</div>\n",
11318 styles: [":host{display:flex}:host .user-container{position:relative;display:flex;align-items:center}:host .user-picture{position:relative;flex-shrink:0}:host .user-picture.image{background-size:cover;background-repeat:no-repeat}:host .user-picture.initials{display:flex;align-items:center;justify-content:center}[dir=rtl] :host .user-name,[dir=rtl] :host .user-title{text-align:right}[dir=ltr] :host .info-container{margin-left:.5rem}[dir=rtl] :host .info-container{margin-right:.5rem}\n"]
11319 },] }
11320 ];
11321 NbUserComponent.ctorParameters = function () { return [
11322 { type: _angular_platformBrowser.DomSanitizer }
11323 ]; };
11324 NbUserComponent.propDecorators = {
11325 name: [{ type: i0.Input }],
11326 title: [{ type: i0.Input }],
11327 picture: [{ type: i0.Input }],
11328 color: [{ type: i0.Input }],
11329 size: [{ type: i0.Input }],
11330 shape: [{ type: i0.Input }],
11331 showName: [{ type: i0.Input }],
11332 showTitle: [{ type: i0.Input }],
11333 showInitials: [{ type: i0.Input }],
11334 onlyPicture: [{ type: i0.Input }],
11335 badgeText: [{ type: i0.Input }],
11336 badgeStatus: [{ type: i0.Input }],
11337 badgePosition: [{ type: i0.Input }],
11338 tiny: [{ type: i0.HostBinding, args: ['class.size-tiny',] }],
11339 small: [{ type: i0.HostBinding, args: ['class.size-small',] }],
11340 medium: [{ type: i0.HostBinding, args: ['class.size-medium',] }],
11341 large: [{ type: i0.HostBinding, args: ['class.size-large',] }],
11342 giant: [{ type: i0.HostBinding, args: ['class.size-giant',] }],
11343 rectangle: [{ type: i0.HostBinding, args: ['class.shape-rectangle',] }],
11344 semiRound: [{ type: i0.HostBinding, args: ['class.shape-semi-round',] }],
11345 round: [{ type: i0.HostBinding, args: ['class.shape-round',] }]
11346 };
11347 return NbUserComponent;
11348}());
11349
11350/**
11351 * @license
11352 * Copyright Akveo. All Rights Reserved.
11353 * Licensed under the MIT License. See License.txt in the project root for license information.
11354 */
11355var NB_USER_COMPONENTS = [
11356 NbUserComponent,
11357];
11358var NbUserModule = /** @class */ (function () {
11359 function NbUserModule() {
11360 }
11361 NbUserModule.decorators = [
11362 { type: i0.NgModule, args: [{
11363 imports: [
11364 NbSharedModule,
11365 NbBadgeModule,
11366 ],
11367 declarations: tslib.__spreadArray([], NB_USER_COMPONENTS),
11368 exports: tslib.__spreadArray([], NB_USER_COMPONENTS),
11369 },] }
11370 ];
11371 return NbUserModule;
11372}());
11373
11374/**
11375 * @license
11376 * Copyright Akveo. All Rights Reserved.
11377 * Licensed under the MIT License. See License.txt in the project root for license information.
11378 */
11379/**
11380 * Action item, display a link with an icon, or any other content provided instead.
11381 */
11382var NbActionComponent = /** @class */ (function () {
11383 function NbActionComponent() {
11384 /**
11385 * Optional title for mouseover
11386 * @type string
11387 */
11388 this.title = '';
11389 this._disabled = false;
11390 /**
11391 * Badge status (adds specific styles):
11392 * 'basic', 'primary', 'info', 'success', 'warning', 'danger', 'control'
11393 * @param {string} val
11394 */
11395 this.badgeStatus = 'basic';
11396 }
11397 Object.defineProperty(NbActionComponent.prototype, "disabled", {
11398 /**
11399 * Visually disables the item
11400 * @type boolean
11401 */
11402 get: function () {
11403 return this._disabled;
11404 },
11405 set: function (value) {
11406 this._disabled = convertToBoolProperty(value);
11407 },
11408 enumerable: false,
11409 configurable: true
11410 });
11411 Object.defineProperty(NbActionComponent.prototype, "badgeDot", {
11412 /**
11413 * Use badge dot mode
11414 * @type boolean
11415 */
11416 get: function () {
11417 return this._badgeDot;
11418 },
11419 set: function (value) {
11420 this._badgeDot = convertToBoolProperty(value);
11421 },
11422 enumerable: false,
11423 configurable: true
11424 });
11425 NbActionComponent.decorators = [
11426 { type: i0.Component, args: [{
11427 selector: 'nb-action',
11428 template: "\n <ng-container *ngIf=\"icon; else projectedContent\">\n <a class=\"icon-container\"\n [routerLink]=\"link\"\n [title]=\"title\"\n *ngIf=\"link\">\n <nb-icon [config]=\"icon\"></nb-icon>\n <ng-container [ngTemplateOutlet]=\"badgeTemplate\"></ng-container>\n </a>\n <a class=\"icon-container\"\n [href]=\"href\"\n [title]=\"title\"\n *ngIf=\"href && !link\">\n <nb-icon [config]=\"icon\"></nb-icon>\n <ng-container [ngTemplateOutlet]=\"badgeTemplate\"></ng-container>\n </a>\n <a class=\"icon-container\"\n href=\"#\"\n [title]=\"title\"\n *ngIf=\"!href && !link\"\n (click)=\"$event.preventDefault()\">\n <nb-icon [config]=\"icon\"></nb-icon>\n <ng-container [ngTemplateOutlet]=\"badgeTemplate\"></ng-container>\n </a>\n </ng-container>\n\n <ng-template #projectedContent>\n <ng-content></ng-content>\n <ng-container [ngTemplateOutlet]=\"badgeTemplate\"></ng-container>\n </ng-template>\n <ng-template #badgeTemplate>\n <nb-badge *ngIf=\"badgeText || badgeDot\"\n [text]=\"badgeText\"\n [dotMode]=\"badgeDot\"\n [status]=\"badgeStatus\"\n [position]=\"badgePosition\">\n </nb-badge>\n </ng-template>\n ",
11429 styles: [":host{background:transparent;display:flex;align-items:center;position:relative}:host(.disabled){cursor:not-allowed}:host(.disabled) a,:host(.disabled) nb-icon{cursor:not-allowed}:host-context(nb-actions.full-width){justify-content:center;width:100%}a.icon-container{position:relative}a.icon-container:hover,a.icon-container:focus{text-decoration:none}nb-icon:hover{cursor:pointer}\n"]
11430 },] }
11431 ];
11432 NbActionComponent.propDecorators = {
11433 link: [{ type: i0.Input }],
11434 href: [{ type: i0.Input }],
11435 title: [{ type: i0.Input }],
11436 icon: [{ type: i0.Input }],
11437 disabled: [{ type: i0.Input }, { type: i0.HostBinding, args: ['class.disabled',] }],
11438 badgeDot: [{ type: i0.Input }],
11439 badgeText: [{ type: i0.Input }],
11440 badgeStatus: [{ type: i0.Input }],
11441 badgePosition: [{ type: i0.Input }]
11442 };
11443 return NbActionComponent;
11444}());
11445/**
11446 * Shows a horizontal list of actions, available in multiple sizes.
11447 * Aligns items vertically.
11448 *
11449 * @stacked-example(Showcase, action/action-showcase.component)
11450 *
11451 * Basic actions setup:
11452 * ```html
11453 * <nb-actions size="small">
11454 * <nb-action icon="nb-search"></nb-action>
11455 * <nb-action icon="nb-power-circled"></nb-action>
11456 * <nb-action icon="nb-person"></nb-action>
11457 * </nb-actions>
11458 * ```
11459 * ### Installation
11460 *
11461 * Import `NbActionsModule` to your feature module.
11462 * ```ts
11463 * @NgModule({
11464 * imports: [
11465 * // ...
11466 * NbActionsModule,
11467 * ],
11468 * })
11469 * export class PageModule { }
11470 * ```
11471 * ### Usage
11472 *
11473 * Multiple sizes example:
11474 * @stacked-example(Multiple Sizes, action/action-sizes.component)
11475 *
11476 * It is also possible to specify a `badge` value:
11477 *
11478 * @stacked-example(Action Badge, action/action-badge.component)
11479 *
11480 * and we can set it to full a width of a parent component
11481 * @stacked-example(Full Width, action/action-width.component)
11482 *
11483 * Action dot mode
11484 * @stacked-example(Action badge in dot mode, action/action-dot-mode.component)
11485 *
11486 * @styles
11487 *
11488 * actions-background-color:
11489 * actions-divider-color:
11490 * actions-divider-style:
11491 * actions-divider-width:
11492 * actions-icon-color:
11493 * actions-text-color:
11494 * actions-text-font-family:
11495 * actions-text-font-weight:
11496 * actions-text-line-height:
11497 * actions-disabled-icon-color:
11498 * actions-disabled-text-color:
11499 * actions-tiny-height:
11500 * actions-tiny-icon-height:
11501 * actions-tiny-padding:
11502 * actions-tiny-text-font-size:
11503 * actions-small-height:
11504 * actions-small-icon-height:
11505 * actions-small-padding:
11506 * actions-small-text-font-size:
11507 * actions-medium-height:
11508 * actions-medium-icon-height:
11509 * actions-medium-padding:
11510 * actions-medium-text-font-size:
11511 * actions-large-height:
11512 * actions-large-icon-height:
11513 * actions-large-padding:
11514 * actions-large-text-font-size:
11515 * actions-giant-height:
11516 * actions-giant-icon-height:
11517 * actions-giant-padding:
11518 * actions-giant-text-font-size:
11519 */
11520var NbActionsComponent = /** @class */ (function () {
11521 function NbActionsComponent() {
11522 this._size = 'small';
11523 this._fullWidth = false;
11524 }
11525 Object.defineProperty(NbActionsComponent.prototype, "size", {
11526 /**
11527 * Size of the component: 'tiny', 'small' (default), 'medium', 'large', 'giant'
11528 */
11529 get: function () {
11530 return this._size;
11531 },
11532 set: function (value) {
11533 this._size = value;
11534 },
11535 enumerable: false,
11536 configurable: true
11537 });
11538 Object.defineProperty(NbActionsComponent.prototype, "fullWidth", {
11539 /**
11540 * Component will fill full width of the container
11541 */
11542 get: function () {
11543 return this._fullWidth;
11544 },
11545 set: function (value) {
11546 this._fullWidth = convertToBoolProperty(value);
11547 },
11548 enumerable: false,
11549 configurable: true
11550 });
11551 Object.defineProperty(NbActionsComponent.prototype, "tiny", {
11552 get: function () {
11553 return this.size === 'tiny';
11554 },
11555 enumerable: false,
11556 configurable: true
11557 });
11558 Object.defineProperty(NbActionsComponent.prototype, "small", {
11559 get: function () {
11560 return this.size === 'small';
11561 },
11562 enumerable: false,
11563 configurable: true
11564 });
11565 Object.defineProperty(NbActionsComponent.prototype, "medium", {
11566 get: function () {
11567 return this.size === 'medium';
11568 },
11569 enumerable: false,
11570 configurable: true
11571 });
11572 Object.defineProperty(NbActionsComponent.prototype, "large", {
11573 get: function () {
11574 return this.size === 'large';
11575 },
11576 enumerable: false,
11577 configurable: true
11578 });
11579 Object.defineProperty(NbActionsComponent.prototype, "giant", {
11580 get: function () {
11581 return this.size === 'giant';
11582 },
11583 enumerable: false,
11584 configurable: true
11585 });
11586 NbActionsComponent.decorators = [
11587 { type: i0.Component, args: [{
11588 selector: 'nb-actions',
11589 template: "\n <ng-content select=\"nb-action\"></ng-content>\n ",
11590 styles: [":host{display:flex;align-items:center}\n"]
11591 },] }
11592 ];
11593 NbActionsComponent.propDecorators = {
11594 size: [{ type: i0.Input }],
11595 fullWidth: [{ type: i0.Input }, { type: i0.HostBinding, args: ['class.full-width',] }],
11596 tiny: [{ type: i0.HostBinding, args: ['class.size-tiny',] }],
11597 small: [{ type: i0.HostBinding, args: ['class.size-small',] }],
11598 medium: [{ type: i0.HostBinding, args: ['class.size-medium',] }],
11599 large: [{ type: i0.HostBinding, args: ['class.size-large',] }],
11600 giant: [{ type: i0.HostBinding, args: ['class.size-giant',] }]
11601 };
11602 return NbActionsComponent;
11603}());
11604
11605/**
11606 * @license
11607 * Copyright Akveo. All Rights Reserved.
11608 * Licensed under the MIT License. See License.txt in the project root for license information.
11609 */
11610var NB_ACTIONS_COMPONENTS = [
11611 NbActionComponent,
11612 NbActionsComponent,
11613];
11614var NbActionsModule = /** @class */ (function () {
11615 function NbActionsModule() {
11616 }
11617 NbActionsModule.decorators = [
11618 { type: i0.NgModule, args: [{
11619 imports: [
11620 NbSharedModule,
11621 NbBadgeModule,
11622 NbIconModule,
11623 ],
11624 declarations: tslib.__spreadArray([], NB_ACTIONS_COMPONENTS),
11625 exports: tslib.__spreadArray([], NB_ACTIONS_COMPONENTS),
11626 },] }
11627 ];
11628 return NbActionsModule;
11629}());
11630
11631/**
11632 * @license
11633 * Copyright Akveo. All Rights Reserved.
11634 * Licensed under the MIT License. See License.txt in the project root for license information.
11635 */
11636/**
11637 * Search component service, connects your code to a page-level search component.
11638 */
11639var NbSearchService = /** @class */ (function () {
11640 function NbSearchService() {
11641 this.searchSubmittings$ = new rxjs.Subject();
11642 this.searchActivations$ = new rxjs.Subject();
11643 this.searchDeactivations$ = new rxjs.Subject();
11644 this.searchInput$ = new rxjs.Subject();
11645 }
11646 /***
11647 * Activate (open) search component
11648 * @param {string} searchType
11649 * @param {string} tag
11650 */
11651 NbSearchService.prototype.activateSearch = function (searchType, tag) {
11652 this.searchActivations$.next({ searchType: searchType, tag: tag });
11653 };
11654 /**
11655 * Deactibate (close) search component
11656 * @param {string} searchType
11657 * @param {string} tag
11658 */
11659 NbSearchService.prototype.deactivateSearch = function (searchType, tag) {
11660 this.searchDeactivations$.next({ searchType: searchType, tag: tag });
11661 };
11662 /**
11663 * Trigger search submit
11664 * @param {string} term
11665 * @param {string} tag
11666 */
11667 NbSearchService.prototype.submitSearch = function (term, tag) {
11668 this.searchSubmittings$.next({ term: term, tag: tag });
11669 };
11670 /**
11671 * Trigger search submit by input event
11672 * @param {string} term
11673 * @param {string} tag
11674 */
11675 NbSearchService.prototype.searchInput = function (term, tag) {
11676 this.searchInput$.next({ term: term, tag: tag });
11677 };
11678 /**
11679 * Subscribe to 'activate' event
11680 * @returns Observable<{searchType: string; tag?: string}>
11681 */
11682 NbSearchService.prototype.onSearchActivate = function () {
11683 return this.searchActivations$.pipe(rxjs_operators.share());
11684 };
11685 /**
11686 * Subscribe to 'deactivate' event
11687 * @returns Observable<{searchType: string; tag?: string}>
11688 */
11689 NbSearchService.prototype.onSearchDeactivate = function () {
11690 return this.searchDeactivations$.pipe(rxjs_operators.share());
11691 };
11692 /**
11693 * Subscribe to 'submit' event (when submit button clicked)
11694 * @returns Observable<{term: string; tag?: string}>
11695 */
11696 NbSearchService.prototype.onSearchSubmit = function () {
11697 return this.searchSubmittings$.pipe(rxjs_operators.share());
11698 };
11699 /**
11700 * Subscribe to input event
11701 * @returns Observable<{term: string; tag?: string}>
11702 */
11703 NbSearchService.prototype.onSearchInput = function () {
11704 return this.searchInput$.pipe(rxjs_operators.share());
11705 };
11706 NbSearchService.decorators = [
11707 { type: i0.Injectable }
11708 ];
11709 return NbSearchService;
11710}());
11711
11712/**
11713 * @license
11714 * Copyright Akveo. All Rights Reserved.
11715 * Licensed under the MIT License. See License.txt in the project root for license information.
11716 */
11717/**
11718 * search-field-component is used under the hood by nb-search component
11719 * can't be used itself
11720 */
11721var NbSearchFieldComponent = /** @class */ (function () {
11722 function NbSearchFieldComponent() {
11723 this.show = false;
11724 this.close = new i0.EventEmitter();
11725 this.search = new i0.EventEmitter();
11726 this.searchInput = new i0.EventEmitter();
11727 }
11728 Object.defineProperty(NbSearchFieldComponent.prototype, "showClass", {
11729 get: function () {
11730 return this.show;
11731 },
11732 enumerable: false,
11733 configurable: true
11734 });
11735 Object.defineProperty(NbSearchFieldComponent.prototype, "modalZoomin", {
11736 get: function () {
11737 return this.type === NbSearchFieldComponent.TYPE_MODAL_ZOOMIN;
11738 },
11739 enumerable: false,
11740 configurable: true
11741 });
11742 Object.defineProperty(NbSearchFieldComponent.prototype, "rotateLayout", {
11743 get: function () {
11744 return this.type === NbSearchFieldComponent.TYPE_ROTATE_LAYOUT;
11745 },
11746 enumerable: false,
11747 configurable: true
11748 });
11749 Object.defineProperty(NbSearchFieldComponent.prototype, "modalMove", {
11750 get: function () {
11751 return this.type === NbSearchFieldComponent.TYPE_MODAL_MOVE;
11752 },
11753 enumerable: false,
11754 configurable: true
11755 });
11756 Object.defineProperty(NbSearchFieldComponent.prototype, "curtain", {
11757 get: function () {
11758 return this.type === NbSearchFieldComponent.TYPE_CURTAIN;
11759 },
11760 enumerable: false,
11761 configurable: true
11762 });
11763 Object.defineProperty(NbSearchFieldComponent.prototype, "columnCurtain", {
11764 get: function () {
11765 return this.type === NbSearchFieldComponent.TYPE_COLUMN_CURTAIN;
11766 },
11767 enumerable: false,
11768 configurable: true
11769 });
11770 Object.defineProperty(NbSearchFieldComponent.prototype, "modalDrop", {
11771 get: function () {
11772 return this.type === NbSearchFieldComponent.TYPE_MODAL_DROP;
11773 },
11774 enumerable: false,
11775 configurable: true
11776 });
11777 Object.defineProperty(NbSearchFieldComponent.prototype, "modalHalf", {
11778 get: function () {
11779 return this.type === NbSearchFieldComponent.TYPE_MODAL_HALF;
11780 },
11781 enumerable: false,
11782 configurable: true
11783 });
11784 NbSearchFieldComponent.prototype.ngOnChanges = function (_a) {
11785 var show = _a.show;
11786 var becameHidden = !show.isFirstChange() && show.currentValue === false;
11787 if (becameHidden && this.inputElement) {
11788 this.inputElement.nativeElement.value = '';
11789 }
11790 this.focusInput();
11791 };
11792 NbSearchFieldComponent.prototype.ngAfterViewInit = function () {
11793 this.focusInput();
11794 };
11795 NbSearchFieldComponent.prototype.emitClose = function () {
11796 this.close.emit();
11797 };
11798 NbSearchFieldComponent.prototype.submitSearch = function (term) {
11799 if (term) {
11800 this.search.emit(term);
11801 }
11802 };
11803 NbSearchFieldComponent.prototype.emitSearchInput = function (term) {
11804 this.searchInput.emit(term);
11805 };
11806 NbSearchFieldComponent.prototype.focusInput = function () {
11807 if (this.show && this.inputElement) {
11808 this.inputElement.nativeElement.focus();
11809 }
11810 };
11811 NbSearchFieldComponent.TYPE_MODAL_ZOOMIN = 'modal-zoomin';
11812 NbSearchFieldComponent.TYPE_ROTATE_LAYOUT = 'rotate-layout';
11813 NbSearchFieldComponent.TYPE_MODAL_MOVE = 'modal-move';
11814 NbSearchFieldComponent.TYPE_CURTAIN = 'curtain';
11815 NbSearchFieldComponent.TYPE_COLUMN_CURTAIN = 'column-curtain';
11816 NbSearchFieldComponent.TYPE_MODAL_DROP = 'modal-drop';
11817 NbSearchFieldComponent.TYPE_MODAL_HALF = 'modal-half';
11818 NbSearchFieldComponent.decorators = [
11819 { type: i0.Component, args: [{
11820 selector: 'nb-search-field',
11821 changeDetection: i0.ChangeDetectionStrategy.OnPush,
11822 template: "\n <div class=\"search\" (keyup.esc)=\"emitClose()\">\n <button (click)=\"emitClose()\" nbButton ghost class=\"close-button\">\n <nb-icon icon=\"close-outline\" pack=\"nebular-essentials\"></nb-icon>\n </button>\n <div class=\"form-wrapper\">\n <form class=\"form\" (keyup.enter)=\"submitSearch(searchInput.value)\">\n <div class=\"form-content\">\n <input class=\"search-input\"\n #searchInput\n (input)=\"emitSearchInput(searchInput.value)\"\n autocomplete=\"off\"\n [attr.placeholder]=\"placeholder\"\n tabindex=\"-1\"\n (blur)=\"focusInput()\"/>\n </div>\n <span class=\"info\">{{ hint }}</span>\n </form>\n </div>\n </div>\n ",
11823 styles: [":host button{margin:0;padding:0;cursor:pointer;border:none;background:none}:host button:focus{box-shadow:none;outline:none}:host input{border-top:0;border-right:0;border-left:0;background:transparent;border-radius:0;line-height:1;display:inline-block;box-sizing:border-box;padding:0.05rem 0;-webkit-appearance:none}:host input:focus{outline:none}:host input::placeholder{opacity:0.3}:host span{font-size:90%;font-weight:bold;display:block;width:75%;margin:0 auto;padding:0.85rem 0;text-align:right}:host.modal-zoomin{display:block}:host.modal-zoomin .search{display:flex;flex-direction:column;justify-content:center;align-items:center;text-align:center;position:fixed;z-index:1050;top:0;left:0;width:100%;height:100vh;pointer-events:none;opacity:0;transition:opacity 0.5s}:host.modal-zoomin .search::before,:host.modal-zoomin .search::after{content:'';position:absolute;width:calc(100% + 15px);height:calc(100% + 15px);pointer-events:none}:host.modal-zoomin .search::before{top:0;left:0;border-right-width:0;border-bottom-width:0;transform:translate3d(-15px, -15px, 0)}:host.modal-zoomin .search::after{right:0;bottom:0;border-top-width:0;border-left-width:0;transform:translate3d(15px, 15px, 0)}:host.modal-zoomin .search button{position:absolute;top:3rem;font-size:2.5rem}[dir=ltr] :host.modal-zoomin .search button{right:3rem}[dir=rtl] :host.modal-zoomin .search button{left:3rem}:host.modal-zoomin .search input{font-size:10vw;width:75%}:host.modal-zoomin .search button{opacity:0;transform:scale3d(0.8, 0.8, 1);transition:opacity 0.5s, transform 0.5s}:host.modal-zoomin .search form{opacity:0;transform:scale3d(0.8, 0.8, 1);transition:opacity 0.5s, transform 0.5s}:host.modal-zoomin.show .search{pointer-events:auto;opacity:1}:host.modal-zoomin.show .search::before,:host.modal-zoomin.show .search::after{transform:translate3d(0, 0, 0);transition:transform 0.5s}:host.modal-zoomin.show .search button{opacity:1;transform:scale3d(1, 1, 1)}:host.modal-zoomin.show .search form{opacity:1;transform:scale3d(1, 1, 1)}@media screen and (max-width: 40rem){:host.modal-zoomin form{margin:5rem 0 1rem}:host.modal-zoomin span{text-align:left}}\n", "::ng-deep nb-layout.rotate-layout{position:fixed;overflow:hidden;width:100%}::ng-deep nb-layout.rotate-layout .scrollable-container{position:relative;z-index:10001;transition:transform 0.5s cubic-bezier(0.2, 1, 0.3, 1)}::ng-deep nb-layout.rotate-layout.with-search .scrollable-container{transition:transform 0.5s cubic-bezier(0.2, 1, 0.3, 1);transform-origin:50vw 50vh;transform:perspective(1000px) translate3d(0, 50vh, 0) rotate3d(1, 0, 0, 30deg);pointer-events:none}:host.rotate-layout{position:absolute;display:block;width:100vw;height:100vh;pointer-events:none;opacity:0;transition-property:opacity;transition-delay:0.4s}:host.rotate-layout .search{display:flex;flex-direction:column;justify-content:center;align-items:center;text-align:center;z-index:1050;position:fixed;top:0;left:0;width:100%;height:50vh;pointer-events:none;opacity:0;transition:opacity 0.5s;transition-timing-function:cubic-bezier(0.2, 1, 0.3, 1)}:host.rotate-layout .search button{position:absolute;top:3rem;font-size:2.5rem;opacity:0;transform:scale3d(0.8, 0.8, 1);transition:opacity 0.5s, transform 0.5s;transition-timing-function:cubic-bezier(0.2, 1, 0.3, 1)}[dir=ltr] :host.rotate-layout .search button{right:3rem}[dir=rtl] :host.rotate-layout .search button{left:3rem}:host.rotate-layout .search form{margin:5rem 0;opacity:0;transform:scale3d(0.7, 0.7, 1);transition:opacity 0.5s, transform 0.5s;transition-timing-function:cubic-bezier(0.2, 1, 0.3, 1)}:host.rotate-layout .search input{font-size:7vw;width:75%}:host.rotate-layout.show{opacity:1;transition-delay:0s}:host.rotate-layout.show .search{pointer-events:auto;opacity:1}:host.rotate-layout.show .search button{opacity:1;transform:scale3d(1, 1, 1)}:host.rotate-layout.show .search form{opacity:1;transform:scale3d(1, 1, 1)}\n", "::ng-deep nb-layout.modal-move .layout{transition:transform 0.5s}::ng-deep nb-layout.modal-move.with-search .layout{transform:scale3d(0.8, 0.8, 1);pointer-events:none}:host.modal-move .search{display:flex;flex-direction:column;justify-content:center;align-items:center;text-align:center;position:fixed;z-index:1050;top:0;left:0;width:100%;height:100vh;pointer-events:none;opacity:0;transition:opacity 0.5s}:host.modal-move .search button{position:absolute;top:3rem;font-size:2.5rem;opacity:0;transition:opacity 0.5s}[dir=ltr] :host.modal-move .search button{right:3rem}[dir=rtl] :host.modal-move .search button{left:3rem}:host.modal-move .search form{margin:5rem 0;opacity:0;transform:scale3d(0.8, 0.8, 1);transition:opacity 0.5s, transform 0.5s}:host.modal-move .search input{font-size:10vw;width:75%;transform:scale3d(0, 1, 1);transform-origin:0 50%;transition:transform 0.3s}:host.modal-move.show .search{pointer-events:auto;opacity:1}:host.modal-move.show .search button{opacity:1}:host.modal-move.show .search form{opacity:1;transform:scale3d(1, 1, 1)}:host.modal-move.show .search input{transform:scale3d(1, 1, 1);transition-duration:0.5s}@media screen and (max-width: 40rem){:host.modal-move span{text-align:left}}\n", ":host.curtain .search{position:fixed;z-index:1050;top:0;left:100%;overflow:hidden;height:100vh;width:100%;padding:3rem;pointer-events:none;transition:transform 0.3s;transition-delay:0.4s;transition-timing-function:ease-out}:host.curtain .search::after{content:'';position:absolute;top:0;left:0;width:100%;height:100%;transition:transform 0.3s;transition-timing-function:ease-out}:host.curtain .search button{font-size:2.5rem;position:absolute;top:3rem;transition:opacity 0.1s;transition-delay:0.3s}[dir=ltr] :host.curtain .search button{right:3rem}[dir=rtl] :host.curtain .search button{left:3rem}:host.curtain .search form{width:50%;opacity:0;transform:scale3d(0.8, 0.8, 1);transition:opacity 0.5s, transform 0.5s}:host.curtain .search input{width:100%;font-size:6vw}:host.curtain.show .search{width:100%;pointer-events:auto;transform:translate3d(-100%, 0, 0);transition-delay:0s}:host.curtain.show .search::after{transform:translate3d(100%, 0, 0);transition-delay:0.4s}:host.curtain.show .search button{opacity:1;transform:scale3d(1, 1, 1)}:host.curtain.show .search form{opacity:1;transform:scale3d(1, 1, 1)}@media screen and (max-width: 40em){:host.curtain span{width:90%}:host.curtain input{font-size:2em;width:90%}}::ng-deep nb-layout.curtain .scrollable-container{position:relative;z-index:0}\n", "::ng-deep nb-layout.column-curtain.with-search .layout{pointer-events:none}:host.column-curtain{display:block;position:fixed;z-index:1050;top:0;left:50%;overflow:hidden;width:50%;height:100vh;pointer-events:none}:host.column-curtain::before{content:'';position:absolute;top:0;left:0;width:100%;height:100%;transform:scale3d(0, 1, 1);transform-origin:0 50%;transition:transform 0.3s;transition-timing-function:cubic-bezier(0.86, 0, 0.07, 1)}:host.column-curtain .search{position:relative;padding:2.5rem 1.5rem 0;background:transparent}:host.column-curtain .search button{position:absolute;top:2rem;font-size:2.5rem;opacity:0;transition:opacity 0.5s}[dir=ltr] :host.column-curtain .search button{right:2rem}[dir=rtl] :host.column-curtain .search button{left:2rem}:host.column-curtain .search form{width:85%;transform:translate3d(-150%, 0, 0);transition:transform 0.3s}:host.column-curtain .search input{font-size:2.5rem;width:100%}:host.column-curtain .search span{font-size:85%}:host.column-curtain.show{pointer-events:auto}:host.column-curtain.show::before{transform:scale3d(1, 1, 1)}:host.column-curtain.show .search form{transform:translate3d(0, 0, 0);transition-delay:0.15s;transition-timing-function:cubic-bezier(0.86, 0, 0.07, 1)}:host.column-curtain.show .search button{opacity:1;z-index:100}@media screen and (max-width: 40rem){:host.column-curtain span{width:90%}:host.column-curtain input{font-size:2rem;width:90%}}\n", "::ng-deep nb-layout.modal-drop .layout{position:relative;transition:transform 0.4s, opacity 0.4s;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1)}::ng-deep nb-layout.modal-drop.with-search .layout{opacity:0;transform:scale3d(0.9, 0.9, 1);pointer-events:none}:host.modal-drop .search{display:flex;flex-direction:column;justify-content:center;align-items:center;text-align:center;z-index:1050;position:fixed;top:0;left:0;width:100%;height:100vh;background:none;pointer-events:none}:host.modal-drop .search::before{content:'';position:absolute;top:0;right:0;width:100%;height:100%;opacity:0;transition:opacity 0.4s}:host.modal-drop .search button{font-size:2.5rem;position:absolute;top:3rem;display:block;opacity:0;transition:opacity 0.4s}[dir=ltr] :host.modal-drop .search button{right:3rem}[dir=rtl] :host.modal-drop .search button{left:3rem}:host.modal-drop .search form{position:relative;margin:5rem 0 2rem}:host.modal-drop .search input{font-size:6vw;width:60%;padding:0.25rem;text-align:center;opacity:0;transition:opacity 0.4s}:host.modal-drop .search span{position:relative;z-index:9;display:block;width:60%;padding:0.85rem 0;opacity:0;transform:translate3d(0, -50px, 0);transition:opacity 0.4s, transform 0.4s}:host.modal-drop .search .form-content{position:relative;z-index:10;overflow:hidden;transform:translate3d(0, -50px, 0);transition:transform 0.4s}:host.modal-drop .search .form-content::after{content:'';position:absolute;top:0;left:20%;width:60%;height:105%;opacity:0;transform-origin:50% 0}:host.modal-drop.show .search{pointer-events:auto}:host.modal-drop.show .search::before{opacity:1}:host.modal-drop.show .search button{opacity:1}:host.modal-drop.show .search .form-content{transform:translate3d(0, 0, 0);transition:none}:host.modal-drop.show .search .form-content::after{animation:scaleUpDown 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards}:host.modal-drop.show .search input{opacity:1;transition:opacity 0s 0.4s}:host.modal-drop.show .search span{opacity:1;transform:translate3d(0, 0, 0);transition-delay:0.4s;transition-timing-function:ease-out}@keyframes scaleUpDown{0%{opacity:1;transform:scale3d(1, 0, 1)}50%{transform:scale3d(1, 1, 1);transform-origin:50% 0;transition-timing-function:ease-out}50.1%{transform-origin:50% 100%;transition-timing-function:ease-out}100%{opacity:1;transform:scale3d(1, 0, 1);transform-origin:50% 100%;transition-timing-function:ease-out}}@media screen and (max-width: 40rem){:host.modal-drop form{margin:2rem 0}:host.modal-drop input{width:100%;left:0}}\n", "::ng-deep nb-layout.modal-half .layout{transition:transform 0.6s, opacity 0.6s;transition-timing-function:cubic-bezier(0.2, 1, 0.3, 1)}::ng-deep nb-layout.modal-half.with-search .layout{transform:scale3d(0.8, 0.8, 1);pointer-events:none}:host.modal-half .search{text-align:center;position:fixed;z-index:1050;top:0;left:0;overflow:hidden;width:100%;height:100vh;background:none;pointer-events:none}:host.modal-half .search::before{content:'';position:absolute;top:0;left:0;width:100%;height:100%;pointer-events:none;opacity:0;transition:opacity 0.6s;transition-timing-function:cubic-bezier(0.2, 1, 0.3, 1)}:host.modal-half .search button{font-size:2.5rem;position:absolute;top:3rem;display:block;z-index:100;opacity:0;transform:scale3d(0.8, 0.8, 1);transition:opacity 0.6s, transform 0.6s;transition-timing-function:cubic-bezier(0.2, 1, 0.3, 1)}[dir=ltr] :host.modal-half .search button{right:3rem}[dir=rtl] :host.modal-half .search button{left:3rem}:host.modal-half .search .form-wrapper{position:absolute;display:flex;justify-content:center;align-items:center;width:100%;height:50%;transition:transform 0.6s;transition-timing-function:cubic-bezier(0.2, 1, 0.3, 1);transform:translate3d(0, -100%, 0)}:host.modal-half .search form{width:75%;margin:0 auto}:host.modal-half .search input{font-size:7vw;width:100%}:host.modal-half.show .search{pointer-events:auto}:host.modal-half.show .search::before{opacity:1}:host.modal-half.show .search button{opacity:1;transform:scale3d(1, 1, 1)}:host.modal-half.show .search .form-wrapper{transform:translate3d(0, 0, 0)}\n"]
11824 },] }
11825 ];
11826 NbSearchFieldComponent.propDecorators = {
11827 type: [{ type: i0.Input }],
11828 placeholder: [{ type: i0.Input }],
11829 hint: [{ type: i0.Input }],
11830 show: [{ type: i0.Input }],
11831 close: [{ type: i0.Output }],
11832 search: [{ type: i0.Output }],
11833 searchInput: [{ type: i0.Output }],
11834 inputElement: [{ type: i0.ViewChild, args: ['searchInput',] }],
11835 showClass: [{ type: i0.HostBinding, args: ['class.show',] }],
11836 modalZoomin: [{ type: i0.HostBinding, args: ['class.modal-zoomin',] }],
11837 rotateLayout: [{ type: i0.HostBinding, args: ['class.rotate-layout',] }],
11838 modalMove: [{ type: i0.HostBinding, args: ['class.modal-move',] }],
11839 curtain: [{ type: i0.HostBinding, args: ['class.curtain',] }],
11840 columnCurtain: [{ type: i0.HostBinding, args: ['class.column-curtain',] }],
11841 modalDrop: [{ type: i0.HostBinding, args: ['class.modal-drop',] }],
11842 modalHalf: [{ type: i0.HostBinding, args: ['class.modal-half',] }]
11843 };
11844 return NbSearchFieldComponent;
11845}());
11846/**
11847 * Beautiful full-page search control.
11848 *
11849 * @stacked-example(Showcase, search/search-showcase.component)
11850 *
11851 * Basic setup:
11852 *
11853 * ```ts
11854 * <nb-search type="rotate-layout"></nb-search>
11855 * ```
11856 * ### Installation
11857 *
11858 * Import `NbSearchModule` to your feature module.
11859 * ```ts
11860 * @NgModule({
11861 * imports: [
11862 * // ...
11863 * NbSearchModule,
11864 * ],
11865 * })
11866 * export class PageModule { }
11867 * ```
11868 * ### Usage
11869 *
11870 * Several animation types are available:
11871 * modal-zoomin, rotate-layout, modal-move, curtain, column-curtain, modal-drop, modal-half
11872 *
11873 * It is also possible to handle search event using `NbSearchService`:
11874 *
11875 * @stacked-example(Search Event, search/search-event.component)
11876 *
11877 * @styles
11878 *
11879 * search-background-color:
11880 * search-divider-color:
11881 * search-divider-style:
11882 * search-divider-width:
11883 * search-extra-background-color:
11884 * search-text-color:
11885 * search-text-font-family:
11886 * search-text-font-size:
11887 * search-text-font-weight:
11888 * search-text-line-height:
11889 * search-placeholder-text-color:
11890 * search-info-text-color:
11891 * search-info-text-font-family:
11892 * search-info-text-font-size:
11893 * search-info-text-font-weight:
11894 * search-info-text-line-height:
11895 */
11896var NbSearchComponent = /** @class */ (function () {
11897 function NbSearchComponent(searchService, themeService, router, overlayService, changeDetector) {
11898 this.searchService = searchService;
11899 this.themeService = themeService;
11900 this.router = router;
11901 this.overlayService = overlayService;
11902 this.changeDetector = changeDetector;
11903 this.destroy$ = new rxjs.Subject();
11904 this.showSearchField = false;
11905 /**
11906 * Search input placeholder
11907 * @type {string}
11908 */
11909 this.placeholder = 'Search...';
11910 /**
11911 * Hint showing under the input field to improve user experience
11912 *
11913 * @type {string}
11914 */
11915 this.hint = 'Hit enter to search';
11916 }
11917 NbSearchComponent.prototype.ngOnInit = function () {
11918 var _this = this;
11919 this.router.events
11920 .pipe(rxjs_operators.filter(function (event) { return event instanceof _angular_router.NavigationEnd; }), rxjs_operators.takeUntil(this.destroy$))
11921 .subscribe(function () { return _this.hideSearch(); });
11922 this.searchService.onSearchActivate()
11923 .pipe(rxjs_operators.filter(function (data) { return !_this.tag || data.tag === _this.tag; }), rxjs_operators.takeUntil(this.destroy$))
11924 .subscribe(function () { return _this.openSearch(); });
11925 this.searchService.onSearchDeactivate()
11926 .pipe(rxjs_operators.filter(function (data) { return !_this.tag || data.tag === _this.tag; }), rxjs_operators.takeUntil(this.destroy$))
11927 .subscribe(function () { return _this.hideSearch(); });
11928 };
11929 NbSearchComponent.prototype.ngOnDestroy = function () {
11930 if (this.overlayRef && this.overlayRef.hasAttached()) {
11931 this.removeLayoutClasses();
11932 this.overlayRef.detach();
11933 }
11934 this.destroy$.next();
11935 this.destroy$.complete();
11936 };
11937 NbSearchComponent.prototype.openSearch = function () {
11938 var _this = this;
11939 if (!this.overlayRef) {
11940 this.overlayRef = this.overlayService.create();
11941 this.overlayRef.attach(this.searchFieldPortal);
11942 }
11943 this.themeService.appendLayoutClass(this.type);
11944 rxjs.of(null).pipe(rxjs_operators.delay(0)).subscribe(function () {
11945 _this.themeService.appendLayoutClass('with-search');
11946 _this.showSearchField = true;
11947 _this.changeDetector.detectChanges();
11948 });
11949 };
11950 NbSearchComponent.prototype.hideSearch = function () {
11951 this.removeLayoutClasses();
11952 this.showSearchField = false;
11953 this.changeDetector.detectChanges();
11954 this.searchButton.nativeElement.focus();
11955 };
11956 NbSearchComponent.prototype.search = function (term) {
11957 this.searchService.submitSearch(term, this.tag);
11958 this.hideSearch();
11959 };
11960 NbSearchComponent.prototype.emitInput = function (term) {
11961 this.searchService.searchInput(term, this.tag);
11962 };
11963 NbSearchComponent.prototype.emitActivate = function () {
11964 this.searchService.activateSearch(this.type, this.tag);
11965 };
11966 NbSearchComponent.prototype.emitDeactivate = function () {
11967 this.searchService.deactivateSearch(this.type, this.tag);
11968 };
11969 NbSearchComponent.prototype.removeLayoutClasses = function () {
11970 var _this = this;
11971 this.themeService.removeLayoutClass('with-search');
11972 rxjs.of(null).pipe(rxjs_operators.delay(500)).subscribe(function () {
11973 _this.themeService.removeLayoutClass(_this.type);
11974 });
11975 };
11976 NbSearchComponent.decorators = [
11977 { type: i0.Component, args: [{
11978 selector: 'nb-search',
11979 changeDetection: i0.ChangeDetectionStrategy.OnPush,
11980 template: "\n <button #searchButton class=\"start-search\" (click)=\"emitActivate()\" nbButton ghost>\n <nb-icon icon=\"search-outline\" pack=\"nebular-essentials\"></nb-icon>\n </button>\n <nb-search-field\n *nbPortal\n [show]=\"showSearchField\"\n [type]=\"type\"\n [placeholder]=\"placeholder\"\n [hint]=\"hint\"\n (search)=\"search($event)\"\n (searchInput)=\"emitInput($event)\"\n (close)=\"emitDeactivate()\">\n </nb-search-field>\n ",
11981 styles: [":host button{font-size:2rem;margin:0 auto;padding:0;cursor:pointer;border:none;background:none}:host button:focus{box-shadow:none;outline:none}::ng-deep nb-layout.with-search .scrollable-container{position:relative;z-index:0}\n"]
11982 },] }
11983 ];
11984 NbSearchComponent.ctorParameters = function () { return [
11985 { type: NbSearchService },
11986 { type: NbThemeService },
11987 { type: _angular_router.Router },
11988 { type: NbOverlayService },
11989 { type: i0.ChangeDetectorRef }
11990 ]; };
11991 NbSearchComponent.propDecorators = {
11992 tag: [{ type: i0.Input }],
11993 placeholder: [{ type: i0.Input }],
11994 hint: [{ type: i0.Input }],
11995 type: [{ type: i0.Input }],
11996 searchFieldPortal: [{ type: i0.ViewChild, args: [NbPortalDirective,] }],
11997 searchButton: [{ type: i0.ViewChild, args: ['searchButton', { read: i0.ElementRef },] }]
11998 };
11999 return NbSearchComponent;
12000}());
12001
12002/**
12003 * @license
12004 * Copyright Akveo. All Rights Reserved.
12005 * Licensed under the MIT License. See License.txt in the project root for license information.
12006 */
12007var NbSearchModule = /** @class */ (function () {
12008 function NbSearchModule() {
12009 }
12010 NbSearchModule.decorators = [
12011 { type: i0.NgModule, args: [{
12012 imports: [
12013 NbSharedModule,
12014 NbOverlayModule,
12015 NbIconModule,
12016 NbButtonModule,
12017 ],
12018 declarations: [
12019 NbSearchComponent,
12020 NbSearchFieldComponent,
12021 ],
12022 exports: [
12023 NbSearchComponent,
12024 NbSearchFieldComponent,
12025 ],
12026 providers: [
12027 NbSearchService,
12028 ],
12029 entryComponents: [
12030 NbSearchFieldComponent,
12031 ],
12032 },] }
12033 ];
12034 return NbSearchModule;
12035}());
12036
12037/**
12038 * @license
12039 * Copyright Akveo. All Rights Reserved.
12040 * Licensed under the MIT License. See License.txt in the project root for license information.
12041 */
12042/**
12043 * Styled checkbox component
12044 *
12045 * @stacked-example(Showcase, checkbox/checkbox-showcase.component)
12046 *
12047 * ### Installation
12048 *
12049 * Import `NbCheckboxComponent` to your feature module.
12050 * ```ts
12051 * @NgModule({
12052 * imports: [
12053 * // ...
12054 * NbCheckboxModule,
12055 * ],
12056 * })
12057 * export class PageModule { }
12058 * ```
12059 * ### Usage
12060 *
12061 * Checkbox is available in multiple colors using `status` property:
12062 * @stacked-example(Colored Checkboxes, checkbox/checkbox-status.component)
12063 *
12064 * Indeterminate state is also supported:
12065 * @stacked-example(Indeterminate Checkbox, checkbox/checkbox-indeterminate.component)
12066 *
12067 * Checkbox can be disabled via `disabled` attribute.
12068 * @stacked-example(Disabled Checkbox, checkbox/checkbox-disabled.component)
12069 *
12070 * @styles
12071 *
12072 * checkbox-height:
12073 * checkbox-width:
12074 * checkbox-border-style:
12075 * checkbox-border-width:
12076 * checkbox-border-radius:
12077 * checkbox-outline-width:
12078 * checkbox-outline-color:
12079 * checkbox-text-font-family:
12080 * checkbox-text-font-size:
12081 * checkbox-text-font-weight:
12082 * checkbox-text-line-height:
12083 * checkbox-text-space:
12084 * checkbox-padding:
12085 * checkbox-focus-inset-shadow-length:
12086 * checkbox-basic-text-color:
12087 * checkbox-basic-background-color:
12088 * checkbox-basic-border-color:
12089 * checkbox-basic-checked-background-color:
12090 * checkbox-basic-checked-border-color:
12091 * checkbox-basic-checked-checkmark-color:
12092 * checkbox-basic-indeterminate-background-color:
12093 * checkbox-basic-indeterminate-border-color:
12094 * checkbox-basic-indeterminate-checkmark-color:
12095 * checkbox-basic-focus-background-color:
12096 * checkbox-basic-focus-border-color:
12097 * checkbox-basic-focus-checked-background-color:
12098 * checkbox-basic-focus-checked-border-color:
12099 * checkbox-basic-hover-background-color:
12100 * checkbox-basic-hover-border-color:
12101 * checkbox-basic-hover-checked-background-color:
12102 * checkbox-basic-hover-checked-border-color:
12103 * checkbox-basic-active-background-color:
12104 * checkbox-basic-active-border-color:
12105 * checkbox-basic-active-checked-background-color:
12106 * checkbox-basic-active-checked-border-color:
12107 * checkbox-basic-disabled-background-color:
12108 * checkbox-basic-disabled-border-color:
12109 * checkbox-basic-disabled-checkmark-color:
12110 * checkbox-basic-disabled-text-color:
12111 * checkbox-basic-disabled-checked-background-color:
12112 * checkbox-primary-text-color:
12113 * checkbox-primary-background-color:
12114 * checkbox-primary-border-color:
12115 * checkbox-primary-checked-background-color:
12116 * checkbox-primary-checked-border-color:
12117 * checkbox-primary-checked-checkmark-color:
12118 * checkbox-primary-indeterminate-background-color:
12119 * checkbox-primary-indeterminate-border-color:
12120 * checkbox-primary-indeterminate-checkmark-color:
12121 * checkbox-primary-focus-background-color:
12122 * checkbox-primary-focus-border-color:
12123 * checkbox-primary-focus-checked-background-color:
12124 * checkbox-primary-focus-checked-border-color:
12125 * checkbox-primary-hover-background-color:
12126 * checkbox-primary-hover-border-color:
12127 * checkbox-primary-hover-checked-background-color:
12128 * checkbox-primary-hover-checked-border-color:
12129 * checkbox-primary-active-background-color:
12130 * checkbox-primary-active-border-color:
12131 * checkbox-primary-active-checked-background-color:
12132 * checkbox-primary-active-checked-border-color:
12133 * checkbox-primary-disabled-background-color:
12134 * checkbox-primary-disabled-border-color:
12135 * checkbox-primary-disabled-checkmark-color:
12136 * checkbox-primary-disabled-text-color:
12137 * checkbox-primary-disabled-checked-background-color:
12138 * checkbox-success-text-color:
12139 * checkbox-success-background-color:
12140 * checkbox-success-border-color:
12141 * checkbox-success-checked-background-color:
12142 * checkbox-success-checked-border-color:
12143 * checkbox-success-checked-checkmark-color:
12144 * checkbox-success-indeterminate-background-color:
12145 * checkbox-success-indeterminate-border-color:
12146 * checkbox-success-indeterminate-checkmark-color:
12147 * checkbox-success-focus-background-color:
12148 * checkbox-success-focus-border-color:
12149 * checkbox-success-focus-checked-background-color:
12150 * checkbox-success-focus-checked-border-color:
12151 * checkbox-success-hover-background-color:
12152 * checkbox-success-hover-border-color:
12153 * checkbox-success-hover-checked-background-color:
12154 * checkbox-success-hover-checked-border-color:
12155 * checkbox-success-active-background-color:
12156 * checkbox-success-active-border-color:
12157 * checkbox-success-active-checked-background-color:
12158 * checkbox-success-active-checked-border-color:
12159 * checkbox-success-disabled-background-color:
12160 * checkbox-success-disabled-border-color:
12161 * checkbox-success-disabled-checkmark-color:
12162 * checkbox-success-disabled-text-color:
12163 * checkbox-success-disabled-checked-background-color:
12164 * checkbox-info-text-color:
12165 * checkbox-info-background-color:
12166 * checkbox-info-border-color:
12167 * checkbox-info-checked-background-color:
12168 * checkbox-info-checked-border-color:
12169 * checkbox-info-checked-checkmark-color:
12170 * checkbox-info-indeterminate-background-color:
12171 * checkbox-info-indeterminate-border-color:
12172 * checkbox-info-indeterminate-checkmark-color:
12173 * checkbox-info-focus-background-color:
12174 * checkbox-info-focus-border-color:
12175 * checkbox-info-focus-checked-background-color:
12176 * checkbox-info-focus-checked-border-color:
12177 * checkbox-info-hover-background-color:
12178 * checkbox-info-hover-border-color:
12179 * checkbox-info-hover-checked-background-color:
12180 * checkbox-info-hover-checked-border-color:
12181 * checkbox-info-active-background-color:
12182 * checkbox-info-active-border-color:
12183 * checkbox-info-active-checked-background-color:
12184 * checkbox-info-active-checked-border-color:
12185 * checkbox-info-disabled-background-color:
12186 * checkbox-info-disabled-border-color:
12187 * checkbox-info-disabled-checkmark-color:
12188 * checkbox-info-disabled-text-color:
12189 * checkbox-info-disabled-checked-background-color:
12190 * checkbox-warning-text-color:
12191 * checkbox-warning-background-color:
12192 * checkbox-warning-border-color:
12193 * checkbox-warning-checked-background-color:
12194 * checkbox-warning-checked-border-color:
12195 * checkbox-warning-checked-checkmark-color:
12196 * checkbox-warning-indeterminate-background-color:
12197 * checkbox-warning-indeterminate-border-color:
12198 * checkbox-warning-indeterminate-checkmark-color:
12199 * checkbox-warning-focus-background-color:
12200 * checkbox-warning-focus-border-color:
12201 * checkbox-warning-focus-checked-background-color:
12202 * checkbox-warning-focus-checked-border-color:
12203 * checkbox-warning-hover-background-color:
12204 * checkbox-warning-hover-border-color:
12205 * checkbox-warning-hover-checked-background-color:
12206 * checkbox-warning-hover-checked-border-color:
12207 * checkbox-warning-active-background-color:
12208 * checkbox-warning-active-border-color:
12209 * checkbox-warning-active-checked-background-color:
12210 * checkbox-warning-active-checked-border-color:
12211 * checkbox-warning-disabled-background-color:
12212 * checkbox-warning-disabled-border-color:
12213 * checkbox-warning-disabled-checkmark-color:
12214 * checkbox-warning-disabled-text-color:
12215 * checkbox-warning-disabled-checked-background-color:
12216 * checkbox-danger-text-color:
12217 * checkbox-danger-background-color:
12218 * checkbox-danger-border-color:
12219 * checkbox-danger-checked-background-color:
12220 * checkbox-danger-checked-border-color:
12221 * checkbox-danger-checked-checkmark-color:
12222 * checkbox-danger-indeterminate-background-color:
12223 * checkbox-danger-indeterminate-border-color:
12224 * checkbox-danger-indeterminate-checkmark-color:
12225 * checkbox-danger-focus-background-color:
12226 * checkbox-danger-focus-border-color:
12227 * checkbox-danger-focus-checked-background-color:
12228 * checkbox-danger-focus-checked-border-color:
12229 * checkbox-danger-hover-background-color:
12230 * checkbox-danger-hover-border-color:
12231 * checkbox-danger-hover-checked-background-color:
12232 * checkbox-danger-hover-checked-border-color:
12233 * checkbox-danger-active-background-color:
12234 * checkbox-danger-active-border-color:
12235 * checkbox-danger-active-checked-background-color:
12236 * checkbox-danger-active-checked-border-color:
12237 * checkbox-danger-disabled-background-color:
12238 * checkbox-danger-disabled-border-color:
12239 * checkbox-danger-disabled-checkmark-color:
12240 * checkbox-danger-disabled-text-color:
12241 * checkbox-danger-disabled-checked-background-color:
12242 * checkbox-control-text-color:
12243 * checkbox-control-background-color:
12244 * checkbox-control-border-color:
12245 * checkbox-control-checked-background-color:
12246 * checkbox-control-checked-border-color:
12247 * checkbox-control-checked-checkmark-color:
12248 * checkbox-control-indeterminate-background-color:
12249 * checkbox-control-indeterminate-border-color:
12250 * checkbox-control-indeterminate-checkmark-color:
12251 * checkbox-control-focus-background-color:
12252 * checkbox-control-focus-border-color:
12253 * checkbox-control-focus-checked-background-color:
12254 * checkbox-control-focus-checked-border-color:
12255 * checkbox-control-hover-background-color:
12256 * checkbox-control-hover-border-color:
12257 * checkbox-control-hover-checked-background-color:
12258 * checkbox-control-hover-checked-border-color:
12259 * checkbox-control-active-background-color:
12260 * checkbox-control-active-border-color:
12261 * checkbox-control-active-checked-background-color:
12262 * checkbox-control-active-checked-border-color:
12263 * checkbox-control-disabled-background-color:
12264 * checkbox-control-disabled-border-color:
12265 * checkbox-control-disabled-checkmark-color:
12266 * checkbox-control-disabled-text-color:
12267 * checkbox-control-disabled-checked-background-color:
12268 */
12269var NbCheckboxComponent = /** @class */ (function () {
12270 function NbCheckboxComponent(changeDetector, renderer, hostElement, zone, statusService) {
12271 this.changeDetector = changeDetector;
12272 this.renderer = renderer;
12273 this.hostElement = hostElement;
12274 this.zone = zone;
12275 this.statusService = statusService;
12276 this.onChange = function () { };
12277 this.onTouched = function () { };
12278 this._checked = false;
12279 this._disabled = false;
12280 /**
12281 * Checkbox status.
12282 * Possible values are: `basic`, `primary`, `success`, `warning`, `danger`, `info`, `control`.
12283 */
12284 this.status = 'basic';
12285 this._indeterminate = false;
12286 /**
12287 * Output when checked state is changed by a user
12288 * @type EventEmitter<boolean>
12289 */
12290 this.checkedChange = new i0.EventEmitter();
12291 }
12292 Object.defineProperty(NbCheckboxComponent.prototype, "checked", {
12293 get: function () {
12294 return this._checked;
12295 },
12296 set: function (value) {
12297 this._checked = convertToBoolProperty(value);
12298 },
12299 enumerable: false,
12300 configurable: true
12301 });
12302 Object.defineProperty(NbCheckboxComponent.prototype, "disabled", {
12303 /**
12304 * Controls input disabled state
12305 */
12306 get: function () {
12307 return this._disabled;
12308 },
12309 set: function (value) {
12310 this._disabled = convertToBoolProperty(value);
12311 },
12312 enumerable: false,
12313 configurable: true
12314 });
12315 Object.defineProperty(NbCheckboxComponent.prototype, "indeterminate", {
12316 /**
12317 * Controls checkbox indeterminate state
12318 */
12319 get: function () {
12320 return this._indeterminate;
12321 },
12322 set: function (value) {
12323 this._indeterminate = convertToBoolProperty(value);
12324 },
12325 enumerable: false,
12326 configurable: true
12327 });
12328 Object.defineProperty(NbCheckboxComponent.prototype, "primary", {
12329 get: function () {
12330 return this.status === 'primary';
12331 },
12332 enumerable: false,
12333 configurable: true
12334 });
12335 Object.defineProperty(NbCheckboxComponent.prototype, "success", {
12336 get: function () {
12337 return this.status === 'success';
12338 },
12339 enumerable: false,
12340 configurable: true
12341 });
12342 Object.defineProperty(NbCheckboxComponent.prototype, "warning", {
12343 get: function () {
12344 return this.status === 'warning';
12345 },
12346 enumerable: false,
12347 configurable: true
12348 });
12349 Object.defineProperty(NbCheckboxComponent.prototype, "danger", {
12350 get: function () {
12351 return this.status === 'danger';
12352 },
12353 enumerable: false,
12354 configurable: true
12355 });
12356 Object.defineProperty(NbCheckboxComponent.prototype, "info", {
12357 get: function () {
12358 return this.status === 'info';
12359 },
12360 enumerable: false,
12361 configurable: true
12362 });
12363 Object.defineProperty(NbCheckboxComponent.prototype, "basic", {
12364 get: function () {
12365 return this.status === 'basic';
12366 },
12367 enumerable: false,
12368 configurable: true
12369 });
12370 Object.defineProperty(NbCheckboxComponent.prototype, "control", {
12371 get: function () {
12372 return this.status === 'control';
12373 },
12374 enumerable: false,
12375 configurable: true
12376 });
12377 Object.defineProperty(NbCheckboxComponent.prototype, "additionalClasses", {
12378 get: function () {
12379 if (this.statusService.isCustomStatus(this.status)) {
12380 return [this.statusService.getStatusClass(this.status)];
12381 }
12382 return [];
12383 },
12384 enumerable: false,
12385 configurable: true
12386 });
12387 NbCheckboxComponent.prototype.ngAfterViewInit = function () {
12388 var _this = this;
12389 // TODO: #2254
12390 this.zone.runOutsideAngular(function () { return setTimeout(function () {
12391 _this.renderer.addClass(_this.hostElement.nativeElement, 'nb-transition');
12392 }); });
12393 };
12394 NbCheckboxComponent.prototype.registerOnChange = function (fn) {
12395 this.onChange = fn;
12396 };
12397 NbCheckboxComponent.prototype.registerOnTouched = function (fn) {
12398 this.onTouched = fn;
12399 };
12400 NbCheckboxComponent.prototype.writeValue = function (val) {
12401 this._checked = val;
12402 this.changeDetector.markForCheck();
12403 };
12404 NbCheckboxComponent.prototype.setDisabledState = function (val) {
12405 this.disabled = convertToBoolProperty(val);
12406 this.changeDetector.markForCheck();
12407 };
12408 NbCheckboxComponent.prototype.setTouched = function () {
12409 this.onTouched();
12410 };
12411 NbCheckboxComponent.prototype.updateValueAndIndeterminate = function (event) {
12412 var input = event.target;
12413 this.checked = input.checked;
12414 this.checkedChange.emit(this.checked);
12415 this.onChange(this.checked);
12416 this.indeterminate = input.indeterminate;
12417 };
12418 NbCheckboxComponent.decorators = [
12419 { type: i0.Component, args: [{
12420 selector: 'nb-checkbox',
12421 template: "\n <label class=\"label\">\n <input type=\"checkbox\" class=\"native-input visually-hidden\"\n [disabled]=\"disabled\"\n [checked]=\"checked\"\n (change)=\"updateValueAndIndeterminate($event)\"\n (blur)=\"setTouched()\"\n (click)=\"$event.stopPropagation()\"\n [indeterminate]=\"indeterminate\">\n <span [class.indeterminate]=\"indeterminate\" [class.checked]=\"checked\" class=\"custom-checkbox\">\n <nb-icon *ngIf=\"indeterminate\" icon=\"minus-bold-outline\" pack=\"nebular-essentials\"></nb-icon>\n <nb-icon *ngIf=\"checked && !indeterminate\" icon=\"checkmark-bold-outline\" pack=\"nebular-essentials\"></nb-icon>\n </span>\n <span class=\"text\">\n <ng-content></ng-content>\n </span>\n </label>\n ",
12422 providers: [{
12423 provide: _angular_forms.NG_VALUE_ACCESSOR,
12424 useExisting: i0.forwardRef(function () { return NbCheckboxComponent; }),
12425 multi: true,
12426 }],
12427 changeDetection: i0.ChangeDetectionStrategy.OnPush,
12428 styles: [":host .label{position:relative;display:inline-flex;align-items:center;margin:0;min-height:inherit}:host .custom-checkbox{flex-shrink:0}:host(.nb-transition) .custom-checkbox{transition-duration:0.15s;transition-property:background-color,border,box-shadow;transition-timing-function:ease-in}:host(.nb-transition) .text{transition-duration:0.15s;transition-property:color;transition-timing-function:ease-in}\n"]
12429 },] }
12430 ];
12431 NbCheckboxComponent.ctorParameters = function () { return [
12432 { type: i0.ChangeDetectorRef },
12433 { type: i0.Renderer2 },
12434 { type: i0.ElementRef },
12435 { type: i0.NgZone },
12436 { type: NbStatusService }
12437 ]; };
12438 NbCheckboxComponent.propDecorators = {
12439 checked: [{ type: i0.Input }],
12440 disabled: [{ type: i0.Input }],
12441 status: [{ type: i0.Input }],
12442 indeterminate: [{ type: i0.Input }],
12443 checkedChange: [{ type: i0.Output }],
12444 primary: [{ type: i0.HostBinding, args: ['class.status-primary',] }],
12445 success: [{ type: i0.HostBinding, args: ['class.status-success',] }],
12446 warning: [{ type: i0.HostBinding, args: ['class.status-warning',] }],
12447 danger: [{ type: i0.HostBinding, args: ['class.status-danger',] }],
12448 info: [{ type: i0.HostBinding, args: ['class.status-info',] }],
12449 basic: [{ type: i0.HostBinding, args: ['class.status-basic',] }],
12450 control: [{ type: i0.HostBinding, args: ['class.status-control',] }],
12451 additionalClasses: [{ type: i0.HostBinding, args: ['class',] }]
12452 };
12453 return NbCheckboxComponent;
12454}());
12455
12456/**
12457 * @license
12458 * Copyright Akveo. All Rights Reserved.
12459 * Licensed under the MIT License. See License.txt in the project root for license information.
12460 */
12461var NbCheckboxModule = /** @class */ (function () {
12462 function NbCheckboxModule() {
12463 }
12464 NbCheckboxModule.decorators = [
12465 { type: i0.NgModule, args: [{
12466 imports: [
12467 NbSharedModule,
12468 NbIconModule,
12469 ],
12470 declarations: [NbCheckboxComponent],
12471 exports: [NbCheckboxComponent],
12472 },] }
12473 ];
12474 return NbCheckboxModule;
12475}());
12476
12477var NbDynamicOverlay = /** @class */ (function () {
12478 function NbDynamicOverlay(overlay, componentFactoryResolver, zone, overlayContainer) {
12479 this.overlay = overlay;
12480 this.componentFactoryResolver = componentFactoryResolver;
12481 this.zone = zone;
12482 this.overlayContainer = overlayContainer;
12483 this.context = {};
12484 this.overlayConfig = {};
12485 this.positionStrategyChange$ = new rxjs.Subject();
12486 this.isShown$ = new rxjs.BehaviorSubject(false);
12487 this.destroy$ = new rxjs.Subject();
12488 this.overlayDestroy$ = new rxjs.Subject();
12489 }
12490 Object.defineProperty(NbDynamicOverlay.prototype, "isAttached", {
12491 get: function () {
12492 return this.ref && this.ref.hasAttached();
12493 },
12494 enumerable: false,
12495 configurable: true
12496 });
12497 Object.defineProperty(NbDynamicOverlay.prototype, "isShown", {
12498 get: function () {
12499 return this.isShown$.pipe(rxjs_operators.distinctUntilChanged());
12500 },
12501 enumerable: false,
12502 configurable: true
12503 });
12504 NbDynamicOverlay.prototype.create = function (componentType, content, context, positionStrategy, overlayConfig) {
12505 if (overlayConfig === void 0) { overlayConfig = {}; }
12506 this.setContentAndContext(content, context);
12507 this.setComponent(componentType);
12508 this.setPositionStrategy(positionStrategy);
12509 this.setOverlayConfig(overlayConfig);
12510 return this;
12511 };
12512 NbDynamicOverlay.prototype.setContent = function (content) {
12513 this.content = content;
12514 if (this.container) {
12515 this.updateContext();
12516 }
12517 this.updatePosition();
12518 };
12519 NbDynamicOverlay.prototype.setContext = function (context) {
12520 this.context = context;
12521 if (this.container) {
12522 this.updateContext();
12523 }
12524 this.updatePosition();
12525 };
12526 NbDynamicOverlay.prototype.setContentAndContext = function (content, context) {
12527 this.content = content;
12528 this.context = context;
12529 if (this.container) {
12530 this.updateContext();
12531 }
12532 this.updatePosition();
12533 };
12534 NbDynamicOverlay.prototype.setComponent = function (componentType) {
12535 this.componentType = componentType;
12536 // in case the component is shown we recreate it and show it back
12537 var wasAttached = this.isAttached;
12538 this.disposeOverlayRef();
12539 if (wasAttached) {
12540 this.show();
12541 }
12542 };
12543 NbDynamicOverlay.prototype.setPositionStrategy = function (positionStrategy) {
12544 var _this = this;
12545 this.positionStrategyChange$.next();
12546 this.positionStrategy = positionStrategy;
12547 this.positionStrategy.positionChange
12548 .pipe(rxjs_operators.filter(function () { return !!_this.container; }), rxjs_operators.takeUntil(rxjs.merge(this.positionStrategyChange$, this.destroy$)))
12549 .subscribe(function (position) {
12550 _this.lastAppliedPosition = position;
12551 patch(_this.container, { position: position });
12552 });
12553 if (this.ref) {
12554 this.ref.updatePositionStrategy(this.positionStrategy);
12555 }
12556 };
12557 NbDynamicOverlay.prototype.setOverlayConfig = function (overlayConfig) {
12558 this.overlayConfig = overlayConfig;
12559 var wasAttached = this.isAttached;
12560 this.disposeOverlayRef();
12561 if (wasAttached) {
12562 this.show();
12563 }
12564 };
12565 NbDynamicOverlay.prototype.show = function () {
12566 if (!this.ref) {
12567 this.createOverlay();
12568 }
12569 this.renderContainer();
12570 if (!this.hasOverlayInContainer()) {
12571 // Dispose overlay ref as it refers to the old overlay container and create new by calling `show`
12572 this.disposeOverlayRef();
12573 return this.show();
12574 }
12575 this.isShown$.next(true);
12576 };
12577 NbDynamicOverlay.prototype.hide = function () {
12578 if (!this.ref) {
12579 return;
12580 }
12581 this.ref.detach();
12582 this.container = null;
12583 this.isShown$.next(false);
12584 };
12585 NbDynamicOverlay.prototype.toggle = function () {
12586 if (this.isAttached) {
12587 this.hide();
12588 }
12589 else {
12590 this.show();
12591 }
12592 };
12593 NbDynamicOverlay.prototype.dispose = function () {
12594 this.destroy$.next();
12595 this.destroy$.complete();
12596 this.hide();
12597 this.disposeOverlayRef();
12598 this.isShown$.complete();
12599 this.positionStrategyChange$.complete();
12600 this.overlayDestroy$.complete();
12601 };
12602 NbDynamicOverlay.prototype.getContainer = function () {
12603 return this.container;
12604 };
12605 NbDynamicOverlay.prototype.createOverlay = function () {
12606 this.ref = this.overlay.create(tslib.__assign({ positionStrategy: this.positionStrategy, scrollStrategy: this.overlay.scrollStrategies.reposition() }, this.overlayConfig));
12607 this.updatePositionWhenStable(this.ref);
12608 };
12609 NbDynamicOverlay.prototype.renderContainer = function () {
12610 var containerContext = this.createContainerContext();
12611 if (!this.container) {
12612 this.container = createContainer(this.ref, this.componentType, containerContext, this.componentFactoryResolver);
12613 }
12614 this.container.instance.renderContent();
12615 };
12616 NbDynamicOverlay.prototype.updateContext = function () {
12617 var containerContext = this.createContainerContext();
12618 Object.assign(this.container.instance, containerContext);
12619 this.container.instance.renderContent();
12620 this.container.changeDetectorRef.detectChanges();
12621 };
12622 NbDynamicOverlay.prototype.createContainerContext = function () {
12623 return {
12624 content: this.content,
12625 context: this.context,
12626 cfr: this.componentFactoryResolver,
12627 position: this.lastAppliedPosition,
12628 };
12629 };
12630 /**
12631 * Dimensions of the container may change after content update. So we listen to zone.stable event to
12632 * reposition the container.
12633 */
12634 NbDynamicOverlay.prototype.updatePositionWhenStable = function (overlay) {
12635 var _this = this;
12636 var overlayDestroy$ = this.overlayDestroy$.pipe(rxjs_operators.filter(function (destroyedOverlay) { return destroyedOverlay === overlay; }));
12637 this.zone.onStable
12638 .pipe(rxjs_operators.takeUntil(rxjs.merge(this.destroy$, overlayDestroy$)))
12639 .subscribe(function () { return _this.updatePosition(); });
12640 };
12641 NbDynamicOverlay.prototype.updatePosition = function () {
12642 if (this.ref) {
12643 this.ref.updatePosition();
12644 }
12645 };
12646 NbDynamicOverlay.prototype.hasOverlayInContainer = function () {
12647 return this.overlayContainer.getContainerElement().contains(this.ref.hostElement);
12648 };
12649 NbDynamicOverlay.prototype.disposeOverlayRef = function () {
12650 if (this.ref) {
12651 this.ref.dispose();
12652 this.overlayDestroy$.next(this.ref);
12653 this.ref = null;
12654 this.container = null;
12655 }
12656 };
12657 NbDynamicOverlay.decorators = [
12658 { type: i0.Injectable }
12659 ];
12660 NbDynamicOverlay.ctorParameters = function () { return [
12661 { type: NbOverlayService },
12662 { type: i0.ComponentFactoryResolver },
12663 { type: i0.NgZone },
12664 { type: NbOverlayContainer }
12665 ]; };
12666 return NbDynamicOverlay;
12667}());
12668
12669var NbDynamicOverlayChange = /** @class */ (function (_super) {
12670 tslib.__extends(NbDynamicOverlayChange, _super);
12671 function NbDynamicOverlayChange(previousValue, currentValue, firstChange) {
12672 if (firstChange === void 0) { firstChange = false; }
12673 return _super.call(this, previousValue, currentValue, firstChange) || this;
12674 }
12675 NbDynamicOverlayChange.prototype.isChanged = function () {
12676 return this.currentValue !== this.previousValue;
12677 };
12678 return NbDynamicOverlayChange;
12679}(i0.SimpleChange));
12680var NbDynamicOverlayHandler = /** @class */ (function () {
12681 function NbDynamicOverlayHandler(positionBuilder, triggerStrategyBuilder, dynamicOverlayService) {
12682 this.positionBuilder = positionBuilder;
12683 this.triggerStrategyBuilder = triggerStrategyBuilder;
12684 this.dynamicOverlayService = dynamicOverlayService;
12685 this._context = {};
12686 this._trigger = exports.NbTrigger.NOOP;
12687 this._position = exports.NbPosition.TOP;
12688 this._adjustment = exports.NbAdjustment.NOOP;
12689 this._offset = 15;
12690 this._overlayConfig = {};
12691 this.changes = {};
12692 }
12693 NbDynamicOverlayHandler.prototype.host = function (host) {
12694 this.changes.host = new NbDynamicOverlayChange(this._host, host);
12695 this._host = host;
12696 return this;
12697 };
12698 NbDynamicOverlayHandler.prototype.trigger = function (trigger$$1) {
12699 this.changes.trigger = new NbDynamicOverlayChange(this._trigger, trigger$$1);
12700 this._trigger = trigger$$1;
12701 return this;
12702 };
12703 NbDynamicOverlayHandler.prototype.position = function (position) {
12704 this.changes.position = new NbDynamicOverlayChange(this._position, position);
12705 this._position = position;
12706 return this;
12707 };
12708 NbDynamicOverlayHandler.prototype.adjustment = function (adjustment) {
12709 this.changes.adjustment = new NbDynamicOverlayChange(this._adjustment, adjustment);
12710 this._adjustment = adjustment;
12711 return this;
12712 };
12713 NbDynamicOverlayHandler.prototype.componentType = function (componentType) {
12714 this.changes.componentType = new NbDynamicOverlayChange(this._componentType, componentType);
12715 this._componentType = componentType;
12716 return this;
12717 };
12718 NbDynamicOverlayHandler.prototype.content = function (content) {
12719 this.changes.content = new NbDynamicOverlayChange(this._content, content);
12720 this._content = content;
12721 return this;
12722 };
12723 NbDynamicOverlayHandler.prototype.context = function (context) {
12724 this.changes.context = new NbDynamicOverlayChange(this._context, context);
12725 this._context = context;
12726 return this;
12727 };
12728 NbDynamicOverlayHandler.prototype.offset = function (offset) {
12729 this.changes.offset = new NbDynamicOverlayChange(this._offset, offset);
12730 this._offset = offset;
12731 return this;
12732 };
12733 NbDynamicOverlayHandler.prototype.overlayConfig = function (overlayConfig) {
12734 this.changes.overlayConfig = new NbDynamicOverlayChange(this._overlayConfig, overlayConfig);
12735 this._overlayConfig = overlayConfig;
12736 return this;
12737 };
12738 NbDynamicOverlayHandler.prototype.build = function () {
12739 if (!this._componentType || !this._host) {
12740 throw Error("NbDynamicOverlayHandler: at least 'componentType' and 'host' should be\n passed before building a dynamic overlay.");
12741 }
12742 this.dynamicOverlay = this.dynamicOverlayService.create(this._componentType, this._content, this._context, this.createPositionStrategy(), this._overlayConfig);
12743 this.connect();
12744 this.clearChanges();
12745 return this.dynamicOverlay;
12746 };
12747 NbDynamicOverlayHandler.prototype.rebuild = function () {
12748 /**
12749 * we should not throw here
12750 * as we use rebuilt in lifecycle hooks
12751 * which it could be called before the build
12752 * so we just ignore this call
12753 */
12754 if (!this.dynamicOverlay) {
12755 return;
12756 }
12757 if (this.isPositionStrategyUpdateRequired()) {
12758 this.dynamicOverlay.setPositionStrategy(this.createPositionStrategy());
12759 }
12760 if (this.isTriggerStrategyUpdateRequired()) {
12761 this.connect();
12762 }
12763 if (this.isContainerRerenderRequired()) {
12764 this.dynamicOverlay.setContentAndContext(this._content, this._context);
12765 }
12766 if (this.isComponentTypeUpdateRequired()) {
12767 this.dynamicOverlay.setComponent(this._componentType);
12768 }
12769 if (this.isOverlayConfigUpdateRequired()) {
12770 this.dynamicOverlay.setOverlayConfig(this._overlayConfig);
12771 }
12772 this.clearChanges();
12773 return this.dynamicOverlay;
12774 };
12775 NbDynamicOverlayHandler.prototype.connect = function () {
12776 if (!this.dynamicOverlay) {
12777 throw new Error("NbDynamicOverlayHandler: cannot connect to DynamicOverlay\n as it is not created yet. Call build() first");
12778 }
12779 this.disconnect();
12780 this.subscribeOnTriggers(this.dynamicOverlay);
12781 };
12782 NbDynamicOverlayHandler.prototype.disconnect = function () {
12783 if (this.triggerStrategy) {
12784 this.triggerStrategy.destroy();
12785 }
12786 };
12787 NbDynamicOverlayHandler.prototype.destroy = function () {
12788 this.disconnect();
12789 this.clearChanges();
12790 if (this.dynamicOverlay) {
12791 this.dynamicOverlay.dispose();
12792 }
12793 };
12794 NbDynamicOverlayHandler.prototype.createPositionStrategy = function () {
12795 return this.positionBuilder
12796 .connectedTo(this._host)
12797 .position(this._position)
12798 .adjustment(this._adjustment)
12799 .offset(this._offset);
12800 };
12801 NbDynamicOverlayHandler.prototype.subscribeOnTriggers = function (dynamicOverlay) {
12802 this.triggerStrategy = this.triggerStrategyBuilder
12803 .trigger(this._trigger)
12804 .host(this._host.nativeElement)
12805 .container(function () { return dynamicOverlay.getContainer(); })
12806 .build();
12807 this.triggerStrategy.show$.subscribe(function () { return dynamicOverlay.show(); });
12808 this.triggerStrategy.hide$.subscribe(function () { return dynamicOverlay.hide(); });
12809 };
12810 NbDynamicOverlayHandler.prototype.isContainerRerenderRequired = function () {
12811 return this.isContentUpdated()
12812 || this.isContextUpdated()
12813 || this.isPositionStrategyUpdateRequired();
12814 };
12815 NbDynamicOverlayHandler.prototype.isPositionStrategyUpdateRequired = function () {
12816 return this.isAdjustmentUpdated() || this.isPositionUpdated() || this.isOffsetUpdated() || this.isHostUpdated();
12817 };
12818 NbDynamicOverlayHandler.prototype.isTriggerStrategyUpdateRequired = function () {
12819 return this.isTriggerUpdated() || this.isHostUpdated();
12820 };
12821 NbDynamicOverlayHandler.prototype.isComponentTypeUpdateRequired = function () {
12822 return this.isComponentTypeUpdated();
12823 };
12824 NbDynamicOverlayHandler.prototype.isOverlayConfigUpdateRequired = function () {
12825 return this.isOverlayConfigUpdated();
12826 };
12827 NbDynamicOverlayHandler.prototype.isComponentTypeUpdated = function () {
12828 return this.changes.componentType && this.changes.componentType.isChanged();
12829 };
12830 NbDynamicOverlayHandler.prototype.isContentUpdated = function () {
12831 return this.changes.content && this.changes.content.isChanged();
12832 };
12833 NbDynamicOverlayHandler.prototype.isContextUpdated = function () {
12834 return this.changes.context && this.changes.context.isChanged();
12835 };
12836 NbDynamicOverlayHandler.prototype.isAdjustmentUpdated = function () {
12837 return this.changes.adjustment && this.changes.adjustment.isChanged();
12838 };
12839 NbDynamicOverlayHandler.prototype.isPositionUpdated = function () {
12840 return this.changes.position && this.changes.position.isChanged();
12841 };
12842 NbDynamicOverlayHandler.prototype.isHostUpdated = function () {
12843 return this.changes.host && this.changes.host.isChanged();
12844 };
12845 NbDynamicOverlayHandler.prototype.isTriggerUpdated = function () {
12846 return this.changes.trigger && this.changes.trigger.isChanged();
12847 };
12848 NbDynamicOverlayHandler.prototype.isOffsetUpdated = function () {
12849 return this.changes.offset && this.changes.offset.isChanged();
12850 };
12851 NbDynamicOverlayHandler.prototype.isOverlayConfigUpdated = function () {
12852 return this.changes.overlayConfig && this.changes.overlayConfig.isChanged();
12853 };
12854 NbDynamicOverlayHandler.prototype.clearChanges = function () {
12855 this.changes = {};
12856 };
12857 NbDynamicOverlayHandler.decorators = [
12858 { type: i0.Injectable }
12859 ];
12860 NbDynamicOverlayHandler.ctorParameters = function () { return [
12861 { type: NbPositionBuilderService },
12862 { type: NbTriggerStrategyBuilderService },
12863 { type: NbDynamicOverlay }
12864 ]; };
12865 return NbDynamicOverlayHandler;
12866}());
12867
12868/**
12869 * @license
12870 * Copyright Akveo. All Rights Reserved.
12871 * Licensed under the MIT License. See License.txt in the project root for license information.
12872 */
12873/**
12874 * Overlay container.
12875 * Renders provided content inside.
12876 *
12877 * @styles
12878 *
12879 * popover-text-color:
12880 * popover-text-font-family:
12881 * popover-text-font-size:
12882 * popover-text-font-weight:
12883 * popover-text-line-height:
12884 * popover-background-color:
12885 * popover-border-width:
12886 * popover-border-color:
12887 * popover-border-radius:
12888 * popover-shadow:
12889 * popover-arrow-size:
12890 * popover-padding:
12891 * */
12892var NbPopoverComponent = /** @class */ (function (_super) {
12893 tslib.__extends(NbPopoverComponent, _super);
12894 function NbPopoverComponent() {
12895 return _super !== null && _super.apply(this, arguments) || this;
12896 }
12897 NbPopoverComponent.prototype.renderContent = function () {
12898 this.detachContent();
12899 this.attachContent();
12900 };
12901 NbPopoverComponent.prototype.detachContent = function () {
12902 this.overlayContainer.detach();
12903 };
12904 NbPopoverComponent.prototype.attachContent = function () {
12905 if (this.content instanceof i0.TemplateRef) {
12906 this.attachTemplate();
12907 }
12908 else if (this.content instanceof i0.Type) {
12909 this.attachComponent();
12910 }
12911 else {
12912 this.attachString();
12913 }
12914 };
12915 NbPopoverComponent.prototype.attachTemplate = function () {
12916 this.overlayContainer
12917 .attachTemplatePortal(new NbTemplatePortal(this.content, null, { $implicit: this.context }));
12918 };
12919 NbPopoverComponent.prototype.attachComponent = function () {
12920 var portal = new NbComponentPortal(this.content, null, null, this.cfr);
12921 var ref = this.overlayContainer.attachComponentPortal(portal, this.context);
12922 ref.changeDetectorRef.detectChanges();
12923 };
12924 NbPopoverComponent.prototype.attachString = function () {
12925 this.overlayContainer.attachStringContent(this.content);
12926 };
12927 NbPopoverComponent.decorators = [
12928 { type: i0.Component, args: [{
12929 selector: 'nb-popover',
12930 template: "\n <span class=\"arrow\"></span>\n <nb-overlay-container></nb-overlay-container>\n ",
12931 styles: [":host .arrow{position:absolute;width:0;height:0}\n"]
12932 },] }
12933 ];
12934 NbPopoverComponent.propDecorators = {
12935 overlayContainer: [{ type: i0.ViewChild, args: [NbOverlayContainerComponent,] }],
12936 content: [{ type: i0.Input }],
12937 context: [{ type: i0.Input }],
12938 cfr: [{ type: i0.Input }]
12939 };
12940 return NbPopoverComponent;
12941}(NbPositionedContainerComponent));
12942
12943/**
12944 * @license
12945 * Copyright Akveo. All Rights Reserved.
12946 * Licensed under the MIT License. See License.txt in the project root for license information.
12947 */
12948/**
12949 * Powerful popover directive, which provides the best UX for your users.
12950 *
12951 * @stacked-example(Showcase, popover/popover-showcase.component)
12952 *
12953 * Popover can accept different content such as:
12954 * TemplateRef
12955 *
12956 * ```html
12957 * <button [nbPopover]="templateRef"></button>
12958 * <ng-template #templateRef>
12959 * <span>Hello, Popover!</span>
12960 * </ng-template>
12961 * ```
12962 * ### Installation
12963 *
12964 * Import `NbPopoverModule` to your feature module.
12965 * ```ts
12966 * @NgModule({
12967 * imports: [
12968 * // ...
12969 * NbPopoverModule,
12970 * ],
12971 * })
12972 * export class PageModule { }
12973 * ```
12974 * ### Usage
12975 *
12976 * Custom components
12977 *
12978 * ```html
12979 * <button [nbPopover]="MyPopoverComponent"></button>
12980 * ```
12981 *
12982 * Both custom components and templateRef popovers can receive *contentContext* property
12983 * that will be passed to the content props.
12984 *
12985 * Primitive types
12986 *
12987 * ```html
12988 * <button nbPopover="Hello, Popover!"></button>
12989 * ```
12990 *
12991 * Popover has different placements, such as: top, bottom, left, right, start and end
12992 * which can be used as following:
12993 *
12994 * @stacked-example(Placements, popover/popover-placements.component)
12995 *
12996 * By default popover will try to adjust itself to maximally fit viewport
12997 * and provide the best user experience. It will try to change position of the popover container.
12998 * If you want to disable this behaviour set it `noop`.
12999 *
13000 * ```html
13001 * <button nbPopover="Hello, Popover!" nbPopoverAdjustment="noop"></button>
13002 * ```
13003 *
13004 * Popover has a number of triggers which provides an ability to show and hide the component in different ways:
13005 *
13006 * - Click mode shows the component when a user clicks on the host element and hides when the user clicks
13007 * somewhere on the document outside the component.
13008 * - Hint provides capability to show the component when the user hovers over the host element
13009 * and hide when the user hovers out of the host.
13010 * - Hover works like hint mode with one exception - when the user moves mouse from host element to
13011 * the container element the component remains open, so that it is possible to interact with it content.
13012 * - Focus mode is applied when user focuses the element.
13013 * - Noop mode - the component won't react to the user interaction.
13014 *
13015 * @stacked-example(Available Triggers, popover/popover-modes.component.html)
13016 *
13017 * Noop mode is especially useful when you need to control Popover programmatically, for example show/hide
13018 * as a result of some third-party action, like HTTP request or validation check:
13019 *
13020 * @stacked-example(Manual Control, popover/popover-noop.component)
13021 *
13022 * Below are examples for manual popover settings control, both via template binding and code.
13023 * @stacked-example(Popover Settings, popover/popover-dynamic.component)
13024 *
13025 * Please note, while manipulating Popover setting via code, you need to call `rebuild()` method to apply the settings
13026 * changed.
13027 * @stacked-example(Popover Settings Code, popover/popover-dynamic-code.component)
13028 *
13029 * @additional-example(Template Ref, popover/popover-template-ref.component)
13030 * @additional-example(Custom Component, popover/popover-custom-component.component)
13031 * */
13032var NbPopoverDirective = /** @class */ (function () {
13033 function NbPopoverDirective(hostRef, dynamicOverlayHandler) {
13034 this.hostRef = hostRef;
13035 this.dynamicOverlayHandler = dynamicOverlayHandler;
13036 this.popoverComponent = NbPopoverComponent;
13037 this.destroy$ = new rxjs.Subject();
13038 /**
13039 * Container content context. Will be applied to the rendered component.
13040 * */
13041 this.context = {};
13042 /**
13043 * Position will be calculated relatively host element based on the position.
13044 * Can be top, right, bottom, left, start or end.
13045 * */
13046 this.position = exports.NbPosition.TOP;
13047 this._adjustment = exports.NbAdjustment.CLOCKWISE;
13048 /**
13049 * Describes when the container will be shown.
13050 * Available options: `click`, `hover`, `hint`, `focus` and `noop`
13051 * */
13052 this.trigger = exports.NbTrigger.CLICK;
13053 /**
13054 * Sets popover offset
13055 * */
13056 this.offset = 15;
13057 this._popoverClass = '';
13058 this.nbPopoverShowStateChange = new i0.EventEmitter();
13059 this.overlayConfig = { panelClass: this.popoverClass };
13060 }
13061 Object.defineProperty(NbPopoverDirective.prototype, "adjustment", {
13062 /**
13063 * Container position will be changes automatically based on this strategy if container can't fit view port.
13064 * Set this property to `noop` value if you want to disable automatically adjustment.
13065 * Available values: `clockwise` (default), `counterclockwise`, `vertical`, `horizontal`, `noop`.
13066 * */
13067 get: function () {
13068 return this._adjustment;
13069 },
13070 set: function (value) {
13071 this._adjustment = value;
13072 },
13073 enumerable: false,
13074 configurable: true
13075 });
13076 Object.defineProperty(NbPopoverDirective.prototype, "popoverClass", {
13077 get: function () {
13078 return this._popoverClass;
13079 },
13080 set: function (value) {
13081 if (value !== this.popoverClass) {
13082 this._popoverClass = value;
13083 this.overlayConfig = { panelClass: this.popoverClass };
13084 }
13085 },
13086 enumerable: false,
13087 configurable: true
13088 });
13089 Object.defineProperty(NbPopoverDirective.prototype, "isShown", {
13090 get: function () {
13091 return !!(this.dynamicOverlay && this.dynamicOverlay.isAttached);
13092 },
13093 enumerable: false,
13094 configurable: true
13095 });
13096 NbPopoverDirective.prototype.ngOnInit = function () {
13097 this.dynamicOverlayHandler
13098 .host(this.hostRef)
13099 .componentType(this.popoverComponent);
13100 };
13101 NbPopoverDirective.prototype.ngOnChanges = function () {
13102 this.rebuild();
13103 };
13104 NbPopoverDirective.prototype.ngAfterViewInit = function () {
13105 var _this = this;
13106 this.dynamicOverlay = this.configureDynamicOverlay()
13107 .build();
13108 this.dynamicOverlay.isShown
13109 .pipe(rxjs_operators.skip(1), rxjs_operators.takeUntil(this.destroy$))
13110 .subscribe(function (isShown) { return _this.nbPopoverShowStateChange.emit({ isShown: isShown }); });
13111 };
13112 NbPopoverDirective.prototype.rebuild = function () {
13113 this.dynamicOverlay = this.configureDynamicOverlay()
13114 .rebuild();
13115 };
13116 NbPopoverDirective.prototype.show = function () {
13117 this.dynamicOverlay.show();
13118 };
13119 NbPopoverDirective.prototype.hide = function () {
13120 this.dynamicOverlay.hide();
13121 };
13122 NbPopoverDirective.prototype.toggle = function () {
13123 this.dynamicOverlay.toggle();
13124 };
13125 NbPopoverDirective.prototype.ngOnDestroy = function () {
13126 this.dynamicOverlayHandler.destroy();
13127 this.destroy$.next();
13128 this.destroy$.complete();
13129 };
13130 NbPopoverDirective.prototype.configureDynamicOverlay = function () {
13131 return this.dynamicOverlayHandler
13132 .position(this.position)
13133 .trigger(this.trigger)
13134 .offset(this.offset)
13135 .adjustment(this.adjustment)
13136 .content(this.content)
13137 .context(this.context)
13138 .overlayConfig(this.overlayConfig);
13139 };
13140 NbPopoverDirective.decorators = [
13141 { type: i0.Directive, args: [{
13142 selector: '[nbPopover]',
13143 exportAs: 'nbPopover',
13144 providers: [NbDynamicOverlayHandler, NbDynamicOverlay],
13145 },] }
13146 ];
13147 NbPopoverDirective.ctorParameters = function () { return [
13148 { type: i0.ElementRef },
13149 { type: NbDynamicOverlayHandler }
13150 ]; };
13151 NbPopoverDirective.propDecorators = {
13152 content: [{ type: i0.Input, args: ['nbPopover',] }],
13153 context: [{ type: i0.Input, args: ['nbPopoverContext',] }],
13154 position: [{ type: i0.Input, args: ['nbPopoverPlacement',] }],
13155 adjustment: [{ type: i0.Input, args: ['nbPopoverAdjustment',] }],
13156 trigger: [{ type: i0.Input, args: ['nbPopoverTrigger',] }],
13157 offset: [{ type: i0.Input, args: ['nbPopoverOffset',] }],
13158 popoverClass: [{ type: i0.Input, args: ['nbPopoverClass',] }],
13159 nbPopoverShowStateChange: [{ type: i0.Output }]
13160 };
13161 return NbPopoverDirective;
13162}());
13163
13164/**
13165 * @license
13166 * Copyright Akveo. All Rights Reserved.
13167 * Licensed under the MIT License. See License.txt in the project root for license information.
13168 */
13169var NbPopoverModule = /** @class */ (function () {
13170 function NbPopoverModule() {
13171 }
13172 NbPopoverModule.decorators = [
13173 { type: i0.NgModule, args: [{
13174 imports: [NbOverlayModule],
13175 declarations: [NbPopoverDirective, NbPopoverComponent],
13176 exports: [NbPopoverDirective],
13177 entryComponents: [NbPopoverComponent],
13178 },] }
13179 ];
13180 return NbPopoverModule;
13181}());
13182
13183/**
13184 * @license
13185 * Copyright Akveo. All Rights Reserved.
13186 * Licensed under the MIT License. See License.txt in the project root for license information.
13187 */
13188/**
13189 * Context menu component used as content within NbContextMenuDirective.
13190 *
13191 * @styles
13192 *
13193 * context-menu-background-color:
13194 * context-menu-border-color:
13195 * context-menu-border-style:
13196 * context-menu-border-width:
13197 * context-menu-border-radius:
13198 * context-menu-text-align:
13199 * context-menu-min-width:
13200 * context-menu-max-width:
13201 * context-menu-shadow:
13202 * */
13203var NbContextMenuComponent = /** @class */ (function (_super) {
13204 tslib.__extends(NbContextMenuComponent, _super);
13205 function NbContextMenuComponent() {
13206 var _this = _super !== null && _super.apply(this, arguments) || this;
13207 _this.items = [];
13208 _this.context = { items: [] };
13209 return _this;
13210 }
13211 /**
13212 * The method is empty since we don't need to do anything additionally
13213 * render is handled by change detection
13214 */
13215 NbContextMenuComponent.prototype.renderContent = function () { };
13216 NbContextMenuComponent.decorators = [
13217 { type: i0.Component, args: [{
13218 selector: 'nb-context-menu',
13219 template: "\n <nb-menu class=\"context-menu\" [items]=\"context.items\" [tag]=\"context.tag\"></nb-menu>\n "
13220 },] }
13221 ];
13222 NbContextMenuComponent.propDecorators = {
13223 items: [{ type: i0.Input }],
13224 tag: [{ type: i0.Input }],
13225 context: [{ type: i0.Input }]
13226 };
13227 return NbContextMenuComponent;
13228}(NbPositionedContainerComponent));
13229
13230/**
13231 * @license
13232 * Copyright Akveo. All Rights Reserved.
13233 * Licensed under the MIT License. See License.txt in the project root for license information.
13234 */
13235/**
13236 * Full featured context menu directive.
13237 *
13238 * @stacked-example(Showcase, context-menu/context-menu-showcase.component)
13239 *
13240 * Just pass menu items array:
13241 *
13242 * ```html
13243 * <button [nbContextMenu]="items"></button>
13244 * ...
13245 * items = [{ title: 'Profile' }, { title: 'Log out' }];
13246 * ```
13247 * ### Installation
13248 *
13249 * Import `NbContextMenuModule` to your feature module.
13250 * ```ts
13251 * @NgModule({
13252 * imports: [
13253 * // ...
13254 * NbContextMenuModule,
13255 * ],
13256 * })
13257 * export class PageModule { }
13258 * ```
13259 * Also make sure `NbMenuModule` is imported to your `app.module`.
13260 * ```ts
13261 * @NgModule({
13262 * imports: [
13263 * // ...
13264 * NbMenuModule.forRoot(),
13265 * ],
13266 * })
13267 * export class AppModule { }
13268 * ```
13269 *
13270 * ### Usage
13271 *
13272 * If you want to handle context menu clicks you have to pass `nbContextMenuTag`
13273 * param and register to events using NbMenuService.
13274 * `NbContextMenu` renders plain `NbMenu` inside, so
13275 * you have to work with it just like with `NbMenu` component:
13276 *
13277 * @stacked-example(Menu item click, context-menu/context-menu-click.component)
13278 *
13279 * Context menu has different placements, such as: top, bottom, left and right
13280 * which can be used as following:
13281 *
13282 * ```html
13283 * <button [nbContextMenu]="items" nbContextMenuPlacement="right"></button>
13284 * ```
13285 *
13286 * ```ts
13287 * items = [{ title: 'Profile' }, { title: 'Log out' }];
13288 * ```
13289 *
13290 * By default context menu will try to adjust itself to maximally fit viewport
13291 * and provide the best user experience. It will try to change position of the context menu.
13292 * If you wanna disable this behaviour just set it falsy value.
13293 *
13294 * ```html
13295 * <button [nbContextMenu]="items" nbContextMenuAdjustment="counterclockwise"></button>
13296 * ```
13297 *
13298 * ```ts
13299 * items = [{ title: 'Profile' }, { title: 'Log out' }];
13300 * ```
13301 * Context menu has a number of triggers which provides an ability to show and hide the component in different ways:
13302 *
13303 * - Click mode shows the component when a user clicks on the host element and hides when the user clicks
13304 * somewhere on the document outside the component.
13305 * - Hint provides capability to show the component when the user hovers over the host element
13306 * and hide when the user hovers out of the host.
13307 * - Hover works like hint mode with one exception - when the user moves mouse from host element to
13308 * the container element the component remains open, so that it is possible to interact with it content.
13309 * - Focus mode is applied when user focuses the element.
13310 * - Noop mode - the component won't react to the user interaction.
13311 *
13312 * @stacked-example(Available Triggers, context-menu/context-menu-modes.component.html)
13313 *
13314 * Noop mode is especially useful when you need to control Popover programmatically, for example show/hide
13315 * as a result of some third-party action, like HTTP request or validation check:
13316 *
13317 * @stacked-example(Manual Control, context-menu/context-menu-noop.component)
13318 *
13319 * @stacked-example(Manual Control, context-menu/context-menu-right-click.component)
13320 * */
13321var NbContextMenuDirective = /** @class */ (function () {
13322 function NbContextMenuDirective(hostRef, menuService, dynamicOverlayHandler) {
13323 this.hostRef = hostRef;
13324 this.menuService = menuService;
13325 this.dynamicOverlayHandler = dynamicOverlayHandler;
13326 this.contextMenuHost = true;
13327 this._position = exports.NbPosition.BOTTOM;
13328 /**
13329 * Container position will be changes automatically based on this strategy if container can't fit view port.
13330 * Set this property to any falsy value if you want to disable automatically adjustment.
13331 * Available values: clockwise, counterclockwise.
13332 * */
13333 this.adjustment = exports.NbAdjustment.CLOCKWISE;
13334 /**
13335 * Describes when the container will be shown.
13336 * Available options: `click`, `hover`, `hint`, `focus` and `noop`
13337 * */
13338 this.trigger = exports.NbTrigger.CLICK;
13339 this._contextMenuClass = '';
13340 this.overlayConfig = { panelClass: this.contextMenuClass };
13341 this.overlayContext = { items: this.items, tag: this.tag, position: this.position };
13342 this.destroy$ = new rxjs.Subject();
13343 this._items = [];
13344 }
13345 Object.defineProperty(NbContextMenuDirective.prototype, "position", {
13346 /**
13347 * Position will be calculated relatively host element based on the position.
13348 * Can be top, right, bottom and left.
13349 * */
13350 get: function () {
13351 return this._position;
13352 },
13353 set: function (value) {
13354 if (value !== this.position) {
13355 this._position = value;
13356 this.updateOverlayContext();
13357 }
13358 },
13359 enumerable: false,
13360 configurable: true
13361 });
13362 Object.defineProperty(NbContextMenuDirective.prototype, "tag", {
13363 /**
13364 * Set NbMenu tag, which helps identify menu when working with NbMenuService.
13365 * */
13366 get: function () {
13367 return this._tag;
13368 },
13369 set: function (value) {
13370 if (value !== this.tag) {
13371 this._tag = value;
13372 this.updateOverlayContext();
13373 }
13374 },
13375 enumerable: false,
13376 configurable: true
13377 });
13378 Object.defineProperty(NbContextMenuDirective.prototype, "items", {
13379 /**
13380 * Basic menu items, will be passed to the internal NbMenuComponent.
13381 * */
13382 get: function () {
13383 return this._items;
13384 },
13385 set: function (items) {
13386 this.validateItems(items);
13387 this._items = items;
13388 this.updateOverlayContext();
13389 },
13390 enumerable: false,
13391 configurable: true
13392 });
13393
13394 Object.defineProperty(NbContextMenuDirective.prototype, "contextMenuClass", {
13395 get: function () {
13396 return this._contextMenuClass;
13397 },
13398 set: function (value) {
13399 if (value !== this.contextMenuClass) {
13400 this._contextMenuClass = value;
13401 this.overlayConfig = { panelClass: this.contextMenuClass };
13402 }
13403 },
13404 enumerable: false,
13405 configurable: true
13406 });
13407 NbContextMenuDirective.prototype.ngOnInit = function () {
13408 this.dynamicOverlayHandler
13409 .host(this.hostRef)
13410 .componentType(NbContextMenuComponent);
13411 };
13412 NbContextMenuDirective.prototype.ngOnChanges = function () {
13413 this.rebuild();
13414 };
13415 NbContextMenuDirective.prototype.ngAfterViewInit = function () {
13416 this.dynamicOverlay = this.configureDynamicOverlay()
13417 .build();
13418 this.subscribeOnItemClick();
13419 };
13420 NbContextMenuDirective.prototype.rebuild = function () {
13421 this.dynamicOverlay = this.configureDynamicOverlay()
13422 .rebuild();
13423 };
13424 NbContextMenuDirective.prototype.show = function () {
13425 this.dynamicOverlay.show();
13426 };
13427 NbContextMenuDirective.prototype.hide = function () {
13428 this.dynamicOverlay.hide();
13429 };
13430 NbContextMenuDirective.prototype.toggle = function () {
13431 this.dynamicOverlay.toggle();
13432 };
13433 NbContextMenuDirective.prototype.ngOnDestroy = function () {
13434 this.dynamicOverlayHandler.destroy();
13435 this.destroy$.next();
13436 this.destroy$.complete();
13437 };
13438 NbContextMenuDirective.prototype.configureDynamicOverlay = function () {
13439 return this.dynamicOverlayHandler
13440 .position(this.position)
13441 .trigger(this.trigger)
13442 .adjustment(this.adjustment)
13443 .context(this.overlayContext)
13444 .overlayConfig(this.overlayConfig);
13445 };
13446 /*
13447 * NbMenuComponent will crash if don't pass menu items to it.
13448 * So, we just validating them and throw custom obvious error.
13449 * */
13450 NbContextMenuDirective.prototype.validateItems = function (items) {
13451 if (!items || !items.length) {
13452 throw Error("List of menu items expected, but given: " + items);
13453 }
13454 };
13455 NbContextMenuDirective.prototype.subscribeOnItemClick = function () {
13456 var _this = this;
13457 this.menuService.onItemClick()
13458 .pipe(rxjs_operators.filter(function (_a) {
13459 var tag = _a.tag;
13460 return tag === _this.tag;
13461 }), rxjs_operators.takeUntil(this.destroy$))
13462 .subscribe(function () { return _this.hide(); });
13463 };
13464 NbContextMenuDirective.prototype.updateOverlayContext = function () {
13465 this.overlayContext = { items: this.items, position: this.position, tag: this.tag };
13466 };
13467 NbContextMenuDirective.decorators = [
13468 { type: i0.Directive, args: [{
13469 selector: '[nbContextMenu]',
13470 providers: [NbDynamicOverlayHandler, NbDynamicOverlay],
13471 },] }
13472 ];
13473 NbContextMenuDirective.ctorParameters = function () { return [
13474 { type: i0.ElementRef },
13475 { type: NbMenuService },
13476 { type: NbDynamicOverlayHandler }
13477 ]; };
13478 NbContextMenuDirective.propDecorators = {
13479 contextMenuHost: [{ type: i0.HostBinding, args: ['class.context-menu-host',] }],
13480 position: [{ type: i0.Input, args: ['nbContextMenuPlacement',] }],
13481 adjustment: [{ type: i0.Input, args: ['nbContextMenuAdjustment',] }],
13482 tag: [{ type: i0.Input, args: ['nbContextMenuTag',] }],
13483 items: [{ type: i0.Input, args: ['nbContextMenu',] }],
13484 trigger: [{ type: i0.Input, args: ['nbContextMenuTrigger',] }],
13485 contextMenuClass: [{ type: i0.Input, args: ['nbContextMenuClass',] }]
13486 };
13487 return NbContextMenuDirective;
13488}());
13489
13490/**
13491 * @license
13492 * Copyright Akveo. All Rights Reserved.
13493 * Licensed under the MIT License. See License.txt in the project root for license information.
13494 */
13495var NbContextMenuModule = /** @class */ (function () {
13496 function NbContextMenuModule() {
13497 }
13498 NbContextMenuModule.decorators = [
13499 { type: i0.NgModule, args: [{
13500 imports: [_angular_common.CommonModule, NbOverlayModule, NbMenuModule],
13501 exports: [NbContextMenuDirective],
13502 declarations: [NbContextMenuDirective, NbContextMenuComponent],
13503 entryComponents: [NbContextMenuComponent],
13504 },] }
13505 ];
13506 return NbContextMenuModule;
13507}());
13508
13509/**
13510 * @license
13511 * Copyright Akveo. All Rights Reserved.
13512 * Licensed under the MIT License. See License.txt in the project root for license information.
13513 */
13514/**
13515 * Progress Bar is a component for indicating progress.
13516 *
13517 * Simple usage:
13518 *
13519 * ```html
13520 * <nb-progress-bar [value]="50"></nb-progress-bar>
13521 * ```
13522 * ### Installation
13523 *
13524 * Import `NbProgressBarModule` to your feature module.
13525 * ```ts
13526 * @NgModule({
13527 * imports: [
13528 * // ...
13529 * NbProgressBarModule,
13530 * ],
13531 * })
13532 * export class PageModule { }
13533 * ```
13534 * ### Usage
13535 *
13536 * Progress bar accepts property `value` in range 0-100
13537 * @stacked-example(Progress bar, progress-bar/progress-bar-showcase.component)
13538 *
13539 * Progress bar background could be configured by providing a `status` property:
13540 * @stacked-example(Progress bar status, progress-bar/progress-bar-status.component)
13541 *
13542 * Progress bar size (height and font-size) could be configured by providing a `size` property:
13543 * @stacked-example(Progress bar size, progress-bar/progress-bar-size.component)
13544 *
13545 * `displayValue` property shows current value inside progress bar. It's also possible to add custom text inside:
13546 * @stacked-example(Progress bar value, progress-bar/progress-bar-value.component)
13547 *
13548 * Progress bar supports `width` and `background-color` transition:
13549 * @stacked-example(Progress bar interactive, progress-bar/progress-bar-interactive.component)
13550 *
13551 * @styles
13552 *
13553 * progress-bar-animation-duration:
13554 * progress-bar-border-radius:
13555 * progress-bar-text-font-family:
13556 * progress-bar-tiny-height:
13557 * progress-bar-tiny-text-font-size:
13558 * progress-bar-tiny-text-font-weight:
13559 * progress-bar-tiny-text-line-height:
13560 * progress-bar-small-height:
13561 * progress-bar-small-text-font-size:
13562 * progress-bar-small-text-font-weight:
13563 * progress-bar-small-text-line-height:
13564 * progress-bar-medium-height:
13565 * progress-bar-medium-text-font-size:
13566 * progress-bar-medium-text-font-weight:
13567 * progress-bar-medium-text-line-height:
13568 * progress-bar-large-height:
13569 * progress-bar-large-text-font-size:
13570 * progress-bar-large-text-font-weight:
13571 * progress-bar-large-text-line-height:
13572 * progress-bar-giant-height:
13573 * progress-bar-giant-text-font-size:
13574 * progress-bar-giant-text-font-weight:
13575 * progress-bar-giant-text-line-height:
13576 * progress-bar-basic-background-color:
13577 * progress-bar-basic-filled-background-color:
13578 * progress-bar-basic-text-color:
13579 * progress-bar-primary-background-color:
13580 * progress-bar-primary-filled-background-color:
13581 * progress-bar-primary-text-color:
13582 * progress-bar-success-background-color:
13583 * progress-bar-success-filled-background-color:
13584 * progress-bar-success-text-color:
13585 * progress-bar-info-background-color:
13586 * progress-bar-info-filled-background-color:
13587 * progress-bar-info-text-color:
13588 * progress-bar-warning-background-color:
13589 * progress-bar-warning-filled-background-color:
13590 * progress-bar-warning-text-color:
13591 * progress-bar-danger-background-color:
13592 * progress-bar-danger-filled-background-color:
13593 * progress-bar-danger-text-color:
13594 * progress-bar-control-background-color:
13595 * progress-bar-control-filled-background-color:
13596 * progress-bar-control-text-color:
13597 */
13598var NbProgressBarComponent = /** @class */ (function () {
13599 function NbProgressBarComponent(statusService) {
13600 this.statusService = statusService;
13601 /**
13602 * Progress bar value in percent (0 - 100)
13603 */
13604 this.value = 0;
13605 /**
13606 * Progress bar background (`basic` (default), `primary`, `info`, `success`, `warning`, `danger`, `control`)
13607 */
13608 this.status = 'basic';
13609 /**
13610 * Progress bar size (`tiny`, `small`, `medium` (default), `large`, `giant`)
13611 */
13612 this.size = 'medium';
13613 /**
13614 * Displays value inside progress bar
13615 */
13616 this.displayValue = false;
13617 }
13618 Object.defineProperty(NbProgressBarComponent.prototype, "tiny", {
13619 get: function () {
13620 return this.size === 'tiny';
13621 },
13622 enumerable: false,
13623 configurable: true
13624 });
13625 Object.defineProperty(NbProgressBarComponent.prototype, "small", {
13626 get: function () {
13627 return this.size === 'small';
13628 },
13629 enumerable: false,
13630 configurable: true
13631 });
13632 Object.defineProperty(NbProgressBarComponent.prototype, "medium", {
13633 get: function () {
13634 return this.size === 'medium';
13635 },
13636 enumerable: false,
13637 configurable: true
13638 });
13639 Object.defineProperty(NbProgressBarComponent.prototype, "large", {
13640 get: function () {
13641 return this.size === 'large';
13642 },
13643 enumerable: false,
13644 configurable: true
13645 });
13646 Object.defineProperty(NbProgressBarComponent.prototype, "giant", {
13647 get: function () {
13648 return this.size === 'giant';
13649 },
13650 enumerable: false,
13651 configurable: true
13652 });
13653 Object.defineProperty(NbProgressBarComponent.prototype, "primary", {
13654 get: function () {
13655 return this.status === 'primary';
13656 },
13657 enumerable: false,
13658 configurable: true
13659 });
13660 Object.defineProperty(NbProgressBarComponent.prototype, "success", {
13661 get: function () {
13662 return this.status === 'success';
13663 },
13664 enumerable: false,
13665 configurable: true
13666 });
13667 Object.defineProperty(NbProgressBarComponent.prototype, "info", {
13668 get: function () {
13669 return this.status === 'info';
13670 },
13671 enumerable: false,
13672 configurable: true
13673 });
13674 Object.defineProperty(NbProgressBarComponent.prototype, "warning", {
13675 get: function () {
13676 return this.status === 'warning';
13677 },
13678 enumerable: false,
13679 configurable: true
13680 });
13681 Object.defineProperty(NbProgressBarComponent.prototype, "danger", {
13682 get: function () {
13683 return this.status === 'danger';
13684 },
13685 enumerable: false,
13686 configurable: true
13687 });
13688 Object.defineProperty(NbProgressBarComponent.prototype, "basic", {
13689 get: function () {
13690 return this.status === 'basic';
13691 },
13692 enumerable: false,
13693 configurable: true
13694 });
13695 Object.defineProperty(NbProgressBarComponent.prototype, "control", {
13696 get: function () {
13697 return this.status === 'control';
13698 },
13699 enumerable: false,
13700 configurable: true
13701 });
13702 Object.defineProperty(NbProgressBarComponent.prototype, "additionalClasses", {
13703 get: function () {
13704 if (this.statusService.isCustomStatus(this.status)) {
13705 return [this.statusService.getStatusClass(this.status)];
13706 }
13707 return [];
13708 },
13709 enumerable: false,
13710 configurable: true
13711 });
13712 NbProgressBarComponent.decorators = [
13713 { type: i0.Component, args: [{
13714 selector: 'nb-progress-bar',
13715 template: "\n <div class=\"progress-container\">\n <div class=\"progress-value\" [style.width.%]=\"value\">\n <span *ngIf=\"displayValue\">{{ value }}%</span>\n <ng-content></ng-content>\n </div>\n </div>\n ",
13716 styles: [":host{display:block}.progress-container{overflow:hidden}.progress-value{height:100%;text-align:center;overflow:hidden}\n"]
13717 },] }
13718 ];
13719 NbProgressBarComponent.ctorParameters = function () { return [
13720 { type: NbStatusService }
13721 ]; };
13722 NbProgressBarComponent.propDecorators = {
13723 value: [{ type: i0.Input }],
13724 status: [{ type: i0.Input }],
13725 size: [{ type: i0.Input }],
13726 displayValue: [{ type: i0.Input }],
13727 tiny: [{ type: i0.HostBinding, args: ['class.size-tiny',] }],
13728 small: [{ type: i0.HostBinding, args: ['class.size-small',] }],
13729 medium: [{ type: i0.HostBinding, args: ['class.size-medium',] }],
13730 large: [{ type: i0.HostBinding, args: ['class.size-large',] }],
13731 giant: [{ type: i0.HostBinding, args: ['class.size-giant',] }],
13732 primary: [{ type: i0.HostBinding, args: ['class.status-primary',] }],
13733 success: [{ type: i0.HostBinding, args: ['class.status-success',] }],
13734 info: [{ type: i0.HostBinding, args: ['class.status-info',] }],
13735 warning: [{ type: i0.HostBinding, args: ['class.status-warning',] }],
13736 danger: [{ type: i0.HostBinding, args: ['class.status-danger',] }],
13737 basic: [{ type: i0.HostBinding, args: ['class.status-basic',] }],
13738 control: [{ type: i0.HostBinding, args: ['class.status-control',] }],
13739 additionalClasses: [{ type: i0.HostBinding, args: ['class',] }]
13740 };
13741 return NbProgressBarComponent;
13742}());
13743
13744/**
13745 * @license
13746 * Copyright Akveo. All Rights Reserved.
13747 * Licensed under the MIT License. See License.txt in the project root for license information.
13748 */
13749var NbProgressBarModule = /** @class */ (function () {
13750 function NbProgressBarModule() {
13751 }
13752 NbProgressBarModule.decorators = [
13753 { type: i0.NgModule, args: [{
13754 imports: [
13755 NbSharedModule,
13756 ],
13757 declarations: [NbProgressBarComponent],
13758 exports: [NbProgressBarComponent],
13759 },] }
13760 ];
13761 return NbProgressBarModule;
13762}());
13763
13764/**
13765 * @license
13766 * Copyright Akveo. All Rights Reserved.
13767 * Licensed under the MIT License. See License.txt in the project root for license information.
13768 */
13769/**
13770 * Alert component.
13771 *
13772 * Basic alert example:
13773 * @stacked-example(Showcase, alert/alert-showcase.component)
13774 *
13775 * Alert configuration:
13776 *
13777 * ```html
13778 * <nb-alert status="success">
13779 * You have been successfully authenticated!
13780 * </nb-alert>
13781 * ```
13782 * ### Installation
13783 *
13784 * Import `NbAlertModule` to your feature module.
13785 * ```ts
13786 * @NgModule({
13787 * imports: [
13788 * // ...
13789 * NbAlertModule,
13790 * ],
13791 * })
13792 * export class PageModule { }
13793 * ```
13794 * ### Usage
13795 *
13796 * Alert could additionally have a `close` button when `closable` property is set:
13797 * ```html
13798 * <nb-alert status="success" closable (close)="onClose()">
13799 * You have been successfully authenticated!
13800 * </nb-alert>
13801 * ```
13802 *
13803 * Colored alerts could be simply configured by providing a `status` property:
13804 * @stacked-example(Alert status, alert/alert-colors.component)
13805 *
13806 * It is also possible to assign an `accent` property for a slight alert highlight
13807 * as well as combine it with `status`:
13808 * @stacked-example(Alert accent, alert/alert-accents.component)
13809 *
13810 * And `outline` property:
13811 * @stacked-example(Outline Alert, alert/alert-outline.component)
13812 *
13813 * @additional-example(Multiple Sizes, alert/alert-sizes.component)
13814 *
13815 * @styles
13816 *
13817 * alert-border-radius:
13818 * alert-bottom-margin:
13819 * alert-padding:
13820 * alert-scrollbar-color:
13821 * alert-scrollbar-background-color:
13822 * alert-scrollbar-width:
13823 * alert-shadow:
13824 * alert-text-font-family:
13825 * alert-text-font-size:
13826 * alert-text-font-weight:
13827 * alert-text-line-height:
13828 * alert-closable-start-padding:
13829 * alert-tiny-height:
13830 * alert-small-height:
13831 * alert-medium-height:
13832 * alert-medium-padding:
13833 * alert-large-height:
13834 * alert-giant-height:
13835 * alert-basic-background-color:
13836 * alert-basic-text-color:
13837 * alert-primary-background-color:
13838 * alert-primary-text-color:
13839 * alert-success-background-color:
13840 * alert-success-text-color:
13841 * alert-info-background-color:
13842 * alert-info-text-color:
13843 * alert-warning-background-color:
13844 * alert-warning-text-color:
13845 * alert-danger-background-color:
13846 * alert-danger-text-color:
13847 * alert-control-background-color:
13848 * alert-control-text-color:
13849 * alert-accent-basic-color:
13850 * alert-accent-primary-color:
13851 * alert-accent-info-color:
13852 * alert-accent-success-color:
13853 * alert-accent-warning-color:
13854 * alert-accent-danger-color:
13855 * alert-accent-control-color:
13856 * alert-outline-width:
13857 * alert-outline-basic-color:
13858 * alert-outline-primary-color:
13859 * alert-outline-info-color:
13860 * alert-outline-success-color:
13861 * alert-outline-warning-color:
13862 * alert-outline-danger-color:
13863 * alert-outline-control-color:
13864 */
13865var NbAlertComponent = /** @class */ (function () {
13866 function NbAlertComponent(statusService) {
13867 this.statusService = statusService;
13868 /**
13869 * Alert size, available sizes:
13870 * `tiny`, `small`, `medium`, `large`, `giant`
13871 * Unset by default.
13872 */
13873 this.size = '';
13874 /**
13875 * Alert status (adds specific styles):
13876 * `basic` (default), `primary`, `success`, `info`, `warning`, `danger`, `control`.
13877 */
13878 this.status = 'basic';
13879 /**
13880 * Alert accent (color of the top border):
13881 * `basic`, `primary`, `success`, `info`, `warning`, `danger`, `control`.
13882 * Unset by default.
13883 */
13884 this.accent = '';
13885 /**
13886 * Alert outline (color of the border):
13887 * `basic`, `primary`, `success`, `info`, `warning`, `danger`, `control`.
13888 * Unset by default.
13889 */
13890 this.outline = '';
13891 this._closable = false;
13892 /**
13893 * Emits when chip is removed
13894 * @type EventEmitter<any>
13895 */
13896 this.close = new i0.EventEmitter();
13897 }
13898 Object.defineProperty(NbAlertComponent.prototype, "closable", {
13899 /**
13900 * Shows `close` icon
13901 */
13902 get: function () {
13903 return this._closable;
13904 },
13905 set: function (value) {
13906 this._closable = convertToBoolProperty(value);
13907 },
13908 enumerable: false,
13909 configurable: true
13910 });
13911 /**
13912 * Emits the removed chip event
13913 */
13914 NbAlertComponent.prototype.onClose = function () {
13915 this.close.emit();
13916 };
13917 Object.defineProperty(NbAlertComponent.prototype, "tiny", {
13918 get: function () {
13919 return this.size === 'tiny';
13920 },
13921 enumerable: false,
13922 configurable: true
13923 });
13924 Object.defineProperty(NbAlertComponent.prototype, "small", {
13925 get: function () {
13926 return this.size === 'small';
13927 },
13928 enumerable: false,
13929 configurable: true
13930 });
13931 Object.defineProperty(NbAlertComponent.prototype, "medium", {
13932 get: function () {
13933 return this.size === 'medium';
13934 },
13935 enumerable: false,
13936 configurable: true
13937 });
13938 Object.defineProperty(NbAlertComponent.prototype, "large", {
13939 get: function () {
13940 return this.size === 'large';
13941 },
13942 enumerable: false,
13943 configurable: true
13944 });
13945 Object.defineProperty(NbAlertComponent.prototype, "giant", {
13946 get: function () {
13947 return this.size === 'giant';
13948 },
13949 enumerable: false,
13950 configurable: true
13951 });
13952 Object.defineProperty(NbAlertComponent.prototype, "primary", {
13953 get: function () {
13954 return this.status === 'primary';
13955 },
13956 enumerable: false,
13957 configurable: true
13958 });
13959 Object.defineProperty(NbAlertComponent.prototype, "success", {
13960 get: function () {
13961 return this.status === 'success';
13962 },
13963 enumerable: false,
13964 configurable: true
13965 });
13966 Object.defineProperty(NbAlertComponent.prototype, "info", {
13967 get: function () {
13968 return this.status === 'info';
13969 },
13970 enumerable: false,
13971 configurable: true
13972 });
13973 Object.defineProperty(NbAlertComponent.prototype, "warning", {
13974 get: function () {
13975 return this.status === 'warning';
13976 },
13977 enumerable: false,
13978 configurable: true
13979 });
13980 Object.defineProperty(NbAlertComponent.prototype, "danger", {
13981 get: function () {
13982 return this.status === 'danger';
13983 },
13984 enumerable: false,
13985 configurable: true
13986 });
13987 Object.defineProperty(NbAlertComponent.prototype, "basic", {
13988 get: function () {
13989 return this.status === 'basic';
13990 },
13991 enumerable: false,
13992 configurable: true
13993 });
13994 Object.defineProperty(NbAlertComponent.prototype, "control", {
13995 get: function () {
13996 return this.status === 'control';
13997 },
13998 enumerable: false,
13999 configurable: true
14000 });
14001 Object.defineProperty(NbAlertComponent.prototype, "primaryAccent", {
14002 get: function () {
14003 return this.accent === 'primary';
14004 },
14005 enumerable: false,
14006 configurable: true
14007 });
14008 Object.defineProperty(NbAlertComponent.prototype, "successAccent", {
14009 get: function () {
14010 return this.accent === 'success';
14011 },
14012 enumerable: false,
14013 configurable: true
14014 });
14015 Object.defineProperty(NbAlertComponent.prototype, "infoAccent", {
14016 get: function () {
14017 return this.accent === 'info';
14018 },
14019 enumerable: false,
14020 configurable: true
14021 });
14022 Object.defineProperty(NbAlertComponent.prototype, "warningAccent", {
14023 get: function () {
14024 return this.accent === 'warning';
14025 },
14026 enumerable: false,
14027 configurable: true
14028 });
14029 Object.defineProperty(NbAlertComponent.prototype, "dangerAccent", {
14030 get: function () {
14031 return this.accent === 'danger';
14032 },
14033 enumerable: false,
14034 configurable: true
14035 });
14036 Object.defineProperty(NbAlertComponent.prototype, "basicAccent", {
14037 get: function () {
14038 return this.accent === 'basic';
14039 },
14040 enumerable: false,
14041 configurable: true
14042 });
14043 Object.defineProperty(NbAlertComponent.prototype, "controlAccent", {
14044 get: function () {
14045 return this.accent === 'control';
14046 },
14047 enumerable: false,
14048 configurable: true
14049 });
14050 Object.defineProperty(NbAlertComponent.prototype, "primaryOutline", {
14051 get: function () {
14052 return this.outline === 'primary';
14053 },
14054 enumerable: false,
14055 configurable: true
14056 });
14057 Object.defineProperty(NbAlertComponent.prototype, "successOutline", {
14058 get: function () {
14059 return this.outline === 'success';
14060 },
14061 enumerable: false,
14062 configurable: true
14063 });
14064 Object.defineProperty(NbAlertComponent.prototype, "infoOutline", {
14065 get: function () {
14066 return this.outline === 'info';
14067 },
14068 enumerable: false,
14069 configurable: true
14070 });
14071 Object.defineProperty(NbAlertComponent.prototype, "warningOutline", {
14072 get: function () {
14073 return this.outline === 'warning';
14074 },
14075 enumerable: false,
14076 configurable: true
14077 });
14078 Object.defineProperty(NbAlertComponent.prototype, "dangerOutline", {
14079 get: function () {
14080 return this.outline === 'danger';
14081 },
14082 enumerable: false,
14083 configurable: true
14084 });
14085 Object.defineProperty(NbAlertComponent.prototype, "basicOutline", {
14086 get: function () {
14087 return this.outline === 'basic';
14088 },
14089 enumerable: false,
14090 configurable: true
14091 });
14092 Object.defineProperty(NbAlertComponent.prototype, "controlOutline", {
14093 get: function () {
14094 return this.outline === 'control';
14095 },
14096 enumerable: false,
14097 configurable: true
14098 });
14099 Object.defineProperty(NbAlertComponent.prototype, "additionalClasses", {
14100 get: function () {
14101 if (this.statusService.isCustomStatus(this.status)) {
14102 return [this.statusService.getStatusClass(this.status)];
14103 }
14104 return [];
14105 },
14106 enumerable: false,
14107 configurable: true
14108 });
14109 NbAlertComponent.decorators = [
14110 { type: i0.Component, args: [{
14111 selector: 'nb-alert',
14112 template: "\n <button *ngIf=\"closable\" type=\"button\" class=\"close\" aria-label=\"Close\" (click)=\"onClose()\">\n <span aria-hidden=\"true\">&times;</span>\n </button>\n <ng-content></ng-content>\n ",
14113 styles: [":host{display:flex;flex-direction:column;position:relative}[dir=ltr] :host .close{right:0}[dir=rtl] :host .close{left:0}.close{position:absolute;top:0;color:inherit;background-color:transparent;border:0;appearance:none}\n"]
14114 },] }
14115 ];
14116 NbAlertComponent.ctorParameters = function () { return [
14117 { type: NbStatusService }
14118 ]; };
14119 NbAlertComponent.propDecorators = {
14120 size: [{ type: i0.Input }],
14121 status: [{ type: i0.Input }],
14122 accent: [{ type: i0.Input }],
14123 outline: [{ type: i0.Input }],
14124 closable: [{ type: i0.Input }, { type: i0.HostBinding, args: ['class.closable',] }],
14125 close: [{ type: i0.Output }],
14126 tiny: [{ type: i0.HostBinding, args: ['class.size-tiny',] }],
14127 small: [{ type: i0.HostBinding, args: ['class.size-small',] }],
14128 medium: [{ type: i0.HostBinding, args: ['class.size-medium',] }],
14129 large: [{ type: i0.HostBinding, args: ['class.size-large',] }],
14130 giant: [{ type: i0.HostBinding, args: ['class.size-giant',] }],
14131 primary: [{ type: i0.HostBinding, args: ['class.status-primary',] }],
14132 success: [{ type: i0.HostBinding, args: ['class.status-success',] }],
14133 info: [{ type: i0.HostBinding, args: ['class.status-info',] }],
14134 warning: [{ type: i0.HostBinding, args: ['class.status-warning',] }],
14135 danger: [{ type: i0.HostBinding, args: ['class.status-danger',] }],
14136 basic: [{ type: i0.HostBinding, args: ['class.status-basic',] }],
14137 control: [{ type: i0.HostBinding, args: ['class.status-control',] }],
14138 primaryAccent: [{ type: i0.HostBinding, args: ['class.accent-primary',] }],
14139 successAccent: [{ type: i0.HostBinding, args: ['class.accent-success',] }],
14140 infoAccent: [{ type: i0.HostBinding, args: ['class.accent-info',] }],
14141 warningAccent: [{ type: i0.HostBinding, args: ['class.accent-warning',] }],
14142 dangerAccent: [{ type: i0.HostBinding, args: ['class.accent-danger',] }],
14143 basicAccent: [{ type: i0.HostBinding, args: ['class.accent-basic',] }],
14144 controlAccent: [{ type: i0.HostBinding, args: ['class.accent-control',] }],
14145 primaryOutline: [{ type: i0.HostBinding, args: ['class.outline-primary',] }],
14146 successOutline: [{ type: i0.HostBinding, args: ['class.outline-success',] }],
14147 infoOutline: [{ type: i0.HostBinding, args: ['class.outline-info',] }],
14148 warningOutline: [{ type: i0.HostBinding, args: ['class.outline-warning',] }],
14149 dangerOutline: [{ type: i0.HostBinding, args: ['class.outline-danger',] }],
14150 basicOutline: [{ type: i0.HostBinding, args: ['class.outline-basic',] }],
14151 controlOutline: [{ type: i0.HostBinding, args: ['class.outline-control',] }],
14152 additionalClasses: [{ type: i0.HostBinding, args: ['class',] }]
14153 };
14154 return NbAlertComponent;
14155}());
14156
14157/**
14158 * @license
14159 * Copyright Akveo. All Rights Reserved.
14160 * Licensed under the MIT License. See License.txt in the project root for license information.
14161 */
14162var NbAlertModule = /** @class */ (function () {
14163 function NbAlertModule() {
14164 }
14165 NbAlertModule.decorators = [
14166 { type: i0.NgModule, args: [{
14167 imports: [
14168 NbSharedModule,
14169 ],
14170 declarations: [
14171 NbAlertComponent,
14172 ],
14173 exports: [
14174 NbAlertComponent,
14175 ],
14176 },] }
14177 ];
14178 return NbAlertModule;
14179}());
14180
14181/**
14182 * @license
14183 * Copyright Akveo. All Rights Reserved.
14184 * Licensed under the MIT License. See License.txt in the project root for license information.
14185 */
14186/**
14187 * Chat form component.
14188 *
14189 * Show a message form with a send message button.
14190 *
14191 * ```ts
14192 * <nb-chat-form showButton="true" buttonIcon="nb-send">
14193 * </nb-chat-form>
14194 * ```
14195 *
14196 * When `[dropFiles]="true"` handles files drag&drop with a file preview.
14197 *
14198 * Drag & drop available for files and images:
14199 * @stacked-example(Drag & Drop Chat, chat/chat-drop.component)
14200 *
14201 * New message could be tracked outside by using `(send)` output.
14202 *
14203 * ```ts
14204 * <nb-chat-form (send)="onNewMessage($event)">
14205 * </nb-chat-form>
14206 *
14207 * // ...
14208 *
14209 * onNewMessage({ message: string, files: any[] }) {
14210 * this.service.sendToServer(message, files);
14211 * }
14212 * ```
14213 */
14214var NbChatFormComponent = /** @class */ (function () {
14215 function NbChatFormComponent(cd, domSanitizer) {
14216 this.cd = cd;
14217 this.domSanitizer = domSanitizer;
14218 this.status = 'basic';
14219 this.inputFocus = false;
14220 this.inputHover = false;
14221 this.droppedFiles = [];
14222 this.imgDropTypes = ['image/png', 'image/jpeg', 'image/gif'];
14223 /**
14224 * Predefined message text
14225 * @type {string}
14226 */
14227 this.message = '';
14228 /**
14229 * Message placeholder text
14230 * @type {string}
14231 */
14232 this.messagePlaceholder = 'Type a message';
14233 /**
14234 * Send button title
14235 * @type {string}
14236 */
14237 this.buttonTitle = '';
14238 /**
14239 * Send button icon, shown if `buttonTitle` is empty
14240 * @type {string}
14241 */
14242 this.buttonIcon = 'paper-plane-outline';
14243 /**
14244 * Show send button
14245 * @type {boolean}
14246 */
14247 this.showButton = true;
14248 /**
14249 * Show send button
14250 * @type {boolean}
14251 */
14252 this.dropFiles = false;
14253 /**
14254 * File drop placeholder text
14255 * @type {string}
14256 */
14257 this.dropFilePlaceholder = 'Drop file to send';
14258 /**
14259 *
14260 * @type {EventEmitter<{ message: string, files: File[] }>}
14261 */
14262 this.send = new i0.EventEmitter();
14263 /**
14264 * Emits when message input value has been changed
14265 * @type {EventEmitter<string>}
14266 */
14267 this.onInputChange = new i0.EventEmitter();
14268 this.fileOver = false;
14269 }
14270 NbChatFormComponent.prototype.onDrop = function (event) {
14271 var _this = this;
14272 if (this.dropFiles) {
14273 event.preventDefault();
14274 event.stopPropagation();
14275 this.fileOver = false;
14276 if (event.dataTransfer && event.dataTransfer.files) {
14277 var _loop_1 = function (file) {
14278 var res = file;
14279 if (this_1.imgDropTypes.includes(file.type)) {
14280 var fr = new FileReader();
14281 fr.onload = function (e) {
14282 res.src = e.target.result;
14283 res.urlStyle = _this.domSanitizer.bypassSecurityTrustStyle("url(" + res.src + ")");
14284 _this.cd.detectChanges();
14285 };
14286 fr.readAsDataURL(file);
14287 }
14288 this_1.droppedFiles.push(res);
14289 };
14290 var this_1 = this;
14291 for (var _i = 0, _a = event.dataTransfer.files; _i < _a.length; _i++) {
14292 var file = _a[_i];
14293 _loop_1(file);
14294 }
14295 }
14296 }
14297 };
14298 NbChatFormComponent.prototype.removeFile = function (file) {
14299 var index = this.droppedFiles.indexOf(file);
14300 if (index >= 0) {
14301 this.droppedFiles.splice(index, 1);
14302 }
14303 };
14304 NbChatFormComponent.prototype.onDragOver = function () {
14305 if (this.dropFiles) {
14306 this.fileOver = true;
14307 }
14308 };
14309 NbChatFormComponent.prototype.onDragLeave = function () {
14310 if (this.dropFiles) {
14311 this.fileOver = false;
14312 }
14313 };
14314 NbChatFormComponent.prototype.sendMessage = function () {
14315 if (this.droppedFiles.length || String(this.message).trim().length) {
14316 this.send.emit({ message: this.message, files: this.droppedFiles });
14317 this.message = '';
14318 this.droppedFiles = [];
14319 }
14320 };
14321 NbChatFormComponent.prototype.setStatus = function (status) {
14322 if (this.status !== status) {
14323 this.status = status;
14324 this.cd.detectChanges();
14325 }
14326 };
14327 NbChatFormComponent.prototype.getInputStatus = function () {
14328 if (this.fileOver) {
14329 return this.getHighlightStatus();
14330 }
14331 if (this.inputFocus || this.inputHover) {
14332 return this.status;
14333 }
14334 return 'basic';
14335 };
14336 NbChatFormComponent.prototype.getButtonStatus = function () {
14337 return this.getHighlightStatus();
14338 };
14339 NbChatFormComponent.prototype.getHighlightStatus = function () {
14340 if (this.status === 'basic' || this.status === 'control') {
14341 return 'primary';
14342 }
14343 return this.status;
14344 };
14345 NbChatFormComponent.prototype.onModelChange = function (value) {
14346 this.onInputChange.emit(value);
14347 };
14348 NbChatFormComponent.decorators = [
14349 { type: i0.Component, args: [{
14350 selector: 'nb-chat-form',
14351 template: "\n <div class=\"dropped-files\" *ngIf=\"droppedFiles?.length\">\n <ng-container *ngFor=\"let file of droppedFiles\">\n <div *ngIf=\"file.urlStyle\" [style.background-image]=\"file.urlStyle\">\n <span class=\"remove\" (click)=\"removeFile(file)\">&times;</span>\n </div>\n\n <div *ngIf=\"!file.urlStyle\">\n <nb-icon icon=\"file-text-outline\" pack=\"nebular-essentials\"></nb-icon>\n <span class=\"remove\" (click)=\"removeFile(file)\">&times;</span>\n </div>\n </ng-container>\n </div>\n <div class=\"message-row\">\n <input nbInput\n fullWidth\n [status]=\"getInputStatus()\"\n (focus)=\"inputFocus = true\"\n (blur)=\"inputFocus = false\"\n (mouseenter)=\"inputHover = true\"\n (mouseleave)=\"inputHover = false\"\n [(ngModel)]=\"message\"\n (ngModelChange)=\"onModelChange($event)\"\n [class.with-button]=\"showButton\"\n type=\"text\"\n placeholder=\"{{ fileOver ? dropFilePlaceholder : messagePlaceholder }}\"\n (keyup.enter)=\"sendMessage()\">\n <button nbButton\n [status]=\"getButtonStatus()\"\n *ngIf=\"showButton\"\n [class.with-icon]=\"!buttonTitle\"\n (click)=\"sendMessage()\"\n class=\"send-button\">\n <nb-icon *ngIf=\"!buttonTitle; else title\" [icon]=\"buttonIcon\" pack=\"nebular-essentials\"></nb-icon>\n <ng-template #title>{{ buttonTitle }}</ng-template>\n </button>\n </div>\n ",
14352 changeDetection: i0.ChangeDetectionStrategy.OnPush
14353 },] }
14354 ];
14355 NbChatFormComponent.ctorParameters = function () { return [
14356 { type: i0.ChangeDetectorRef },
14357 { type: _angular_platformBrowser.DomSanitizer }
14358 ]; };
14359 NbChatFormComponent.propDecorators = {
14360 message: [{ type: i0.Input }],
14361 messagePlaceholder: [{ type: i0.Input }],
14362 buttonTitle: [{ type: i0.Input }],
14363 buttonIcon: [{ type: i0.Input }],
14364 showButton: [{ type: i0.Input }],
14365 dropFiles: [{ type: i0.Input }],
14366 dropFilePlaceholder: [{ type: i0.Input }],
14367 send: [{ type: i0.Output }],
14368 onInputChange: [{ type: i0.Output }],
14369 fileOver: [{ type: i0.HostBinding, args: ['class.file-over',] }],
14370 onDrop: [{ type: i0.HostListener, args: ['drop', ['$event'],] }],
14371 onDragOver: [{ type: i0.HostListener, args: ['dragover',] }],
14372 onDragLeave: [{ type: i0.HostListener, args: ['dragleave',] }]
14373 };
14374 return NbChatFormComponent;
14375}());
14376
14377/**
14378 * `NbCustomMessageService` is used to store instances of `NbChatCustomMessageDirective`s which
14379 * were provided in the chat component.
14380 */
14381var NbCustomMessageService = /** @class */ (function () {
14382 function NbCustomMessageService() {
14383 this.customMessages = new Map();
14384 }
14385 NbCustomMessageService.prototype.register = function (type, instance) {
14386 this.customMessages.set(type, instance);
14387 };
14388 NbCustomMessageService.prototype.unregister = function (type) {
14389 return this.customMessages.delete(type);
14390 };
14391 NbCustomMessageService.prototype.getInstance = function (type) {
14392 return this.customMessages.get(type);
14393 };
14394 NbCustomMessageService.decorators = [
14395 { type: i0.Injectable }
14396 ];
14397 return NbCustomMessageService;
14398}());
14399
14400/**
14401 * @license
14402 * Copyright Akveo. All Rights Reserved.
14403 * Licensed under the MIT License. See License.txt in the project root for license information.
14404 */
14405/**
14406 * Chat message component.
14407 *
14408 * Multiple message types are available through a `type` property, such as
14409 * - text - simple text message
14410 * - file - could be a file preview or a file icon
14411 * if multiple files are provided grouped files are shown
14412 * - quote - quotes a message with specific quote styles
14413 * - map - shows a google map picture by provided [latitude] and [longitude] properties
14414 *
14415 * @stacked-example(Available Types, chat/chat-message-types-showcase.component)
14416 *
14417 * Message with attached files:
14418 * ```html
14419 * <nb-chat-message
14420 * type="file"
14421 * [files]="[ { url: '...' } ]"
14422 * message="Hello world!">
14423 * </nb-chat-message>
14424 * ```
14425 *
14426 * Map message:
14427 * ```html
14428 * <nb-chat-message
14429 * type="map"
14430 * [latitude]="53.914"
14431 * [longitude]="27.59"
14432 * message="Here I am">
14433 * </nb-chat-message>
14434 * ```
14435 *
14436 * @styles
14437 *
14438 * chat-message-background:
14439 * chat-message-text-color:
14440 * chat-message-reply-background-color:
14441 * chat-message-reply-text-color:
14442 * chat-message-avatar-background-color:
14443 * chat-message-sender-text-color:
14444 * chat-message-quote-background-color:
14445 * chat-message-quote-text-color:
14446 * chat-message-file-text-color:
14447 * chat-message-file-background-color:
14448 */
14449var NbChatMessageComponent = /** @class */ (function () {
14450 function NbChatMessageComponent(domSanitizer, customMessageService) {
14451 this.domSanitizer = domSanitizer;
14452 this.customMessageService = customMessageService;
14453 this.builtInMessageTypes = ['text', 'file', 'map', 'quote'];
14454 this._reply = false;
14455 }
14456 Object.defineProperty(NbChatMessageComponent.prototype, "_addReplyClass", {
14457 get: function () {
14458 return this._areDefaultStylesEnabled() && this.reply;
14459 },
14460 enumerable: false,
14461 configurable: true
14462 });
14463 Object.defineProperty(NbChatMessageComponent.prototype, "_addNotReplyClass", {
14464 get: function () {
14465 return this._areDefaultStylesEnabled() && this.notReply;
14466 },
14467 enumerable: false,
14468 configurable: true
14469 });
14470 Object.defineProperty(NbChatMessageComponent.prototype, "_addNoSpaceClass", {
14471 get: function () {
14472 return this._areDefaultStylesEnabled() && !this.message;
14473 },
14474 enumerable: false,
14475 configurable: true
14476 });
14477 Object.defineProperty(NbChatMessageComponent.prototype, "flyInOut", {
14478 get: function () {
14479 return true;
14480 },
14481 enumerable: false,
14482 configurable: true
14483 });
14484 Object.defineProperty(NbChatMessageComponent.prototype, "notReply", {
14485 get: function () {
14486 return !this.reply;
14487 },
14488 enumerable: false,
14489 configurable: true
14490 });
14491 Object.defineProperty(NbChatMessageComponent.prototype, "reply", {
14492 /**
14493 * Determines if a message is a reply
14494 */
14495 get: function () {
14496 return this._reply;
14497 },
14498 set: function (value) {
14499 this._reply = convertToBoolProperty(value);
14500 },
14501 enumerable: false,
14502 configurable: true
14503 });
14504 Object.defineProperty(NbChatMessageComponent.prototype, "avatar", {
14505 /**
14506 * Message send avatar
14507 * @type {string}
14508 */
14509 set: function (value) {
14510 this.avatarStyle = value ? this.domSanitizer.bypassSecurityTrustStyle("url(" + value + ")") : null;
14511 },
14512 enumerable: false,
14513 configurable: true
14514 });
14515 NbChatMessageComponent.prototype.getInitials = function () {
14516 if (this.sender) {
14517 var names = this.sender.split(' ');
14518 return names.map(function (n) { return n.charAt(0); }).splice(0, 2).join('').toUpperCase();
14519 }
14520 return '';
14521 };
14522 NbChatMessageComponent.prototype._isBuiltInMessageType = function () {
14523 // Unset type defaults to "text" type
14524 return this.type == null || this.builtInMessageTypes.includes(this.type);
14525 };
14526 NbChatMessageComponent.prototype._getTemplate = function () {
14527 var customMessage = this.getCustomMessage(this.type);
14528 return customMessage.templateRef;
14529 };
14530 NbChatMessageComponent.prototype._getTemplateContext = function () {
14531 return { $implicit: this.customMessageData, isReply: this.reply };
14532 };
14533 NbChatMessageComponent.prototype._areDefaultStylesEnabled = function () {
14534 var customMessageDirective = this.getCustomMessage(this.type);
14535 return !customMessageDirective.noStyles;
14536 };
14537 NbChatMessageComponent.prototype.getCustomMessage = function (type) {
14538 var customMessageDirective = this.customMessageService.getInstance(type);
14539 if (!customMessageDirective) {
14540 throw new Error("nb-chat: Can't find template for custom type '" + type + "'. " +
14541 ("Make sure you provide it in the chat component with *nbCustomMessage='" + type + "'."));
14542 }
14543 return customMessageDirective;
14544 };
14545 NbChatMessageComponent.decorators = [
14546 { type: i0.Component, args: [{
14547 selector: 'nb-chat-message',
14548 template: "\n <nb-chat-avatar *ngIf=\"notReply\"\n [initials]=\"getInitials()\"\n [avatarStyle]=\"avatarStyle\">\n </nb-chat-avatar>\n\n <div class=\"message\">\n <ng-container [ngSwitch]=\"type\" *ngIf=\"_isBuiltInMessageType(); else customTemplate\">\n <nb-chat-message-file *ngSwitchCase=\"'file'\"\n [sender]=\"sender\"\n [date]=\"date\"\n [dateFormat]=\"dateFormat\"\n [message]=\"message\"\n [files]=\"files\">\n </nb-chat-message-file>\n\n <nb-chat-message-quote *ngSwitchCase=\"'quote'\"\n [sender]=\"sender\"\n [date]=\"date\"\n [dateFormat]=\"dateFormat\"\n [message]=\"message\"\n [quote]=\"quote\">\n </nb-chat-message-quote>\n\n <nb-chat-message-map *ngSwitchCase=\"'map'\"\n [sender]=\"sender\"\n [date]=\"date\"\n [message]=\"message\"\n [latitude]=\"latitude\"\n [longitude]=\"longitude\">\n </nb-chat-message-map>\n\n <nb-chat-message-text *ngSwitchDefault\n [sender]=\"sender\"\n [date]=\"date\"\n [dateFormat]=\"dateFormat\"\n [message]=\"message\">\n </nb-chat-message-text>\n </ng-container>\n </div>\n\n <ng-template #customTemplate>\n <nb-chat-message-text [sender]=\"sender\"\n [date]=\"date\"\n [dateFormat]=\"dateFormat\"\n [message]=\"message\">\n </nb-chat-message-text>\n <div [class.nb-custom-message]=\"_areDefaultStylesEnabled()\"\n [class.nb-custom-message-no-space]=\"_addNoSpaceClass\"\n [class.nb-custom-message-reply]=\"_addReplyClass\"\n [class.nb-custom-message-not-reply]=\"_addNotReplyClass\"\n [class.nb-custom-message-full-width]=\"!_areDefaultStylesEnabled()\">\n <ng-container [ngTemplateOutlet]=\"_getTemplate()\"\n [ngTemplateOutletContext]=\"_getTemplateContext()\">\n </ng-container>\n </div>\n </ng-template>\n ",
14549 animations: [
14550 _angular_animations.trigger('flyInOut', [
14551 _angular_animations.state('in', _angular_animations.style({ transform: 'translateX(0)' })),
14552 _angular_animations.transition('void => *', [
14553 _angular_animations.style({ transform: 'translateX(-100%)' }),
14554 _angular_animations.animate(80),
14555 ]),
14556 _angular_animations.transition('* => void', [
14557 _angular_animations.animate(80, _angular_animations.style({ transform: 'translateX(100%)' })),
14558 ]),
14559 ]),
14560 ],
14561 changeDetection: i0.ChangeDetectionStrategy.OnPush
14562 },] }
14563 ];
14564 NbChatMessageComponent.ctorParameters = function () { return [
14565 { type: _angular_platformBrowser.DomSanitizer },
14566 { type: NbCustomMessageService }
14567 ]; };
14568 NbChatMessageComponent.propDecorators = {
14569 flyInOut: [{ type: i0.HostBinding, args: ['@flyInOut',] }],
14570 notReply: [{ type: i0.HostBinding, args: ['class.not-reply',] }],
14571 reply: [{ type: i0.Input }, { type: i0.HostBinding, args: ['class.reply',] }],
14572 message: [{ type: i0.Input }],
14573 sender: [{ type: i0.Input }],
14574 date: [{ type: i0.Input }],
14575 dateFormat: [{ type: i0.Input }],
14576 files: [{ type: i0.Input }],
14577 quote: [{ type: i0.Input }],
14578 latitude: [{ type: i0.Input }],
14579 longitude: [{ type: i0.Input }],
14580 avatar: [{ type: i0.Input }],
14581 type: [{ type: i0.Input }],
14582 customMessageData: [{ type: i0.Input }]
14583 };
14584 return NbChatMessageComponent;
14585}());
14586
14587/**
14588 * @license
14589 * Copyright Akveo. All Rights Reserved.
14590 * Licensed under the MIT License. See License.txt in the project root for license information.
14591 */
14592/**
14593 * Conversational UI collection - a set of components for chat-like UI construction.
14594 *
14595 * Main features:
14596 * - different message types support (text, image, file, file group, map, etc)
14597 * - drag & drop for images and files with preview
14598 * - different UI styles
14599 * - custom action buttons (coming soon)
14600 *
14601 * Here's a complete example build in a bot-like app. Type `help` to be able to receive different message types.
14602 * Enjoy the conversation and the beautiful UI.
14603 * @stacked-example(Showcase, chat/chat-showcase.component)
14604 *
14605 * Basic chat configuration and usage:
14606 * ```ts
14607 * <nb-chat title="Nebular Conversational UI">
14608 * <nb-chat-message *ngFor="let msg of messages"
14609 * [type]="msg.type"
14610 * [message]="msg.text"
14611 * [reply]="msg.reply"
14612 * [sender]="msg.user.name"
14613 * [date]="msg.date"
14614 * [files]="msg.files"
14615 * [quote]="msg.quote"
14616 * [latitude]="msg.latitude"
14617 * [longitude]="msg.longitude"
14618 * [avatar]="msg.user.avatar">
14619 * </nb-chat-message>
14620 *
14621 * <nb-chat-form (send)="sendMessage($event)" [dropFiles]="true">
14622 * </nb-chat-form>
14623 * </nb-chat>
14624 * ```
14625 * ### Installation
14626 *
14627 * Import `NbChatModule` to your feature module.
14628 * ```ts
14629 * @NgModule({
14630 * imports: [
14631 * // ...
14632 * NbChatModule,
14633 * ],
14634 * })
14635 * export class PageModule { }
14636 * ```
14637 *
14638 * If you need to provide an API key for a `map` message type (which is required by Google Maps)
14639 * you may use `NbChatModule.forRoot({ ... })` call if this is a global app configuration
14640 * or `NbChatModule.forChild({ ... })` for a feature module configuration:
14641 *
14642 * ```ts
14643 * @NgModule({
14644 * imports: [
14645 * // ...
14646 * NbChatModule.forRoot({ messageGoogleMapKey: 'MAP_KEY' }),
14647 * ],
14648 * })
14649 * export class AppModule { }
14650 * ```
14651 *
14652 * ### Usage
14653 *
14654 * There are three main components:
14655 * ```ts
14656 * <nb-chat>
14657 * </nb-chat> // chat container
14658 *
14659 * <nb-chat-form>
14660 * </nb-chat-form> // chat form with drag&drop files feature
14661 *
14662 * <nb-chat-message>
14663 * </nb-chat-message> // chat message, available multiple types
14664 * ```
14665 *
14666 * Two users conversation showcase:
14667 * @stacked-example(Conversation, chat/chat-conversation-showcase.component)
14668 *
14669 * Chat UI is also available in different colors by specifying a `[status]` input:
14670 *
14671 * @stacked-example(Colored Chat, chat/chat-colors.component)
14672 *
14673 * Also it is possible to configure sizes through `[size]` input:
14674 *
14675 * @stacked-example(Chat Sizes, chat/chat-sizes.component)
14676 *
14677 * # Custom message types
14678 *
14679 * Besides built-in message types, you could provide custom ones with their own template to render.
14680 * As an example, let's add the `link` message type.
14681 * <br>
14682 * First, you need to provide a template for the `link` message type:
14683 * ```html
14684 * <nb-chat>
14685 * <a *nbCustomMessage="'link'" href="https://example.com">example.com</a>
14686 * </nb-chat>
14687 * ```
14688 * Then, add the `nb-chat-message` component with the `link` type:
14689 * ```html
14690 * <nb-chat>
14691 * <a *nbCustomMessage="'link'" href="https://example.com">example.com</a>
14692 * <nb-chat-message type="link"></nb-chat-message>
14693 * </nb-chat>
14694 * ```
14695 *
14696 * <div class="note note-warning">
14697 * <div class="note-title">Important!</div>
14698 * <div class="note-body">
14699 * Custom chat messages must be defined before the `nb-chat-message`.
14700 * </div>
14701 * </div>
14702 *
14703 * Custom message templates could have arbitrary data associated with them. Let's extract hardcoded link
14704 * href and text. To pass some data to the custom message template, use the `customMessageData` input
14705 * of the `nb-chat-message` component:
14706 * ```html
14707 * ...
14708 * <nb-chat-message type="link" [customMessageData]="{ href: 'https://example.com', text: 'example.com' }">
14709 * </nb-chat-message>
14710 * ...
14711 * ```
14712 * When `customMessageData` is set, this object would become a template context and you'll be able
14713 * to reference it via `let varName` syntax:
14714 * ```html
14715 * <a *nbCustomMessage="'link'; let data" [href]="data.href">{{ data.text }}</a>
14716 * ```
14717 *
14718 * That's it, full example will look like this:
14719 * ```html
14720 * <nb-chat title="Nebular Conversational UI">
14721 * <a *nbCustomMessage="'link'; let data" [href]="data.href">{{ data.text }}</a>
14722 * <nb-chat-message type="link" [customMessageData]="{ href: 'https://example.com', text: 'example.com' }">
14723 * </nb-chat-message>
14724 * </nb-chat>
14725 * ```
14726 *
14727 * If you want to style your custom template from the ground up you could turn off generic message styling
14728 * (such as round borders, color, background, etc.) via the `noStyles` input:
14729 * ```html
14730 * <div *nbCustomMessage="'my-custom-type'; noStyles: true">...</div>
14731 * ```
14732 * When you decide to use your own styles, the `isReply` property of the custom message template context
14733 * would come in handy. This property allows you to determine whether the message is a reply or not.
14734 * For example, to change link text color (as replies have a different background):
14735 * ```html
14736 * <a *nbCustomMessage="'link'; let data; let isReply=isReply"
14737 * [href]="data.href"
14738 * [class.link-control]="!isReply">
14739 * {{ data.label }}
14740 * </a>
14741 * ```
14742 *
14743 * Below, you could find a more complex example with multiple custom message types:
14744 * @stacked-example(Custom message, chat/chat-custom-message.component)
14745 *
14746 * @styles
14747 *
14748 * chat-background-color:
14749 * chat-border:
14750 * chat-border-radius:
14751 * chat-shadow:
14752 * chat-padding:
14753 * chat-scrollbar-color:
14754 * chat-scrollbar-background-color:
14755 * chat-scrollbar-width:
14756 * chat-text-color:
14757 * chat-text-font-family:
14758 * chat-text-font-size:
14759 * chat-text-font-weight:
14760 * chat-text-line-height:
14761 * chat-header-text-font-family:
14762 * chat-header-text-font-size:
14763 * chat-header-text-font-weight:
14764 * chat-header-text-line-height:
14765 * chat-tiny-height:
14766 * chat-small-height:
14767 * chat-medium-height:
14768 * chat-large-height:
14769 * chat-giant-height:
14770 * chat-basic-background-color:
14771 * chat-basic-text-color:
14772 * chat-primary-background-color:
14773 * chat-primary-text-color:
14774 * chat-success-background-color:
14775 * chat-success-text-color:
14776 * chat-info-background-color:
14777 * chat-info-text-color:
14778 * chat-warning-background-color:
14779 * chat-warning-text-color:
14780 * chat-danger-background-color:
14781 * chat-danger-text-color:
14782 * chat-control-background-color:
14783 * chat-control-text-color:
14784 * chat-divider-color:
14785 * chat-divider-style:
14786 * chat-divider-width:
14787 * chat-message-background:
14788 * chat-message-text-color:
14789 * chat-message-reply-background-color:
14790 * chat-message-reply-text-color:
14791 * chat-message-avatar-background-color:
14792 * chat-message-sender-text-color:
14793 * chat-message-quote-background-color:
14794 * chat-message-quote-text-color:
14795 * chat-message-file-text-color:
14796 * chat-message-file-background-color:
14797 */
14798var NbChatComponent = /** @class */ (function () {
14799 function NbChatComponent(statusService) {
14800 this.statusService = statusService;
14801 /**
14802 * Chat status color (adds specific styles):
14803 * `basic` (default), `primary`, `success`, `info`, `warning`, `danger`, `control`.
14804 */
14805 this.status = 'basic';
14806 this.noMessagesPlaceholder = 'No messages yet.';
14807 this._scrollBottom = true;
14808 }
14809 Object.defineProperty(NbChatComponent.prototype, "scrollBottom", {
14810 /**
14811 * Scroll chat to the bottom of the list when a new message arrives
14812 */
14813 get: function () {
14814 return this._scrollBottom;
14815 },
14816 set: function (value) {
14817 this._scrollBottom = convertToBoolProperty(value);
14818 },
14819 enumerable: false,
14820 configurable: true
14821 });
14822 NbChatComponent.prototype.ngOnChanges = function (changes) {
14823 if ('status' in changes) {
14824 this.updateFormStatus();
14825 }
14826 };
14827 NbChatComponent.prototype.ngAfterContentInit = function () {
14828 this.updateFormStatus();
14829 };
14830 NbChatComponent.prototype.ngAfterViewInit = function () {
14831 var _this = this;
14832 this.messages.changes
14833 .subscribe(function (messages) {
14834 _this.messages = messages;
14835 _this.updateView();
14836 });
14837 this.updateView();
14838 };
14839 NbChatComponent.prototype.updateView = function () {
14840 if (this.scrollBottom) {
14841 this.scrollListBottom();
14842 }
14843 };
14844 NbChatComponent.prototype.scrollListBottom = function () {
14845 this.scrollable.nativeElement.scrollTop = this.scrollable.nativeElement.scrollHeight;
14846 };
14847 NbChatComponent.prototype.updateFormStatus = function () {
14848 if (this.chatForm) {
14849 this.chatForm.setStatus(this.status);
14850 }
14851 };
14852 Object.defineProperty(NbChatComponent.prototype, "tiny", {
14853 get: function () {
14854 return this.size === 'tiny';
14855 },
14856 enumerable: false,
14857 configurable: true
14858 });
14859 Object.defineProperty(NbChatComponent.prototype, "small", {
14860 get: function () {
14861 return this.size === 'small';
14862 },
14863 enumerable: false,
14864 configurable: true
14865 });
14866 Object.defineProperty(NbChatComponent.prototype, "medium", {
14867 get: function () {
14868 return this.size === 'medium';
14869 },
14870 enumerable: false,
14871 configurable: true
14872 });
14873 Object.defineProperty(NbChatComponent.prototype, "large", {
14874 get: function () {
14875 return this.size === 'large';
14876 },
14877 enumerable: false,
14878 configurable: true
14879 });
14880 Object.defineProperty(NbChatComponent.prototype, "giant", {
14881 get: function () {
14882 return this.size === 'giant';
14883 },
14884 enumerable: false,
14885 configurable: true
14886 });
14887 Object.defineProperty(NbChatComponent.prototype, "primary", {
14888 get: function () {
14889 return this.status === 'primary';
14890 },
14891 enumerable: false,
14892 configurable: true
14893 });
14894 Object.defineProperty(NbChatComponent.prototype, "success", {
14895 get: function () {
14896 return this.status === 'success';
14897 },
14898 enumerable: false,
14899 configurable: true
14900 });
14901 Object.defineProperty(NbChatComponent.prototype, "info", {
14902 get: function () {
14903 return this.status === 'info';
14904 },
14905 enumerable: false,
14906 configurable: true
14907 });
14908 Object.defineProperty(NbChatComponent.prototype, "warning", {
14909 get: function () {
14910 return this.status === 'warning';
14911 },
14912 enumerable: false,
14913 configurable: true
14914 });
14915 Object.defineProperty(NbChatComponent.prototype, "danger", {
14916 get: function () {
14917 return this.status === 'danger';
14918 },
14919 enumerable: false,
14920 configurable: true
14921 });
14922 Object.defineProperty(NbChatComponent.prototype, "basic", {
14923 get: function () {
14924 return this.status === 'basic';
14925 },
14926 enumerable: false,
14927 configurable: true
14928 });
14929 Object.defineProperty(NbChatComponent.prototype, "control", {
14930 get: function () {
14931 return this.status === 'control';
14932 },
14933 enumerable: false,
14934 configurable: true
14935 });
14936 Object.defineProperty(NbChatComponent.prototype, "additionalClasses", {
14937 get: function () {
14938 if (this.statusService.isCustomStatus(this.status)) {
14939 return [this.statusService.getStatusClass(this.status)];
14940 }
14941 return [];
14942 },
14943 enumerable: false,
14944 configurable: true
14945 });
14946 NbChatComponent.decorators = [
14947 { type: i0.Component, args: [{
14948 selector: 'nb-chat',
14949 template: "\n <div class=\"header\">{{ title }}</div>\n <div class=\"scrollable\" #scrollable>\n <div class=\"messages\">\n <ng-content select=\"nb-chat-message\"></ng-content>\n <p class=\"no-messages\" *ngIf=\"!messages?.length\">{{ noMessagesPlaceholder }}</p>\n </div>\n </div>\n <div class=\"form\">\n <ng-content select=\"nb-chat-form\"></ng-content>\n </div>\n ",
14950 providers: [
14951 NbCustomMessageService,
14952 ],
14953 styles: [":host{display:flex;flex-direction:column;position:relative;height:100%}\n"]
14954 },] }
14955 ];
14956 NbChatComponent.ctorParameters = function () { return [
14957 { type: NbStatusService }
14958 ]; };
14959 NbChatComponent.propDecorators = {
14960 title: [{ type: i0.Input }],
14961 size: [{ type: i0.Input }],
14962 status: [{ type: i0.Input }],
14963 noMessagesPlaceholder: [{ type: i0.Input }],
14964 scrollBottom: [{ type: i0.Input }],
14965 scrollable: [{ type: i0.ViewChild, args: ['scrollable',] }],
14966 messages: [{ type: i0.ContentChildren, args: [NbChatMessageComponent,] }],
14967 chatForm: [{ type: i0.ContentChild, args: [NbChatFormComponent,] }],
14968 tiny: [{ type: i0.HostBinding, args: ['class.size-tiny',] }],
14969 small: [{ type: i0.HostBinding, args: ['class.size-small',] }],
14970 medium: [{ type: i0.HostBinding, args: ['class.size-medium',] }],
14971 large: [{ type: i0.HostBinding, args: ['class.size-large',] }],
14972 giant: [{ type: i0.HostBinding, args: ['class.size-giant',] }],
14973 primary: [{ type: i0.HostBinding, args: ['class.status-primary',] }],
14974 success: [{ type: i0.HostBinding, args: ['class.status-success',] }],
14975 info: [{ type: i0.HostBinding, args: ['class.status-info',] }],
14976 warning: [{ type: i0.HostBinding, args: ['class.status-warning',] }],
14977 danger: [{ type: i0.HostBinding, args: ['class.status-danger',] }],
14978 basic: [{ type: i0.HostBinding, args: ['class.status-basic',] }],
14979 control: [{ type: i0.HostBinding, args: ['class.status-control',] }],
14980 additionalClasses: [{ type: i0.HostBinding, args: ['class',] }]
14981 };
14982 return NbChatComponent;
14983}());
14984
14985/**
14986 * @license
14987 * Copyright Akveo. All Rights Reserved.
14988 * Licensed under the MIT License. See License.txt in the project root for license information.
14989 */
14990var NbChatOptions = /** @class */ (function () {
14991 function NbChatOptions() {
14992 }
14993 return NbChatOptions;
14994}());
14995
14996/**
14997 * @license
14998 * Copyright Akveo. All Rights Reserved.
14999 * Licensed under the MIT License. See License.txt in the project root for license information.
15000 */
15001/**
15002 * Chat message component.
15003 */
15004var NbChatMessageMapComponent = /** @class */ (function () {
15005 function NbChatMessageMapComponent(options) {
15006 /**
15007 * Message send date format, default 'shortTime'
15008 * @type {string}
15009 */
15010 this.dateFormat = 'shortTime';
15011 this.mapKey = options.messageGoogleMapKey;
15012 }
15013 Object.defineProperty(NbChatMessageMapComponent.prototype, "file", {
15014 get: function () {
15015 return {
15016 // tslint:disable-next-line:max-line-length
15017 url: "https://maps.googleapis.com/maps/api/staticmap?center=" + this.latitude + "," + this.longitude + "&zoom=12&size=400x400&key=" + this.mapKey,
15018 type: 'image/png',
15019 icon: 'location',
15020 };
15021 },
15022 enumerable: false,
15023 configurable: true
15024 });
15025 NbChatMessageMapComponent.decorators = [
15026 { type: i0.Component, args: [{
15027 selector: 'nb-chat-message-map',
15028 template: "\n <nb-chat-message-file [files]=\"[file]\" [message]=\"message\" [sender]=\"sender\" [date]=\"date\"\n [dateFormat]=\"dateFormat\"></nb-chat-message-file>\n ",
15029 changeDetection: i0.ChangeDetectionStrategy.OnPush
15030 },] }
15031 ];
15032 NbChatMessageMapComponent.ctorParameters = function () { return [
15033 { type: NbChatOptions }
15034 ]; };
15035 NbChatMessageMapComponent.propDecorators = {
15036 message: [{ type: i0.Input }],
15037 sender: [{ type: i0.Input }],
15038 date: [{ type: i0.Input }],
15039 dateFormat: [{ type: i0.Input }],
15040 latitude: [{ type: i0.Input }],
15041 longitude: [{ type: i0.Input }]
15042 };
15043 return NbChatMessageMapComponent;
15044}());
15045
15046/**
15047 * @license
15048 * Copyright Akveo. All Rights Reserved.
15049 * Licensed under the MIT License. See License.txt in the project root for license information.
15050 */
15051/**
15052 * Chat message component.
15053 */
15054var NbChatMessageFileComponent = /** @class */ (function () {
15055 function NbChatMessageFileComponent(cd, domSanitizer) {
15056 this.cd = cd;
15057 this.domSanitizer = domSanitizer;
15058 /**
15059 * Message send date format, default 'shortTime'
15060 * @type {string}
15061 */
15062 this.dateFormat = 'shortTime';
15063 }
15064 Object.defineProperty(NbChatMessageFileComponent.prototype, "files", {
15065 /**
15066 * Message file path
15067 * @type {Date}
15068 */
15069 set: function (files) {
15070 var _this = this;
15071 this.readyFiles = (files || []).map(function (file) {
15072 var isImage = _this.isImage(file);
15073 return tslib.__assign(tslib.__assign({}, file), { urlStyle: isImage && _this.domSanitizer.bypassSecurityTrustStyle("url(" + file.url + ")"), isImage: isImage });
15074 });
15075 this.cd.detectChanges();
15076 },
15077 enumerable: false,
15078 configurable: true
15079 });
15080 NbChatMessageFileComponent.prototype.isImage = function (file) {
15081 var type = file.type;
15082 if (type) {
15083 return ['image/png', 'image/jpeg', 'image/gif'].includes(type);
15084 }
15085 return false;
15086 };
15087 NbChatMessageFileComponent.decorators = [
15088 { type: i0.Component, args: [{
15089 selector: 'nb-chat-message-file',
15090 template: "\n <nb-chat-message-text [sender]=\"sender\" [date]=\"date\" [dateFormat]=\"dateFormat\" [message]=\"message\">\n {{ message }}\n </nb-chat-message-text>\n\n <ng-container *ngIf=\"readyFiles?.length > 1\">\n <div class=\"message-content-group\">\n <a *ngFor=\"let file of readyFiles\" [href]=\"file.url\" target=\"_blank\">\n <nb-icon [icon]=\"file.icon\" *ngIf=\"!file.urlStyle && file.icon\"></nb-icon>\n <div *ngIf=\"file.urlStyle\" [style.background-image]=\"file.urlStyle\"></div>\n </a>\n </div>\n </ng-container>\n\n <ng-container *ngIf=\"readyFiles?.length === 1\">\n <a [href]=\"readyFiles[0].url\" target=\"_blank\">\n <nb-icon [icon]=\"readyFiles[0].icon\" *ngIf=\"!readyFiles[0].urlStyle && readyFiles[0].icon\"></nb-icon>\n <div *ngIf=\"readyFiles[0].urlStyle\" [style.background-image]=\"readyFiles[0].urlStyle\"></div>\n </a>\n </ng-container>\n ",
15091 changeDetection: i0.ChangeDetectionStrategy.OnPush
15092 },] }
15093 ];
15094 NbChatMessageFileComponent.ctorParameters = function () { return [
15095 { type: i0.ChangeDetectorRef },
15096 { type: _angular_platformBrowser.DomSanitizer }
15097 ]; };
15098 NbChatMessageFileComponent.propDecorators = {
15099 message: [{ type: i0.Input }],
15100 sender: [{ type: i0.Input }],
15101 date: [{ type: i0.Input }],
15102 dateFormat: [{ type: i0.Input }],
15103 files: [{ type: i0.Input }]
15104 };
15105 return NbChatMessageFileComponent;
15106}());
15107
15108/**
15109 * @license
15110 * Copyright Akveo. All Rights Reserved.
15111 * Licensed under the MIT License. See License.txt in the project root for license information.
15112 */
15113/**
15114 * Chat message component.
15115 */
15116var NbChatMessageQuoteComponent = /** @class */ (function () {
15117 function NbChatMessageQuoteComponent() {
15118 /**
15119 * Message send date format, default 'shortTime'
15120 * @type {string}
15121 */
15122 this.dateFormat = 'shortTime';
15123 }
15124 NbChatMessageQuoteComponent.decorators = [
15125 { type: i0.Component, args: [{
15126 selector: 'nb-chat-message-quote',
15127 template: "\n <p class=\"sender\" *ngIf=\"sender || date\">{{ sender }} <time>{{ date | date: dateFormat }}</time></p>\n <p class=\"quote\">\n {{ quote }}\n </p>\n <nb-chat-message-text [message]=\"message\">\n {{ message }}\n </nb-chat-message-text>\n ",
15128 changeDetection: i0.ChangeDetectionStrategy.OnPush
15129 },] }
15130 ];
15131 NbChatMessageQuoteComponent.propDecorators = {
15132 message: [{ type: i0.Input }],
15133 sender: [{ type: i0.Input }],
15134 date: [{ type: i0.Input }],
15135 dateFormat: [{ type: i0.Input }],
15136 quote: [{ type: i0.Input }]
15137 };
15138 return NbChatMessageQuoteComponent;
15139}());
15140
15141/**
15142 * @license
15143 * Copyright Akveo. All Rights Reserved.
15144 * Licensed under the MIT License. See License.txt in the project root for license information.
15145 */
15146/**
15147 * Chat message component.
15148 */
15149var NbChatMessageTextComponent = /** @class */ (function () {
15150 function NbChatMessageTextComponent() {
15151 /**
15152 * Message send date format, default 'shortTime'
15153 * @type {string}
15154 */
15155 this.dateFormat = 'shortTime';
15156 }
15157 NbChatMessageTextComponent.decorators = [
15158 { type: i0.Component, args: [{
15159 selector: 'nb-chat-message-text',
15160 template: "\n <p class=\"sender\" *ngIf=\"sender || date\">{{ sender }} <time>{{ date | date: dateFormat }}</time></p>\n <p class=\"text\" *ngIf=\"message\">{{ message }}</p>\n ",
15161 changeDetection: i0.ChangeDetectionStrategy.OnPush
15162 },] }
15163 ];
15164 NbChatMessageTextComponent.propDecorators = {
15165 sender: [{ type: i0.Input }],
15166 message: [{ type: i0.Input }],
15167 date: [{ type: i0.Input }],
15168 dateFormat: [{ type: i0.Input }]
15169 };
15170 return NbChatMessageTextComponent;
15171}());
15172
15173/**
15174 * @license
15175 * Copyright Akveo. All Rights Reserved.
15176 * Licensed under the MIT License. See License.txt in the project root for license information.
15177 */
15178/*
15179 * Class used as injection token to provide form element.
15180 **/
15181var NbFormFieldControl = /** @class */ (function () {
15182 function NbFormFieldControl() {
15183 }
15184 NbFormFieldControl.decorators = [
15185 { type: i0.Injectable }
15186 ];
15187 return NbFormFieldControl;
15188}());
15189/*
15190 * Optional config to be provided on NbFormFieldControl to alter default settings.
15191 **/
15192var NbFormFieldControlConfig = /** @class */ (function () {
15193 function NbFormFieldControlConfig() {
15194 this.supportsPrefix = true;
15195 this.supportsSuffix = true;
15196 }
15197 NbFormFieldControlConfig.decorators = [
15198 { type: i0.Injectable }
15199 ];
15200 return NbFormFieldControlConfig;
15201}());
15202
15203/**
15204 * @license
15205 * Copyright Akveo. All Rights Reserved.
15206 * Licensed under the MIT License. See License.txt in the project root for license information.
15207 */
15208/**
15209 * Basic input directive.
15210 *
15211 * ```html
15212 * <input nbInput></input>
15213 * ```
15214 *
15215 * ### Installation
15216 *
15217 * Import `NbInputModule` to your feature module.
15218 * ```ts
15219 * @NgModule({
15220 * imports: [
15221 * // ...
15222 * NbInputModule,
15223 * ],
15224 * })
15225 * export class PageModule { }
15226 * ```
15227 * ### Usage
15228 *
15229 * Default input size is `medium`:
15230 * @stacked-example(Showcase, input/input-showcase.component)
15231 *
15232 * Inputs are available in multiple colors using `status` property:
15233 * @stacked-example(Input Colors, input/input-colors.component)
15234 *
15235 * There are three input sizes:
15236 *
15237 * @stacked-example(Input Sizes, input/input-sizes.component)
15238 *
15239 * Inputs available in different shapes, which could be combined with the other properties:
15240 * @stacked-example(Input Shapes, input/input-shapes.component)
15241 *
15242 * `nbInput` could be applied to the following selectors - `input`, `textarea`:
15243 * @stacked-example(Input Elements, input/input-types.component)
15244 *
15245 * You can add `fullWidth` attribute to make element fill container:
15246 * @stacked-example(Full width inputs, input/input-full-width.component)
15247 *
15248 * Or you can bind control with form controls or ngModel:
15249 * @stacked-example(Input form binding, input/input-form.component)
15250 *
15251 * Use `<nb-form-field>` to add custom content to the input field.
15252 * First import `NbFormFieldModule`. Then put the input field and custom content into
15253 * `<nb-form-field>` and add `nbPrefix` or `nbSuffix` directive to the custom content.
15254 * `nbPrefix` puts content before input and `nbSuffix` after.
15255 *
15256 * @stacked-example(Input with icon, form-field/form-field-input.component)
15257 * @stacked-example(Input with button, form-field/form-field-password.component)
15258 *
15259 * @styles
15260 *
15261 * input-border-style:
15262 * input-border-width:
15263 * input-outline-color:
15264 * input-outline-width:
15265 * input-placeholder-text-font-family:
15266 * input-text-font-family:
15267 * input-basic-text-color:
15268 * input-basic-placeholder-text-color:
15269 * input-basic-background-color:
15270 * input-basic-border-color:
15271 * input-basic-focus-background-color:
15272 * input-basic-focus-border-color:
15273 * input-basic-hover-background-color:
15274 * input-basic-hover-border-color:
15275 * input-basic-disabled-background-color:
15276 * input-basic-disabled-border-color:
15277 * input-basic-disabled-text-color:
15278 * input-basic-disabled-placeholder-text-color:
15279 * input-primary-text-color:
15280 * input-primary-placeholder-text-color:
15281 * input-primary-background-color:
15282 * input-primary-border-color:
15283 * input-primary-focus-background-color:
15284 * input-primary-focus-border-color:
15285 * input-primary-hover-background-color:
15286 * input-primary-hover-border-color:
15287 * input-primary-disabled-background-color:
15288 * input-primary-disabled-border-color:
15289 * input-primary-disabled-text-color:
15290 * input-primary-disabled-placeholder-text-color:
15291 * input-success-text-color:
15292 * input-success-placeholder-text-color:
15293 * input-success-background-color:
15294 * input-success-border-color:
15295 * input-success-focus-background-color:
15296 * input-success-focus-border-color:
15297 * input-success-hover-background-color:
15298 * input-success-hover-border-color:
15299 * input-success-disabled-background-color:
15300 * input-success-disabled-border-color:
15301 * input-success-disabled-text-color:
15302 * input-success-disabled-placeholder-text-color:
15303 * input-info-text-color:
15304 * input-info-placeholder-text-color:
15305 * input-info-background-color:
15306 * input-info-border-color:
15307 * input-info-focus-background-color:
15308 * input-info-focus-border-color:
15309 * input-info-hover-background-color:
15310 * input-info-hover-border-color:
15311 * input-info-disabled-background-color:
15312 * input-info-disabled-border-color:
15313 * input-info-disabled-text-color:
15314 * input-info-disabled-placeholder-text-color:
15315 * input-warning-text-color:
15316 * input-warning-placeholder-text-color:
15317 * input-warning-background-color:
15318 * input-warning-border-color:
15319 * input-warning-focus-background-color:
15320 * input-warning-focus-border-color:
15321 * input-warning-hover-background-color:
15322 * input-warning-hover-border-color:
15323 * input-warning-disabled-background-color:
15324 * input-warning-disabled-border-color:
15325 * input-warning-disabled-text-color:
15326 * input-warning-disabled-placeholder-text-color:
15327 * input-danger-text-color:
15328 * input-danger-placeholder-text-color:
15329 * input-danger-background-color:
15330 * input-danger-border-color:
15331 * input-danger-focus-background-color:
15332 * input-danger-focus-border-color:
15333 * input-danger-hover-background-color:
15334 * input-danger-hover-border-color:
15335 * input-danger-disabled-background-color:
15336 * input-danger-disabled-border-color:
15337 * input-danger-disabled-text-color:
15338 * input-danger-disabled-placeholder-text-color:
15339 * input-control-text-color:
15340 * input-control-placeholder-text-color:
15341 * input-control-background-color:
15342 * input-control-border-color:
15343 * input-control-focus-background-color:
15344 * input-control-focus-border-color:
15345 * input-control-hover-background-color:
15346 * input-control-hover-border-color:
15347 * input-control-disabled-background-color:
15348 * input-control-disabled-border-color:
15349 * input-control-disabled-text-color:
15350 * input-control-disabled-placeholder-text-color:
15351 * input-rectangle-border-radius:
15352 * input-semi-round-border-radius:
15353 * input-round-border-radius:
15354 * input-tiny-text-font-size:
15355 * input-tiny-text-font-weight:
15356 * input-tiny-text-line-height:
15357 * input-tiny-placeholder-text-font-size:
15358 * input-tiny-placeholder-text-font-weight:
15359 * input-tiny-placeholder-text-line-height:
15360 * input-tiny-padding:
15361 * input-tiny-max-width:
15362 * input-small-text-font-size:
15363 * input-small-text-font-weight:
15364 * input-small-text-line-height:
15365 * input-small-placeholder-text-font-size:
15366 * input-small-placeholder-text-font-weight:
15367 * input-small-placeholder-text-line-height:
15368 * input-small-padding:
15369 * input-small-max-width:
15370 * input-medium-text-font-size:
15371 * input-medium-text-font-weight:
15372 * input-medium-text-line-height:
15373 * input-medium-placeholder-text-font-size:
15374 * input-medium-placeholder-text-font-weight:
15375 * input-medium-placeholder-text-line-height:
15376 * input-medium-padding:
15377 * input-medium-max-width:
15378 * input-large-text-font-size:
15379 * input-large-text-font-weight:
15380 * input-large-text-line-height:
15381 * input-large-placeholder-text-font-size:
15382 * input-large-placeholder-text-font-weight:
15383 * input-large-placeholder-text-line-height:
15384 * input-large-padding:
15385 * input-large-max-width:
15386 * input-giant-text-font-size:
15387 * input-giant-text-font-weight:
15388 * input-giant-text-line-height:
15389 * input-giant-placeholder-text-font-size:
15390 * input-giant-placeholder-text-font-weight:
15391 * input-giant-placeholder-text-line-height:
15392 * input-giant-padding:
15393 * input-giant-max-width:
15394 */
15395var NbInputDirective = /** @class */ (function () {
15396 function NbInputDirective(elementRef, focusMonitor, renderer, zone, statusService) {
15397 this.elementRef = elementRef;
15398 this.focusMonitor = focusMonitor;
15399 this.renderer = renderer;
15400 this.zone = zone;
15401 this.statusService = statusService;
15402 this.destroy$ = new rxjs.Subject();
15403 /**
15404 * Field size modifications. Possible values: `small`, `medium` (default), `large`.
15405 */
15406 this.fieldSize = 'medium';
15407 /**
15408 * Field status (adds specific styles):
15409 * `basic`, `primary`, `info`, `success`, `warning`, `danger`, `control`
15410 */
15411 this.status = 'basic';
15412 /**
15413 * Field shapes modifications. Possible values: `rectangle` (default), `round`, `semi-round`.
15414 */
15415 this.shape = 'rectangle';
15416 this._fullWidth = false;
15417 /*
15418 * @docs-private
15419 **/
15420 this.status$ = new rxjs.BehaviorSubject(this.status);
15421 /*
15422 * @docs-private
15423 **/
15424 this.size$ = new rxjs.BehaviorSubject(this.fieldSize);
15425 /*
15426 * @docs-private
15427 **/
15428 this.focused$ = new rxjs.BehaviorSubject(false);
15429 /*
15430 * @docs-private
15431 **/
15432 this.disabled$ = new rxjs.BehaviorSubject(false);
15433 /*
15434 * @docs-private
15435 **/
15436 this.fullWidth$ = new rxjs.BehaviorSubject(this.fullWidth);
15437 }
15438 Object.defineProperty(NbInputDirective.prototype, "fullWidth", {
15439 /**
15440 * If set element will fill container. `false` by default.
15441 */
15442 get: function () {
15443 return this._fullWidth;
15444 },
15445 set: function (value) {
15446 this._fullWidth = convertToBoolProperty(value);
15447 },
15448 enumerable: false,
15449 configurable: true
15450 });
15451 Object.defineProperty(NbInputDirective.prototype, "additionalClasses", {
15452 get: function () {
15453 if (this.statusService.isCustomStatus(this.status)) {
15454 return [this.statusService.getStatusClass(this.status)];
15455 }
15456 return [];
15457 },
15458 enumerable: false,
15459 configurable: true
15460 });
15461 NbInputDirective.prototype.ngDoCheck = function () {
15462 var isDisabled = this.elementRef.nativeElement.disabled;
15463 if (isDisabled !== this.disabled$.value) {
15464 this.disabled$.next(isDisabled);
15465 }
15466 };
15467 NbInputDirective.prototype.ngOnChanges = function (_a) {
15468 var status = _a.status, fieldSize = _a.fieldSize, fullWidth = _a.fullWidth;
15469 if (status) {
15470 this.status$.next(this.status);
15471 }
15472 if (fieldSize) {
15473 this.size$.next(this.fieldSize);
15474 }
15475 if (fullWidth) {
15476 this.fullWidth$.next(this.fullWidth);
15477 }
15478 };
15479 NbInputDirective.prototype.ngOnInit = function () {
15480 var _this = this;
15481 this.focusMonitor.monitor(this.elementRef)
15482 .pipe(rxjs_operators.map(function (origin) { return !!origin; }), rxjs_operators.finalize(function () { return _this.focusMonitor.stopMonitoring(_this.elementRef); }), rxjs_operators.takeUntil(this.destroy$))
15483 .subscribe(this.focused$);
15484 };
15485 NbInputDirective.prototype.ngAfterViewInit = function () {
15486 var _this = this;
15487 // TODO: #2254
15488 this.zone.runOutsideAngular(function () { return setTimeout(function () {
15489 _this.renderer.addClass(_this.elementRef.nativeElement, 'nb-transition');
15490 }); });
15491 };
15492 NbInputDirective.prototype.ngOnDestroy = function () {
15493 this.destroy$.next();
15494 };
15495 Object.defineProperty(NbInputDirective.prototype, "tiny", {
15496 get: function () {
15497 return this.fieldSize === 'tiny';
15498 },
15499 enumerable: false,
15500 configurable: true
15501 });
15502 Object.defineProperty(NbInputDirective.prototype, "small", {
15503 get: function () {
15504 return this.fieldSize === 'small';
15505 },
15506 enumerable: false,
15507 configurable: true
15508 });
15509 Object.defineProperty(NbInputDirective.prototype, "medium", {
15510 get: function () {
15511 return this.fieldSize === 'medium';
15512 },
15513 enumerable: false,
15514 configurable: true
15515 });
15516 Object.defineProperty(NbInputDirective.prototype, "large", {
15517 get: function () {
15518 return this.fieldSize === 'large';
15519 },
15520 enumerable: false,
15521 configurable: true
15522 });
15523 Object.defineProperty(NbInputDirective.prototype, "giant", {
15524 get: function () {
15525 return this.fieldSize === 'giant';
15526 },
15527 enumerable: false,
15528 configurable: true
15529 });
15530 Object.defineProperty(NbInputDirective.prototype, "primary", {
15531 get: function () {
15532 return this.status === 'primary';
15533 },
15534 enumerable: false,
15535 configurable: true
15536 });
15537 Object.defineProperty(NbInputDirective.prototype, "info", {
15538 get: function () {
15539 return this.status === 'info';
15540 },
15541 enumerable: false,
15542 configurable: true
15543 });
15544 Object.defineProperty(NbInputDirective.prototype, "success", {
15545 get: function () {
15546 return this.status === 'success';
15547 },
15548 enumerable: false,
15549 configurable: true
15550 });
15551 Object.defineProperty(NbInputDirective.prototype, "warning", {
15552 get: function () {
15553 return this.status === 'warning';
15554 },
15555 enumerable: false,
15556 configurable: true
15557 });
15558 Object.defineProperty(NbInputDirective.prototype, "danger", {
15559 get: function () {
15560 return this.status === 'danger';
15561 },
15562 enumerable: false,
15563 configurable: true
15564 });
15565 Object.defineProperty(NbInputDirective.prototype, "basic", {
15566 get: function () {
15567 return this.status === 'basic';
15568 },
15569 enumerable: false,
15570 configurable: true
15571 });
15572 Object.defineProperty(NbInputDirective.prototype, "control", {
15573 get: function () {
15574 return this.status === 'control';
15575 },
15576 enumerable: false,
15577 configurable: true
15578 });
15579 Object.defineProperty(NbInputDirective.prototype, "rectangle", {
15580 get: function () {
15581 return this.shape === 'rectangle';
15582 },
15583 enumerable: false,
15584 configurable: true
15585 });
15586 Object.defineProperty(NbInputDirective.prototype, "semiRound", {
15587 get: function () {
15588 return this.shape === 'semi-round';
15589 },
15590 enumerable: false,
15591 configurable: true
15592 });
15593 Object.defineProperty(NbInputDirective.prototype, "round", {
15594 get: function () {
15595 return this.shape === 'round';
15596 },
15597 enumerable: false,
15598 configurable: true
15599 });
15600 NbInputDirective.decorators = [
15601 { type: i0.Directive, args: [{
15602 selector: 'input[nbInput],textarea[nbInput]',
15603 providers: [
15604 { provide: NbFormFieldControl, useExisting: NbInputDirective },
15605 ],
15606 },] }
15607 ];
15608 NbInputDirective.ctorParameters = function () { return [
15609 { type: i0.ElementRef },
15610 { type: NbFocusMonitor },
15611 { type: i0.Renderer2 },
15612 { type: i0.NgZone },
15613 { type: NbStatusService }
15614 ]; };
15615 NbInputDirective.propDecorators = {
15616 fieldSize: [{ type: i0.Input }],
15617 status: [{ type: i0.Input }],
15618 shape: [{ type: i0.Input }],
15619 fullWidth: [{ type: i0.Input }, { type: i0.HostBinding, args: ['class.input-full-width',] }],
15620 additionalClasses: [{ type: i0.HostBinding, args: ['class',] }],
15621 tiny: [{ type: i0.HostBinding, args: ['class.size-tiny',] }],
15622 small: [{ type: i0.HostBinding, args: ['class.size-small',] }],
15623 medium: [{ type: i0.HostBinding, args: ['class.size-medium',] }],
15624 large: [{ type: i0.HostBinding, args: ['class.size-large',] }],
15625 giant: [{ type: i0.HostBinding, args: ['class.size-giant',] }],
15626 primary: [{ type: i0.HostBinding, args: ['class.status-primary',] }],
15627 info: [{ type: i0.HostBinding, args: ['class.status-info',] }],
15628 success: [{ type: i0.HostBinding, args: ['class.status-success',] }],
15629 warning: [{ type: i0.HostBinding, args: ['class.status-warning',] }],
15630 danger: [{ type: i0.HostBinding, args: ['class.status-danger',] }],
15631 basic: [{ type: i0.HostBinding, args: ['class.status-basic',] }],
15632 control: [{ type: i0.HostBinding, args: ['class.status-control',] }],
15633 rectangle: [{ type: i0.HostBinding, args: ['class.shape-rectangle',] }],
15634 semiRound: [{ type: i0.HostBinding, args: ['class.shape-semi-round',] }],
15635 round: [{ type: i0.HostBinding, args: ['class.shape-round',] }]
15636 };
15637 return NbInputDirective;
15638}());
15639
15640/**
15641 * @license
15642 * Copyright Akveo. All Rights Reserved.
15643 * Licensed under the MIT License. See License.txt in the project root for license information.
15644 */
15645var NB_INPUT_COMPONENTS = [
15646 NbInputDirective,
15647];
15648var NbInputModule = /** @class */ (function () {
15649 function NbInputModule() {
15650 }
15651 NbInputModule.decorators = [
15652 { type: i0.NgModule, args: [{
15653 imports: [NbSharedModule],
15654 declarations: NB_INPUT_COMPONENTS,
15655 exports: NB_INPUT_COMPONENTS,
15656 },] }
15657 ];
15658 return NbInputModule;
15659}());
15660
15661var NbChatAvatarComponent = /** @class */ (function () {
15662 function NbChatAvatarComponent() {
15663 this.avatarClass = true;
15664 }
15665 NbChatAvatarComponent.decorators = [
15666 { type: i0.Component, args: [{
15667 selector: 'nb-chat-avatar',
15668 template: "\n <ng-container *ngIf=\"!avatarStyle\">\n {{ initials }}\n </ng-container>\n ",
15669 changeDetection: i0.ChangeDetectionStrategy.OnPush
15670 },] }
15671 ];
15672 NbChatAvatarComponent.propDecorators = {
15673 initials: [{ type: i0.Input }],
15674 avatarStyle: [{ type: i0.Input }, { type: i0.HostBinding, args: ['style.background-image',] }],
15675 avatarClass: [{ type: i0.HostBinding, args: ['class.avatar',] }]
15676 };
15677 return NbChatAvatarComponent;
15678}());
15679
15680function throwCustomMessageTypeIsRequired() {
15681 throw new Error('[nbCustomMessage]: custom message type is required.');
15682}
15683/**
15684 * `[nbCustomMessage]` directive should be used as a structural directive or should be applied to the `ng-template`:
15685 *
15686 * ```html
15687 * <div *nbCustomMessage="'my-custom-type'; let data">
15688 * <!-- custom message -->
15689 * </div>
15690 * ```
15691 * or
15692 * ```html
15693 * <ng-template nbCustomMessage='my-custom-type' let-data>
15694 * <!-- custom message -->
15695 * </ng-template>
15696 * ```
15697 */
15698var NbChatCustomMessageDirective = /** @class */ (function () {
15699 function NbChatCustomMessageDirective(templateRef, customMessageService) {
15700 this.templateRef = templateRef;
15701 this.customMessageService = customMessageService;
15702 this._noStyles = false;
15703 }
15704 Object.defineProperty(NbChatCustomMessageDirective.prototype, "nbCustomMessage", {
15705 /**
15706 * Defines a message type which should rendered with the custom message template.
15707 * @type {string}
15708 */
15709 get: function () {
15710 return this._type;
15711 },
15712 set: function (value) {
15713 this._type = value;
15714 },
15715 enumerable: false,
15716 configurable: true
15717 });
15718 Object.defineProperty(NbChatCustomMessageDirective.prototype, "type", {
15719 get: function () {
15720 return this._type;
15721 },
15722 enumerable: false,
15723 configurable: true
15724 });
15725 Object.defineProperty(NbChatCustomMessageDirective.prototype, "nbCustomMessageNoStyles", {
15726 get: function () {
15727 return this._noStyles;
15728 },
15729 /**
15730 * Disables generic message styles, such as round corners, text color, background, etc.,
15731 * so a custom message could be styled from the ground up.
15732 *
15733 * @type {boolean}
15734 */
15735 set: function (value) {
15736 this._noStyles = convertToBoolProperty(value);
15737 },
15738 enumerable: false,
15739 configurable: true
15740 });
15741 Object.defineProperty(NbChatCustomMessageDirective.prototype, "noStyles", {
15742 get: function () {
15743 return this.nbCustomMessageNoStyles;
15744 },
15745 enumerable: false,
15746 configurable: true
15747 });
15748 NbChatCustomMessageDirective.prototype.ngOnInit = function () {
15749 if (!this._type) {
15750 throwCustomMessageTypeIsRequired();
15751 }
15752 this.customMessageService.register(this.type, this);
15753 };
15754 NbChatCustomMessageDirective.prototype.ngOnDestroy = function () {
15755 this.customMessageService.unregister(this.type);
15756 };
15757 NbChatCustomMessageDirective.decorators = [
15758 { type: i0.Directive, args: [{
15759 selector: "[nbCustomMessage]",
15760 },] }
15761 ];
15762 NbChatCustomMessageDirective.ctorParameters = function () { return [
15763 { type: i0.TemplateRef },
15764 { type: NbCustomMessageService }
15765 ]; };
15766 NbChatCustomMessageDirective.propDecorators = {
15767 nbCustomMessage: [{ type: i0.Input }],
15768 nbCustomMessageNoStyles: [{ type: i0.Input }]
15769 };
15770 return NbChatCustomMessageDirective;
15771}());
15772
15773/**
15774 * @license
15775 * Copyright Akveo. All Rights Reserved.
15776 * Licensed under the MIT License. See License.txt in the project root for license information.
15777 */
15778var NB_CHAT_COMPONENTS = [
15779 NbChatComponent,
15780 NbChatMessageComponent,
15781 NbChatFormComponent,
15782 NbChatMessageTextComponent,
15783 NbChatMessageFileComponent,
15784 NbChatMessageQuoteComponent,
15785 NbChatMessageMapComponent,
15786 NbChatAvatarComponent,
15787];
15788var NB_CHAT_DIRECTIVES = [
15789 NbChatCustomMessageDirective,
15790];
15791var NbChatModule = /** @class */ (function () {
15792 function NbChatModule() {
15793 }
15794 NbChatModule.forRoot = function (options) {
15795 return {
15796 ngModule: NbChatModule,
15797 providers: [
15798 { provide: NbChatOptions, useValue: options || {} },
15799 ],
15800 };
15801 };
15802 NbChatModule.forChild = function (options) {
15803 return {
15804 ngModule: NbChatModule,
15805 providers: [
15806 { provide: NbChatOptions, useValue: options || {} },
15807 ],
15808 };
15809 };
15810 NbChatModule.decorators = [
15811 { type: i0.NgModule, args: [{
15812 imports: [
15813 NbSharedModule,
15814 NbIconModule,
15815 NbInputModule,
15816 NbButtonModule,
15817 ],
15818 declarations: tslib.__spreadArray(tslib.__spreadArray([], NB_CHAT_COMPONENTS), NB_CHAT_DIRECTIVES),
15819 exports: tslib.__spreadArray(tslib.__spreadArray([], NB_CHAT_COMPONENTS), NB_CHAT_DIRECTIVES),
15820 },] }
15821 ];
15822 return NbChatModule;
15823}());
15824
15825/**
15826 * @license
15827 * Copyright Akveo. All Rights Reserved.
15828 * Licensed under the MIT License. See License.txt in the project root for license information.
15829 */
15830/**
15831 * Styled spinner component
15832 *
15833 * @styles
15834 *
15835 * spinner-text-color:
15836 * spinner-text-font-family:
15837 * spinner-text-font-size:
15838 * spinner-text-font-weight:
15839 * spinner-text-line-height:
15840 * spinner-basic-background-color:
15841 * spinner-basic-circle-filled-color:
15842 * spinner-basic-circle-empty-color:
15843 * spinner-primary-background-color:
15844 * spinner-primary-circle-filled-color:
15845 * spinner-primary-circle-empty-color:
15846 * spinner-info-background-color:
15847 * spinner-info-circle-filled-color:
15848 * spinner-info-circle-empty-color:
15849 * spinner-success-background-color:
15850 * spinner-success-circle-filled-color:
15851 * spinner-success-circle-empty-color:
15852 * spinner-warning-background-color:
15853 * spinner-warning-circle-filled-color:
15854 * spinner-warning-circle-empty-color:
15855 * spinner-danger-background-color:
15856 * spinner-danger-circle-filled-color:
15857 * spinner-danger-circle-empty-color:
15858 * spinner-control-background-color:
15859 * spinner-control-circle-filled-color:
15860 * spinner-control-circle-empty-color:
15861 * spinner-height-tiny:
15862 * spinner-height-small:
15863 * spinner-height-medium:
15864 * spinner-height-large:
15865 * spinner-height-giant:
15866 */
15867var NbSpinnerComponent = /** @class */ (function () {
15868 function NbSpinnerComponent(statusService) {
15869 this.statusService = statusService;
15870 /**
15871 * Loading text that is shown near the icon
15872 * @type string
15873 */
15874 this.message = 'Loading...';
15875 /**
15876 * Spinner size, available sizes:
15877 * tiny, small, medium, large, giant
15878 * @param {string} value
15879 */
15880 this.size = 'medium';
15881 /**
15882 * Spinner status (adds specific styles):
15883 * `basic`, `primary`, `info`, `success`, `warning`, `danger`, `control`.
15884 */
15885 this.status = 'basic';
15886 }
15887 Object.defineProperty(NbSpinnerComponent.prototype, "tiny", {
15888 get: function () {
15889 return this.size === 'tiny';
15890 },
15891 enumerable: false,
15892 configurable: true
15893 });
15894 Object.defineProperty(NbSpinnerComponent.prototype, "small", {
15895 get: function () {
15896 return this.size === 'small';
15897 },
15898 enumerable: false,
15899 configurable: true
15900 });
15901 Object.defineProperty(NbSpinnerComponent.prototype, "medium", {
15902 get: function () {
15903 return this.size === 'medium';
15904 },
15905 enumerable: false,
15906 configurable: true
15907 });
15908 Object.defineProperty(NbSpinnerComponent.prototype, "large", {
15909 get: function () {
15910 return this.size === 'large';
15911 },
15912 enumerable: false,
15913 configurable: true
15914 });
15915 Object.defineProperty(NbSpinnerComponent.prototype, "giant", {
15916 get: function () {
15917 return this.size === 'giant';
15918 },
15919 enumerable: false,
15920 configurable: true
15921 });
15922 Object.defineProperty(NbSpinnerComponent.prototype, "primary", {
15923 get: function () {
15924 return this.status === 'primary';
15925 },
15926 enumerable: false,
15927 configurable: true
15928 });
15929 Object.defineProperty(NbSpinnerComponent.prototype, "info", {
15930 get: function () {
15931 return this.status === 'info';
15932 },
15933 enumerable: false,
15934 configurable: true
15935 });
15936 Object.defineProperty(NbSpinnerComponent.prototype, "success", {
15937 get: function () {
15938 return this.status === 'success';
15939 },
15940 enumerable: false,
15941 configurable: true
15942 });
15943 Object.defineProperty(NbSpinnerComponent.prototype, "warning", {
15944 get: function () {
15945 return this.status === 'warning';
15946 },
15947 enumerable: false,
15948 configurable: true
15949 });
15950 Object.defineProperty(NbSpinnerComponent.prototype, "danger", {
15951 get: function () {
15952 return this.status === 'danger';
15953 },
15954 enumerable: false,
15955 configurable: true
15956 });
15957 Object.defineProperty(NbSpinnerComponent.prototype, "basic", {
15958 get: function () {
15959 return this.status === 'basic';
15960 },
15961 enumerable: false,
15962 configurable: true
15963 });
15964 Object.defineProperty(NbSpinnerComponent.prototype, "control", {
15965 get: function () {
15966 return this.status === 'control';
15967 },
15968 enumerable: false,
15969 configurable: true
15970 });
15971 Object.defineProperty(NbSpinnerComponent.prototype, "additionalClasses", {
15972 get: function () {
15973 if (this.statusService.isCustomStatus(this.status)) {
15974 return [this.statusService.getStatusClass(this.status)];
15975 }
15976 return [];
15977 },
15978 enumerable: false,
15979 configurable: true
15980 });
15981 NbSpinnerComponent.decorators = [
15982 { type: i0.Component, args: [{
15983 selector: 'nb-spinner',
15984 template: "\n <span class=\"spin-circle\"></span>\n <span class=\"message\" *ngIf=\"message\">{{ message }}</span>\n ",
15985 styles: [":host{opacity:1;position:absolute;border-radius:inherit;top:0;right:0;left:0;bottom:0;overflow:hidden;z-index:9999;display:flex;justify-content:center;align-items:center;visibility:visible}:host .spin-circle{animation:spin 0.8s infinite linear;border-radius:50%;border-style:solid;border-width:0.125em;width:1em;height:1em}:host .message{margin-left:0.5rem}\n"]
15986 },] }
15987 ];
15988 NbSpinnerComponent.ctorParameters = function () { return [
15989 { type: NbStatusService }
15990 ]; };
15991 NbSpinnerComponent.propDecorators = {
15992 message: [{ type: i0.Input }],
15993 size: [{ type: i0.Input }],
15994 status: [{ type: i0.Input }],
15995 tiny: [{ type: i0.HostBinding, args: ['class.size-tiny',] }],
15996 small: [{ type: i0.HostBinding, args: ['class.size-small',] }],
15997 medium: [{ type: i0.HostBinding, args: ['class.size-medium',] }],
15998 large: [{ type: i0.HostBinding, args: ['class.size-large',] }],
15999 giant: [{ type: i0.HostBinding, args: ['class.size-giant',] }],
16000 primary: [{ type: i0.HostBinding, args: ['class.status-primary',] }],
16001 info: [{ type: i0.HostBinding, args: ['class.status-info',] }],
16002 success: [{ type: i0.HostBinding, args: ['class.status-success',] }],
16003 warning: [{ type: i0.HostBinding, args: ['class.status-warning',] }],
16004 danger: [{ type: i0.HostBinding, args: ['class.status-danger',] }],
16005 basic: [{ type: i0.HostBinding, args: ['class.status-basic',] }],
16006 control: [{ type: i0.HostBinding, args: ['class.status-control',] }],
16007 additionalClasses: [{ type: i0.HostBinding, args: ['class',] }]
16008 };
16009 return NbSpinnerComponent;
16010}());
16011
16012/**
16013 * @license
16014 * Copyright Akveo. All Rights Reserved.
16015 * Licensed under the MIT License. See License.txt in the project root for license information.
16016 */
16017/**
16018 * Styled spinner directive
16019 *
16020 * @stacked-example(Spinner Showcase, spinner/spinner-card.component)
16021 *
16022 *
16023 * ```ts
16024 * <nb-card [nbSpinner]="loading" nbSpinnerStatus="danger">
16025 * <nb-card-body>Card Content</nb-card-body>
16026 * </nb-card>
16027 * ```
16028 *
16029 * ### Installation
16030 *
16031 * Import `NbSpinnerModule` to your feature module.
16032 * ```ts
16033 * @NgModule({
16034 * imports: [
16035 * // ...
16036 * NbSpinnerModule,
16037 * ],
16038 * })
16039 * export class PageModule { }
16040 * ```
16041 * ### Usage
16042 *
16043 * Could be colored using `status` property
16044 *
16045 * @stacked-example(Spinner Colors, spinner/spinner-colors.component)
16046 *
16047 * Available in different sizes with `size` property:
16048 *
16049 * @stacked-example(Spinner Sizes, spinner/spinner-sizes.component)
16050 *
16051 * It is also possible to place it into the button:
16052 * @stacked-example(Buttons with spinner, spinner/spinner-button.component)
16053 *
16054 * Or tabs:
16055 * @stacked-example(Spinner in tabs, spinner/spinner-tabs.component)
16056 */
16057var NbSpinnerDirective = /** @class */ (function () {
16058 function NbSpinnerDirective(directiveView, componentFactoryResolver, renderer, directiveElement) {
16059 this.directiveView = directiveView;
16060 this.componentFactoryResolver = componentFactoryResolver;
16061 this.renderer = renderer;
16062 this.directiveElement = directiveElement;
16063 this.shouldShow = false;
16064 /**
16065 * Spinner status color
16066 * `basic`, `primary`, `info`, `success`, `warning`, `danger`, `control`.
16067 */
16068 this.spinnerStatus = 'basic';
16069 /**
16070 * Spinner size. Possible values: `tiny`, `small`, `medium` (default), `large`, `giant`
16071 */
16072 this.spinnerSize = 'medium';
16073 this.isSpinnerExist = false;
16074 }
16075 Object.defineProperty(NbSpinnerDirective.prototype, "nbSpinner", {
16076 /**
16077 * Directive value - show or hide spinner
16078 * @param {boolean} val
16079 */
16080 set: function (val) {
16081 if (this.componentFactory) {
16082 if (val) {
16083 this.show();
16084 }
16085 else {
16086 this.hide();
16087 }
16088 }
16089 else {
16090 this.shouldShow = val;
16091 }
16092 },
16093 enumerable: false,
16094 configurable: true
16095 });
16096 NbSpinnerDirective.prototype.ngOnInit = function () {
16097 this.componentFactory = this.componentFactoryResolver.resolveComponentFactory(NbSpinnerComponent);
16098 if (this.shouldShow) {
16099 this.show();
16100 }
16101 };
16102 NbSpinnerDirective.prototype.hide = function () {
16103 if (this.isSpinnerExist) {
16104 this.directiveView.remove();
16105 this.isSpinnerExist = false;
16106 }
16107 };
16108 NbSpinnerDirective.prototype.show = function () {
16109 if (!this.isSpinnerExist) {
16110 this.spinner = this.directiveView.createComponent(this.componentFactory);
16111 this.setInstanceInputs(this.spinner.instance);
16112 this.spinner.changeDetectorRef.detectChanges();
16113 this.renderer.appendChild(this.directiveElement.nativeElement, this.spinner.location.nativeElement);
16114 this.isSpinnerExist = true;
16115 }
16116 };
16117 NbSpinnerDirective.prototype.setInstanceInputs = function (instance) {
16118 instance.message = this.spinnerMessage;
16119 typeof this.spinnerStatus !== 'undefined' && (instance.status = this.spinnerStatus);
16120 typeof this.spinnerSize !== 'undefined' && (instance.size = this.spinnerSize);
16121 };
16122 NbSpinnerDirective.decorators = [
16123 { type: i0.Directive, args: [{ selector: '[nbSpinner]' },] }
16124 ];
16125 NbSpinnerDirective.ctorParameters = function () { return [
16126 { type: i0.ViewContainerRef },
16127 { type: i0.ComponentFactoryResolver },
16128 { type: i0.Renderer2 },
16129 { type: i0.ElementRef }
16130 ]; };
16131 NbSpinnerDirective.propDecorators = {
16132 spinnerMessage: [{ type: i0.Input, args: ['nbSpinnerMessage',] }],
16133 spinnerStatus: [{ type: i0.Input, args: ['nbSpinnerStatus',] }],
16134 spinnerSize: [{ type: i0.Input, args: ['nbSpinnerSize',] }],
16135 nbSpinner: [{ type: i0.Input, args: ['nbSpinner',] }],
16136 isSpinnerExist: [{ type: i0.HostBinding, args: ['class.nb-spinner-container',] }]
16137 };
16138 return NbSpinnerDirective;
16139}());
16140
16141/**
16142 * @license
16143 * Copyright Akveo. All Rights Reserved.
16144 * Licensed under the MIT License. See License.txt in the project root for license information.
16145 */
16146var NbSpinnerModule = /** @class */ (function () {
16147 function NbSpinnerModule() {
16148 }
16149 NbSpinnerModule.decorators = [
16150 { type: i0.NgModule, args: [{
16151 imports: [
16152 NbSharedModule,
16153 ],
16154 exports: [NbSpinnerComponent, NbSpinnerDirective],
16155 declarations: [NbSpinnerComponent, NbSpinnerDirective],
16156 entryComponents: [NbSpinnerComponent],
16157 },] }
16158 ];
16159 return NbSpinnerModule;
16160}());
16161
16162var NB_STEPPER = new i0.InjectionToken('Nebular Stepper Component');
16163
16164/**
16165 * Component intended to be used within the `<nb-stepper>` component.
16166 * Container for a step
16167 */
16168var NbStepComponent = /** @class */ (function () {
16169 function NbStepComponent(stepper) {
16170 this._hidden = false;
16171 this._completed = false;
16172 this.interacted = false;
16173 this.stepper = stepper;
16174 }
16175 Object.defineProperty(NbStepComponent.prototype, "hidden", {
16176 /**
16177 * Whether step will be displayed in wizard
16178 *
16179 * @type {boolean}
16180 */
16181 get: function () {
16182 return this._hidden;
16183 },
16184 set: function (value) {
16185 this._hidden = convertToBoolProperty(value);
16186 },
16187 enumerable: false,
16188 configurable: true
16189 });
16190 Object.defineProperty(NbStepComponent.prototype, "isLabelTemplate", {
16191 /**
16192 * Check that label is a TemplateRef.
16193 *
16194 * @return boolean
16195 * */
16196 get: function () {
16197 return this.label instanceof i0.TemplateRef;
16198 },
16199 enumerable: false,
16200 configurable: true
16201 });
16202 Object.defineProperty(NbStepComponent.prototype, "completed", {
16203 /**
16204 * Whether step is marked as completed.
16205 *
16206 * @type {boolean}
16207 */
16208 get: function () {
16209 return this._completed || this.isCompleted;
16210 },
16211 set: function (value) {
16212 this._completed = convertToBoolProperty(value);
16213 },
16214 enumerable: false,
16215 configurable: true
16216 });
16217 Object.defineProperty(NbStepComponent.prototype, "isCompleted", {
16218 get: function () {
16219 return this.stepControl ? this.stepControl.valid && this.interacted : this.interacted;
16220 },
16221 enumerable: false,
16222 configurable: true
16223 });
16224 /**
16225 * Mark step as selected
16226 * */
16227 NbStepComponent.prototype.select = function () {
16228 this.stepper.selected = this;
16229 };
16230 /**
16231 * Reset step and stepControl state
16232 * */
16233 NbStepComponent.prototype.reset = function () {
16234 this.interacted = false;
16235 if (this.stepControl) {
16236 this.stepControl.reset();
16237 }
16238 };
16239 NbStepComponent.decorators = [
16240 { type: i0.Component, args: [{
16241 selector: 'nb-step',
16242 template: "\n <ng-template>\n <ng-content></ng-content>\n </ng-template>\n "
16243 },] }
16244 ];
16245 NbStepComponent.ctorParameters = function () { return [
16246 { type: undefined, decorators: [{ type: i0.Inject, args: [NB_STEPPER,] }] }
16247 ]; };
16248 NbStepComponent.propDecorators = {
16249 content: [{ type: i0.ViewChild, args: [i0.TemplateRef, { static: true },] }],
16250 stepControl: [{ type: i0.Input }],
16251 label: [{ type: i0.Input }],
16252 hidden: [{ type: i0.Input }],
16253 completed: [{ type: i0.Input }]
16254 };
16255 return NbStepComponent;
16256}());
16257
16258/**
16259 * @license
16260 * Copyright Akveo. All Rights Reserved.
16261 * Licensed under the MIT License. See License.txt in the project root for license information.
16262 */
16263/**
16264 * Stepper component
16265 *
16266 * @stacked-example(Showcase, stepper/stepper-showcase.component)
16267 *
16268 * ### Installation
16269 *
16270 * Import `NbStepperModule` to your feature module.
16271 * ```ts
16272 * @NgModule({
16273 * imports: [
16274 * // ...
16275 * NbStepperModule,
16276 * ],
16277 * })
16278 * export class PageModule { }
16279 * ```
16280 * ### Usage
16281 *
16282 * If step label is string you can pass it as `label` attribute. Otherwise ng-template should be used:
16283 * ```html
16284 * // ...
16285 * <nb-stepper orientation="horizontal">
16286 * <nb-step label="step number one">
16287 * // ... step content here
16288 * </nb-step>
16289 * <nb-step label="stepLabel">
16290 * <ng-template #stepLabel>
16291 * <div>
16292 * step number two
16293 * </div>
16294 * </ng-template>
16295 * // ... step content here
16296 * </nb-step>
16297 * </nb-stepper>
16298 * ```
16299 *
16300 * When linear mode enabled user can't move forward unless current step is complete.
16301 * @stacked-example(Linear, stepper/stepper-linear.component)
16302 *
16303 * Specify `[stepControl]="form"` and stepper allow go to the next step only if form is valid.
16304 * You can disable it via `linear` mode setting.
16305 * ```html
16306 * // ...
16307 * <nb-stepper orientation="horizontal">
16308 * <nb-step label="step number one" [stepControl]="form">
16309 * <form [formGroup]="form">
16310 * // ...
16311 * </form>
16312 * </nb-step>
16313 * // ...
16314 * </nb-stepper>
16315 * ```
16316 *
16317 * @stacked-example(Validation, stepper/stepper-validation.component)
16318 *
16319 * Stepper component has two layout options - `vertical` & `horizontal`
16320 * @stacked-example(Vertical, stepper/stepper-vertical.component)
16321 *
16322 * `disableStepNavigation` disables navigation by clicking on steps, so user can navigate only using
16323 * 'nbStepperPrevious' and 'nbStepperNext' buttons.
16324 * @stacked-example(Disabled steps navigation, stepper/stepper-disabled-step-nav.component)
16325 *
16326 * @styles
16327 *
16328 * stepper-step-text-color:
16329 * stepper-step-text-font-family:
16330 * stepper-step-text-font-size:
16331 * stepper-step-text-font-weight:
16332 * stepper-step-text-line-height:
16333 * stepper-step-active-text-color:
16334 * stepper-step-completed-text-color:
16335 * stepper-step-index-border-color:
16336 * stepper-step-index-border-style:
16337 * stepper-step-index-border-width:
16338 * stepper-step-index-border-radius:
16339 * stepper-step-index-width:
16340 * stepper-step-index-active-border-color:
16341 * stepper-step-index-completed-background-color:
16342 * stepper-step-index-completed-border-color:
16343 * stepper-step-index-completed-text-color:
16344 * stepper-connector-background-color:
16345 * stepper-connector-completed-background-color:
16346 * stepper-horizontal-connector-margin:
16347 * stepper-vertical-connector-margin:
16348 * stepper-step-content-padding:
16349 */
16350var NbStepperComponent = /** @class */ (function () {
16351 function NbStepperComponent() {
16352 this._selectedIndex = 0;
16353 this._disableStepNavigation = false;
16354 /**
16355 * Stepper orientation - `horizontal`|`vertical`
16356 */
16357 this.orientation = 'horizontal';
16358 this._linear = true;
16359 }
16360 Object.defineProperty(NbStepperComponent.prototype, "selectedIndex", {
16361 /**
16362 * Selected step index
16363 */
16364 get: function () {
16365 return this._selectedIndex;
16366 },
16367 set: function (index) {
16368 if (!this.steps) {
16369 this._selectedIndex = index;
16370 return;
16371 }
16372 this.markCurrentStepInteracted();
16373 if (this.canBeSelected(index)) {
16374 this._selectedIndex = index;
16375 }
16376 },
16377 enumerable: false,
16378 configurable: true
16379 });
16380 Object.defineProperty(NbStepperComponent.prototype, "disableStepNavigation", {
16381 get: function () {
16382 return this._disableStepNavigation;
16383 },
16384 /**
16385 * Disables navigation by clicking on steps. False by default
16386 * @param {boolean} value
16387 */
16388 set: function (value) {
16389 this._disableStepNavigation = convertToBoolProperty(value);
16390 },
16391 enumerable: false,
16392 configurable: true
16393 });
16394 Object.defineProperty(NbStepperComponent.prototype, "selected", {
16395 /**
16396 * Selected step component
16397 */
16398 get: function () {
16399 return this.steps ? this.steps.toArray()[this.selectedIndex] : undefined;
16400 },
16401 set: function (step) {
16402 if (!this.steps) {
16403 return;
16404 }
16405 this.selectedIndex = this.steps.toArray().indexOf(step);
16406 },
16407 enumerable: false,
16408 configurable: true
16409 });
16410 Object.defineProperty(NbStepperComponent.prototype, "linear", {
16411 get: function () {
16412 return this._linear;
16413 },
16414 /**
16415 * Allow moving forward only if the current step is complete
16416 * @default true
16417 */
16418 set: function (value) {
16419 this._linear = convertToBoolProperty(value);
16420 },
16421 enumerable: false,
16422 configurable: true
16423 });
16424 Object.defineProperty(NbStepperComponent.prototype, "vertical", {
16425 get: function () {
16426 return this.orientation === 'vertical';
16427 },
16428 enumerable: false,
16429 configurable: true
16430 });
16431 Object.defineProperty(NbStepperComponent.prototype, "horizontal", {
16432 get: function () {
16433 return this.orientation === 'horizontal';
16434 },
16435 enumerable: false,
16436 configurable: true
16437 });
16438 /**
16439 * Navigate to next step
16440 * */
16441 NbStepperComponent.prototype.next = function () {
16442 this.selectedIndex = Math.min(this.selectedIndex + 1, this.steps.length - 1);
16443 };
16444 /**
16445 * Navigate to previous step
16446 * */
16447 NbStepperComponent.prototype.previous = function () {
16448 this.selectedIndex = Math.max(this.selectedIndex - 1, 0);
16449 };
16450 /**
16451 * Reset stepper and stepControls to initial state
16452 * */
16453 NbStepperComponent.prototype.reset = function () {
16454 this._selectedIndex = 0;
16455 this.steps.forEach(function (step) { return step.reset(); });
16456 };
16457 NbStepperComponent.prototype.isStepSelected = function (step) {
16458 return this.selected === step;
16459 };
16460 /*
16461 * @docs-private
16462 **/
16463 NbStepperComponent.prototype.getStepTemplate = function (step) {
16464 if (step.isLabelTemplate) {
16465 return step.label;
16466 }
16467 return null;
16468 };
16469 NbStepperComponent.prototype.isStepValid = function (index) {
16470 return this.steps.toArray()[index].completed;
16471 };
16472 NbStepperComponent.prototype.canBeSelected = function (indexToCheck) {
16473 var noSteps = !this.steps || this.steps.length === 0;
16474 if (noSteps || indexToCheck < 0 || indexToCheck >= this.steps.length) {
16475 return false;
16476 }
16477 if (indexToCheck <= this.selectedIndex || !this.linear) {
16478 return true;
16479 }
16480 var isAllStepsValid = true;
16481 for (var i = this.selectedIndex; i < indexToCheck; i++) {
16482 if (!this.isStepValid(i)) {
16483 isAllStepsValid = false;
16484 break;
16485 }
16486 }
16487 return isAllStepsValid;
16488 };
16489 NbStepperComponent.prototype.markCurrentStepInteracted = function () {
16490 if (this.selected) {
16491 this.selected.interacted = true;
16492 }
16493 };
16494 NbStepperComponent.decorators = [
16495 { type: i0.Component, args: [{
16496 selector: 'nb-stepper',
16497 template: "<ng-template><ng-content select=\"nb-step\"></ng-content></ng-template>\n<div class=\"header\">\n <ng-container *ngFor=\"let step of steps; let index = index; let first = first\">\n\n <div *ngIf=\"!first && !step.hidden\"\n [class.connector-past]=\"index <= selectedIndex\"\n class=\"connector\"></div>\n\n <div *ngIf=\"!step.hidden\" class=\"step\"\n [class.selected]=\"isStepSelected(step)\"\n [class.completed]=\"!isStepSelected(step) && step.completed\"\n [class.noninteractive]=\"disableStepNavigation\"\n (click)=\"!disableStepNavigation && step.select()\">\n <div class=\"label-index\">\n <span *ngIf=\"!step.completed || isStepSelected(step)\">{{ index + 1 }}</span>\n <nb-icon *ngIf=\"!isStepSelected(step) && step.completed\" icon=\"checkmark-outline\" pack=\"nebular-essentials\">\n </nb-icon>\n </div>\n <div class=\"label\">\n <ng-container *ngIf=\"step.isLabelTemplate\">\n <ng-container *ngTemplateOutlet=\"getStepTemplate(step)\"></ng-container>\n </ng-container>\n <span *ngIf=\"!step.isLabelTemplate\">{{ step.label }}</span>\n </div>\n </div>\n </ng-container>\n</div>\n<div class=\"step-content\">\n <ng-container [ngTemplateOutlet]=\"selected?.content\"></ng-container>\n</div>\n",
16498 providers: [{ provide: NB_STEPPER, useExisting: NbStepperComponent }],
16499 styles: [":host(.horizontal) .header .step{flex-direction:column}:host(.horizontal) .header .connector{height:2px}:host(.horizontal) .label-index{margin-bottom:10px}:host(.vertical){display:flex;height:100%}:host(.vertical) .header{flex-direction:column}:host(.vertical) .header .label{margin:0 10px}:host(.vertical) .header .connector{width:2px}.header{display:flex;justify-content:space-between;align-items:flex-start;margin-bottom:10px}.header .connector{flex:auto}.header .step{display:flex;align-items:center;cursor:pointer}.header .step.noninteractive{cursor:default}.header .label-index{display:flex;justify-content:center;align-items:center}.header .label{width:max-content}\n"]
16500 },] }
16501 ];
16502 NbStepperComponent.propDecorators = {
16503 selectedIndex: [{ type: i0.Input }],
16504 disableStepNavigation: [{ type: i0.Input }],
16505 selected: [{ type: i0.Input }],
16506 orientation: [{ type: i0.Input }],
16507 linear: [{ type: i0.Input }],
16508 vertical: [{ type: i0.HostBinding, args: ['class.vertical',] }],
16509 horizontal: [{ type: i0.HostBinding, args: ['class.horizontal',] }],
16510 steps: [{ type: i0.ContentChildren, args: [NbStepComponent,] }]
16511 };
16512 return NbStepperComponent;
16513}());
16514
16515var NbStepperNextDirective = /** @class */ (function () {
16516 function NbStepperNextDirective(stepper) {
16517 this.stepper = stepper;
16518 this.type = 'submit';
16519 }
16520 NbStepperNextDirective.prototype.onClick = function () {
16521 this.stepper.next();
16522 };
16523 NbStepperNextDirective.decorators = [
16524 { type: i0.Directive, args: [{
16525 selector: 'button[nbStepperNext]',
16526 },] }
16527 ];
16528 NbStepperNextDirective.ctorParameters = function () { return [
16529 { type: NbStepperComponent }
16530 ]; };
16531 NbStepperNextDirective.propDecorators = {
16532 type: [{ type: i0.Input }, { type: i0.HostBinding, args: ['attr.type',] }],
16533 onClick: [{ type: i0.HostListener, args: ['click',] }]
16534 };
16535 return NbStepperNextDirective;
16536}());
16537var NbStepperPreviousDirective = /** @class */ (function () {
16538 function NbStepperPreviousDirective(stepper) {
16539 this.stepper = stepper;
16540 this.type = 'button';
16541 }
16542 NbStepperPreviousDirective.prototype.onClick = function () {
16543 this.stepper.previous();
16544 };
16545 NbStepperPreviousDirective.decorators = [
16546 { type: i0.Directive, args: [{
16547 selector: 'button[nbStepperPrevious]',
16548 },] }
16549 ];
16550 NbStepperPreviousDirective.ctorParameters = function () { return [
16551 { type: NbStepperComponent }
16552 ]; };
16553 NbStepperPreviousDirective.propDecorators = {
16554 type: [{ type: i0.Input }, { type: i0.HostBinding, args: ['attr.type',] }],
16555 onClick: [{ type: i0.HostListener, args: ['click',] }]
16556 };
16557 return NbStepperPreviousDirective;
16558}());
16559
16560/**
16561 * @license
16562 * Copyright Akveo. All Rights Reserved.
16563 * Licensed under the MIT License. See License.txt in the project root for license information.
16564 */
16565var NbStepperModule = /** @class */ (function () {
16566 function NbStepperModule() {
16567 }
16568 NbStepperModule.decorators = [
16569 { type: i0.NgModule, args: [{
16570 imports: [
16571 NbSharedModule,
16572 NbIconModule,
16573 ],
16574 declarations: [
16575 NbStepperComponent,
16576 NbStepComponent,
16577 NbStepperNextDirective,
16578 NbStepperPreviousDirective,
16579 ],
16580 exports: [
16581 NbStepperComponent,
16582 NbStepComponent,
16583 NbStepperNextDirective,
16584 NbStepperPreviousDirective,
16585 ],
16586 },] }
16587 ];
16588 return NbStepperModule;
16589}());
16590
16591/**
16592 * @license
16593 * Copyright Akveo. All Rights Reserved.
16594 * Licensed under the MIT License. See License.txt in the project root for license information.
16595 */
16596/**
16597 * An accordion allows to toggle the display of sections of content
16598 *
16599 * Basic example
16600 * @stacked-example(Showcase, accordion/accordion-showcase.component)
16601 *
16602 * ```ts
16603 * <nb-accordion>
16604 * <nb-accordion-item>
16605 * <nb-accordion-item-header>Product Details</nb-accordion-item-header>
16606 * <nb-accordion-item-body>
16607 * Item Content
16608 * </nb-accordion-item-body>
16609 * </nb-accordion-item>
16610 * </nb-accordion>
16611 * ```
16612 * ### Installation
16613 *
16614 * Import `NbAccordionModule` to your feature module.
16615 * ```ts
16616 * @NgModule({
16617 * imports: [
16618 * // ...
16619 * NbAccordionModule,
16620 * ],
16621 * })
16622 * export class PageModule { }
16623 * ```
16624 * ### Usage
16625 *
16626 * With `multi` mode accordion can have multiple items expanded:
16627 * @stacked-example(Multiple expanded items, accordion/accordion-multi.component)
16628 *
16629 * `NbAccordionItemComponent` has several methods, for example it is possible to trigger item click/toggle:
16630 * @stacked-example(Expand API, accordion/accordion-toggle.component)
16631 *
16632 * @styles
16633 *
16634 * accordion-border-radius:
16635 * accordion-padding:
16636 * accordion-shadow:
16637 * accordion-header-text-color:
16638 * accordion-header-text-font-family:
16639 * accordion-header-text-font-size:
16640 * accordion-header-text-font-weight:
16641 * accordion-header-text-line-height:
16642 * accordion-header-disabled-text-color:
16643 * accordion-header-border-color:
16644 * accordion-header-border-style:
16645 * accordion-header-border-width:
16646 * accordion-item-background-color:
16647 * accordion-item-text-color:
16648 * accordion-item-text-font-family:
16649 * accordion-item-text-font-size:
16650 * accordion-item-text-font-weight:
16651 * accordion-item-text-line-height:
16652 */
16653var NbAccordionComponent = /** @class */ (function () {
16654 function NbAccordionComponent() {
16655 this.openCloseItems = new rxjs.Subject();
16656 this.multiValue = false;
16657 }
16658 Object.defineProperty(NbAccordionComponent.prototype, "multi", {
16659 /**
16660 * Allow multiple items to be expanded at the same time.
16661 * @type {boolean}
16662 */
16663 get: function () {
16664 return this.multiValue;
16665 },
16666 set: function (val) {
16667 this.multiValue = convertToBoolProperty(val);
16668 },
16669 enumerable: false,
16670 configurable: true
16671 });
16672 /**
16673 * Opens all enabled accordion items.
16674 */
16675 NbAccordionComponent.prototype.openAll = function () {
16676 if (this.multi) {
16677 this.openCloseItems.next(false);
16678 }
16679 };
16680 /**
16681 * Closes all enabled accordion items.
16682 */
16683 NbAccordionComponent.prototype.closeAll = function () {
16684 this.openCloseItems.next(true);
16685 };
16686 NbAccordionComponent.decorators = [
16687 { type: i0.Component, args: [{
16688 selector: 'nb-accordion',
16689 template: "\n <ng-content select=\"nb-accordion-item\"></ng-content>\n ",
16690 changeDetection: i0.ChangeDetectionStrategy.OnPush
16691 },] }
16692 ];
16693 NbAccordionComponent.propDecorators = {
16694 multi: [{ type: i0.Input, args: ['multi',] }]
16695 };
16696 return NbAccordionComponent;
16697}());
16698
16699/**
16700 * @license
16701 * Copyright Akveo. All Rights Reserved.
16702 * Licensed under the MIT License. See License.txt in the project root for license information.
16703 */
16704/**
16705 * Component intended to be used within `<nb-accordion>` component
16706 */
16707var NbAccordionItemComponent = /** @class */ (function () {
16708 function NbAccordionItemComponent(accordion, cd) {
16709 this.accordion = accordion;
16710 this.cd = cd;
16711 /**
16712 * Emits whenever the expanded state of the accordion changes.
16713 * Primarily used to facilitate two-way binding.
16714 */
16715 this.collapsedChange = new i0.EventEmitter();
16716 this.accordionItemInvalidate = new rxjs.Subject();
16717 this.collapsedValue = true;
16718 this.disabledValue = false;
16719 this.destroy$ = new rxjs.Subject();
16720 }
16721 Object.defineProperty(NbAccordionItemComponent.prototype, "collapsed", {
16722 /**
16723 * Item is collapse (`true` by default)
16724 * @type {boolean}
16725 */
16726 get: function () {
16727 return this.collapsedValue;
16728 },
16729 set: function (val) {
16730 this.collapsedValue = convertToBoolProperty(val);
16731 this.collapsedChange.emit(this.collapsedValue);
16732 this.invalidate();
16733 },
16734 enumerable: false,
16735 configurable: true
16736 });
16737 Object.defineProperty(NbAccordionItemComponent.prototype, "expanded", {
16738 /**
16739 * Item is expanded (`false` by default)
16740 * @type {boolean}
16741 */
16742 get: function () {
16743 return !this.collapsed;
16744 },
16745 set: function (val) {
16746 this.collapsedValue = !convertToBoolProperty(val);
16747 },
16748 enumerable: false,
16749 configurable: true
16750 });
16751 Object.defineProperty(NbAccordionItemComponent.prototype, "disabled", {
16752 /**
16753 * Item is disabled and cannot be opened.
16754 * @type {boolean}
16755 */
16756 get: function () {
16757 return this.disabledValue;
16758 },
16759 set: function (val) {
16760 this.disabledValue = convertToBoolProperty(val);
16761 this.invalidate();
16762 },
16763 enumerable: false,
16764 configurable: true
16765 });
16766 /**
16767 * Open/close the item
16768 */
16769 NbAccordionItemComponent.prototype.toggle = function () {
16770 if (!this.disabled) {
16771 // we need this temporary variable as `openCloseItems.next` will change current value we need to save
16772 var willSet = !this.collapsed;
16773 if (!this.accordion.multi) {
16774 this.accordion.openCloseItems.next(true);
16775 }
16776 this.collapsed = willSet;
16777 }
16778 };
16779 /**
16780 * Open the item.
16781 */
16782 NbAccordionItemComponent.prototype.open = function () {
16783 !this.disabled && (this.collapsed = false);
16784 };
16785 /**
16786 * Collapse the item.
16787 */
16788 NbAccordionItemComponent.prototype.close = function () {
16789 !this.disabled && (this.collapsed = true);
16790 };
16791 NbAccordionItemComponent.prototype.ngOnInit = function () {
16792 var _this = this;
16793 this.accordion.openCloseItems
16794 .pipe(rxjs_operators.takeUntil(this.destroy$))
16795 .subscribe(function (collapsed) {
16796 !_this.disabled && (_this.collapsed = collapsed);
16797 });
16798 };
16799 NbAccordionItemComponent.prototype.ngOnChanges = function (changes) {
16800 this.accordionItemInvalidate.next(true);
16801 };
16802 NbAccordionItemComponent.prototype.ngOnDestroy = function () {
16803 this.destroy$.next();
16804 this.destroy$.complete();
16805 this.accordionItemInvalidate.complete();
16806 };
16807 NbAccordionItemComponent.prototype.invalidate = function () {
16808 this.accordionItemInvalidate.next(true);
16809 this.cd.markForCheck();
16810 };
16811 NbAccordionItemComponent.decorators = [
16812 { type: i0.Component, args: [{
16813 selector: 'nb-accordion-item',
16814 template: "\n <ng-content select=\"nb-accordion-item-header\"></ng-content>\n <ng-content select=\"nb-accordion-item-body\"></ng-content>\n ",
16815 changeDetection: i0.ChangeDetectionStrategy.OnPush,
16816 styles: [":host{display:flex;flex-direction:column}\n"]
16817 },] }
16818 ];
16819 NbAccordionItemComponent.ctorParameters = function () { return [
16820 { type: NbAccordionComponent, decorators: [{ type: i0.Host }] },
16821 { type: i0.ChangeDetectorRef }
16822 ]; };
16823 NbAccordionItemComponent.propDecorators = {
16824 collapsed: [{ type: i0.Input, args: ['collapsed',] }, { type: i0.HostBinding, args: ['class.collapsed',] }],
16825 expanded: [{ type: i0.Input, args: ['expanded',] }, { type: i0.HostBinding, args: ['class.expanded',] }],
16826 disabled: [{ type: i0.Input, args: ['disabled',] }, { type: i0.HostBinding, args: ['class.disabled',] }],
16827 collapsedChange: [{ type: i0.Output }]
16828 };
16829 return NbAccordionItemComponent;
16830}());
16831
16832/**
16833 * @license
16834 * Copyright Akveo. All Rights Reserved.
16835 * Licensed under the MIT License. See License.txt in the project root for license information.
16836 */
16837var accordionItemBodyTrigger = _angular_animations.trigger('accordionItemBody', [
16838 _angular_animations.state('collapsed', _angular_animations.style({
16839 overflow: 'hidden',
16840 visibility: 'hidden',
16841 height: 0,
16842 })),
16843 _angular_animations.state('expanded', _angular_animations.style({
16844 overflow: 'hidden',
16845 visibility: 'visible',
16846 })),
16847 _angular_animations.transition('collapsed => expanded', _angular_animations.animate('100ms ease-in')),
16848 _angular_animations.transition('expanded => collapsed', _angular_animations.animate('100ms ease-out')),
16849]);
16850/**
16851 * Component intended to be used within `<nb-accordion-item>` component
16852 */
16853var NbAccordionItemBodyComponent = /** @class */ (function () {
16854 function NbAccordionItemBodyComponent(accordionItem, cd) {
16855 this.accordionItem = accordionItem;
16856 this.cd = cd;
16857 this.destroy$ = new rxjs.Subject();
16858 }
16859 Object.defineProperty(NbAccordionItemBodyComponent.prototype, "state", {
16860 get: function () {
16861 return this.accordionItem.collapsed ? 'collapsed' : 'expanded';
16862 },
16863 enumerable: false,
16864 configurable: true
16865 });
16866 NbAccordionItemBodyComponent.prototype.ngOnInit = function () {
16867 var _this = this;
16868 this.accordionItem.accordionItemInvalidate
16869 .pipe(rxjs_operators.takeUntil(this.destroy$))
16870 .subscribe(function () { return _this.cd.markForCheck(); });
16871 };
16872 NbAccordionItemBodyComponent.prototype.ngOnDestroy = function () {
16873 this.destroy$.next();
16874 this.destroy$.complete();
16875 };
16876 NbAccordionItemBodyComponent.decorators = [
16877 { type: i0.Component, args: [{
16878 selector: 'nb-accordion-item-body',
16879 template: "\n <div [@accordionItemBody]=\"{ value: state }\">\n <div class=\"item-body\">\n <ng-content></ng-content>\n </div>\n </div>\n ",
16880 animations: [accordionItemBodyTrigger],
16881 changeDetection: i0.ChangeDetectionStrategy.OnPush
16882 },] }
16883 ];
16884 NbAccordionItemBodyComponent.ctorParameters = function () { return [
16885 { type: NbAccordionItemComponent, decorators: [{ type: i0.Host }] },
16886 { type: i0.ChangeDetectorRef }
16887 ]; };
16888 return NbAccordionItemBodyComponent;
16889}());
16890
16891/**
16892 * @license
16893 * Copyright Akveo. All Rights Reserved.
16894 * Licensed under the MIT License. See License.txt in the project root for license information.
16895 */
16896/**
16897 * Component intended to be used within `<nb-accordion-item>` component
16898 */
16899var NbAccordionItemHeaderComponent = /** @class */ (function () {
16900 function NbAccordionItemHeaderComponent(accordionItem, cd) {
16901 this.accordionItem = accordionItem;
16902 this.cd = cd;
16903 this.destroy$ = new rxjs.Subject();
16904 }
16905 Object.defineProperty(NbAccordionItemHeaderComponent.prototype, "isCollapsed", {
16906 get: function () {
16907 return this.accordionItem.collapsed;
16908 },
16909 enumerable: false,
16910 configurable: true
16911 });
16912 Object.defineProperty(NbAccordionItemHeaderComponent.prototype, "expanded", {
16913 get: function () {
16914 return !this.accordionItem.collapsed;
16915 },
16916 enumerable: false,
16917 configurable: true
16918 });
16919 Object.defineProperty(NbAccordionItemHeaderComponent.prototype, "tabbable", {
16920 // issue #794
16921 get: function () {
16922 return this.accordionItem.disabled ? '-1' : '0';
16923 },
16924 enumerable: false,
16925 configurable: true
16926 });
16927 Object.defineProperty(NbAccordionItemHeaderComponent.prototype, "disabled", {
16928 get: function () {
16929 return this.accordionItem.disabled;
16930 },
16931 enumerable: false,
16932 configurable: true
16933 });
16934 NbAccordionItemHeaderComponent.prototype.toggle = function () {
16935 this.accordionItem.toggle();
16936 };
16937 Object.defineProperty(NbAccordionItemHeaderComponent.prototype, "state", {
16938 get: function () {
16939 if (this.isCollapsed) {
16940 return 'collapsed';
16941 }
16942 if (this.expanded) {
16943 return 'expanded';
16944 }
16945 },
16946 enumerable: false,
16947 configurable: true
16948 });
16949 NbAccordionItemHeaderComponent.prototype.ngOnInit = function () {
16950 var _this = this;
16951 this.accordionItem.accordionItemInvalidate
16952 .pipe(rxjs_operators.takeUntil(this.destroy$))
16953 .subscribe(function () { return _this.cd.markForCheck(); });
16954 };
16955 NbAccordionItemHeaderComponent.prototype.ngOnDestroy = function () {
16956 this.destroy$.next();
16957 this.destroy$.complete();
16958 };
16959 NbAccordionItemHeaderComponent.decorators = [
16960 { type: i0.Component, args: [{
16961 selector: 'nb-accordion-item-header',
16962 template: "\n <ng-content select=\"nb-accordion-item-title\"></ng-content>\n <ng-content select=\"nb-accordion-item-description\"></ng-content>\n <ng-content></ng-content>\n <nb-icon icon=\"chevron-down-outline\"\n pack=\"nebular-essentials\"\n [@expansionIndicator]=\"state\"\n *ngIf=\"!disabled\"\n class=\"expansion-indicator\">\n </nb-icon>\n ",
16963 animations: [
16964 _angular_animations.trigger('expansionIndicator', [
16965 _angular_animations.state('expanded', _angular_animations.style({
16966 transform: 'rotate(180deg)',
16967 })),
16968 _angular_animations.transition('collapsed => expanded', _angular_animations.animate('100ms ease-in')),
16969 _angular_animations.transition('expanded => collapsed', _angular_animations.animate('100ms ease-out')),
16970 ]),
16971 ],
16972 changeDetection: i0.ChangeDetectionStrategy.OnPush,
16973 styles: [":host{display:flex;align-items:center;cursor:pointer}:host:focus{outline:0}\n"]
16974 },] }
16975 ];
16976 NbAccordionItemHeaderComponent.ctorParameters = function () { return [
16977 { type: NbAccordionItemComponent, decorators: [{ type: i0.Host }] },
16978 { type: i0.ChangeDetectorRef }
16979 ]; };
16980 NbAccordionItemHeaderComponent.propDecorators = {
16981 isCollapsed: [{ type: i0.HostBinding, args: ['class.accordion-item-header-collapsed',] }],
16982 expanded: [{ type: i0.HostBinding, args: ['class.accordion-item-header-expanded',] }, { type: i0.HostBinding, args: ['attr.aria-expanded',] }],
16983 tabbable: [{ type: i0.HostBinding, args: ['attr.tabindex',] }],
16984 disabled: [{ type: i0.HostBinding, args: ['attr.aria-disabled',] }],
16985 toggle: [{ type: i0.HostListener, args: ['click',] }, { type: i0.HostListener, args: ['keydown.space',] }, { type: i0.HostListener, args: ['keydown.enter',] }]
16986 };
16987 return NbAccordionItemHeaderComponent;
16988}());
16989
16990/**
16991 * @license
16992 * Copyright Akveo. All Rights Reserved.
16993 * Licensed under the MIT License. See License.txt in the project root for license information.
16994 */
16995var NB_ACCORDION_COMPONENTS = [
16996 NbAccordionComponent,
16997 NbAccordionItemComponent,
16998 NbAccordionItemHeaderComponent,
16999 NbAccordionItemBodyComponent,
17000];
17001var NbAccordionModule = /** @class */ (function () {
17002 function NbAccordionModule() {
17003 }
17004 NbAccordionModule.decorators = [
17005 { type: i0.NgModule, args: [{
17006 imports: [_angular_common.CommonModule, NbIconModule],
17007 exports: tslib.__spreadArray([], NB_ACCORDION_COMPONENTS),
17008 declarations: tslib.__spreadArray([], NB_ACCORDION_COMPONENTS),
17009 providers: [],
17010 },] }
17011 ];
17012 return NbAccordionModule;
17013}());
17014
17015/**
17016 * @license
17017 * Copyright Akveo. All Rights Reserved.
17018 * Licensed under the MIT License. See License.txt in the project root for license information.
17019 */
17020/**
17021 * `[nbButtonToggle]` is a directive to add a `pressed` state to a button.
17022 */
17023var NbButtonToggleDirective = /** @class */ (function (_super) {
17024 tslib.__extends(NbButtonToggleDirective, _super);
17025 function NbButtonToggleDirective(renderer, hostElement, cd, zone, statusService) {
17026 var _this = _super.call(this, renderer, hostElement, cd, zone, statusService) || this;
17027 _this.renderer = renderer;
17028 _this.hostElement = hostElement;
17029 _this.cd = cd;
17030 _this.zone = zone;
17031 _this.statusService = statusService;
17032 _this._pressedChange$ = new rxjs.Subject();
17033 _this.appearance = 'filled';
17034 _this._pressed = false;
17035 /**
17036 * Emits whenever button pressed state change
17037 **/
17038 _this.pressedChange = new i0.EventEmitter();
17039 return _this;
17040 }
17041 Object.defineProperty(NbButtonToggleDirective.prototype, "pressedChange$", {
17042 get: function () {
17043 return this._pressedChange$.asObservable();
17044 },
17045 enumerable: false,
17046 configurable: true
17047 });
17048 Object.defineProperty(NbButtonToggleDirective.prototype, "pressed", {
17049 /**
17050 * Controls button pressed state
17051 **/
17052 get: function () {
17053 return this._pressed;
17054 },
17055 set: function (value) {
17056 if (this.pressed !== convertToBoolProperty(value)) {
17057 this._pressed = !this.pressed;
17058 this.pressedChange.emit(this.pressed);
17059 this._pressedChange$.next({ source: this, pressed: this.pressed });
17060 }
17061 },
17062 enumerable: false,
17063 configurable: true
17064 });
17065 Object.defineProperty(NbButtonToggleDirective.prototype, "basic", {
17066 get: function () {
17067 // By design, all toggle buttons should have a `basic` status when not pressed.
17068 return !this.pressed;
17069 },
17070 enumerable: false,
17071 configurable: true
17072 });
17073 Object.defineProperty(NbButtonToggleDirective.prototype, "primary", {
17074 get: function () {
17075 return this.pressed && (this.status === 'basic' || this.status === 'primary');
17076 },
17077 enumerable: false,
17078 configurable: true
17079 });
17080 Object.defineProperty(NbButtonToggleDirective.prototype, "success", {
17081 get: function () {
17082 return this.pressed && this.status === 'success';
17083 },
17084 enumerable: false,
17085 configurable: true
17086 });
17087 Object.defineProperty(NbButtonToggleDirective.prototype, "info", {
17088 get: function () {
17089 return this.pressed && this.status === 'info';
17090 },
17091 enumerable: false,
17092 configurable: true
17093 });
17094 Object.defineProperty(NbButtonToggleDirective.prototype, "warning", {
17095 get: function () {
17096 return this.pressed && this.status === 'warning';
17097 },
17098 enumerable: false,
17099 configurable: true
17100 });
17101 Object.defineProperty(NbButtonToggleDirective.prototype, "danger", {
17102 get: function () {
17103 return this.pressed && this.status === 'danger';
17104 },
17105 enumerable: false,
17106 configurable: true
17107 });
17108 Object.defineProperty(NbButtonToggleDirective.prototype, "control", {
17109 get: function () {
17110 return this.pressed && this.status === 'control';
17111 },
17112 enumerable: false,
17113 configurable: true
17114 });
17115 Object.defineProperty(NbButtonToggleDirective.prototype, "additionalClasses", {
17116 get: function () {
17117 if (this.statusService.isCustomStatus(this.status)) {
17118 return [this.statusService.getStatusClass(this.status)];
17119 }
17120 return [];
17121 },
17122 enumerable: false,
17123 configurable: true
17124 });
17125 NbButtonToggleDirective.prototype.onClick = function () {
17126 this.pressed = !this.pressed;
17127 };
17128 /**
17129 * @docs-private
17130 */
17131 NbButtonToggleDirective.prototype._updatePressed = function (value) {
17132 this.pressed = value;
17133 this.cd.markForCheck();
17134 };
17135 NbButtonToggleDirective.decorators = [
17136 { type: i0.Directive, args: [{
17137 selector: 'button[nbButtonToggle]',
17138 providers: [
17139 { provide: NbButton, useExisting: NbButtonToggleDirective },
17140 ],
17141 exportAs: 'nbButtonToggle',
17142 },] }
17143 ];
17144 NbButtonToggleDirective.ctorParameters = function () { return [
17145 { type: i0.Renderer2 },
17146 { type: i0.ElementRef },
17147 { type: i0.ChangeDetectorRef },
17148 { type: i0.NgZone },
17149 { type: NbStatusService }
17150 ]; };
17151 NbButtonToggleDirective.propDecorators = {
17152 appearance: [{ type: i0.Input }],
17153 value: [{ type: i0.Input }],
17154 pressed: [{ type: i0.Input }, { type: i0.HostBinding, args: ['attr.aria-pressed',] }],
17155 pressedChange: [{ type: i0.Output }],
17156 basic: [{ type: i0.HostBinding, args: ['class.status-basic',] }],
17157 primary: [{ type: i0.HostBinding, args: ['class.status-primary',] }],
17158 success: [{ type: i0.HostBinding, args: ['class.status-success',] }],
17159 info: [{ type: i0.HostBinding, args: ['class.status-info',] }],
17160 warning: [{ type: i0.HostBinding, args: ['class.status-warning',] }],
17161 danger: [{ type: i0.HostBinding, args: ['class.status-danger',] }],
17162 control: [{ type: i0.HostBinding, args: ['class.status-control',] }],
17163 additionalClasses: [{ type: i0.HostBinding, args: ['class',] }],
17164 onClick: [{ type: i0.HostListener, args: ['click',] }]
17165 };
17166 return NbButtonToggleDirective;
17167}(NbButton));
17168
17169/**
17170 * @license
17171 * Copyright Akveo. All Rights Reserved.
17172 * Licensed under the MIT License. See License.txt in the project root for license information.
17173 */
17174/**
17175 * `<nb-button-group>` visually groups buttons together and allow to control buttons properties and the state as a
17176 * group.
17177 * @stacked-example(Button Group Showcase, button-group/button-group-showcase.component)
17178 *
17179 * ### Installation
17180 *
17181 * Import `NbButtonGroupModule` to your feature module.
17182 * ```ts
17183 * @NgModule({
17184 * imports: [
17185 * // ...
17186 * NbButtonGroupModule,
17187 * ],
17188 * })
17189 * export class PageModule { }
17190 * ```
17191 *
17192 * ### Usage
17193 *
17194 * You can use `<nb-button-group>` to group a series of `[nbButton]` or `[nbButtonToggle]` components.
17195 * @stacked-example(Button and Button Toggle Groups, button-group/button-and-button-toggle-groups.component)
17196 *
17197 * For a group of multiple `[nbButtonToggle]` you also can control multi-selection behavior. By default, the group
17198 * component allows only one pressed button toggle at a time (similar to the radio group). To be able to keep multiple
17199 * toggles pressed, you need to add `multiple` attributes to the `<nb-button-toggle>`.
17200 * @stacked-example(Button Group Multiple, button-group/button-group-multiple.component)
17201 *
17202 * To know which buttons are currently pressed listen to `(valueChange)` on the `nb-button-group`. Event
17203 * contains an array of values of currently pressed button toggles. You can assign a value to the
17204 * `[nbButtonToggle]` via the `value` input.
17205 * @stacked-example(Button Group Value Change, button-group/button-group-value-change.component)
17206 *
17207 * To disable a group of buttons, add a `disabled` attribute to the `<nb-button-group>`.
17208 * @stacked-example(Button Group Disabled, button-group/button-group-disabled.component)
17209 *
17210 * The group component controls all visual attributes of buttons such as `appearance`, `status`, `size`, `shape`.
17211 * You can change it via the appropriate attributes.
17212 *
17213 * Button group appearances:
17214 * @stacked-example(Button Group Appearances, button-group/button-group-appearances.component)
17215 *
17216 * Button group statuses:
17217 * @stacked-example(Button Group Statuses, button-group/button-group-statuses.component)
17218 *
17219 * Button group sizes:
17220 * @stacked-example(Button Group Sizes, button-group/button-group-sizes.component)
17221 *
17222 * Buttons group shapes:
17223 * @additional-example(Button Group Shapes, button-group/button-group-shapes.component)
17224 *
17225 * @styles
17226 *
17227 * button-group-filled-button-basic-text-color:
17228 * button-group-filled-button-primary-text-color:
17229 * button-group-filled-button-success-text-color:
17230 * button-group-filled-button-info-text-color:
17231 * button-group-filled-button-warning-text-color:
17232 * button-group-filled-button-danger-text-color:
17233 * button-group-filled-button-control-text-color:
17234 * button-group-filled-basic-divider-color:
17235 * button-group-filled-primary-divider-color:
17236 * button-group-filled-success-divider-color:
17237 * button-group-filled-info-divider-color:
17238 * button-group-filled-warning-divider-color:
17239 * button-group-filled-danger-divider-color:
17240 * button-group-filled-control-divider-color:
17241 * button-group-ghost-divider-color:
17242 **/
17243var NbButtonGroupComponent = /** @class */ (function () {
17244 function NbButtonGroupComponent(cd, statusService) {
17245 this.cd = cd;
17246 this.statusService = statusService;
17247 this.lastEmittedValue = [];
17248 this.destroy$ = new rxjs.Subject();
17249 this.buttonsChange$ = new rxjs.Subject();
17250 /**
17251 * Button group size, available sizes:
17252 * `tiny`, `small`, `medium`, `large`, `giant`
17253 */
17254 this.size = 'medium';
17255 /**
17256 * Button group status (adds specific styles):
17257 * `basic`, `primary`, `info`, `success`, `warning`, `danger`, `control`
17258 */
17259 this.status = 'basic';
17260 /**
17261 * Button group shapes: `rectangle`, `round`, `semi-round`
17262 */
17263 this.shape = 'rectangle';
17264 /**
17265 * Button group appearance: `filled`, `outline`, `ghost`
17266 */
17267 this.appearance = 'filled';
17268 this._disabled = false;
17269 this._multiple = false;
17270 /**
17271 * Emits when `nbButtonToggle` pressed state change. `$event` contains an array of the currently pressed button
17272 * toggles.
17273 */
17274 this.valueChange = new i0.EventEmitter();
17275 this.role = 'group';
17276 }
17277 Object.defineProperty(NbButtonGroupComponent.prototype, "disabled", {
17278 get: function () {
17279 return this._disabled;
17280 },
17281 set: function (value) {
17282 if (this.disabled !== convertToBoolProperty(value)) {
17283 this._disabled = !this.disabled;
17284 }
17285 },
17286 enumerable: false,
17287 configurable: true
17288 });
17289 Object.defineProperty(NbButtonGroupComponent.prototype, "multiple", {
17290 /**
17291 * Allows to keep multiple button toggles pressed. Off by default.
17292 */
17293 get: function () {
17294 return this._multiple;
17295 },
17296 set: function (value) {
17297 this._multiple = convertToBoolProperty(value);
17298 },
17299 enumerable: false,
17300 configurable: true
17301 });
17302 Object.defineProperty(NbButtonGroupComponent.prototype, "filled", {
17303 /**
17304 * Sets `filled` appearance
17305 */
17306 get: function () {
17307 return this.appearance === 'filled';
17308 },
17309 set: function (value) {
17310 if (convertToBoolProperty(value)) {
17311 this.appearance = 'filled';
17312 }
17313 },
17314 enumerable: false,
17315 configurable: true
17316 });
17317 Object.defineProperty(NbButtonGroupComponent.prototype, "outline", {
17318 /**
17319 * Sets `outline` appearance
17320 */
17321 get: function () {
17322 return this.appearance === 'outline';
17323 },
17324 set: function (value) {
17325 if (convertToBoolProperty(value)) {
17326 this.appearance = 'outline';
17327 }
17328 },
17329 enumerable: false,
17330 configurable: true
17331 });
17332 Object.defineProperty(NbButtonGroupComponent.prototype, "ghost", {
17333 /**
17334 * Sets `ghost` appearance
17335 */
17336 get: function () {
17337 return this.appearance === 'ghost';
17338 },
17339 set: function (value) {
17340 if (convertToBoolProperty(value)) {
17341 this.appearance = 'ghost';
17342 }
17343 },
17344 enumerable: false,
17345 configurable: true
17346 });
17347 Object.defineProperty(NbButtonGroupComponent.prototype, "additionalClasses", {
17348 get: function () {
17349 if (this.statusService.isCustomStatus(this.status)) {
17350 return [this.statusService.getStatusClass(this.status)];
17351 }
17352 return [];
17353 },
17354 enumerable: false,
17355 configurable: true
17356 });
17357 NbButtonGroupComponent.prototype.ngOnChanges = function (_a) {
17358 var _b;
17359 var size = _a.size, status = _a.status, shape = _a.shape, multiple = _a.multiple, filled = _a.filled, outline = _a.outline, ghost = _a.ghost, disabled = _a.disabled;
17360 if (size || status || shape || multiple || filled || outline || ghost || disabled) {
17361 this.syncButtonsProperties(((_b = this.buttons) === null || _b === void 0 ? void 0 : _b.toArray()) || []);
17362 }
17363 };
17364 NbButtonGroupComponent.prototype.ngAfterContentInit = function () {
17365 var _this = this;
17366 this.buttonsChange$
17367 .pipe(rxjs_operators.takeUntil(this.destroy$))
17368 .subscribe(function (buttons) {
17369 _this.listenButtonPressedState(buttons);
17370 _this.syncButtonsProperties(buttons);
17371 });
17372 this.buttons.changes
17373 .pipe(
17374 // `buttons.changes` emit during change detection run after projected content already was initialized.
17375 // So at this time, it's too late to update projected buttons properties as updating bindings after
17376 // initialization doesn't make sense. Changes won't be picked up and should cause an "expression changed" error.
17377 // Instead, we wrap the new buttons list into a promise to defer update to the following microtask and also to
17378 // trigger change detection one more time.
17379 rxjs_operators.switchMap(function (buttons) { return rxjs.from(Promise.resolve(buttons.toArray())); }), rxjs_operators.takeUntil(this.destroy$))
17380 .subscribe(this.buttonsChange$);
17381 this.buttonsChange$.next(this.buttons.toArray());
17382 };
17383 NbButtonGroupComponent.prototype.listenButtonPressedState = function (buttons) {
17384 var _this = this;
17385 var toggleButtons = buttons.filter(function (button) {
17386 return button instanceof NbButtonToggleDirective;
17387 });
17388 if (!toggleButtons.length) {
17389 return;
17390 }
17391 var buttonsPressedChange$ = toggleButtons
17392 .map(function (button) { return button.pressedChange$; });
17393 rxjs.merge.apply(void 0, buttonsPressedChange$).pipe(rxjs_operators.filter(function (_a) {
17394 var pressed = _a.pressed;
17395 return !_this.multiple && pressed;
17396 }), rxjs_operators.takeUntil(rxjs.merge(this.buttonsChange$, this.destroy$)))
17397 .subscribe(function (_a) {
17398 var source = _a.source;
17399 toggleButtons
17400 .filter(function (button) { return button !== source; })
17401 .forEach(function (button) { return button._updatePressed(false); });
17402 });
17403 rxjs.merge.apply(void 0, buttonsPressedChange$).pipe(
17404 // Use startWith to emit if some buttons are initially pressed.
17405 rxjs_operators.startWith(''),
17406 // Use debounce to emit change once when pressed state change in multiple button toggles.
17407 rxjs_operators.debounceTime(0), rxjs_operators.takeUntil(rxjs.merge(this.buttonsChange$, this.destroy$)))
17408 .subscribe(function () { return _this.emitCurrentValue(toggleButtons); });
17409 };
17410 NbButtonGroupComponent.prototype.syncButtonsProperties = function (buttons) {
17411 var _this = this;
17412 buttons.forEach(function (button) {
17413 button.updateProperties({
17414 appearance: _this.appearance,
17415 size: _this.size,
17416 status: _this.status,
17417 shape: _this.shape,
17418 disabled: _this.disabled,
17419 });
17420 });
17421 };
17422 NbButtonGroupComponent.prototype.emitCurrentValue = function (toggleButtons) {
17423 var pressedToggleValues = toggleButtons
17424 .filter(function (b) { return b.pressed && typeof b.value !== 'undefined'; })
17425 .map(function (b) { return b.value; });
17426 // Prevent multiple emissions of empty value.
17427 if (pressedToggleValues.length === 0 && this.lastEmittedValue.length === 0) {
17428 return;
17429 }
17430 this.valueChange.emit(pressedToggleValues);
17431 this.lastEmittedValue = pressedToggleValues;
17432 };
17433 NbButtonGroupComponent.decorators = [
17434 { type: i0.Component, args: [{
17435 selector: 'nb-button-group',
17436 template: "\n <ng-content></ng-content>\n ",
17437 changeDetection: i0.ChangeDetectionStrategy.OnPush
17438 },] }
17439 ];
17440 NbButtonGroupComponent.ctorParameters = function () { return [
17441 { type: i0.ChangeDetectorRef },
17442 { type: NbStatusService }
17443 ]; };
17444 NbButtonGroupComponent.propDecorators = {
17445 buttons: [{ type: i0.ContentChildren, args: [NbButton,] }],
17446 size: [{ type: i0.Input }],
17447 status: [{ type: i0.Input }],
17448 shape: [{ type: i0.Input }],
17449 appearance: [{ type: i0.Input }],
17450 disabled: [{ type: i0.Input }],
17451 multiple: [{ type: i0.Input }],
17452 filled: [{ type: i0.Input }],
17453 outline: [{ type: i0.Input }],
17454 ghost: [{ type: i0.Input }],
17455 valueChange: [{ type: i0.Output }],
17456 role: [{ type: i0.HostBinding, args: ['attr.role',] }],
17457 additionalClasses: [{ type: i0.HostBinding, args: ['class',] }]
17458 };
17459 return NbButtonGroupComponent;
17460}());
17461
17462/**
17463 * @license
17464 * Copyright Akveo. All Rights Reserved.
17465 * Licensed under the MIT License. See License.txt in the project root for license information.
17466 */
17467var NbButtonGroupModule = /** @class */ (function () {
17468 function NbButtonGroupModule() {
17469 }
17470 NbButtonGroupModule.decorators = [
17471 { type: i0.NgModule, args: [{
17472 declarations: [NbButtonGroupComponent, NbButtonToggleDirective],
17473 exports: [NbButtonGroupComponent, NbButtonToggleDirective],
17474 },] }
17475 ];
17476 return NbButtonGroupModule;
17477}());
17478
17479/**
17480 * List is a container component that wraps `nb-list-item` component.
17481 *
17482 * Basic example:
17483 * @stacked-example(Simple list, list/simple-list-showcase.component)
17484 *
17485 * `nb-list-item` accepts arbitrary content, so you can create a list of any components.
17486 *
17487 * ### Installation
17488 *
17489 * Import `NbListModule` to your feature module.
17490 * ```ts
17491 * @NgModule({
17492 * imports: [
17493 * // ...
17494 * NbListModule,
17495 * ],
17496 * })
17497 * export class PageModule { }
17498 * ```
17499 * ### Usage
17500 *
17501 * List of users:
17502 * @stacked-example(Users list, list/users-list-showcase.component)
17503 *
17504 * @styles
17505 *
17506 * list-item-divider-color:
17507 * list-item-divider-style:
17508 * list-item-divider-width:
17509 * list-item-padding:
17510 * list-item-text-color:
17511 * list-item-font-family:
17512 * list-item-font-size:
17513 * list-item-font-weight:
17514 * list-item-line-height:
17515 */
17516var NbListComponent = /** @class */ (function () {
17517 function NbListComponent() {
17518 /**
17519 * Role attribute value
17520 *
17521 * @type {string}
17522 */
17523 this.role = 'list';
17524 }
17525 NbListComponent.decorators = [
17526 { type: i0.Component, args: [{
17527 selector: 'nb-list',
17528 template: "<ng-content select=\"nb-list-item\"></ng-content>",
17529 styles: [":host{display:flex;flex-direction:column;flex:1 1 auto;overflow:auto}\n"]
17530 },] }
17531 ];
17532 NbListComponent.propDecorators = {
17533 role: [{ type: i0.Input }, { type: i0.HostBinding, args: ['attr.role',] }]
17534 };
17535 return NbListComponent;
17536}());
17537/**
17538 * List item component is a grouping component that accepts arbitrary content.
17539 * It should be direct child of `nb-list` componet.
17540 */
17541var NbListItemComponent = /** @class */ (function () {
17542 function NbListItemComponent() {
17543 /**
17544 * Role attribute value
17545 *
17546 * @type {string}
17547 */
17548 this.role = 'listitem';
17549 }
17550 NbListItemComponent.decorators = [
17551 { type: i0.Component, args: [{
17552 selector: 'nb-list-item',
17553 template: "<ng-content></ng-content>",
17554 styles: [":host{display:flex;align-items:center;flex-shrink:0}\n"]
17555 },] }
17556 ];
17557 NbListItemComponent.propDecorators = {
17558 role: [{ type: i0.Input }, { type: i0.HostBinding, args: ['attr.role',] }]
17559 };
17560 return NbListItemComponent;
17561}());
17562
17563/**
17564 * List pager directive
17565 *
17566 * Directive allows you to determine page of currently viewing items.
17567 *
17568 */
17569var NbListPageTrackerDirective = /** @class */ (function () {
17570 function NbListPageTrackerDirective() {
17571 var _this = this;
17572 this.destroy$ = new rxjs.Subject();
17573 /**
17574 * Page to start counting with.
17575 */
17576 this.startPage = 1;
17577 /**
17578 * Emits when another page become visible.
17579 */
17580 this.pageChange = new i0.EventEmitter();
17581 this.observer = new IntersectionObserver(function (entries) { return _this.checkForPageChange(entries); }, { threshold: 0.5 });
17582 }
17583 NbListPageTrackerDirective.prototype.ngAfterViewInit = function () {
17584 var _this = this;
17585 if (this.listItems && this.listItems.length) {
17586 this.observeItems();
17587 }
17588 this.listItems.changes
17589 .pipe(rxjs_operators.takeUntil(this.destroy$))
17590 .subscribe(function () { return _this.observeItems(); });
17591 };
17592 NbListPageTrackerDirective.prototype.ngOnDestroy = function () {
17593 this.observer.disconnect && this.observer.disconnect();
17594 };
17595 NbListPageTrackerDirective.prototype.observeItems = function () {
17596 var _this = this;
17597 this.listItems.forEach(function (i) { return _this.observer.observe(i.nativeElement); });
17598 };
17599 NbListPageTrackerDirective.prototype.checkForPageChange = function (entries) {
17600 var mostVisiblePage = this.findMostVisiblePage(entries);
17601 if (mostVisiblePage && this.currentPage !== mostVisiblePage) {
17602 this.currentPage = mostVisiblePage;
17603 this.pageChange.emit(this.currentPage);
17604 }
17605 };
17606 NbListPageTrackerDirective.prototype.findMostVisiblePage = function (entries) {
17607 var intersectionRatioByPage = new Map();
17608 for (var _i = 0, entries_1 = entries; _i < entries_1.length; _i++) {
17609 var entry = entries_1[_i];
17610 if (entry.intersectionRatio < 0.5) {
17611 continue;
17612 }
17613 var elementIndex = this.elementIndex(entry.target);
17614 if (elementIndex === -1) {
17615 continue;
17616 }
17617 var page = this.startPage + Math.floor(elementIndex / this.pageSize);
17618 var ratio = entry.intersectionRatio;
17619 if (intersectionRatioByPage.has(page)) {
17620 ratio += intersectionRatioByPage.get(page);
17621 }
17622 intersectionRatioByPage.set(page, ratio);
17623 }
17624 var maxRatio = 0;
17625 var mostVisiblePage;
17626 intersectionRatioByPage.forEach(function (ratio, page) {
17627 if (ratio > maxRatio) {
17628 maxRatio = ratio;
17629 mostVisiblePage = page;
17630 }
17631 });
17632 return mostVisiblePage;
17633 };
17634 NbListPageTrackerDirective.prototype.elementIndex = function (element) {
17635 return element.parentElement && element.parentElement.children
17636 ? Array.from(element.parentElement.children).indexOf(element)
17637 : -1;
17638 };
17639 NbListPageTrackerDirective.decorators = [
17640 { type: i0.Directive, args: [{
17641 selector: '[nbListPageTracker]',
17642 },] }
17643 ];
17644 NbListPageTrackerDirective.ctorParameters = function () { return []; };
17645 NbListPageTrackerDirective.propDecorators = {
17646 pageSize: [{ type: i0.Input }],
17647 startPage: [{ type: i0.Input }],
17648 pageChange: [{ type: i0.Output }],
17649 listItems: [{ type: i0.ContentChildren, args: [NbListItemComponent, { read: i0.ElementRef },] }]
17650 };
17651 return NbListPageTrackerDirective;
17652}());
17653
17654var NbScrollableContainerDimentions = /** @class */ (function () {
17655 function NbScrollableContainerDimentions() {
17656 }
17657 return NbScrollableContainerDimentions;
17658}());
17659/**
17660 * Infinite List Directive
17661 *
17662 * ```html
17663 * <nb-list nbInfiniteList [threshold]="500" (bottomThreshold)="loadNext()">
17664 * <nb-list-item *ngFor="let item of items"></nb-list-item>
17665 * </nb-list>
17666 * ```
17667 *
17668 * @stacked-example(Simple infinite list, infinite-list/infinite-list-showcase.component)
17669 *
17670 * Directive will notify when list scrolled up or down to a given threshold.
17671 * By default it listen to scroll of list on which applied, but also can be set to listen to window scroll.
17672 *
17673 * @stacked-example(Scroll modes, infinite-list/infinite-list-scroll-modes.component)
17674 *
17675 * To improve UX of infinite lists, it's better to keep current page in url,
17676 * so user able to return to the last viewed page or to share a link to this page.
17677 * `nbListPageTracker` directive will help you to know, what page user currently viewing.
17678 * Just put it on a list, set page size and it will calculate page that currently in viewport.
17679 * You can [open the example](example/infinite-list/infinite-news-list.component)
17680 * in a new tab to check out this feature.
17681 *
17682 * @stacked-example(Infinite list with pager, infinite-list/infinite-news-list.component)
17683 *
17684 * @stacked-example(Infinite list with placeholders at the top, infinite-list/infinite-list-placeholders.component)
17685 *
17686 */
17687var NbInfiniteListDirective = /** @class */ (function () {
17688 function NbInfiniteListDirective(elementRef, scrollService, dimensionsService) {
17689 this.elementRef = elementRef;
17690 this.scrollService = scrollService;
17691 this.dimensionsService = dimensionsService;
17692 this.destroy$ = new rxjs.Subject();
17693 this.windowScroll = false;
17694 /**
17695 * Emits when distance between list bottom and current scroll position is less than threshold.
17696 */
17697 this.bottomThreshold = new i0.EventEmitter(true);
17698 /**
17699 * Emits when distance between list top and current scroll position is less than threshold.
17700 */
17701 this.topThreshold = new i0.EventEmitter(true);
17702 }
17703 Object.defineProperty(NbInfiniteListDirective.prototype, "elementScroll", {
17704 get: function () {
17705 return !this.windowScroll;
17706 },
17707 enumerable: false,
17708 configurable: true
17709 });
17710 Object.defineProperty(NbInfiniteListDirective.prototype, "listenWindowScroll", {
17711 /**
17712 * By default component observes list scroll position.
17713 * If set to `true`, component will observe position of page scroll instead.
17714 */
17715 set: function (value) {
17716 this.windowScroll = convertToBoolProperty(value);
17717 },
17718 enumerable: false,
17719 configurable: true
17720 });
17721 NbInfiniteListDirective.prototype.onElementScroll = function () {
17722 if (this.elementScroll) {
17723 this.checkPosition(this.elementRef.nativeElement);
17724 }
17725 };
17726 NbInfiniteListDirective.prototype.ngAfterViewInit = function () {
17727 var _this = this;
17728 this.scrollService.onScroll()
17729 .pipe(rxjs_operators.filter(function () { return _this.windowScroll; }), rxjs_operators.switchMap(function () { return _this.getContainerDimensions(); }), rxjs_operators.takeUntil(this.destroy$))
17730 .subscribe(function (dimentions) { return _this.checkPosition(dimentions); });
17731 this.listItems.changes
17732 .pipe(
17733 // For some reason, changes are emitted before list item removed from dom,
17734 // so dimensions will be incorrect.
17735 // Check every 50ms for a second if dom and query are in sync.
17736 // Once they synchronized, we can get proper dimensions.
17737 rxjs_operators.switchMap(function () { return rxjs.interval(50).pipe(rxjs_operators.filter(function () { return _this.inSyncWithDom(); }), rxjs_operators.take(1), rxjs_operators.takeUntil(rxjs.timer(1000))); }), rxjs_operators.switchMap(function () { return _this.getContainerDimensions(); }), rxjs_operators.takeUntil(this.destroy$))
17738 .subscribe(function (dimentions) { return _this.checkPosition(dimentions); });
17739 this.getContainerDimensions().subscribe(function (dimentions) { return _this.checkPosition(dimentions); });
17740 };
17741 NbInfiniteListDirective.prototype.ngOnDestroy = function () {
17742 this.destroy$.next();
17743 this.destroy$.complete();
17744 };
17745 NbInfiniteListDirective.prototype.checkPosition = function (_a) {
17746 var scrollHeight = _a.scrollHeight, scrollTop = _a.scrollTop, clientHeight = _a.clientHeight;
17747 var initialCheck = this.lastScrollPosition == null;
17748 var manualCheck = this.lastScrollPosition === scrollTop;
17749 var scrollUp = scrollTop < this.lastScrollPosition;
17750 var scrollDown = scrollTop > this.lastScrollPosition;
17751 var distanceToBottom = scrollHeight - scrollTop - clientHeight;
17752 if ((initialCheck || manualCheck || scrollDown) && distanceToBottom <= this.threshold) {
17753 this.bottomThreshold.emit();
17754 }
17755 if ((initialCheck || scrollUp) && scrollTop <= this.threshold) {
17756 this.topThreshold.emit();
17757 }
17758 this.lastScrollPosition = scrollTop;
17759 };
17760 NbInfiniteListDirective.prototype.getContainerDimensions = function () {
17761 if (this.elementScroll) {
17762 var _a = this.elementRef.nativeElement, scrollTop = _a.scrollTop, scrollHeight = _a.scrollHeight, clientHeight = _a.clientHeight;
17763 return rxjs.of({ scrollTop: scrollTop, scrollHeight: scrollHeight, clientHeight: clientHeight });
17764 }
17765 return rxjs.forkJoin([this.scrollService.getPosition(), this.dimensionsService.getDimensions()])
17766 .pipe(rxjs_operators.map(function (_a) {
17767 var scrollPosition = _a[0], dimensions = _a[1];
17768 return ({
17769 scrollTop: scrollPosition.y,
17770 scrollHeight: dimensions.scrollHeight,
17771 clientHeight: dimensions.clientHeight,
17772 });
17773 }));
17774 };
17775 NbInfiniteListDirective.prototype.inSyncWithDom = function () {
17776 return this.elementRef.nativeElement.children.length === this.listItems.length;
17777 };
17778 NbInfiniteListDirective.decorators = [
17779 { type: i0.Directive, args: [{
17780 selector: '[nbInfiniteList]',
17781 },] }
17782 ];
17783 NbInfiniteListDirective.ctorParameters = function () { return [
17784 { type: i0.ElementRef },
17785 { type: NbLayoutScrollService },
17786 { type: NbLayoutRulerService }
17787 ]; };
17788 NbInfiniteListDirective.propDecorators = {
17789 threshold: [{ type: i0.Input }],
17790 listenWindowScroll: [{ type: i0.Input }],
17791 bottomThreshold: [{ type: i0.Output }],
17792 topThreshold: [{ type: i0.Output }],
17793 onElementScroll: [{ type: i0.HostListener, args: ['scroll',] }],
17794 listItems: [{ type: i0.ContentChildren, args: [NbListItemComponent,] }]
17795 };
17796 return NbInfiniteListDirective;
17797}());
17798
17799var components = [
17800 NbListComponent,
17801 NbListItemComponent,
17802 NbListPageTrackerDirective,
17803 NbInfiniteListDirective,
17804];
17805var NbListModule = /** @class */ (function () {
17806 function NbListModule() {
17807 }
17808 NbListModule.decorators = [
17809 { type: i0.NgModule, args: [{
17810 declarations: components,
17811 exports: components,
17812 },] }
17813 ];
17814 return NbListModule;
17815}());
17816
17817var NbDirectionality = /** @class */ (function (_super) {
17818 tslib.__extends(NbDirectionality, _super);
17819 function NbDirectionality() {
17820 return _super !== null && _super.apply(this, arguments) || this;
17821 }
17822 NbDirectionality.decorators = [
17823 { type: i0.Injectable }
17824 ];
17825 return NbDirectionality;
17826}(_angular_cdk_bidi.Directionality));
17827
17828var NbBidiModule = /** @class */ (function (_super) {
17829 tslib.__extends(NbBidiModule, _super);
17830 function NbBidiModule() {
17831 return _super !== null && _super.apply(this, arguments) || this;
17832 }
17833 NbBidiModule.decorators = [
17834 { type: i0.NgModule, args: [{
17835 providers: [
17836 { provide: NbDirectionality, useExisting: _angular_cdk_bidi.Directionality },
17837 ],
17838 },] }
17839 ];
17840 return NbBidiModule;
17841}(_angular_cdk_bidi.BidiModule));
17842
17843/*
17844 * @license
17845 * Copyright Akveo. All Rights Reserved.
17846 * Licensed under the MIT License. See License.txt in the project root for license infornbion.
17847 */
17848/**
17849 * Cell definition for the nb-table.
17850 * Captures the template of a column's data row cell as well as cell-specific properties.
17851 */
17852var NbCellDefDirective = /** @class */ (function (_super) {
17853 tslib.__extends(NbCellDefDirective, _super);
17854 function NbCellDefDirective() {
17855 return _super !== null && _super.apply(this, arguments) || this;
17856 }
17857 NbCellDefDirective.decorators = [
17858 { type: i0.Directive, args: [{
17859 selector: '[nbCellDef]',
17860 providers: [{ provide: _angular_cdk_table.CdkCellDef, useExisting: NbCellDefDirective }],
17861 },] }
17862 ];
17863 return NbCellDefDirective;
17864}(_angular_cdk_table.CdkCellDef));
17865/**
17866 * Header cell definition for the nb-table.
17867 * Captures the template of a column's header cell and as well as cell-specific properties.
17868 */
17869var NbHeaderCellDefDirective = /** @class */ (function (_super) {
17870 tslib.__extends(NbHeaderCellDefDirective, _super);
17871 function NbHeaderCellDefDirective() {
17872 return _super !== null && _super.apply(this, arguments) || this;
17873 }
17874 NbHeaderCellDefDirective.decorators = [
17875 { type: i0.Directive, args: [{
17876 selector: '[nbHeaderCellDef]',
17877 providers: [{ provide: _angular_cdk_table.CdkHeaderCellDef, useExisting: NbHeaderCellDefDirective }],
17878 },] }
17879 ];
17880 return NbHeaderCellDefDirective;
17881}(_angular_cdk_table.CdkHeaderCellDef));
17882/**
17883 * Footer cell definition for the nb-table.
17884 * Captures the template of a column's footer cell and as well as cell-specific properties.
17885 */
17886var NbFooterCellDefDirective = /** @class */ (function (_super) {
17887 tslib.__extends(NbFooterCellDefDirective, _super);
17888 function NbFooterCellDefDirective() {
17889 return _super !== null && _super.apply(this, arguments) || this;
17890 }
17891 NbFooterCellDefDirective.decorators = [
17892 { type: i0.Directive, args: [{
17893 selector: '[nbFooterCellDef]',
17894 providers: [{ provide: _angular_cdk_table.CdkFooterCellDef, useExisting: NbFooterCellDefDirective }],
17895 },] }
17896 ];
17897 return NbFooterCellDefDirective;
17898}(_angular_cdk_table.CdkFooterCellDef));
17899var NB_SORT_HEADER_COLUMN_DEF = new i0.InjectionToken('NB_SORT_HEADER_COLUMN_DEF');
17900/**
17901 * Column definition for the nb-table.
17902 * Defines a set of cells available for a table column.
17903 */
17904var NbColumnDefDirective = /** @class */ (function (_super) {
17905 tslib.__extends(NbColumnDefDirective, _super);
17906 function NbColumnDefDirective() {
17907 return _super !== null && _super.apply(this, arguments) || this;
17908 }
17909 Object.defineProperty(NbColumnDefDirective.prototype, "name", {
17910 /** Unique name for this column. */
17911 get: function () {
17912 return this._name;
17913 },
17914 set: function (value) {
17915 this._setNameInput(value);
17916 },
17917 enumerable: false,
17918 configurable: true
17919 });
17920 Object.defineProperty(NbColumnDefDirective.prototype, "stickyEnd", {
17921 /** Whether this column should be sticky positioned on the end of the row */
17922 get: function () {
17923 return this._stickyEnd;
17924 },
17925 set: function (value) {
17926 var prevValue = this._stickyEnd;
17927 this._stickyEnd = _angular_cdk_coercion.coerceBooleanProperty(value);
17928 this._hasStickyChanged = prevValue !== this._stickyEnd;
17929 },
17930 enumerable: false,
17931 configurable: true
17932 });
17933 NbColumnDefDirective.decorators = [
17934 { type: i0.Directive, args: [{
17935 selector: '[nbColumnDef]',
17936 providers: [
17937 { provide: _angular_cdk_table.CdkColumnDef, useExisting: NbColumnDefDirective },
17938 { provide: NB_SORT_HEADER_COLUMN_DEF, useExisting: NbColumnDefDirective },
17939 ],
17940 },] }
17941 ];
17942 NbColumnDefDirective.propDecorators = {
17943 name: [{ type: i0.Input, args: ['nbColumnDef',] }],
17944 sticky: [{ type: i0.Input }],
17945 stickyEnd: [{ type: i0.Input }]
17946 };
17947 return NbColumnDefDirective;
17948}(_angular_cdk_table.CdkColumnDef));
17949/** Header cell template container that adds the right classes and role. */
17950var NbHeaderCellDirective = /** @class */ (function (_super) {
17951 tslib.__extends(NbHeaderCellDirective, _super);
17952 function NbHeaderCellDirective(columnDef, elementRef) {
17953 var _this = _super.call(this, columnDef, elementRef) || this;
17954 elementRef.nativeElement.classList.add("nb-column-" + columnDef.cssClassFriendlyName);
17955 return _this;
17956 }
17957 NbHeaderCellDirective.decorators = [
17958 { type: i0.Directive, args: [{
17959 selector: 'nb-header-cell, th[nbHeaderCell]',
17960 host: {
17961 'class': 'nb-header-cell',
17962 'role': 'columnheader',
17963 },
17964 },] }
17965 ];
17966 NbHeaderCellDirective.ctorParameters = function () { return [
17967 { type: NbColumnDefDirective },
17968 { type: i0.ElementRef }
17969 ]; };
17970 return NbHeaderCellDirective;
17971}(_angular_cdk_table.CdkHeaderCell));
17972/** Footer cell template container that adds the right classes and role. */
17973var NbFooterCellDirective = /** @class */ (function (_super) {
17974 tslib.__extends(NbFooterCellDirective, _super);
17975 function NbFooterCellDirective(columnDef, elementRef) {
17976 var _this = _super.call(this, columnDef, elementRef) || this;
17977 elementRef.nativeElement.classList.add("nb-column-" + columnDef.cssClassFriendlyName);
17978 return _this;
17979 }
17980 NbFooterCellDirective.decorators = [
17981 { type: i0.Directive, args: [{
17982 selector: 'nb-footer-cell, td[nbFooterCell]',
17983 host: {
17984 'class': 'nb-footer-cell',
17985 'role': 'gridcell',
17986 },
17987 },] }
17988 ];
17989 NbFooterCellDirective.ctorParameters = function () { return [
17990 { type: NbColumnDefDirective },
17991 { type: i0.ElementRef }
17992 ]; };
17993 return NbFooterCellDirective;
17994}(_angular_cdk_table.CdkFooterCell));
17995/** Cell template container that adds the right classes and role. */
17996var NbCellDirective = /** @class */ (function (_super) {
17997 tslib.__extends(NbCellDirective, _super);
17998 function NbCellDirective(columnDef, elementRef) {
17999 var _this = _super.call(this, columnDef, elementRef) || this;
18000 elementRef.nativeElement.classList.add("nb-column-" + columnDef.cssClassFriendlyName);
18001 return _this;
18002 }
18003 NbCellDirective.decorators = [
18004 { type: i0.Directive, args: [{
18005 selector: 'nb-cell, td[nbCell]',
18006 host: {
18007 'class': 'nb-cell',
18008 'role': 'gridcell',
18009 },
18010 },] }
18011 ];
18012 NbCellDirective.ctorParameters = function () { return [
18013 { type: NbColumnDefDirective },
18014 { type: i0.ElementRef }
18015 ]; };
18016 return NbCellDirective;
18017}(_angular_cdk_table.CdkCell));
18018
18019var NbDataSource = /** @class */ (function (_super) {
18020 tslib.__extends(NbDataSource, _super);
18021 function NbDataSource() {
18022 return _super !== null && _super.apply(this, arguments) || this;
18023 }
18024 return NbDataSource;
18025}(_angular_cdk_table.DataSource));
18026
18027var NbDataRowOutletDirective = /** @class */ (function (_super) {
18028 tslib.__extends(NbDataRowOutletDirective, _super);
18029 function NbDataRowOutletDirective() {
18030 return _super !== null && _super.apply(this, arguments) || this;
18031 }
18032 NbDataRowOutletDirective.decorators = [
18033 { type: i0.Directive, args: [{
18034 selector: '[nbRowOutlet]',
18035 providers: [{ provide: _angular_cdk_table.DataRowOutlet, useExisting: NbDataRowOutletDirective }],
18036 },] }
18037 ];
18038 return NbDataRowOutletDirective;
18039}(_angular_cdk_table.DataRowOutlet));
18040var NbHeaderRowOutletDirective = /** @class */ (function (_super) {
18041 tslib.__extends(NbHeaderRowOutletDirective, _super);
18042 function NbHeaderRowOutletDirective() {
18043 return _super !== null && _super.apply(this, arguments) || this;
18044 }
18045 NbHeaderRowOutletDirective.decorators = [
18046 { type: i0.Directive, args: [{
18047 selector: '[nbHeaderRowOutlet]',
18048 providers: [{ provide: _angular_cdk_table.HeaderRowOutlet, useExisting: NbHeaderRowOutletDirective }],
18049 },] }
18050 ];
18051 return NbHeaderRowOutletDirective;
18052}(_angular_cdk_table.HeaderRowOutlet));
18053var NbFooterRowOutletDirective = /** @class */ (function (_super) {
18054 tslib.__extends(NbFooterRowOutletDirective, _super);
18055 function NbFooterRowOutletDirective() {
18056 return _super !== null && _super.apply(this, arguments) || this;
18057 }
18058 NbFooterRowOutletDirective.decorators = [
18059 { type: i0.Directive, args: [{
18060 selector: '[nbFooterRowOutlet]',
18061 providers: [{ provide: _angular_cdk_table.FooterRowOutlet, useExisting: NbFooterRowOutletDirective }],
18062 },] }
18063 ];
18064 return NbFooterRowOutletDirective;
18065}(_angular_cdk_table.FooterRowOutlet));
18066var NbNoDataRowOutletDirective = /** @class */ (function (_super) {
18067 tslib.__extends(NbNoDataRowOutletDirective, _super);
18068 function NbNoDataRowOutletDirective() {
18069 return _super !== null && _super.apply(this, arguments) || this;
18070 }
18071 NbNoDataRowOutletDirective.decorators = [
18072 { type: i0.Directive, args: [{
18073 selector: '[nbNoDataRowOutlet]',
18074 providers: [{ provide: _angular_cdk_table.NoDataRowOutlet, useExisting: NbNoDataRowOutletDirective }],
18075 },] }
18076 ];
18077 return NbNoDataRowOutletDirective;
18078}(_angular_cdk_table.NoDataRowOutlet));
18079var NbCellOutletDirective = /** @class */ (function (_super) {
18080 tslib.__extends(NbCellOutletDirective, _super);
18081 function NbCellOutletDirective() {
18082 return _super !== null && _super.apply(this, arguments) || this;
18083 }
18084 NbCellOutletDirective.decorators = [
18085 { type: i0.Directive, args: [{
18086 selector: '[nbCellOutlet]',
18087 providers: [{ provide: _angular_cdk_table.CdkCellOutlet, useExisting: NbCellOutletDirective }],
18088 },] }
18089 ];
18090 return NbCellOutletDirective;
18091}(_angular_cdk_table.CdkCellOutlet));
18092/**
18093 * Header row definition for the nb-table.
18094 * Captures the header row's template and other header properties such as the columns to display.
18095 */
18096var NbHeaderRowDefDirective = /** @class */ (function (_super) {
18097 tslib.__extends(NbHeaderRowDefDirective, _super);
18098 function NbHeaderRowDefDirective() {
18099 return _super !== null && _super.apply(this, arguments) || this;
18100 }
18101 NbHeaderRowDefDirective.decorators = [
18102 { type: i0.Directive, args: [{
18103 selector: '[nbHeaderRowDef]',
18104 providers: [{ provide: _angular_cdk_table.CdkHeaderRowDef, useExisting: NbHeaderRowDefDirective }],
18105 },] }
18106 ];
18107 NbHeaderRowDefDirective.propDecorators = {
18108 columns: [{ type: i0.Input, args: ['nbHeaderRowDef',] }],
18109 sticky: [{ type: i0.Input, args: ['nbHeaderRowDefSticky',] }]
18110 };
18111 return NbHeaderRowDefDirective;
18112}(_angular_cdk_table.CdkHeaderRowDef));
18113/**
18114 * Footer row definition for the nb-table.
18115 * Captures the footer row's template and other footer properties such as the columns to display.
18116 */
18117var NbFooterRowDefDirective = /** @class */ (function (_super) {
18118 tslib.__extends(NbFooterRowDefDirective, _super);
18119 function NbFooterRowDefDirective() {
18120 return _super !== null && _super.apply(this, arguments) || this;
18121 }
18122 NbFooterRowDefDirective.decorators = [
18123 { type: i0.Directive, args: [{
18124 selector: '[nbFooterRowDef]',
18125 providers: [{ provide: _angular_cdk_table.CdkFooterRowDef, useExisting: NbFooterRowDefDirective }],
18126 },] }
18127 ];
18128 NbFooterRowDefDirective.propDecorators = {
18129 columns: [{ type: i0.Input, args: ['nbFooterRowDef',] }],
18130 sticky: [{ type: i0.Input, args: ['nbFooterRowDefSticky',] }]
18131 };
18132 return NbFooterRowDefDirective;
18133}(_angular_cdk_table.CdkFooterRowDef));
18134/**
18135 * Data row definition for the nb-table.
18136 * Captures the data row's template and other properties such as the columns to display and
18137 * a when predicate that describes when this row should be used.
18138 */
18139var NbRowDefDirective = /** @class */ (function (_super) {
18140 tslib.__extends(NbRowDefDirective, _super);
18141 function NbRowDefDirective() {
18142 return _super !== null && _super.apply(this, arguments) || this;
18143 }
18144 NbRowDefDirective.decorators = [
18145 { type: i0.Directive, args: [{
18146 selector: '[nbRowDef]',
18147 providers: [{ provide: _angular_cdk_table.CdkRowDef, useExisting: NbRowDefDirective }],
18148 },] }
18149 ];
18150 NbRowDefDirective.propDecorators = {
18151 columns: [{ type: i0.Input, args: ['nbRowDefColumns',] }],
18152 when: [{ type: i0.Input, args: ['nbRowDefWhen',] }]
18153 };
18154 return NbRowDefDirective;
18155}(_angular_cdk_table.CdkRowDef));
18156/** Footer template container that contains the cell outlet. Adds the right class and role. */
18157var NbHeaderRowComponent = /** @class */ (function (_super) {
18158 tslib.__extends(NbHeaderRowComponent, _super);
18159 function NbHeaderRowComponent() {
18160 return _super !== null && _super.apply(this, arguments) || this;
18161 }
18162 NbHeaderRowComponent.decorators = [
18163 { type: i0.Component, args: [{
18164 selector: 'nb-header-row, tr[nbHeaderRow]',
18165 template: "\n <ng-container nbCellOutlet></ng-container>",
18166 host: {
18167 'class': 'nb-header-row',
18168 'role': 'row',
18169 },
18170 providers: [{ provide: _angular_cdk_table.CdkHeaderRow, useExisting: NbHeaderRowComponent }]
18171 },] }
18172 ];
18173 return NbHeaderRowComponent;
18174}(_angular_cdk_table.CdkHeaderRow));
18175/** Footer template container that contains the cell outlet. Adds the right class and role. */
18176var NbFooterRowComponent = /** @class */ (function (_super) {
18177 tslib.__extends(NbFooterRowComponent, _super);
18178 function NbFooterRowComponent() {
18179 return _super !== null && _super.apply(this, arguments) || this;
18180 }
18181 NbFooterRowComponent.decorators = [
18182 { type: i0.Component, args: [{
18183 selector: 'nb-footer-row, tr[nbFooterRow]',
18184 template: "\n <ng-container nbCellOutlet></ng-container>",
18185 host: {
18186 'class': 'nb-footer-row',
18187 'role': 'row',
18188 },
18189 providers: [{ provide: _angular_cdk_table.CdkFooterRow, useExisting: NbFooterRowComponent }]
18190 },] }
18191 ];
18192 return NbFooterRowComponent;
18193}(_angular_cdk_table.CdkFooterRow));
18194/** Data row template container that contains the cell outlet. Adds the right class and role. */
18195var NbRowComponent = /** @class */ (function (_super) {
18196 tslib.__extends(NbRowComponent, _super);
18197 function NbRowComponent() {
18198 return _super !== null && _super.apply(this, arguments) || this;
18199 }
18200 NbRowComponent.decorators = [
18201 { type: i0.Component, args: [{
18202 selector: 'nb-row, tr[nbRow]',
18203 template: "\n <ng-container nbCellOutlet></ng-container>",
18204 host: {
18205 'class': 'nb-row',
18206 'role': 'row',
18207 },
18208 providers: [{ provide: _angular_cdk_table.CdkRow, useExisting: NbRowComponent }]
18209 },] }
18210 ];
18211 return NbRowComponent;
18212}(_angular_cdk_table.CdkRow));
18213
18214var NbCdkRowDef = _angular_cdk_table.CdkRowDef;
18215var NbCdkRow = _angular_cdk_table.CdkRow;
18216var NbCdkCellDef = _angular_cdk_table.CdkCellDef;
18217var NbCdkHeaderRowDef = _angular_cdk_table.CdkHeaderRowDef;
18218var NbCdkHeaderRow = _angular_cdk_table.CdkHeaderRow;
18219var NbCdkHeaderCellDef = _angular_cdk_table.CdkHeaderCellDef;
18220var NbCdkFooterRowDef = _angular_cdk_table.CdkFooterRowDef;
18221var NbCdkFooterRow = _angular_cdk_table.CdkFooterRow;
18222var NbCdkFooterCellDef = _angular_cdk_table.CdkFooterCellDef;
18223var NbCdkColumnDef = _angular_cdk_table.CdkColumnDef;
18224var NbCdkCell = _angular_cdk_table.CdkCell;
18225var NbCdkHeaderCell = _angular_cdk_table.CdkHeaderCell;
18226var NbCdkFooterCell = _angular_cdk_table.CdkFooterCell;
18227var NB_STICKY_POSITIONING_LISTENER = _angular_cdk_table.STICKY_POSITIONING_LISTENER;
18228
18229var NB_TABLE_TEMPLATE = "\n <ng-container nbHeaderRowOutlet></ng-container>\n <ng-container nbRowOutlet></ng-container>\n <ng-container nbNoDataRowOutlet></ng-container>\n <ng-container nbFooterRowOutlet></ng-container>\n";
18230var NB_VIEW_REPEATER_STRATEGY = _angular_cdk_collections._VIEW_REPEATER_STRATEGY;
18231var NB_COALESCED_STYLE_SCHEDULER = _angular_cdk_table._COALESCED_STYLE_SCHEDULER;
18232var NB_TABLE_PROVIDERS = [
18233 { provide: NB_VIEW_REPEATER_STRATEGY, useClass: _angular_cdk_collections._DisposeViewRepeaterStrategy },
18234 { provide: NB_COALESCED_STYLE_SCHEDULER, useClass: _angular_cdk_table._CoalescedStyleScheduler },
18235];
18236var NbTable = /** @class */ (function (_super) {
18237 tslib.__extends(NbTable, _super);
18238 function NbTable(differs, changeDetectorRef, elementRef, role, dir, document, platform, _viewRepeater, _coalescedStyleScheduler, _viewportRuler, _stickyPositioningListener) {
18239 var _this = _super.call(this, differs, changeDetectorRef, elementRef, role, dir, document, platform, _viewRepeater, _coalescedStyleScheduler, _viewportRuler, _stickyPositioningListener) || this;
18240 _this._viewRepeater = _viewRepeater;
18241 _this._coalescedStyleScheduler = _coalescedStyleScheduler;
18242 _this._stickyPositioningListener = _stickyPositioningListener;
18243 return _this;
18244 }
18245 NbTable.decorators = [
18246 { type: i0.Component, args: [{
18247 selector: 'nb-table-not-implemented',
18248 template: "",
18249 providers: NB_TABLE_PROVIDERS
18250 },] }
18251 ];
18252 NbTable.ctorParameters = function () { return [
18253 { type: i0.IterableDiffers },
18254 { type: i0.ChangeDetectorRef },
18255 { type: i0.ElementRef },
18256 { type: String, decorators: [{ type: i0.Attribute, args: ['role',] }] },
18257 { type: NbDirectionality },
18258 { type: undefined, decorators: [{ type: i0.Inject, args: [NB_DOCUMENT,] }] },
18259 { type: NbPlatform },
18260 { type: undefined, decorators: [{ type: i0.Inject, args: [_angular_cdk_collections._VIEW_REPEATER_STRATEGY,] }] },
18261 { type: _angular_cdk_table._CoalescedStyleScheduler, decorators: [{ type: i0.Inject, args: [_angular_cdk_table._COALESCED_STYLE_SCHEDULER,] }] },
18262 { type: NbViewportRulerAdapter },
18263 { type: undefined, decorators: [{ type: i0.Optional }, { type: i0.SkipSelf }, { type: i0.Inject, args: [NB_STICKY_POSITIONING_LISTENER,] }] }
18264 ]; };
18265 return NbTable;
18266}(_angular_cdk_table.CdkTable));
18267var COMPONENTS$1 = [
18268 NbTable,
18269 // Template defs
18270 NbHeaderCellDefDirective,
18271 NbHeaderRowDefDirective,
18272 NbColumnDefDirective,
18273 NbCellDefDirective,
18274 NbRowDefDirective,
18275 NbFooterCellDefDirective,
18276 NbFooterRowDefDirective,
18277 // Outlets
18278 NbDataRowOutletDirective,
18279 NbHeaderRowOutletDirective,
18280 NbFooterRowOutletDirective,
18281 NbNoDataRowOutletDirective,
18282 NbCellOutletDirective,
18283 // Cell directives
18284 NbHeaderCellDirective,
18285 NbCellDirective,
18286 NbFooterCellDirective,
18287 // Row directives
18288 NbHeaderRowComponent,
18289 NbRowComponent,
18290 NbFooterRowComponent,
18291];
18292var NbTableModule = /** @class */ (function (_super) {
18293 tslib.__extends(NbTableModule, _super);
18294 function NbTableModule() {
18295 return _super !== null && _super.apply(this, arguments) || this;
18296 }
18297 NbTableModule.decorators = [
18298 { type: i0.NgModule, args: [{
18299 imports: [NbBidiModule],
18300 declarations: tslib.__spreadArray([], COMPONENTS$1),
18301 exports: tslib.__spreadArray([], COMPONENTS$1),
18302 },] }
18303 ];
18304 return NbTableModule;
18305}(_angular_cdk_table.CdkTableModule));
18306
18307/**
18308 * @license
18309 * Copyright Akveo. All Rights Reserved.
18310 * Licensed under the MIT License. See License.txt in the project root for license information.
18311 */
18312var NB_DIALOG_CONFIG = new i0.InjectionToken('Default dialog options');
18313/**
18314 * Describes all available options that may be passed to the NbDialogService.
18315 * */
18316var NbDialogConfig = /** @class */ (function () {
18317 function NbDialogConfig(config) {
18318 /**
18319 * If true than overlay will render backdrop under a dialog.
18320 * */
18321 this.hasBackdrop = true;
18322 /**
18323 * Class that'll be assigned to the backdrop element.
18324 * */
18325 this.backdropClass = 'overlay-backdrop';
18326 /**
18327 * Class that'll be assigned to the dialog overlay.
18328 * */
18329 this.dialogClass = '';
18330 /**
18331 * If true then mouse clicks by backdrop will close a dialog.
18332 * */
18333 this.closeOnBackdropClick = true;
18334 /**
18335 * If true then escape press will close a dialog.
18336 * */
18337 this.closeOnEsc = true;
18338 /**
18339 * Disables scroll on content under dialog if true and does nothing otherwise.
18340 * */
18341 this.hasScroll = false;
18342 /**
18343 * Focuses dialog automatically after open if true.
18344 * */
18345 this.autoFocus = true;
18346 Object.assign(this, config);
18347 }
18348 return NbDialogConfig;
18349}());
18350
18351/**
18352 * @license
18353 * Copyright Akveo. All Rights Reserved.
18354 * Licensed under the MIT License. See License.txt in the project root for license information.
18355 */
18356/**
18357 * The `NbDialogRef` helps to manipulate dialog after it was created.
18358 * The dialog can be dismissed by using `close` method of the dialogRef.
18359 * You can access rendered component as `content` property of the dialogRef.
18360 * `onBackdropClick` streams click events on the backdrop of the dialog.
18361 * */
18362var NbDialogRef = /** @class */ (function () {
18363 function NbDialogRef(overlayRef) {
18364 this.overlayRef = overlayRef;
18365 this.onClose$ = new rxjs.Subject();
18366 this.onClose = this.onClose$.asObservable();
18367 this.onBackdropClick = this.overlayRef.backdropClick();
18368 }
18369 /**
18370 * Hides dialog.
18371 * */
18372 NbDialogRef.prototype.close = function (res) {
18373 this.overlayRef.detach();
18374 this.overlayRef.dispose();
18375 this.onClose$.next(res);
18376 this.onClose$.complete();
18377 };
18378 return NbDialogRef;
18379}());
18380
18381/**
18382 * @license
18383 * Copyright Akveo. All Rights Reserved.
18384 * Licensed under the MIT License. See License.txt in the project root for license information.
18385 */
18386/**
18387 * Container component for each dialog.
18388 * All the dialogs will be attached to it.
18389 * // TODO add animations
18390 * */
18391var NbDialogContainerComponent = /** @class */ (function () {
18392 function NbDialogContainerComponent(config, elementRef, focusTrapFactory) {
18393 this.config = config;
18394 this.elementRef = elementRef;
18395 this.focusTrapFactory = focusTrapFactory;
18396 }
18397 NbDialogContainerComponent.prototype.ngOnInit = function () {
18398 if (this.config.autoFocus) {
18399 this.focusTrap = this.focusTrapFactory.create(this.elementRef.nativeElement);
18400 this.focusTrap.blurPreviouslyFocusedElement();
18401 this.focusTrap.focusInitialElement();
18402 }
18403 };
18404 NbDialogContainerComponent.prototype.ngOnDestroy = function () {
18405 if (this.config.autoFocus && this.focusTrap) {
18406 this.focusTrap.restoreFocus();
18407 }
18408 };
18409 NbDialogContainerComponent.prototype.attachComponentPortal = function (portal) {
18410 return this.portalOutlet.attachComponentPortal(portal);
18411 };
18412 NbDialogContainerComponent.prototype.attachTemplatePortal = function (portal) {
18413 return this.portalOutlet.attachTemplatePortal(portal);
18414 };
18415 NbDialogContainerComponent.decorators = [
18416 { type: i0.Component, args: [{
18417 selector: 'nb-dialog-container',
18418 template: '<ng-template nbPortalOutlet></ng-template>'
18419 },] }
18420 ];
18421 NbDialogContainerComponent.ctorParameters = function () { return [
18422 { type: NbDialogConfig },
18423 { type: i0.ElementRef },
18424 { type: NbFocusTrapFactoryService }
18425 ]; };
18426 NbDialogContainerComponent.propDecorators = {
18427 portalOutlet: [{ type: i0.ViewChild, args: [NbPortalOutletDirective, { static: true },] }]
18428 };
18429 return NbDialogContainerComponent;
18430}());
18431
18432/**
18433 * @license
18434 * Copyright Akveo. All Rights Reserved.
18435 * Licensed under the MIT License. See License.txt in the project root for license information.
18436 */
18437/**
18438 * The `NbDialogService` helps to open dialogs.
18439 *
18440 * @stacked-example(Showcase, dialog/dialog-showcase.component)
18441 *
18442 * A new dialog is opened by calling the `open` method with a component to be loaded and an optional configuration.
18443 * `open` method will return `NbDialogRef` that can be used for the further manipulations.
18444 *
18445 * ### Installation
18446 *
18447 * Import `NbDialogModule.forRoot()` to your app module.
18448 * ```ts
18449 * @NgModule({
18450 * imports: [
18451 * // ...
18452 * NbDialogModule.forRoot(config),
18453 * ],
18454 * })
18455 * export class AppModule { }
18456 * ```
18457 *
18458 * If you are using it in a lazy loaded module than you have to install it with `NbDialogModule.forChild()`:
18459 * ```ts
18460 * @NgModule({
18461 * imports: [
18462 * // ...
18463 * NbDialogModule.forChild(config),
18464 * ],
18465 * })
18466 * export class LazyLoadedModule { }
18467 * ```
18468 *
18469 * ### Usage
18470 *
18471 * ```ts
18472 * const dialogRef = this.dialogService.open(MyDialogComponent, { ... });
18473 * ```
18474 *
18475 * `NbDialogRef` gives capability access reference to the rendered dialog component,
18476 * destroy dialog and some other options described below.
18477 *
18478 * Also, you can inject `NbDialogRef` in dialog component.
18479 *
18480 * ```ts
18481 * this.dialogService.open(MyDialogComponent, { ... });
18482 *
18483 * // my-dialog.component.ts
18484 * constructor(protected dialogRef: NbDialogRef) {
18485 * }
18486 *
18487 * close() {
18488 * this.dialogRef.close();
18489 * }
18490 * ```
18491 *
18492 * Instead of component you can create dialog from TemplateRef:
18493 *
18494 * @stacked-example(Template ref, dialog/dialog-template.component)
18495 *
18496 * The dialog may return result through `NbDialogRef`. Calling component can receive this result with `onClose`
18497 * stream of `NbDialogRef`.
18498 *
18499 * @stacked-example(Result, dialog/dialog-result.component)
18500 *
18501 * ### Configuration
18502 *
18503 * As we mentioned above, `open` method of the `NbDialogService` may receive optional configuration options.
18504 * Also, you can provide global dialogs configuration through `NbDialogModule.forRoot({ ... })`.
18505 *
18506 * This config may contain the following:
18507 *
18508 * `context` - both, template and component may receive data through `config.context` property.
18509 * For components, this data will be assigned through inputs.
18510 * For templates, you can access it inside template as $implicit.
18511 *
18512 * ```ts
18513 * this.dialogService.open(template, { context: 'pass data in template' });
18514 * ```
18515 *
18516 * ```html
18517 * <ng-template let-some-additional-data>
18518 * {{ some-additional-data }}
18519 * <ng-template/>
18520 * ```
18521 *
18522 * `hasBackdrop` - determines is service have to render backdrop under the dialog.
18523 * Default is true.
18524 * @stacked-example(Backdrop, dialog/dialog-has-backdrop.component)
18525 *
18526 * `closeOnBackdropClick` - close dialog on backdrop click if true.
18527 * Default is true.
18528 * @stacked-example(Backdrop click, dialog/dialog-backdrop-click.component)
18529 *
18530 * `closeOnEsc` - close dialog on escape button on the keyboard.
18531 * Default is true.
18532 * @stacked-example(Escape hit, dialog/dialog-esc.component)
18533 *
18534 * `hasScroll` - Disables scroll on content under dialog if true and does nothing otherwise.
18535 * Default is false.
18536 * Please, open dialogs in the separate window and try to scroll.
18537 * @stacked-example(Scroll, dialog/dialog-scroll.component)
18538 *
18539 * `autoFocus` - Focuses dialog automatically after open if true. It's useful to prevent misclicks on
18540 * trigger elements and opening multiple dialogs.
18541 * Default is true.
18542 *
18543 * As you can see, if you open dialog with auto focus dialog will focus first focusable element
18544 * or just blur previously focused automatically.
18545 * Otherwise, without auto focus, the focus will stay on the previously focused element.
18546 * Please, open dialogs in the separate window and try to click on the button without focus
18547 * and then hit space any times. Multiple same dialogs will be opened.
18548 * @stacked-example(Auto focus, dialog/dialog-auto-focus.component)
18549 * */
18550var NbDialogService = /** @class */ (function () {
18551 function NbDialogService(document, globalConfig, positionBuilder, overlay, injector, cfr) {
18552 this.document = document;
18553 this.globalConfig = globalConfig;
18554 this.positionBuilder = positionBuilder;
18555 this.overlay = overlay;
18556 this.injector = injector;
18557 this.cfr = cfr;
18558 }
18559 /**
18560 * Opens new instance of the dialog, may receive optional config.
18561 * */
18562 NbDialogService.prototype.open = function (content, userConfig) {
18563 if (userConfig === void 0) { userConfig = {}; }
18564 var config = new NbDialogConfig(tslib.__assign(tslib.__assign({}, this.globalConfig), userConfig));
18565 var overlayRef = this.createOverlay(config);
18566 var dialogRef = new NbDialogRef(overlayRef);
18567 var container = this.createContainer(config, overlayRef);
18568 this.createContent(config, content, container, dialogRef);
18569 this.registerCloseListeners(config, overlayRef, dialogRef);
18570 return dialogRef;
18571 };
18572 NbDialogService.prototype.createOverlay = function (config) {
18573 var positionStrategy = this.createPositionStrategy();
18574 var scrollStrategy = this.createScrollStrategy(config.hasScroll);
18575 return this.overlay.create({
18576 positionStrategy: positionStrategy,
18577 scrollStrategy: scrollStrategy,
18578 hasBackdrop: config.hasBackdrop,
18579 backdropClass: config.backdropClass,
18580 panelClass: config.dialogClass,
18581 });
18582 };
18583 NbDialogService.prototype.createPositionStrategy = function () {
18584 return this.positionBuilder
18585 .global()
18586 .centerVertically()
18587 .centerHorizontally();
18588 };
18589 NbDialogService.prototype.createScrollStrategy = function (hasScroll) {
18590 if (hasScroll) {
18591 return this.overlay.scrollStrategies.noop();
18592 }
18593 else {
18594 return this.overlay.scrollStrategies.block();
18595 }
18596 };
18597 NbDialogService.prototype.createContainer = function (config, overlayRef) {
18598 var injector = new NbPortalInjector(this.createInjector(config), new WeakMap([[NbDialogConfig, config]]));
18599 var containerPortal = new NbComponentPortal(NbDialogContainerComponent, null, injector, this.cfr);
18600 var containerRef = overlayRef.attach(containerPortal);
18601 return containerRef.instance;
18602 };
18603 NbDialogService.prototype.createContent = function (config, content, container, dialogRef) {
18604 if (content instanceof i0.TemplateRef) {
18605 var portal = this.createTemplatePortal(config, content, dialogRef);
18606 container.attachTemplatePortal(portal);
18607 }
18608 else {
18609 var portal = this.createComponentPortal(config, content, dialogRef);
18610 dialogRef.componentRef = container.attachComponentPortal(portal);
18611 if (config.context) {
18612 Object.assign(dialogRef.componentRef.instance, tslib.__assign({}, config.context));
18613 }
18614 }
18615 };
18616 NbDialogService.prototype.createTemplatePortal = function (config, content, dialogRef) {
18617 return new NbTemplatePortal(content, null, { $implicit: config.context, dialogRef: dialogRef });
18618 };
18619 /**
18620 * We're creating portal with custom injector provided through config or using global injector.
18621 * This approach provides us capability inject `NbDialogRef` in dialog component.
18622 * */
18623 NbDialogService.prototype.createComponentPortal = function (config, content, dialogRef) {
18624 var injector = this.createInjector(config);
18625 var portalInjector = new NbPortalInjector(injector, new WeakMap([[NbDialogRef, dialogRef]]));
18626 return new NbComponentPortal(content, config.viewContainerRef, portalInjector);
18627 };
18628 NbDialogService.prototype.createInjector = function (config) {
18629 return config.viewContainerRef && config.viewContainerRef.injector || this.injector;
18630 };
18631 NbDialogService.prototype.registerCloseListeners = function (config, overlayRef, dialogRef) {
18632 if (config.closeOnBackdropClick) {
18633 overlayRef.backdropClick().subscribe(function () { return dialogRef.close(); });
18634 }
18635 if (config.closeOnEsc) {
18636 rxjs.fromEvent(this.document, 'keyup')
18637 .pipe(rxjs_operators.filter(function (event) { return event.keyCode === 27; }), rxjs_operators.takeUntil(dialogRef.onClose))
18638 .subscribe(function () { return dialogRef.close(); });
18639 }
18640 };
18641 NbDialogService.decorators = [
18642 { type: i0.Injectable }
18643 ];
18644 NbDialogService.ctorParameters = function () { return [
18645 { type: undefined, decorators: [{ type: i0.Inject, args: [NB_DOCUMENT,] }] },
18646 { type: undefined, decorators: [{ type: i0.Inject, args: [NB_DIALOG_CONFIG,] }] },
18647 { type: NbPositionBuilderService },
18648 { type: NbOverlayService },
18649 { type: i0.Injector },
18650 { type: i0.ComponentFactoryResolver }
18651 ]; };
18652 return NbDialogService;
18653}());
18654
18655/**
18656 * @license
18657 * Copyright Akveo. All Rights Reserved.
18658 * Licensed under the MIT License. See License.txt in the project root for license information.
18659 */
18660var NbDialogModule = /** @class */ (function () {
18661 function NbDialogModule() {
18662 }
18663 NbDialogModule.forRoot = function (dialogConfig) {
18664 if (dialogConfig === void 0) { dialogConfig = {}; }
18665 return {
18666 ngModule: NbDialogModule,
18667 providers: [
18668 NbDialogService,
18669 { provide: NB_DIALOG_CONFIG, useValue: dialogConfig },
18670 ],
18671 };
18672 };
18673 NbDialogModule.forChild = function (dialogConfig) {
18674 if (dialogConfig === void 0) { dialogConfig = {}; }
18675 return {
18676 ngModule: NbDialogModule,
18677 providers: [
18678 NbDialogService,
18679 { provide: NB_DIALOG_CONFIG, useValue: dialogConfig },
18680 ],
18681 };
18682 };
18683 NbDialogModule.decorators = [
18684 { type: i0.NgModule, args: [{
18685 imports: [NbSharedModule, NbOverlayModule],
18686 declarations: [NbDialogContainerComponent],
18687 entryComponents: [NbDialogContainerComponent],
18688 },] }
18689 ];
18690 return NbDialogModule;
18691}());
18692
18693/**
18694 * @license
18695 * Copyright Akveo. All Rights Reserved.
18696 * Licensed under the MIT License. See License.txt in the project root for license information.
18697 */
18698/**
18699 * The `NbToastComponent` is responsible for rendering each toast with appropriate styles.
18700 *
18701 * @styles
18702 *
18703 * toastr-border-style:
18704 * toastr-border-width:
18705 * toastr-border-radius:
18706 * toastr-padding:
18707 * toastr-shadow:
18708 * toastr-text-font-family:
18709 * toastr-text-font-size:
18710 * toastr-text-font-weight:
18711 * toastr-text-line-height:
18712 * toastr-title-text-font-family:
18713 * toastr-title-text-font-size:
18714 * toastr-title-text-font-weight:
18715 * toastr-title-text-line-height:
18716 * toastr-basic-background-color:
18717 * toastr-basic-border-color:
18718 * toastr-basic-text-color:
18719 * toastr-icon-basic-background-color:
18720 * toastr-icon-basic-color:
18721 * toastr-destroyable-basic-hover-background-color:
18722 * toastr-destroyable-basic-hover-border-color:
18723 * toastr-primary-background-color:
18724 * toastr-primary-border-color:
18725 * toastr-primary-text-color:
18726 * toastr-icon-primary-background-color:
18727 * toastr-icon-primary-color:
18728 * toastr-destroyable-primary-hover-background-color:
18729 * toastr-destroyable-primary-hover-border-color:
18730 * toastr-success-background-color:
18731 * toastr-success-border-color:
18732 * toastr-success-text-color:
18733 * toastr-icon-success-background-color:
18734 * toastr-icon-success-color:
18735 * toastr-destroyable-success-hover-background-color:
18736 * toastr-destroyable-success-hover-border-color:
18737 * toastr-info-background-color:
18738 * toastr-info-border-color:
18739 * toastr-info-text-color:
18740 * toastr-icon-info-background-color:
18741 * toastr-icon-info-color:
18742 * toastr-destroyable-info-hover-background-color:
18743 * toastr-destroyable-info-hover-border-color:
18744 * toastr-warning-background-color:
18745 * toastr-warning-border-color:
18746 * toastr-warning-text-color:
18747 * toastr-icon-warning-background-color:
18748 * toastr-icon-warning-color:
18749 * toastr-destroyable-warning-hover-background-color:
18750 * toastr-destroyable-warning-hover-border-color:
18751 * toastr-danger-background-color:
18752 * toastr-danger-border-color:
18753 * toastr-danger-text-color:
18754 * toastr-icon-danger-background-color:
18755 * toastr-icon-danger-color:
18756 * toastr-destroyable-danger-hover-background-color:
18757 * toastr-destroyable-danger-hover-border-color:
18758 * toastr-control-background-color:
18759 * toastr-control-border-color:
18760 * toastr-control-text-color:
18761 * toastr-icon-control-background-color:
18762 * toastr-icon-control-color:
18763 * toastr-destroyable-control-hover-background-color:
18764 * toastr-destroyable-control-hover-border-color:
18765 * */
18766var NbToastComponent = /** @class */ (function () {
18767 function NbToastComponent(renderer, elementRef, statusService) {
18768 this.renderer = renderer;
18769 this.elementRef = elementRef;
18770 this.statusService = statusService;
18771 this.destroy = new i0.EventEmitter();
18772 }
18773 Object.defineProperty(NbToastComponent.prototype, "success", {
18774 get: function () {
18775 return this.toast.config.status === 'success';
18776 },
18777 enumerable: false,
18778 configurable: true
18779 });
18780 Object.defineProperty(NbToastComponent.prototype, "info", {
18781 get: function () {
18782 return this.toast.config.status === 'info';
18783 },
18784 enumerable: false,
18785 configurable: true
18786 });
18787 Object.defineProperty(NbToastComponent.prototype, "warning", {
18788 get: function () {
18789 return this.toast.config.status === 'warning';
18790 },
18791 enumerable: false,
18792 configurable: true
18793 });
18794 Object.defineProperty(NbToastComponent.prototype, "primary", {
18795 get: function () {
18796 return this.toast.config.status === 'primary';
18797 },
18798 enumerable: false,
18799 configurable: true
18800 });
18801 Object.defineProperty(NbToastComponent.prototype, "danger", {
18802 get: function () {
18803 return this.toast.config.status === 'danger';
18804 },
18805 enumerable: false,
18806 configurable: true
18807 });
18808 Object.defineProperty(NbToastComponent.prototype, "basic", {
18809 get: function () {
18810 return this.toast.config.status === 'basic';
18811 },
18812 enumerable: false,
18813 configurable: true
18814 });
18815 Object.defineProperty(NbToastComponent.prototype, "control", {
18816 get: function () {
18817 return this.toast.config.status === 'control';
18818 },
18819 enumerable: false,
18820 configurable: true
18821 });
18822 Object.defineProperty(NbToastComponent.prototype, "destroyByClick", {
18823 get: function () {
18824 return this.toast.config.destroyByClick;
18825 },
18826 enumerable: false,
18827 configurable: true
18828 });
18829 Object.defineProperty(NbToastComponent.prototype, "hasIcon", {
18830 get: function () {
18831 var icon = this.toast.config.icon;
18832 if (typeof icon === 'string') {
18833 return true;
18834 }
18835 return !!(icon && icon.icon);
18836 },
18837 enumerable: false,
18838 configurable: true
18839 });
18840 Object.defineProperty(NbToastComponent.prototype, "customIcon", {
18841 get: function () {
18842 return !!this.icon;
18843 },
18844 enumerable: false,
18845 configurable: true
18846 });
18847 Object.defineProperty(NbToastComponent.prototype, "icon", {
18848 get: function () {
18849 return this.toast.config.icon;
18850 },
18851 enumerable: false,
18852 configurable: true
18853 });
18854 Object.defineProperty(NbToastComponent.prototype, "additionalClasses", {
18855 get: function () {
18856 if (this.statusService.isCustomStatus(this.toast.config.status)) {
18857 return [this.statusService.getStatusClass(this.toast.config.status)];
18858 }
18859 return [];
18860 },
18861 enumerable: false,
18862 configurable: true
18863 });
18864 NbToastComponent.prototype.onClick = function () {
18865 this.destroy.emit();
18866 };
18867 NbToastComponent.prototype.ngOnInit = function () {
18868 if (this.toast.config.toastClass) {
18869 this.renderer.addClass(this.elementRef.nativeElement, this.toast.config.toastClass);
18870 }
18871 };
18872 NbToastComponent.decorators = [
18873 { type: i0.Component, args: [{
18874 selector: 'nb-toast',
18875 template: "<div class=\"icon-container\" *ngIf=\"hasIcon && icon\">\n <nb-icon [config]=\"icon\"></nb-icon>\n</div>\n<div class=\"content-container\">\n <span class=\"title subtitle\">{{ toast.title }}</span>\n <div class=\"message\">{{ toast.message }}</div>\n</div>\n",
18876 styles: [":host{display:flex;align-items:center;width:25rem;margin:0.5rem}:host .title{margin-right:0.25rem}:host.default .content-container,:host:not(.has-icon) .content-container{display:flex;flex-direction:row}:host.destroy-by-click{cursor:pointer}:host nb-icon{font-size:2.5rem}:host svg{width:2.5rem;height:2.5rem}\n"]
18877 },] }
18878 ];
18879 NbToastComponent.ctorParameters = function () { return [
18880 { type: i0.Renderer2 },
18881 { type: i0.ElementRef },
18882 { type: NbStatusService }
18883 ]; };
18884 NbToastComponent.propDecorators = {
18885 toast: [{ type: i0.Input }],
18886 destroy: [{ type: i0.Output }],
18887 success: [{ type: i0.HostBinding, args: ['class.status-success',] }],
18888 info: [{ type: i0.HostBinding, args: ['class.status-info',] }],
18889 warning: [{ type: i0.HostBinding, args: ['class.status-warning',] }],
18890 primary: [{ type: i0.HostBinding, args: ['class.status-primary',] }],
18891 danger: [{ type: i0.HostBinding, args: ['class.status-danger',] }],
18892 basic: [{ type: i0.HostBinding, args: ['class.status-basic',] }],
18893 control: [{ type: i0.HostBinding, args: ['class.status-control',] }],
18894 destroyByClick: [{ type: i0.HostBinding, args: ['class.destroy-by-click',] }],
18895 hasIcon: [{ type: i0.HostBinding, args: ['class.has-icon',] }],
18896 customIcon: [{ type: i0.HostBinding, args: ['class.custom-icon',] }],
18897 additionalClasses: [{ type: i0.HostBinding, args: ['class',] }],
18898 onClick: [{ type: i0.HostListener, args: ['click',] }]
18899 };
18900 return NbToastComponent;
18901}());
18902
18903/**
18904 * @license
18905 * Copyright Akveo. All Rights Reserved.
18906 * Licensed under the MIT License. See License.txt in the project root for license information.
18907 */
18908var voidState = _angular_animations.style({
18909 transform: 'translateX({{ direction }}110%)',
18910 height: 0,
18911 marginLeft: '0',
18912 marginRight: '0',
18913 marginTop: '0',
18914 marginBottom: '0',
18915});
18916var defaultOptions = { params: { direction: '' } };
18917var NbToastrContainerComponent = /** @class */ (function () {
18918 function NbToastrContainerComponent(layoutDirection, positionHelper) {
18919 this.layoutDirection = layoutDirection;
18920 this.positionHelper = positionHelper;
18921 this.destroy$ = new rxjs.Subject();
18922 this.content = [];
18923 }
18924 NbToastrContainerComponent.prototype.ngOnInit = function () {
18925 var _this = this;
18926 this.layoutDirection.onDirectionChange()
18927 .pipe(rxjs_operators.takeUntil(this.destroy$))
18928 .subscribe(function () { return _this.onDirectionChange(); });
18929 };
18930 NbToastrContainerComponent.prototype.ngOnDestroy = function () {
18931 this.destroy$.next();
18932 this.destroy$.complete();
18933 };
18934 NbToastrContainerComponent.prototype.onDirectionChange = function () {
18935 var direction = this.positionHelper.isRightPosition(this.position) ? '' : '-';
18936 this.fadeIn = { value: '', params: { direction: direction } };
18937 };
18938 NbToastrContainerComponent.decorators = [
18939 { type: i0.Component, args: [{
18940 selector: 'nb-toastr-container',
18941 template: "\n <nb-toast [@fadeIn]=\"fadeIn\" *ngFor=\"let toast of content\" [toast]=\"toast\"></nb-toast>",
18942 animations: [
18943 _angular_animations.trigger('fadeIn', [
18944 _angular_animations.transition(':enter', [voidState, _angular_animations.animate(100)], defaultOptions),
18945 _angular_animations.transition(':leave', [_angular_animations.animate(100, voidState)], defaultOptions),
18946 ]),
18947 ]
18948 },] }
18949 ];
18950 NbToastrContainerComponent.ctorParameters = function () { return [
18951 { type: NbLayoutDirectionService },
18952 { type: NbPositionHelper }
18953 ]; };
18954 NbToastrContainerComponent.propDecorators = {
18955 content: [{ type: i0.Input }],
18956 context: [{ type: i0.Input }],
18957 position: [{ type: i0.Input }],
18958 toasts: [{ type: i0.ViewChildren, args: [NbToastComponent,] }]
18959 };
18960 return NbToastrContainerComponent;
18961}());
18962
18963/**
18964 * @license
18965 * Copyright Akveo. All Rights Reserved.
18966 * Licensed under the MIT License. See License.txt in the project root for license information.
18967 */
18968var NB_TOASTR_CONFIG = new i0.InjectionToken('Default toastr options');
18969/**
18970 * The `NbToastrConfig` class describes configuration of the `NbToastrService.show` and global toastr configuration.
18971 * */
18972var NbToastrConfig = /** @class */ (function () {
18973 function NbToastrConfig(config) {
18974 /**
18975 * Determines where on the screen toast have to be rendered.
18976 * */
18977 this.position = exports.NbGlobalLogicalPosition.TOP_END;
18978 /**
18979 * Status chooses color scheme for the toast.
18980 * */
18981 this.status = 'basic';
18982 /**
18983 * Duration is timeout between toast appears and disappears.
18984 * */
18985 this.duration = 3000;
18986 /**
18987 * Destroy by click means you can hide the toast by clicking it.
18988 * */
18989 this.destroyByClick = true;
18990 /**
18991 * If preventDuplicates is true then the toast with the same title, message and status will not be rendered.
18992 * Find duplicates behaviour determined by `preventDuplicates`.
18993 * The default `previous` duplicate behaviour is used.
18994 * */
18995 this.preventDuplicates = false;
18996 /**
18997 * Determines the how to treat duplicates.
18998 * */
18999 this.duplicatesBehaviour = 'previous';
19000 /*
19001 * The number of visible toasts. If the limit exceeded the oldest toast will be removed.
19002 * */
19003 this.limit = null;
19004 /**
19005 * Class to be applied to the toast.
19006 */
19007 this.toastClass = '';
19008 /**
19009 * Determines render icon or not.
19010 * */
19011 this.hasIcon = true;
19012 /**
19013 * Icon name or icon config object that can be provided to render custom icon.
19014 * */
19015 this.icon = 'email';
19016 /**
19017 * Toast status icon-class mapping.
19018 * */
19019 this.icons = {
19020 danger: 'flash-outline',
19021 success: 'checkmark-outline',
19022 info: 'question-mark-outline',
19023 warning: 'alert-triangle-outline',
19024 primary: 'email-outline',
19025 control: 'email-outline',
19026 basic: 'email-outline',
19027 };
19028 this.patchIcon(config);
19029 Object.assign(this, config);
19030 }
19031 NbToastrConfig.prototype.patchIcon = function (config) {
19032 if (!('icon' in config)) {
19033 config.icon = {
19034 icon: this.icons[config.status] || this.icons.basic,
19035 pack: 'nebular-essentials',
19036 };
19037 }
19038 };
19039 return NbToastrConfig;
19040}());
19041
19042/**
19043 * @license
19044 * Copyright Akveo. All Rights Reserved.
19045 * Licensed under the MIT License. See License.txt in the project root for license information.
19046 */
19047var NbToastRef = /** @class */ (function () {
19048 function NbToastRef(toastContainer, toast) {
19049 this.toastContainer = toastContainer;
19050 this.toast = toast;
19051 }
19052 NbToastRef.prototype.close = function () {
19053 this.toastContainer.destroy(this.toast);
19054 };
19055 return NbToastRef;
19056}());
19057var NbToastContainer = /** @class */ (function () {
19058 function NbToastContainer(position, containerRef, positionHelper) {
19059 this.position = position;
19060 this.containerRef = containerRef;
19061 this.positionHelper = positionHelper;
19062 this.toasts = [];
19063 this.toastDuplicateCompareFunc = function (t1, t2) {
19064 return t1.message === t2.message
19065 && t1.title === t2.title
19066 && t1.config.status === t2.config.status;
19067 };
19068 }
19069 Object.defineProperty(NbToastContainer.prototype, "nativeElement", {
19070 get: function () {
19071 return this.containerRef.location.nativeElement;
19072 },
19073 enumerable: false,
19074 configurable: true
19075 });
19076 NbToastContainer.prototype.attach = function (toast) {
19077 if (toast.config.preventDuplicates && this.isDuplicate(toast)) {
19078 return;
19079 }
19080 this.removeToastIfLimitReached(toast);
19081 var toastComponent = this.attachToast(toast);
19082 if (toast.config.destroyByClick) {
19083 this.subscribeOnClick(toastComponent, toast);
19084 }
19085 if (toast.config.duration) {
19086 this.setDestroyTimeout(toast);
19087 }
19088 this.prevToast = toast;
19089 return new NbToastRef(this, toast);
19090 };
19091 NbToastContainer.prototype.destroy = function (toast) {
19092 if (this.prevToast === toast) {
19093 this.prevToast = null;
19094 }
19095 this.toasts = this.toasts.filter(function (t) { return t !== toast; });
19096 this.updateContainer();
19097 };
19098 NbToastContainer.prototype.isDuplicate = function (toast) {
19099 return toast.config.duplicatesBehaviour === 'previous'
19100 ? this.isDuplicatePrevious(toast)
19101 : this.isDuplicateAmongAll(toast);
19102 };
19103 NbToastContainer.prototype.isDuplicatePrevious = function (toast) {
19104 return this.prevToast && this.toastDuplicateCompareFunc(this.prevToast, toast);
19105 };
19106 NbToastContainer.prototype.isDuplicateAmongAll = function (toast) {
19107 var _this = this;
19108 return this.toasts.some(function (t) { return _this.toastDuplicateCompareFunc(t, toast); });
19109 };
19110 NbToastContainer.prototype.removeToastIfLimitReached = function (toast) {
19111 if (!toast.config.limit || this.toasts.length < toast.config.limit) {
19112 return;
19113 }
19114 if (this.positionHelper.isTopPosition(toast.config.position)) {
19115 this.toasts.pop();
19116 }
19117 else {
19118 this.toasts.shift();
19119 }
19120 };
19121 NbToastContainer.prototype.attachToast = function (toast) {
19122 if (this.positionHelper.isTopPosition(toast.config.position)) {
19123 return this.attachToTop(toast);
19124 }
19125 else {
19126 return this.attachToBottom(toast);
19127 }
19128 };
19129 NbToastContainer.prototype.attachToTop = function (toast) {
19130 this.toasts.unshift(toast);
19131 this.updateContainer();
19132 return this.containerRef.instance.toasts.first;
19133 };
19134 NbToastContainer.prototype.attachToBottom = function (toast) {
19135 this.toasts.push(toast);
19136 this.updateContainer();
19137 return this.containerRef.instance.toasts.last;
19138 };
19139 NbToastContainer.prototype.setDestroyTimeout = function (toast) {
19140 var _this = this;
19141 setTimeout(function () { return _this.destroy(toast); }, toast.config.duration);
19142 };
19143 NbToastContainer.prototype.subscribeOnClick = function (toastComponent, toast) {
19144 var _this = this;
19145 toastComponent.destroy.subscribe(function () { return _this.destroy(toast); });
19146 };
19147 NbToastContainer.prototype.updateContainer = function () {
19148 patch(this.containerRef, { content: this.toasts, position: this.position });
19149 };
19150 return NbToastContainer;
19151}());
19152var NbToastrContainerRegistry = /** @class */ (function () {
19153 function NbToastrContainerRegistry(overlay, positionBuilder, positionHelper, cfr, document) {
19154 this.overlay = overlay;
19155 this.positionBuilder = positionBuilder;
19156 this.positionHelper = positionHelper;
19157 this.cfr = cfr;
19158 this.document = document;
19159 this.overlays = new Map();
19160 }
19161 NbToastrContainerRegistry.prototype.get = function (position) {
19162 var logicalPosition = this.positionHelper.toLogicalPosition(position);
19163 var overlayWithContainer = this.overlays.get(logicalPosition);
19164 if (!overlayWithContainer || !this.existsInDom(overlayWithContainer.toastrContainer)) {
19165 if (overlayWithContainer) {
19166 overlayWithContainer.overlayRef.dispose();
19167 }
19168 this.instantiateContainer(logicalPosition);
19169 }
19170 return this.overlays.get(logicalPosition).toastrContainer;
19171 };
19172 NbToastrContainerRegistry.prototype.instantiateContainer = function (position) {
19173 var toastrOverlayWithContainer = this.createContainer(position);
19174 this.overlays.set(position, toastrOverlayWithContainer);
19175 };
19176 NbToastrContainerRegistry.prototype.createContainer = function (position) {
19177 var positionStrategy = this.positionBuilder.global().position(position);
19178 var ref = this.overlay.create({ positionStrategy: positionStrategy });
19179 this.addClassToOverlayHost(ref);
19180 var containerRef = ref.attach(new NbComponentPortal(NbToastrContainerComponent, null, null, this.cfr));
19181 return {
19182 overlayRef: ref,
19183 toastrContainer: new NbToastContainer(position, containerRef, this.positionHelper),
19184 };
19185 };
19186 NbToastrContainerRegistry.prototype.addClassToOverlayHost = function (overlayRef) {
19187 overlayRef.hostElement.classList.add('toastr-overlay-container');
19188 };
19189 NbToastrContainerRegistry.prototype.existsInDom = function (toastContainer) {
19190 return this.document.body.contains(toastContainer.nativeElement);
19191 };
19192 NbToastrContainerRegistry.decorators = [
19193 { type: i0.Injectable }
19194 ];
19195 NbToastrContainerRegistry.ctorParameters = function () { return [
19196 { type: NbOverlayService },
19197 { type: NbPositionBuilderService },
19198 { type: NbPositionHelper },
19199 { type: i0.ComponentFactoryResolver },
19200 { type: undefined, decorators: [{ type: i0.Inject, args: [NB_DOCUMENT,] }] }
19201 ]; };
19202 return NbToastrContainerRegistry;
19203}());
19204/**
19205 * The `NbToastrService` provides a capability to build toast notifications.
19206 *
19207 * @stacked-example(Showcase, toastr/toastr-showcase.component)
19208 *
19209 * `NbToastrService.show(message, title, config)` accepts three params, title and config are optional.
19210 *
19211 * ### Installation
19212 *
19213 * Import `NbToastrModule.forRoot()` to your app module.
19214 * ```ts
19215 * @NgModule({
19216 * imports: [
19217 * // ...
19218 * NbToastrModule.forRoot(config),
19219 * ],
19220 * })
19221 * export class AppModule { }
19222 * ```
19223 *
19224 * ### Usage
19225 *
19226 * Calling `NbToastrService.show(...)` will render new toast and return `NbToastrRef` with
19227 * help of which you may close newly created toast by calling `close` method.
19228 *
19229 * ```ts
19230 * const toastRef: NbToastRef = this.toastrService.show(...);
19231 * toastRef.close();
19232 * ```
19233 *
19234 * Config accepts following options:
19235 *
19236 * `position` - determines where on the screen toast will be rendered.
19237 * Default is `top-end`.
19238 *
19239 * @stacked-example(Position, toastr/toastr-positions.component)
19240 *
19241 * `status` - coloring and icon of the toast.
19242 * Default is `basic`.
19243 *
19244 * @stacked-example(Status, toastr/toastr-statuses.component)
19245 *
19246 * `duration` - the time after which the toast will be destroyed.
19247 * `0` means endless toast, that may be destroyed by click only.
19248 * Default is 3000 ms.
19249 *
19250 * @stacked-example(Duration, toastr/toastr-duration.component)
19251 *
19252 * `destroyByClick` - provides a capability to destroy toast by click.
19253 * Default is true.
19254 *
19255 * @stacked-example(Destroy by click, toastr/toastr-destroy-by-click.component)
19256 *
19257 * `preventDuplicates` - don't create new toast if it has the same title, message and status.
19258 * Default is false.
19259 *
19260 * @stacked-example(Prevent duplicates, toastr/toastr-prevent-duplicates.component)
19261 *
19262 * `duplicatesBehaviour` - determines how to treat the toasts duplication.
19263 * Compare with the previous message `previous`
19264 * or with all visible messages `all`.
19265 *
19266 * @stacked-example(Prevent duplicates behaviour , toastr/toastr-prevent-duplicates-behaviour.component)
19267 *
19268 * `limit` - the number of visible toasts in the toast container. The number of toasts is unlimited by default.
19269 *
19270 * @stacked-example(Prevent duplicates behaviour , toastr/toastr-limit.component)
19271 *
19272 * `hasIcon` - if true then render toast icon.
19273 * `icon` - you can pass icon class that will be applied into the toast.
19274 *
19275 * @stacked-example(Has icon, toastr/toastr-icon.component)
19276 * */
19277var NbToastrService = /** @class */ (function () {
19278 function NbToastrService(globalConfig, containerRegistry) {
19279 this.globalConfig = globalConfig;
19280 this.containerRegistry = containerRegistry;
19281 }
19282 /**
19283 * Shows toast with message, title and user config.
19284 * */
19285 NbToastrService.prototype.show = function (message, title, userConfig) {
19286 var config = new NbToastrConfig(tslib.__assign(tslib.__assign({}, this.globalConfig), userConfig));
19287 var container = this.containerRegistry.get(config.position);
19288 var toast = { message: message, title: title, config: config };
19289 return container.attach(toast);
19290 };
19291 /**
19292 * Shows success toast with message, title and user config.
19293 * */
19294 NbToastrService.prototype.success = function (message, title, config) {
19295 return this.show(message, title, tslib.__assign(tslib.__assign({}, config), { status: 'success' }));
19296 };
19297 /**
19298 * Shows info toast with message, title and user config.
19299 * */
19300 NbToastrService.prototype.info = function (message, title, config) {
19301 return this.show(message, title, tslib.__assign(tslib.__assign({}, config), { status: 'info' }));
19302 };
19303 /**
19304 * Shows warning toast with message, title and user config.
19305 * */
19306 NbToastrService.prototype.warning = function (message, title, config) {
19307 return this.show(message, title, tslib.__assign(tslib.__assign({}, config), { status: 'warning' }));
19308 };
19309 /**
19310 * Shows primary toast with message, title and user config.
19311 * */
19312 NbToastrService.prototype.primary = function (message, title, config) {
19313 return this.show(message, title, tslib.__assign(tslib.__assign({}, config), { status: 'primary' }));
19314 };
19315 /**
19316 * Shows danger toast with message, title and user config.
19317 * */
19318 NbToastrService.prototype.danger = function (message, title, config) {
19319 return this.show(message, title, tslib.__assign(tslib.__assign({}, config), { status: 'danger' }));
19320 };
19321 /**
19322 * Shows default toast with message, title and user config.
19323 * */
19324 NbToastrService.prototype.default = function (message, title, config) {
19325 return this.show(message, title, tslib.__assign(tslib.__assign({}, config), { status: 'basic' }));
19326 };
19327 /**
19328 * Shows control toast with message, title and user config.
19329 * */
19330 NbToastrService.prototype.control = function (message, title, config) {
19331 return this.default(message, title, tslib.__assign(tslib.__assign({}, config), { status: 'control' }));
19332 };
19333 NbToastrService.decorators = [
19334 { type: i0.Injectable }
19335 ];
19336 NbToastrService.ctorParameters = function () { return [
19337 { type: NbToastrConfig, decorators: [{ type: i0.Inject, args: [NB_TOASTR_CONFIG,] }] },
19338 { type: NbToastrContainerRegistry }
19339 ]; };
19340 return NbToastrService;
19341}());
19342
19343/**
19344 * @license
19345 * Copyright Akveo. All Rights Reserved.
19346 * Licensed under the MIT License. See License.txt in the project root for license information.
19347 */
19348var NbToastrModule = /** @class */ (function () {
19349 function NbToastrModule() {
19350 }
19351 NbToastrModule.forRoot = function (toastrConfig) {
19352 if (toastrConfig === void 0) { toastrConfig = {}; }
19353 return {
19354 ngModule: NbToastrModule,
19355 providers: [
19356 NbToastrService,
19357 NbToastrContainerRegistry,
19358 { provide: NB_TOASTR_CONFIG, useValue: toastrConfig },
19359 ],
19360 };
19361 };
19362 NbToastrModule.decorators = [
19363 { type: i0.NgModule, args: [{
19364 imports: [NbSharedModule, NbOverlayModule, NbIconModule],
19365 declarations: [NbToastrContainerComponent, NbToastComponent],
19366 entryComponents: [NbToastrContainerComponent, NbToastComponent],
19367 },] }
19368 ];
19369 return NbToastrModule;
19370}());
19371
19372/**
19373 * @license
19374 * Copyright Akveo. All Rights Reserved.
19375 * Licensed under the MIT License. See License.txt in the project root for license information.
19376 */
19377var NbToast = /** @class */ (function () {
19378 function NbToast() {
19379 }
19380 return NbToast;
19381}());
19382
19383/*
19384 * @license
19385 * Copyright Akveo. All Rights Reserved.
19386 * Licensed under the MIT License. See License.txt in the project root for license information.
19387 */
19388/**
19389 * Tooltip container.
19390 * Renders provided tooltip inside.
19391 *
19392 * @styles
19393 *
19394 * tooltip-background-color:
19395 * tooltip-border-color:
19396 * tooltip-border-style:
19397 * tooltip-border-width:
19398 * tooltip-border-radius:
19399 * tooltip-padding:
19400 * tooltip-text-color:
19401 * tooltip-text-font-family:
19402 * tooltip-text-font-size:
19403 * tooltip-text-font-weight:
19404 * tooltip-text-line-height:
19405 * tooltip-icon-height:
19406 * tooltip-icon-width:
19407 * tooltip-max-width:
19408 * tooltip-basic-background-color:
19409 * tooltip-basic-border-color:
19410 * tooltip-basic-text-color:
19411 * tooltip-primary-background-color:
19412 * tooltip-primary-border-color:
19413 * tooltip-primary-text-color:
19414 * tooltip-info-background-color:
19415 * tooltip-info-border-color:
19416 * tooltip-info-text-color:
19417 * tooltip-success-background-color:
19418 * tooltip-success-border-color:
19419 * tooltip-success-text-color:
19420 * tooltip-warning-background-color:
19421 * tooltip-warning-border-color:
19422 * tooltip-warning-text-color:
19423 * tooltip-danger-background-color:
19424 * tooltip-danger-border-color:
19425 * tooltip-danger-text-color:
19426 * tooltip-control-background-color:
19427 * tooltip-control-border-color:
19428 * tooltip-control-text-color:
19429 * tooltip-shadow:
19430 */
19431var NbTooltipComponent = /** @class */ (function () {
19432 function NbTooltipComponent(statusService) {
19433 this.statusService = statusService;
19434 /**
19435 * Popover position relatively host element.
19436 * */
19437 this.position = exports.NbPosition.TOP;
19438 this.context = {};
19439 }
19440 Object.defineProperty(NbTooltipComponent.prototype, "binding", {
19441 get: function () {
19442 return this.position + " " + this.statusClass;
19443 },
19444 enumerable: false,
19445 configurable: true
19446 });
19447 Object.defineProperty(NbTooltipComponent.prototype, "show", {
19448 get: function () {
19449 return true;
19450 },
19451 enumerable: false,
19452 configurable: true
19453 });
19454 Object.defineProperty(NbTooltipComponent.prototype, "statusClass", {
19455 get: function () {
19456 if (this.context.status) {
19457 return this.statusService.getStatusClass(this.context.status);
19458 }
19459 return '';
19460 },
19461 enumerable: false,
19462 configurable: true
19463 });
19464 /**
19465 * The method is empty since we don't need to do anything additionally
19466 * render is handled by change detection
19467 */
19468 NbTooltipComponent.prototype.renderContent = function () { };
19469 NbTooltipComponent.decorators = [
19470 { type: i0.Component, args: [{
19471 selector: 'nb-tooltip',
19472 template: "\n <span class=\"arrow\"></span>\n <div class=\"content\">\n <nb-icon *ngIf=\"context?.icon\" [config]=\"context.icon\"></nb-icon>\n <span *ngIf=\"content\">{{ content }}</span>\n </div>\n ",
19473 animations: [
19474 _angular_animations.trigger('showTooltip', [
19475 _angular_animations.state('in', _angular_animations.style({ opacity: 1 })),
19476 _angular_animations.transition('void => *', [
19477 _angular_animations.style({ opacity: 0 }),
19478 _angular_animations.animate(100),
19479 ]),
19480 _angular_animations.transition('* => void', [
19481 _angular_animations.animate(100, _angular_animations.style({ opacity: 0 })),
19482 ]),
19483 ]),
19484 ],
19485 styles: [":host{z-index:10000}:host .content{display:flex;align-items:center}:host.right .content{flex-direction:row-reverse}:host .arrow{position:absolute;width:0;height:0}:host nb-icon+span{margin-left:0.5rem}:host.right nb-icon+span{margin-right:0.5rem}:host .arrow{border-left:6px solid transparent;border-right:6px solid transparent}:host(.bottom) .arrow{top:-6px;left:calc(50% - 6px)}:host(.bottom-start) .arrow{top:-6px}[dir=ltr] :host(.bottom-start) .arrow{right:6px}[dir=rtl] :host(.bottom-start) .arrow{left:6px}:host(.bottom-end) .arrow{top:-6px}[dir=ltr] :host(.bottom-end) .arrow{left:6px}[dir=rtl] :host(.bottom-end) .arrow{right:6px}:host(.left) .arrow,:host(.start) .arrow{top:calc(50% - 2.4px)}[dir=ltr] :host(.left) .arrow,[dir=ltr] :host(.start) .arrow{right:-8px;transform:rotate(90deg)}[dir=rtl] :host(.left) .arrow,[dir=rtl] :host(.start) .arrow{left:-8px;transform:rotate(270deg)}:host(.start-top) .arrow{right:-8px;bottom:6px;transform:rotate(90deg)}:host(.start-bottom) .arrow{right:-8px;top:6px;transform:rotate(90deg)}:host(.top) .arrow{bottom:-6px;left:calc(50% - 6px);transform:rotate(180deg)}:host(.top-start) .arrow{bottom:calc(-1 * 6px + 1px);transform:rotate(180deg)}[dir=ltr] :host(.top-start) .arrow{right:6px}[dir=rtl] :host(.top-start) .arrow{left:6px}:host(.top-end) .arrow{bottom:calc(-6px + 1px);transform:rotate(180deg)}[dir=ltr] :host(.top-end) .arrow{left:6px}[dir=rtl] :host(.top-end) .arrow{right:6px}:host(.right) .arrow,:host(.end) .arrow{top:calc(50% - 2.4px)}[dir=ltr] :host(.right) .arrow,[dir=ltr] :host(.end) .arrow{left:-8px;transform:rotate(270deg)}[dir=rtl] :host(.right) .arrow,[dir=rtl] :host(.end) .arrow{right:-8px;transform:rotate(90deg)}:host(.end-top) .arrow{left:calc(-6px - 6px / 2.5);bottom:6px;transform:rotate(270deg)}:host(.end-bottom) .arrow{left:calc(-6px - 6px / 2.5);top:6px;transform:rotate(270deg)}\n"]
19486 },] }
19487 ];
19488 NbTooltipComponent.ctorParameters = function () { return [
19489 { type: NbStatusService }
19490 ]; };
19491 NbTooltipComponent.propDecorators = {
19492 content: [{ type: i0.Input }],
19493 position: [{ type: i0.Input }],
19494 binding: [{ type: i0.HostBinding, args: ['class',] }],
19495 show: [{ type: i0.HostBinding, args: ['@showTooltip',] }],
19496 context: [{ type: i0.Input }]
19497 };
19498 return NbTooltipComponent;
19499}());
19500
19501/*
19502 * @license
19503 * Copyright Akveo. All Rights Reserved.
19504 * Licensed under the MIT License. See License.txt in the project root for license information.
19505 */
19506/**
19507 *
19508 * Tooltip directive for small text/icon hints.
19509 *
19510 * ### Installation
19511 *
19512 * Import `NbTooltipModule` to your feature module.
19513 * ```ts
19514 * @NgModule({
19515 * imports: [
19516 * // ...
19517 * NbTooltipModule,
19518 * ],
19519 * })
19520 * export class PageModule { }
19521 * ```
19522 * ### Usage
19523 *
19524 * @stacked-example(Showcase, tooltip/tooltip-showcase.component)
19525 *
19526 * Tooltip can accept a hint text and/or an icon:
19527 * @stacked-example(With Icon, tooltip/tooltip-with-icon.component)
19528 *
19529 * Same way as Popover, tooltip can accept placement position with `nbTooltipPlacement` property:
19530 * @stacked-example(Placements, tooltip/tooltip-placements.component)
19531 *
19532 * It is also possible to specify tooltip color using `nbTooltipStatus` property:
19533 * @stacked-example(Colored Tooltips, tooltip/tooltip-colors.component)
19534 *
19535 * Tooltip has a number of triggers which provides an ability to show and hide the component in different ways:
19536 *
19537 * - Click mode shows the component when a user clicks on the host element and hides when the user clicks
19538 * somewhere on the document outside the component.
19539 * - Hint provides capability to show the component when the user hovers over the host element
19540 * and hide when the user hovers out of the host.
19541 * - Hover works like hint mode with one exception - when the user moves mouse from host element to
19542 * the container element the component remains open, so that it is possible to interact with it content.
19543 * - Focus mode is applied when user focuses the element.
19544 * - Noop mode - the component won't react to the user interaction.
19545 */
19546var NbTooltipDirective = /** @class */ (function () {
19547 function NbTooltipDirective(hostRef, dynamicOverlayHandler) {
19548 this.hostRef = hostRef;
19549 this.dynamicOverlayHandler = dynamicOverlayHandler;
19550 this.destroy$ = new rxjs.Subject();
19551 this.tooltipComponent = NbTooltipComponent;
19552 this.context = {};
19553 /**
19554 * Position will be calculated relatively host element based on the position.
19555 * Can be top, right, bottom, left, start or end.
19556 */
19557 this.position = exports.NbPosition.TOP;
19558 this._adjustment = exports.NbAdjustment.CLOCKWISE;
19559 this._tooltipClass = '';
19560 /**
19561 * Describes when the container will be shown.
19562 * Available options: `click`, `hover`, `hint`, `focus` and `noop`
19563 * */
19564 this.trigger = exports.NbTrigger.HINT;
19565 /**
19566 * Determines tooltip overlay offset (in pixels).
19567 **/
19568 this.offset = 8;
19569 this.nbTooltipShowStateChange = new i0.EventEmitter();
19570 this.overlayConfig = { panelClass: this.tooltipClass };
19571 }
19572 Object.defineProperty(NbTooltipDirective.prototype, "adjustment", {
19573 /**
19574 * Container position will change automatically based on this strategy if container can't fit view port.
19575 * Set this property to `noop` value if you want to disable automatic adjustment.
19576 * Available values: `clockwise` (default), `counterclockwise`, `vertical`, `horizontal`, `noop`.
19577 */
19578 get: function () {
19579 return this._adjustment;
19580 },
19581 set: function (value) {
19582 this._adjustment = value;
19583 },
19584 enumerable: false,
19585 configurable: true
19586 });
19587 Object.defineProperty(NbTooltipDirective.prototype, "tooltipClass", {
19588 get: function () {
19589 return this._tooltipClass;
19590 },
19591 set: function (value) {
19592 if (value !== this.tooltipClass) {
19593 this._tooltipClass = value;
19594 this.overlayConfig = { panelClass: this.tooltipClass };
19595 }
19596 },
19597 enumerable: false,
19598 configurable: true
19599 });
19600 Object.defineProperty(NbTooltipDirective.prototype, "icon", {
19601 /**
19602 * Accepts icon name or icon config object
19603 * @param {string | NbIconConfig} icon name or config object
19604 */
19605 set: function (icon) {
19606 this.context = Object.assign(this.context, { icon: icon });
19607 },
19608 enumerable: false,
19609 configurable: true
19610 });
19611 Object.defineProperty(NbTooltipDirective.prototype, "status", {
19612 /**
19613 *
19614 * @param {string} status
19615 */
19616 set: function (status) {
19617 this.context = Object.assign(this.context, { status: status });
19618 },
19619 enumerable: false,
19620 configurable: true
19621 });
19622 Object.defineProperty(NbTooltipDirective.prototype, "isShown", {
19623 get: function () {
19624 return !!(this.dynamicOverlay && this.dynamicOverlay.isAttached);
19625 },
19626 enumerable: false,
19627 configurable: true
19628 });
19629 NbTooltipDirective.prototype.ngOnInit = function () {
19630 this.dynamicOverlayHandler
19631 .host(this.hostRef)
19632 .componentType(this.tooltipComponent)
19633 .offset(this.offset);
19634 };
19635 NbTooltipDirective.prototype.ngOnChanges = function () {
19636 this.rebuild();
19637 };
19638 NbTooltipDirective.prototype.ngAfterViewInit = function () {
19639 var _this = this;
19640 this.dynamicOverlay = this.configureDynamicOverlay()
19641 .build();
19642 this.dynamicOverlay.isShown
19643 .pipe(rxjs_operators.skip(1), rxjs_operators.takeUntil(this.destroy$))
19644 .subscribe(function (isShown) { return _this.nbTooltipShowStateChange.emit({ isShown: isShown }); });
19645 };
19646 NbTooltipDirective.prototype.rebuild = function () {
19647 this.dynamicOverlay = this.configureDynamicOverlay()
19648 .rebuild();
19649 };
19650 NbTooltipDirective.prototype.show = function () {
19651 this.dynamicOverlay.show();
19652 };
19653 NbTooltipDirective.prototype.hide = function () {
19654 this.dynamicOverlay.hide();
19655 };
19656 NbTooltipDirective.prototype.toggle = function () {
19657 this.dynamicOverlay.toggle();
19658 };
19659 NbTooltipDirective.prototype.ngOnDestroy = function () {
19660 this.dynamicOverlayHandler.destroy();
19661 this.destroy$.next();
19662 this.destroy$.complete();
19663 };
19664 NbTooltipDirective.prototype.configureDynamicOverlay = function () {
19665 return this.dynamicOverlayHandler
19666 .position(this.position)
19667 .trigger(this.trigger)
19668 .adjustment(this.adjustment)
19669 .content(this.content)
19670 .context(this.context)
19671 .overlayConfig(this.overlayConfig);
19672 };
19673 NbTooltipDirective.decorators = [
19674 { type: i0.Directive, args: [{
19675 selector: '[nbTooltip]',
19676 exportAs: 'nbTooltip',
19677 providers: [NbDynamicOverlayHandler, NbDynamicOverlay],
19678 },] }
19679 ];
19680 NbTooltipDirective.ctorParameters = function () { return [
19681 { type: i0.ElementRef },
19682 { type: NbDynamicOverlayHandler }
19683 ]; };
19684 NbTooltipDirective.propDecorators = {
19685 content: [{ type: i0.Input, args: ['nbTooltip',] }],
19686 position: [{ type: i0.Input, args: ['nbTooltipPlacement',] }],
19687 adjustment: [{ type: i0.Input, args: ['nbTooltipAdjustment',] }],
19688 tooltipClass: [{ type: i0.Input, args: ['nbTooltipClass',] }],
19689 icon: [{ type: i0.Input, args: ['nbTooltipIcon',] }],
19690 status: [{ type: i0.Input, args: ['nbTooltipStatus',] }],
19691 trigger: [{ type: i0.Input, args: ['nbTooltipTrigger',] }],
19692 offset: [{ type: i0.Input, args: ['nbTooltipOffset',] }],
19693 nbTooltipShowStateChange: [{ type: i0.Output }]
19694 };
19695 return NbTooltipDirective;
19696}());
19697
19698/*
19699 * @license
19700 * Copyright Akveo. All Rights Reserved.
19701 * Licensed under the MIT License. See License.txt in the project root for license information.
19702 */
19703var NbTooltipModule = /** @class */ (function () {
19704 function NbTooltipModule() {
19705 }
19706 NbTooltipModule.decorators = [
19707 { type: i0.NgModule, args: [{
19708 imports: [NbSharedModule, NbOverlayModule, NbIconModule],
19709 declarations: [NbTooltipComponent, NbTooltipDirective],
19710 exports: [NbTooltipDirective],
19711 entryComponents: [NbTooltipComponent],
19712 },] }
19713 ];
19714 return NbTooltipModule;
19715}());
19716
19717var NB_SELECT_INJECTION_TOKEN = new i0.InjectionToken('NB_SELECT_INJECTION_TOKEN');
19718
19719/*
19720 * @license
19721 * Copyright Akveo. All Rights Reserved.
19722 * Licensed under the MIT License. See License.txt in the project root for license information.
19723 */
19724// Component class scoped counter for aria attributes.
19725var lastOptionId = 0;
19726/**
19727 * NbOptionComponent
19728 *
19729 * @styles
19730 *
19731 * option-background-color:
19732 * option-text-color:
19733 * option-text-font-family:
19734 * option-hover-background-color:
19735 * option-hover-text-color:
19736 * option-active-background-color:
19737 * option-active-text-color:
19738 * option-focus-background-color:
19739 * option-focus-text-color:
19740 * option-selected-background-color:
19741 * option-selected-text-color:
19742 * option-selected-hover-background-color:
19743 * option-selected-hover-text-color:
19744 * option-selected-active-background-color:
19745 * option-selected-active-text-color:
19746 * option-selected-focus-background-color:
19747 * option-selected-focus-text-color:
19748 * option-disabled-background-color:
19749 * option-disabled-text-color:
19750 * option-tiny-text-font-size:
19751 * option-tiny-text-font-weight:
19752 * option-tiny-text-line-height:
19753 * option-tiny-padding:
19754 * option-small-text-font-size:
19755 * option-small-text-font-weight:
19756 * option-small-text-line-height:
19757 * option-small-padding:
19758 * option-medium-text-font-size:
19759 * option-medium-text-font-weight:
19760 * option-medium-text-line-height:
19761 * option-medium-padding:
19762 * option-large-text-font-size:
19763 * option-large-text-font-weight:
19764 * option-large-text-line-height:
19765 * option-large-padding:
19766 * option-giant-text-font-size:
19767 * option-giant-text-font-weight:
19768 * option-giant-text-line-height:
19769 * option-giant-padding:
19770 **/
19771var NbOptionComponent = /** @class */ (function () {
19772 function NbOptionComponent(parent, elementRef, cd, zone, renderer) {
19773 this.elementRef = elementRef;
19774 this.cd = cd;
19775 this.zone = zone;
19776 this.renderer = renderer;
19777 this.disabledByGroup = false;
19778 this._disabled = false;
19779 /**
19780 * Fires value when option selection change.
19781 * */
19782 this.selectionChange = new i0.EventEmitter();
19783 /**
19784 * Fires when option clicked
19785 */
19786 this.click$ = new rxjs.Subject();
19787 this.selected = false;
19788 this.alive = true;
19789 /**
19790 * Component scoped id for aria attributes.
19791 * */
19792 this.id = "nb-option-" + lastOptionId++;
19793 this._active = false;
19794 this.parent = parent;
19795 }
19796 Object.defineProperty(NbOptionComponent.prototype, "disabled", {
19797 get: function () {
19798 return this._disabled || this.disabledByGroup;
19799 },
19800 set: function (value) {
19801 this._disabled = convertToBoolProperty(value);
19802 },
19803 enumerable: false,
19804 configurable: true
19805 });
19806 Object.defineProperty(NbOptionComponent.prototype, "click", {
19807 get: function () {
19808 return this.click$.asObservable();
19809 },
19810 enumerable: false,
19811 configurable: true
19812 });
19813 NbOptionComponent.prototype.ngOnDestroy = function () {
19814 this.alive = false;
19815 };
19816 NbOptionComponent.prototype.ngAfterViewInit = function () {
19817 var _this = this;
19818 // TODO: #2254
19819 this.zone.runOutsideAngular(function () { return setTimeout(function () {
19820 _this.renderer.addClass(_this.elementRef.nativeElement, 'nb-transition');
19821 }); });
19822 };
19823 Object.defineProperty(NbOptionComponent.prototype, "withCheckbox", {
19824 /**
19825 * Determines should we render checkbox.
19826 * */
19827 get: function () {
19828 return this.multiple && this.value != null;
19829 },
19830 enumerable: false,
19831 configurable: true
19832 });
19833 Object.defineProperty(NbOptionComponent.prototype, "content", {
19834 get: function () {
19835 return this.elementRef.nativeElement.textContent;
19836 },
19837 enumerable: false,
19838 configurable: true
19839 });
19840 Object.defineProperty(NbOptionComponent.prototype, "multiple", {
19841 // TODO: replace with isShowCheckbox property to control this behaviour outside, issues/1965
19842 get: function () {
19843 // We check parent existing because parent can be NbSelectComponent or
19844 // NbAutocomplete and `miltiple` property exists only in NbSelectComponent
19845 return this.parent ? this.parent.multiple : false;
19846 },
19847 enumerable: false,
19848 configurable: true
19849 });
19850 Object.defineProperty(NbOptionComponent.prototype, "selectedClass", {
19851 get: function () {
19852 return this.selected;
19853 },
19854 enumerable: false,
19855 configurable: true
19856 });
19857 Object.defineProperty(NbOptionComponent.prototype, "disabledAttribute", {
19858 get: function () {
19859 return this.disabled ? '' : null;
19860 },
19861 enumerable: false,
19862 configurable: true
19863 });
19864 Object.defineProperty(NbOptionComponent.prototype, "tabindex", {
19865 get: function () {
19866 return '-1';
19867 },
19868 enumerable: false,
19869 configurable: true
19870 });
19871 Object.defineProperty(NbOptionComponent.prototype, "activeClass", {
19872 get: function () {
19873 return this._active;
19874 },
19875 enumerable: false,
19876 configurable: true
19877 });
19878
19879 NbOptionComponent.prototype.onClick = function (event) {
19880 this.click$.next(this);
19881 // Prevent scroll on space click, etc.
19882 event.preventDefault();
19883 };
19884 NbOptionComponent.prototype.select = function () {
19885 this.setSelection(true);
19886 };
19887 NbOptionComponent.prototype.deselect = function () {
19888 this.setSelection(false);
19889 };
19890 /**
19891 * Sets disabled by group state and marks component for check.
19892 */
19893 NbOptionComponent.prototype.setDisabledByGroupState = function (disabled) {
19894 // Check if the component still alive as the option group defer method call so the component may become destroyed.
19895 if (this.disabledByGroup !== disabled && this.alive) {
19896 this.disabledByGroup = disabled;
19897 this.cd.markForCheck();
19898 }
19899 };
19900 NbOptionComponent.prototype.setSelection = function (selected) {
19901 /**
19902 * In case of changing options in runtime the reference to the selected option will be kept in select component.
19903 * This may lead to exceptions with detecting changes in destroyed component.
19904 *
19905 * Also Angular can call writeValue on destroyed view (select implements ControlValueAccessor).
19906 * angular/angular#27803
19907 * */
19908 if (this.alive && this.selected !== selected) {
19909 this.selected = selected;
19910 this.selectionChange.emit(this);
19911 this.cd.markForCheck();
19912 }
19913 };
19914 NbOptionComponent.prototype.focus = function () {
19915 this.elementRef.nativeElement.focus();
19916 };
19917 NbOptionComponent.prototype.getLabel = function () {
19918 return this.content;
19919 };
19920 NbOptionComponent.prototype.setActiveStyles = function () {
19921 this._active = true;
19922 this.cd.markForCheck();
19923 };
19924 NbOptionComponent.prototype.setInactiveStyles = function () {
19925 this._active = false;
19926 this.cd.markForCheck();
19927 };
19928 NbOptionComponent.decorators = [
19929 { type: i0.Component, args: [{
19930 selector: 'nb-option',
19931 changeDetection: i0.ChangeDetectionStrategy.OnPush,
19932 template: "\n <nb-checkbox *ngIf=\"withCheckbox\"\n [checked]=\"selected\"\n [disabled]=\"disabled\"\n aria-hidden=\"true\">\n </nb-checkbox>\n <ng-content></ng-content>\n ",
19933 styles: ["/*!\n * @license\n * Copyright Akveo. All Rights Reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n */:host{display:flex}:host:hover{cursor:pointer}:host nb-checkbox{display:flex;pointer-events:none}[dir=ltr] :host nb-checkbox{margin-right:.5rem}[dir=rtl] :host nb-checkbox{margin-left:.5rem}:host nb-checkbox ::ng-deep .label{padding:0}:host([disabled]){pointer-events:none}:host(.nb-transition){transition-duration:0.15s;transition-property:background-color,color;transition-timing-function:ease-in}\n"]
19934 },] }
19935 ];
19936 NbOptionComponent.ctorParameters = function () { return [
19937 { type: undefined, decorators: [{ type: i0.Optional }, { type: i0.Inject, args: [NB_SELECT_INJECTION_TOKEN,] }] },
19938 { type: i0.ElementRef },
19939 { type: i0.ChangeDetectorRef },
19940 { type: i0.NgZone },
19941 { type: i0.Renderer2 }
19942 ]; };
19943 NbOptionComponent.propDecorators = {
19944 value: [{ type: i0.Input }],
19945 disabled: [{ type: i0.Input }],
19946 selectionChange: [{ type: i0.Output }],
19947 id: [{ type: i0.HostBinding, args: ['attr.id',] }],
19948 multiple: [{ type: i0.HostBinding, args: ['class.multiple',] }],
19949 selectedClass: [{ type: i0.HostBinding, args: ['class.selected',] }],
19950 disabledAttribute: [{ type: i0.HostBinding, args: ['attr.disabled',] }],
19951 tabindex: [{ type: i0.HostBinding, args: ['tabIndex',] }],
19952 activeClass: [{ type: i0.HostBinding, args: ['class.active',] }],
19953 onClick: [{ type: i0.HostListener, args: ['click', ['$event'],] }, { type: i0.HostListener, args: ['keydown.space', ['$event'],] }, { type: i0.HostListener, args: ['keydown.enter', ['$event'],] }]
19954 };
19955 return NbOptionComponent;
19956}());
19957
19958/*
19959 * @license
19960 * Copyright Akveo. All Rights Reserved.
19961 * Licensed under the MIT License. See License.txt in the project root for license information.
19962 */
19963var NbSelectLabelComponent = /** @class */ (function () {
19964 function NbSelectLabelComponent() {
19965 }
19966 NbSelectLabelComponent.decorators = [
19967 { type: i0.Component, args: [{
19968 selector: 'nb-select-label',
19969 template: '<ng-content></ng-content>'
19970 },] }
19971 ];
19972 return NbSelectLabelComponent;
19973}());
19974function nbSelectFormFieldControlConfigFactory() {
19975 var config = new NbFormFieldControlConfig();
19976 config.supportsSuffix = false;
19977 return config;
19978}
19979/**
19980 * The `NbSelectComponent` provides a capability to select one of the passed items.
19981 *
19982 * @stacked-example(Showcase, select/select-showcase.component)
19983 *
19984 * ### Installation
19985 *
19986 * Import `NbSelectModule` to your feature module.
19987 * ```ts
19988 * @NgModule({
19989 * imports: [
19990 * // ...
19991 * NbSelectModule,
19992 * ],
19993 * })
19994 * export class PageModule { }
19995 * ```
19996 * ### Usage
19997 *
19998 * If you want to use it as the multi-select control you have to mark it as `multiple`.
19999 * In this case, `nb-select` will work only with arrays - accept arrays and propagate arrays.
20000 *
20001 * @stacked-example(Multiple, select/select-multiple.component)
20002 *
20003 * Items without values will clean the selection. Both `null` and `undefined` values will also clean the selection.
20004 *
20005 * @stacked-example(Clean selection, select/select-clean.component)
20006 *
20007 * Select may be bounded using `selected` input:
20008 *
20009 * ```html
20010 * <nb-select [(selected)]="selected"></nb-selected>
20011 * ```
20012 *
20013 * Or you can bind control with form controls or ngModel:
20014 *
20015 * @stacked-example(Select form binding, select/select-form.component)
20016 *
20017 * Options in the select may be grouped using `nb-option-group` component.
20018 *
20019 * @stacked-example(Grouping, select/select-groups.component)
20020 *
20021 * Select may have a placeholder that will be shown when nothing selected:
20022 *
20023 * @stacked-example(Placeholder, select/select-placeholder.component)
20024 *
20025 * You can disable select, options and whole groups.
20026 *
20027 * @stacked-example(Disabled select, select/select-disabled.component)
20028 *
20029 * Also, the custom label may be provided in select.
20030 * This custom label will be used for instead placeholder when something selected.
20031 *
20032 * @stacked-example(Custom label, select/select-label.component)
20033 *
20034 * Default `nb-select` size is `medium` and status is `basic`.
20035 * Select is available in multiple colors using `status` property:
20036 *
20037 * @stacked-example(Select statuses, select/select-status.component)
20038 *
20039 * There are five select sizes:
20040 *
20041 * @stacked-example(Select sizes, select/select-sizes.component)
20042 *
20043 * And two additional style types - `filled`:
20044 *
20045 * @stacked-example(Filled select, select/select-filled.component)
20046 *
20047 * and `hero`:
20048 *
20049 * @stacked-example(Select colors, select/select-hero.component)
20050 *
20051 * Select is available in different shapes, that could be combined with the other properties:
20052 *
20053 * @stacked-example(Select shapes, select/select-shapes.component)
20054 *
20055 * By default, the component selects options whose values are strictly equal (`===`) with the select value.
20056 * To change such behavior, pass a custom comparator function to the `compareWith` attribute.
20057 *
20058 * @stacked-example(Select custom comparator, select/select-compare-with.component)
20059 *
20060 * You can add an additional icon to the select via the `nb-form-field` component:
20061 * @stacked-example(Select with icon, select/select-icon.component)
20062 *
20063 * @additional-example(Interactive, select/select-interactive.component)
20064 *
20065 * @styles
20066 *
20067 * select-cursor:
20068 * select-disabled-cursor:
20069 * select-min-width:
20070 * select-outline-width:
20071 * select-outline-color:
20072 * select-icon-offset:
20073 * select-text-font-family:
20074 * select-placeholder-text-font-family:
20075 * select-tiny-text-font-size:
20076 * select-tiny-text-font-weight:
20077 * select-tiny-text-line-height:
20078 * select-tiny-placeholder-text-font-size:
20079 * select-tiny-placeholder-text-font-weight:
20080 * select-tiny-max-width:
20081 * select-small-text-font-size:
20082 * select-small-text-font-weight:
20083 * select-small-text-line-height:
20084 * select-small-placeholder-text-font-size:
20085 * select-small-placeholder-text-font-weight:
20086 * select-small-max-width:
20087 * select-medium-text-font-size:
20088 * select-medium-text-font-weight:
20089 * select-medium-text-line-height:
20090 * select-medium-placeholder-text-font-size:
20091 * select-medium-placeholder-text-font-weight:
20092 * select-medium-max-width:
20093 * select-large-text-font-size:
20094 * select-large-text-font-weight:
20095 * select-large-text-line-height:
20096 * select-large-placeholder-text-font-size:
20097 * select-large-placeholder-text-font-weight:
20098 * select-large-max-width:
20099 * select-giant-text-font-size:
20100 * select-giant-text-font-weight:
20101 * select-giant-text-line-height:
20102 * select-giant-placeholder-text-font-size:
20103 * select-giant-placeholder-text-font-weight:
20104 * select-giant-max-width:
20105 * select-rectangle-border-radius:
20106 * select-semi-round-border-radius:
20107 * select-round-border-radius:
20108 * select-outline-border-style:
20109 * select-outline-border-width:
20110 * select-outline-tiny-padding:
20111 * select-outline-small-padding:
20112 * select-outline-medium-padding:
20113 * select-outline-large-padding:
20114 * select-outline-giant-padding:
20115 * select-outline-basic-icon-color:
20116 * select-outline-basic-text-color:
20117 * select-outline-basic-placeholder-text-color:
20118 * select-outline-basic-background-color:
20119 * select-outline-basic-border-color:
20120 * select-outline-basic-focus-background-color:
20121 * select-outline-basic-focus-border-color:
20122 * select-outline-basic-hover-background-color:
20123 * select-outline-basic-hover-border-color:
20124 * select-outline-basic-disabled-background-color:
20125 * select-outline-basic-disabled-border-color:
20126 * select-outline-basic-disabled-icon-color:
20127 * select-outline-basic-disabled-text-color:
20128 * select-outline-primary-icon-color:
20129 * select-outline-primary-text-color:
20130 * select-outline-primary-placeholder-text-color:
20131 * select-outline-primary-background-color:
20132 * select-outline-primary-border-color:
20133 * select-outline-primary-focus-background-color:
20134 * select-outline-primary-focus-border-color:
20135 * select-outline-primary-hover-background-color:
20136 * select-outline-primary-hover-border-color:
20137 * select-outline-primary-disabled-background-color:
20138 * select-outline-primary-disabled-border-color:
20139 * select-outline-primary-disabled-icon-color:
20140 * select-outline-primary-disabled-text-color:
20141 * select-outline-success-icon-color:
20142 * select-outline-success-text-color:
20143 * select-outline-success-placeholder-text-color:
20144 * select-outline-success-background-color:
20145 * select-outline-success-border-color:
20146 * select-outline-success-focus-background-color:
20147 * select-outline-success-focus-border-color:
20148 * select-outline-success-hover-background-color:
20149 * select-outline-success-hover-border-color:
20150 * select-outline-success-disabled-background-color:
20151 * select-outline-success-disabled-border-color:
20152 * select-outline-success-disabled-icon-color:
20153 * select-outline-success-disabled-text-color:
20154 * select-outline-info-icon-color:
20155 * select-outline-info-text-color:
20156 * select-outline-info-placeholder-text-color:
20157 * select-outline-info-background-color:
20158 * select-outline-info-border-color:
20159 * select-outline-info-focus-background-color:
20160 * select-outline-info-focus-border-color:
20161 * select-outline-info-hover-background-color:
20162 * select-outline-info-hover-border-color:
20163 * select-outline-info-disabled-background-color:
20164 * select-outline-info-disabled-border-color:
20165 * select-outline-info-disabled-icon-color:
20166 * select-outline-info-disabled-text-color:
20167 * select-outline-warning-icon-color:
20168 * select-outline-warning-text-color:
20169 * select-outline-warning-placeholder-text-color:
20170 * select-outline-warning-background-color:
20171 * select-outline-warning-border-color:
20172 * select-outline-warning-focus-background-color:
20173 * select-outline-warning-focus-border-color:
20174 * select-outline-warning-hover-background-color:
20175 * select-outline-warning-hover-border-color:
20176 * select-outline-warning-disabled-background-color:
20177 * select-outline-warning-disabled-border-color:
20178 * select-outline-warning-disabled-icon-color:
20179 * select-outline-warning-disabled-text-color:
20180 * select-outline-danger-icon-color:
20181 * select-outline-danger-text-color:
20182 * select-outline-danger-placeholder-text-color:
20183 * select-outline-danger-background-color:
20184 * select-outline-danger-border-color:
20185 * select-outline-danger-focus-background-color:
20186 * select-outline-danger-focus-border-color:
20187 * select-outline-danger-hover-background-color:
20188 * select-outline-danger-hover-border-color:
20189 * select-outline-danger-disabled-background-color:
20190 * select-outline-danger-disabled-border-color:
20191 * select-outline-danger-disabled-icon-color:
20192 * select-outline-danger-disabled-text-color:
20193 * select-outline-control-icon-color:
20194 * select-outline-control-text-color:
20195 * select-outline-control-placeholder-text-color:
20196 * select-outline-control-background-color:
20197 * select-outline-control-border-color:
20198 * select-outline-control-focus-background-color:
20199 * select-outline-control-focus-border-color:
20200 * select-outline-control-hover-background-color:
20201 * select-outline-control-hover-border-color:
20202 * select-outline-control-disabled-background-color:
20203 * select-outline-control-disabled-border-color:
20204 * select-outline-control-disabled-icon-color:
20205 * select-outline-control-disabled-text-color:
20206 * select-outline-adjacent-border-style:
20207 * select-outline-adjacent-border-width:
20208 * select-outline-basic-open-border-color:
20209 * select-outline-basic-adjacent-border-color:
20210 * select-outline-primary-open-border-color:
20211 * select-outline-primary-adjacent-border-color:
20212 * select-outline-success-open-border-color:
20213 * select-outline-success-adjacent-border-color:
20214 * select-outline-info-open-border-color:
20215 * select-outline-info-adjacent-border-color:
20216 * select-outline-warning-open-border-color:
20217 * select-outline-warning-adjacent-border-color:
20218 * select-outline-danger-open-border-color:
20219 * select-outline-danger-adjacent-border-color:
20220 * select-outline-control-open-border-color:
20221 * select-outline-control-adjacent-border-color:
20222 * select-filled-border-style:
20223 * select-filled-border-width:
20224 * select-filled-tiny-padding:
20225 * select-filled-small-padding:
20226 * select-filled-medium-padding:
20227 * select-filled-large-padding:
20228 * select-filled-giant-padding:
20229 * select-filled-basic-background-color:
20230 * select-filled-basic-border-color:
20231 * select-filled-basic-icon-color:
20232 * select-filled-basic-text-color:
20233 * select-filled-basic-placeholder-text-color:
20234 * select-filled-basic-focus-background-color:
20235 * select-filled-basic-focus-border-color:
20236 * select-filled-basic-hover-background-color:
20237 * select-filled-basic-hover-border-color:
20238 * select-filled-basic-disabled-background-color:
20239 * select-filled-basic-disabled-border-color:
20240 * select-filled-basic-disabled-icon-color:
20241 * select-filled-basic-disabled-text-color:
20242 * select-filled-primary-background-color:
20243 * select-filled-primary-border-color:
20244 * select-filled-primary-icon-color:
20245 * select-filled-primary-text-color:
20246 * select-filled-primary-placeholder-text-color:
20247 * select-filled-primary-focus-background-color:
20248 * select-filled-primary-focus-border-color:
20249 * select-filled-primary-hover-background-color:
20250 * select-filled-primary-hover-border-color:
20251 * select-filled-primary-disabled-background-color:
20252 * select-filled-primary-disabled-border-color:
20253 * select-filled-primary-disabled-icon-color:
20254 * select-filled-primary-disabled-text-color:
20255 * select-filled-success-background-color:
20256 * select-filled-success-border-color:
20257 * select-filled-success-icon-color:
20258 * select-filled-success-text-color:
20259 * select-filled-success-placeholder-text-color:
20260 * select-filled-success-focus-background-color:
20261 * select-filled-success-focus-border-color:
20262 * select-filled-success-hover-background-color:
20263 * select-filled-success-hover-border-color:
20264 * select-filled-success-disabled-background-color:
20265 * select-filled-success-disabled-border-color:
20266 * select-filled-success-disabled-icon-color:
20267 * select-filled-success-disabled-text-color:
20268 * select-filled-info-background-color:
20269 * select-filled-info-border-color:
20270 * select-filled-info-icon-color:
20271 * select-filled-info-text-color:
20272 * select-filled-info-placeholder-text-color:
20273 * select-filled-info-focus-background-color:
20274 * select-filled-info-focus-border-color:
20275 * select-filled-info-hover-background-color:
20276 * select-filled-info-hover-border-color:
20277 * select-filled-info-disabled-background-color:
20278 * select-filled-info-disabled-border-color:
20279 * select-filled-info-disabled-icon-color:
20280 * select-filled-info-disabled-text-color:
20281 * select-filled-warning-background-color:
20282 * select-filled-warning-border-color:
20283 * select-filled-warning-icon-color:
20284 * select-filled-warning-text-color:
20285 * select-filled-warning-placeholder-text-color:
20286 * select-filled-warning-focus-background-color:
20287 * select-filled-warning-focus-border-color:
20288 * select-filled-warning-hover-background-color:
20289 * select-filled-warning-hover-border-color:
20290 * select-filled-warning-disabled-background-color:
20291 * select-filled-warning-disabled-border-color:
20292 * select-filled-warning-disabled-icon-color:
20293 * select-filled-warning-disabled-text-color:
20294 * select-filled-danger-background-color:
20295 * select-filled-danger-border-color:
20296 * select-filled-danger-icon-color:
20297 * select-filled-danger-text-color:
20298 * select-filled-danger-placeholder-text-color:
20299 * select-filled-danger-focus-background-color:
20300 * select-filled-danger-focus-border-color:
20301 * select-filled-danger-hover-background-color:
20302 * select-filled-danger-hover-border-color:
20303 * select-filled-danger-disabled-background-color:
20304 * select-filled-danger-disabled-border-color:
20305 * select-filled-danger-disabled-icon-color:
20306 * select-filled-danger-disabled-text-color:
20307 * select-filled-control-background-color:
20308 * select-filled-control-border-color:
20309 * select-filled-control-icon-color:
20310 * select-filled-control-text-color:
20311 * select-filled-control-placeholder-text-color:
20312 * select-filled-control-focus-background-color:
20313 * select-filled-control-focus-border-color:
20314 * select-filled-control-hover-background-color:
20315 * select-filled-control-hover-border-color:
20316 * select-filled-control-disabled-background-color:
20317 * select-filled-control-disabled-border-color:
20318 * select-filled-control-disabled-icon-color:
20319 * select-filled-control-disabled-text-color:
20320 * select-hero-tiny-padding:
20321 * select-hero-small-padding:
20322 * select-hero-medium-padding:
20323 * select-hero-large-padding:
20324 * select-hero-giant-padding:
20325 * select-hero-basic-left-background-color:
20326 * select-hero-basic-right-background-color:
20327 * select-hero-basic-icon-color:
20328 * select-hero-basic-text-color:
20329 * select-hero-basic-placeholder-text-color:
20330 * select-hero-basic-focus-left-background-color:
20331 * select-hero-basic-focus-right-background-color:
20332 * select-hero-basic-hover-left-background-color:
20333 * select-hero-basic-hover-right-background-color:
20334 * select-hero-basic-disabled-background-color:
20335 * select-hero-basic-disabled-icon-color:
20336 * select-hero-basic-disabled-text-color:
20337 * select-hero-primary-left-background-color:
20338 * select-hero-primary-right-background-color:
20339 * select-hero-primary-icon-color:
20340 * select-hero-primary-text-color:
20341 * select-hero-primary-placeholder-text-color:
20342 * select-hero-primary-focus-left-background-color:
20343 * select-hero-primary-focus-right-background-color:
20344 * select-hero-primary-hover-left-background-color:
20345 * select-hero-primary-hover-right-background-color:
20346 * select-hero-primary-disabled-background-color:
20347 * select-hero-primary-disabled-icon-color:
20348 * select-hero-primary-disabled-text-color:
20349 * select-hero-success-left-background-color:
20350 * select-hero-success-right-background-color:
20351 * select-hero-success-icon-color:
20352 * select-hero-success-text-color:
20353 * select-hero-success-placeholder-text-color:
20354 * select-hero-success-focus-left-background-color:
20355 * select-hero-success-focus-right-background-color:
20356 * select-hero-success-hover-left-background-color:
20357 * select-hero-success-hover-right-background-color:
20358 * select-hero-success-disabled-background-color:
20359 * select-hero-success-disabled-icon-color:
20360 * select-hero-success-disabled-text-color:
20361 * select-hero-info-left-background-color:
20362 * select-hero-info-right-background-color:
20363 * select-hero-info-icon-color:
20364 * select-hero-info-text-color:
20365 * select-hero-info-placeholder-text-color:
20366 * select-hero-info-focus-left-background-color:
20367 * select-hero-info-focus-right-background-color:
20368 * select-hero-info-hover-left-background-color:
20369 * select-hero-info-hover-right-background-color:
20370 * select-hero-info-disabled-background-color:
20371 * select-hero-info-disabled-icon-color:
20372 * select-hero-info-disabled-text-color:
20373 * select-hero-warning-left-background-color:
20374 * select-hero-warning-right-background-color:
20375 * select-hero-warning-icon-color:
20376 * select-hero-warning-text-color:
20377 * select-hero-warning-placeholder-text-color:
20378 * select-hero-warning-focus-left-background-color:
20379 * select-hero-warning-focus-right-background-color:
20380 * select-hero-warning-hover-left-background-color:
20381 * select-hero-warning-hover-right-background-color:
20382 * select-hero-warning-disabled-background-color:
20383 * select-hero-warning-disabled-icon-color:
20384 * select-hero-warning-disabled-text-color:
20385 * select-hero-danger-left-background-color:
20386 * select-hero-danger-right-background-color:
20387 * select-hero-danger-icon-color:
20388 * select-hero-danger-text-color:
20389 * select-hero-danger-placeholder-text-color:
20390 * select-hero-danger-focus-left-background-color:
20391 * select-hero-danger-focus-right-background-color:
20392 * select-hero-danger-hover-left-background-color:
20393 * select-hero-danger-hover-right-background-color:
20394 * select-hero-danger-disabled-background-color:
20395 * select-hero-danger-disabled-icon-color:
20396 * select-hero-danger-disabled-text-color:
20397 * select-hero-control-left-background-color:
20398 * select-hero-control-right-background-color:
20399 * select-hero-control-icon-color:
20400 * select-hero-control-text-color:
20401 * select-hero-control-placeholder-text-color:
20402 * select-hero-control-focus-left-background-color:
20403 * select-hero-control-focus-right-background-color:
20404 * select-hero-control-hover-left-background-color:
20405 * select-hero-control-hover-right-background-color:
20406 * select-hero-control-disabled-background-color:
20407 * select-hero-control-disabled-icon-color:
20408 * select-hero-control-disabled-text-color:
20409 * */
20410var NbSelectComponent = /** @class */ (function () {
20411 function NbSelectComponent(document, overlay, hostRef, positionBuilder, triggerStrategyBuilder, cd, focusKeyManagerFactoryService, focusMonitor, renderer, zone, statusService) {
20412 this.document = document;
20413 this.overlay = overlay;
20414 this.hostRef = hostRef;
20415 this.positionBuilder = positionBuilder;
20416 this.triggerStrategyBuilder = triggerStrategyBuilder;
20417 this.cd = cd;
20418 this.focusKeyManagerFactoryService = focusKeyManagerFactoryService;
20419 this.focusMonitor = focusMonitor;
20420 this.renderer = renderer;
20421 this.zone = zone;
20422 this.statusService = statusService;
20423 /**
20424 * Select size, available sizes:
20425 * `tiny`, `small`, `medium` (default), `large`, `giant`
20426 */
20427 this.size = 'medium';
20428 /**
20429 * Select status (adds specific styles):
20430 * `basic`, `primary`, `info`, `success`, `warning`, `danger`, `control`
20431 */
20432 this.status = 'basic';
20433 /**
20434 * Select shapes: `rectangle` (default), `round`, `semi-round`
20435 */
20436 this.shape = 'rectangle';
20437 /**
20438 * Select appearances: `outline` (default), `filled`, `hero`
20439 */
20440 this.appearance = 'outline';
20441 this._fullWidth = false;
20442 /**
20443 * Renders select placeholder if nothing selected.
20444 * */
20445 this.placeholder = '';
20446 this._compareWith = function (v1, v2) { return v1 === v2; };
20447 this._multiple = false;
20448 /**
20449 * Determines options overlay offset (in pixels).
20450 **/
20451 this.optionsOverlayOffset = 8;
20452 /**
20453 * Determines options overlay scroll strategy.
20454 **/
20455 this.scrollStrategy = 'block';
20456 /**
20457 * Will be emitted when selected value changes.
20458 * */
20459 this.selectedChange = new i0.EventEmitter();
20460 /**
20461 * List of selected options.
20462 * */
20463 this.selectionModel = [];
20464 /**
20465 * Current overlay position because of we have to toggle overlayPosition
20466 * in [ngClass] direction and this directive can use only string.
20467 */
20468 this.overlayPosition = '';
20469 this.alive = true;
20470 this.destroy$ = new rxjs.Subject();
20471 /**
20472 * Function passed through control value accessor to propagate changes.
20473 * */
20474 this.onChange = function () { };
20475 this.onTouched = function () { };
20476 /*
20477 * @docs-private
20478 **/
20479 this.status$ = new rxjs.BehaviorSubject(this.status);
20480 /*
20481 * @docs-private
20482 **/
20483 this.size$ = new rxjs.BehaviorSubject(this.size);
20484 /*
20485 * @docs-private
20486 **/
20487 this.focused$ = new rxjs.BehaviorSubject(false);
20488 /*
20489 * @docs-private
20490 **/
20491 this.disabled$ = new rxjs.BehaviorSubject(this.disabled);
20492 /*
20493 * @docs-private
20494 **/
20495 this.fullWidth$ = new rxjs.BehaviorSubject(this.fullWidth);
20496 }
20497 Object.defineProperty(NbSelectComponent.prototype, "outline", {
20498 /**
20499 * Adds `outline` styles
20500 */
20501 get: function () {
20502 return this.appearance === 'outline';
20503 },
20504 set: function (value) {
20505 if (convertToBoolProperty(value)) {
20506 this.appearance = 'outline';
20507 }
20508 },
20509 enumerable: false,
20510 configurable: true
20511 });
20512 Object.defineProperty(NbSelectComponent.prototype, "filled", {
20513 /**
20514 * Adds `filled` styles
20515 */
20516 get: function () {
20517 return this.appearance === 'filled';
20518 },
20519 set: function (value) {
20520 if (convertToBoolProperty(value)) {
20521 this.appearance = 'filled';
20522 }
20523 },
20524 enumerable: false,
20525 configurable: true
20526 });
20527 Object.defineProperty(NbSelectComponent.prototype, "hero", {
20528 /**
20529 * Adds `hero` styles
20530 */
20531 get: function () {
20532 return this.appearance === 'hero';
20533 },
20534 set: function (value) {
20535 if (convertToBoolProperty(value)) {
20536 this.appearance = 'hero';
20537 }
20538 },
20539 enumerable: false,
20540 configurable: true
20541 });
20542 Object.defineProperty(NbSelectComponent.prototype, "disabled", {
20543 /**
20544 * Disables the select
20545 */
20546 get: function () {
20547 return !!this._disabled;
20548 },
20549 set: function (value) {
20550 this._disabled = convertToBoolProperty(value);
20551 },
20552 enumerable: false,
20553 configurable: true
20554 });
20555 Object.defineProperty(NbSelectComponent.prototype, "fullWidth", {
20556 /**
20557 * If set element will fill its container
20558 */
20559 get: function () {
20560 return this._fullWidth;
20561 },
20562 set: function (value) {
20563 this._fullWidth = convertToBoolProperty(value);
20564 },
20565 enumerable: false,
20566 configurable: true
20567 });
20568 Object.defineProperty(NbSelectComponent.prototype, "compareWith", {
20569 /**
20570 * A function to compare option value with selected value.
20571 * By default, values are compared with strict equality (`===`).
20572 */
20573 get: function () {
20574 return this._compareWith;
20575 },
20576 set: function (fn) {
20577 if (typeof fn !== 'function') {
20578 return;
20579 }
20580 this._compareWith = fn;
20581 if (this.selectionModel.length && this.canSelectValue()) {
20582 this.setSelection(this.selected);
20583 }
20584 },
20585 enumerable: false,
20586 configurable: true
20587 });
20588 Object.defineProperty(NbSelectComponent.prototype, "selected", {
20589 get: function () {
20590 return this.multiple
20591 ? this.selectionModel.map(function (o) { return o.value; })
20592 : this.selectionModel[0].value;
20593 },
20594 /**
20595 * Accepts selected item or array of selected items.
20596 * */
20597 set: function (value) {
20598 this.writeValue(value);
20599 },
20600 enumerable: false,
20601 configurable: true
20602 });
20603 Object.defineProperty(NbSelectComponent.prototype, "multiple", {
20604 /**
20605 * Gives capability just write `multiple` over the element.
20606 * */
20607 get: function () {
20608 return this._multiple;
20609 },
20610 set: function (value) {
20611 this._multiple = convertToBoolProperty(value);
20612 },
20613 enumerable: false,
20614 configurable: true
20615 });
20616 Object.defineProperty(NbSelectComponent.prototype, "additionalClasses", {
20617 get: function () {
20618 if (this.statusService.isCustomStatus(this.status)) {
20619 return [this.statusService.getStatusClass(this.status)];
20620 }
20621 return [];
20622 },
20623 enumerable: false,
20624 configurable: true
20625 });
20626 Object.defineProperty(NbSelectComponent.prototype, "isOpen", {
20627 /**
20628 * Determines is select opened.
20629 * */
20630 get: function () {
20631 return this.ref && this.ref.hasAttached();
20632 },
20633 enumerable: false,
20634 configurable: true
20635 });
20636 Object.defineProperty(NbSelectComponent.prototype, "isHidden", {
20637 /**
20638 * Determines is select hidden.
20639 * */
20640 get: function () {
20641 return !this.isOpen;
20642 },
20643 enumerable: false,
20644 configurable: true
20645 });
20646 Object.defineProperty(NbSelectComponent.prototype, "hostWidth", {
20647 /**
20648 * Returns width of the select button.
20649 * */
20650 get: function () {
20651 return this.button.nativeElement.getBoundingClientRect().width;
20652 },
20653 enumerable: false,
20654 configurable: true
20655 });
20656 Object.defineProperty(NbSelectComponent.prototype, "selectButtonClasses", {
20657 get: function () {
20658 var classes = [];
20659 if (!this.selectionModel.length) {
20660 classes.push('placeholder');
20661 }
20662 if (!this.selectionModel.length && !this.placeholder) {
20663 classes.push('empty');
20664 }
20665 if (this.isOpen) {
20666 classes.push(this.overlayPosition);
20667 }
20668 return classes;
20669 },
20670 enumerable: false,
20671 configurable: true
20672 });
20673 Object.defineProperty(NbSelectComponent.prototype, "selectionView", {
20674 /**
20675 * Content rendered in the label.
20676 * */
20677 get: function () {
20678 if (this.selectionModel.length > 1) {
20679 return this.selectionModel.map(function (option) { return option.content; }).join(', ');
20680 }
20681 return this.selectionModel[0].content;
20682 },
20683 enumerable: false,
20684 configurable: true
20685 });
20686 NbSelectComponent.prototype.ngOnChanges = function (_a) {
20687 var disabled = _a.disabled, status = _a.status, size = _a.size, fullWidth = _a.fullWidth;
20688 if (disabled) {
20689 this.disabled$.next(disabled.currentValue);
20690 }
20691 if (status) {
20692 this.status$.next(status.currentValue);
20693 }
20694 if (size) {
20695 this.size$.next(size.currentValue);
20696 }
20697 if (fullWidth) {
20698 this.fullWidth$.next(this.fullWidth);
20699 }
20700 };
20701 NbSelectComponent.prototype.ngAfterContentInit = function () {
20702 var _this = this;
20703 this.options.changes
20704 .pipe(rxjs_operators.startWith(this.options), rxjs_operators.filter(function () { return _this.queue != null && _this.canSelectValue(); }),
20705 // Call 'writeValue' when current change detection run is finished.
20706 // When writing is finished, change detection starts again, since
20707 // microtasks queue is empty.
20708 // Prevents ExpressionChangedAfterItHasBeenCheckedError.
20709 rxjs_operators.switchMap(function (options) { return rxjs.from(Promise.resolve(options)); }), rxjs_operators.takeUntil(this.destroy$))
20710 .subscribe(function () { return _this.writeValue(_this.queue); });
20711 };
20712 NbSelectComponent.prototype.ngAfterViewInit = function () {
20713 var _this = this;
20714 this.triggerStrategy = this.createTriggerStrategy();
20715 this.subscribeOnButtonFocus();
20716 this.subscribeOnTriggers();
20717 this.subscribeOnOptionClick();
20718 // TODO: #2254
20719 this.zone.runOutsideAngular(function () { return setTimeout(function () {
20720 _this.renderer.addClass(_this.hostRef.nativeElement, 'nb-transition');
20721 }); });
20722 };
20723 NbSelectComponent.prototype.ngOnDestroy = function () {
20724 this.alive = false;
20725 this.destroy$.next();
20726 this.destroy$.complete();
20727 if (this.ref) {
20728 this.ref.dispose();
20729 }
20730 if (this.triggerStrategy) {
20731 this.triggerStrategy.destroy();
20732 }
20733 };
20734 NbSelectComponent.prototype.show = function () {
20735 if (this.isHidden) {
20736 this.attachToOverlay();
20737 this.setActiveOption();
20738 this.cd.markForCheck();
20739 }
20740 };
20741 NbSelectComponent.prototype.hide = function () {
20742 if (this.isOpen) {
20743 this.ref.detach();
20744 this.cd.markForCheck();
20745 }
20746 };
20747 NbSelectComponent.prototype.registerOnChange = function (fn) {
20748 this.onChange = fn;
20749 };
20750 NbSelectComponent.prototype.registerOnTouched = function (fn) {
20751 this.onTouched = fn;
20752 };
20753 NbSelectComponent.prototype.setDisabledState = function (isDisabled) {
20754 this.disabled = isDisabled;
20755 this.cd.markForCheck();
20756 };
20757 NbSelectComponent.prototype.writeValue = function (value) {
20758 if (!this.alive) {
20759 return;
20760 }
20761 if (this.canSelectValue()) {
20762 this.setSelection(value);
20763 if (this.selectionModel.length) {
20764 this.queue = null;
20765 }
20766 }
20767 else {
20768 this.queue = value;
20769 }
20770 };
20771 /**
20772 * Selects option or clear all selected options if value is null.
20773 * */
20774 NbSelectComponent.prototype.handleOptionClick = function (option) {
20775 this.queue = null;
20776 if (option.value == null) {
20777 this.reset();
20778 }
20779 else {
20780 this.selectOption(option);
20781 }
20782 this.cd.markForCheck();
20783 };
20784 /**
20785 * Deselect all selected options.
20786 * */
20787 NbSelectComponent.prototype.reset = function () {
20788 this.selectionModel.forEach(function (option) { return option.deselect(); });
20789 this.selectionModel = [];
20790 this.hide();
20791 this.button.nativeElement.focus();
20792 this.emitSelected(this.multiple ? [] : null);
20793 };
20794 /**
20795 * Determines how to select option as multiple or single.
20796 * */
20797 NbSelectComponent.prototype.selectOption = function (option) {
20798 if (this.multiple) {
20799 this.handleMultipleSelect(option);
20800 }
20801 else {
20802 this.handleSingleSelect(option);
20803 }
20804 };
20805 /**
20806 * Select single option.
20807 * */
20808 NbSelectComponent.prototype.handleSingleSelect = function (option) {
20809 var selected = this.selectionModel.pop();
20810 if (selected && !this._compareWith(selected.value, option.value)) {
20811 selected.deselect();
20812 }
20813 this.selectionModel = [option];
20814 option.select();
20815 this.hide();
20816 this.button.nativeElement.focus();
20817 this.emitSelected(option.value);
20818 };
20819 /**
20820 * Select for multiple options.
20821 * */
20822 NbSelectComponent.prototype.handleMultipleSelect = function (option) {
20823 var _this = this;
20824 if (option.selected) {
20825 this.selectionModel = this.selectionModel.filter(function (s) { return !_this._compareWith(s.value, option.value); });
20826 option.deselect();
20827 }
20828 else {
20829 this.selectionModel.push(option);
20830 option.select();
20831 }
20832 this.emitSelected(this.selectionModel.map(function (opt) { return opt.value; }));
20833 };
20834 NbSelectComponent.prototype.attachToOverlay = function () {
20835 if (!this.ref) {
20836 this.createOverlay();
20837 this.subscribeOnPositionChange();
20838 this.createKeyManager();
20839 this.subscribeOnOverlayKeys();
20840 }
20841 this.ref.attach(this.portal);
20842 };
20843 NbSelectComponent.prototype.setActiveOption = function () {
20844 if (this.selectionModel.length) {
20845 this.keyManager.setActiveItem(this.selectionModel[0]);
20846 }
20847 else {
20848 this.keyManager.setFirstItemActive();
20849 }
20850 };
20851 NbSelectComponent.prototype.createOverlay = function () {
20852 var scrollStrategy = this.createScrollStrategy();
20853 this.positionStrategy = this.createPositionStrategy();
20854 this.ref = this.overlay.create({
20855 positionStrategy: this.positionStrategy,
20856 scrollStrategy: scrollStrategy,
20857 panelClass: this.optionsPanelClass,
20858 });
20859 };
20860 NbSelectComponent.prototype.createKeyManager = function () {
20861 this.keyManager = this.focusKeyManagerFactoryService.create(this.options).withTypeAhead(200);
20862 };
20863 NbSelectComponent.prototype.createPositionStrategy = function () {
20864 return this.positionBuilder
20865 .connectedTo(this.button)
20866 .position(exports.NbPosition.BOTTOM)
20867 .offset(this.optionsOverlayOffset)
20868 .adjustment(exports.NbAdjustment.VERTICAL);
20869 };
20870 NbSelectComponent.prototype.createScrollStrategy = function () {
20871 return this.overlay.scrollStrategies[this.scrollStrategy]();
20872 };
20873 NbSelectComponent.prototype.createTriggerStrategy = function () {
20874 var _this = this;
20875 return this.triggerStrategyBuilder
20876 .trigger(exports.NbTrigger.CLICK)
20877 .host(this.hostRef.nativeElement)
20878 .container(function () { return _this.getContainer(); })
20879 .build();
20880 };
20881 NbSelectComponent.prototype.subscribeOnTriggers = function () {
20882 var _this = this;
20883 this.triggerStrategy.show$.subscribe(function () { return _this.show(); });
20884 this.triggerStrategy.hide$
20885 .pipe(rxjs_operators.filter(function () { return _this.isOpen; }))
20886 .subscribe(function ($event) {
20887 _this.hide();
20888 if (!_this.isClickedWithinComponent($event)) {
20889 _this.onTouched();
20890 }
20891 });
20892 };
20893 NbSelectComponent.prototype.subscribeOnPositionChange = function () {
20894 var _this = this;
20895 this.positionStrategy.positionChange
20896 .pipe(rxjs_operators.takeUntil(this.destroy$))
20897 .subscribe(function (position) {
20898 _this.overlayPosition = position;
20899 _this.cd.detectChanges();
20900 });
20901 };
20902 NbSelectComponent.prototype.subscribeOnOptionClick = function () {
20903 var _this = this;
20904 /**
20905 * If the user changes provided options list in the runtime we have to handle this
20906 * and resubscribe on options selection changes event.
20907 * Otherwise, the user will not be able to select new options.
20908 * */
20909 this.options.changes
20910 .pipe(rxjs_operators.startWith(this.options), rxjs_operators.switchMap(function (options) {
20911 return rxjs.merge.apply(void 0, options.map(function (option) { return option.click; }));
20912 }), rxjs_operators.takeUntil(this.destroy$))
20913 .subscribe(function (clickedOption) { return _this.handleOptionClick(clickedOption); });
20914 };
20915 NbSelectComponent.prototype.subscribeOnOverlayKeys = function () {
20916 var _this = this;
20917 this.ref.keydownEvents()
20918 .pipe(rxjs_operators.filter(function () { return _this.isOpen; }), rxjs_operators.takeUntil(this.destroy$))
20919 .subscribe(function (event) {
20920 if (event.keyCode === _angular_cdk_keycodes.ESCAPE) {
20921 _this.button.nativeElement.focus();
20922 _this.hide();
20923 }
20924 else {
20925 _this.keyManager.onKeydown(event);
20926 }
20927 });
20928 this.keyManager.tabOut
20929 .pipe(rxjs_operators.takeUntil(this.destroy$))
20930 .subscribe(function () {
20931 _this.hide();
20932 _this.onTouched();
20933 });
20934 };
20935 NbSelectComponent.prototype.subscribeOnButtonFocus = function () {
20936 var _this = this;
20937 this.focusMonitor.monitor(this.button)
20938 .pipe(rxjs_operators.map(function (origin) { return !!origin; }), rxjs_operators.finalize(function () { return _this.focusMonitor.stopMonitoring(_this.button); }), rxjs_operators.takeUntil(this.destroy$))
20939 .subscribe(this.focused$);
20940 };
20941 NbSelectComponent.prototype.getContainer = function () {
20942 return this.ref && this.ref.hasAttached() && {
20943 location: {
20944 nativeElement: this.ref.overlayElement,
20945 },
20946 };
20947 };
20948 /**
20949 * Propagate selected value.
20950 * */
20951 NbSelectComponent.prototype.emitSelected = function (selected) {
20952 this.onChange(selected);
20953 this.selectedChange.emit(selected);
20954 };
20955 /**
20956 * Set selected value in model.
20957 * */
20958 NbSelectComponent.prototype.setSelection = function (value) {
20959 var _this = this;
20960 var isArray = Array.isArray(value);
20961 if (this.multiple && !isArray) {
20962 throw new Error('Can\'t assign single value if select is marked as multiple');
20963 }
20964 if (!this.multiple && isArray) {
20965 throw new Error('Can\'t assign array if select is not marked as multiple');
20966 }
20967 var previouslySelectedOptions = this.selectionModel;
20968 this.selectionModel = [];
20969 if (isArray) {
20970 value.forEach(function (option) { return _this.selectValue(option); });
20971 }
20972 else {
20973 this.selectValue(value);
20974 }
20975 // find options which were selected before and trigger deselect
20976 previouslySelectedOptions
20977 .filter(function (option) { return !_this.selectionModel.includes(option); })
20978 .forEach(function (option) { return option.deselect(); });
20979 this.cd.markForCheck();
20980 };
20981 /**
20982 * Selects value.
20983 * */
20984 NbSelectComponent.prototype.selectValue = function (value) {
20985 var _this = this;
20986 var corresponding = this.options.find(function (option) { return _this._compareWith(option.value, value); });
20987 if (corresponding) {
20988 corresponding.select();
20989 this.selectionModel.push(corresponding);
20990 }
20991 };
20992 /**
20993 * Sets touched if focus moved outside of button and overlay,
20994 * ignoring the case when focus moved to options overlay.
20995 */
20996 NbSelectComponent.prototype.trySetTouched = function () {
20997 if (this.isHidden) {
20998 this.onTouched();
20999 }
21000 };
21001 NbSelectComponent.prototype.isClickedWithinComponent = function ($event) {
21002 return this.hostRef.nativeElement === $event.target || this.hostRef.nativeElement.contains($event.target);
21003 };
21004 NbSelectComponent.prototype.canSelectValue = function () {
21005 return !!(this.options && this.options.length);
21006 };
21007 Object.defineProperty(NbSelectComponent.prototype, "tiny", {
21008 get: function () {
21009 return this.size === 'tiny';
21010 },
21011 enumerable: false,
21012 configurable: true
21013 });
21014 Object.defineProperty(NbSelectComponent.prototype, "small", {
21015 get: function () {
21016 return this.size === 'small';
21017 },
21018 enumerable: false,
21019 configurable: true
21020 });
21021 Object.defineProperty(NbSelectComponent.prototype, "medium", {
21022 get: function () {
21023 return this.size === 'medium';
21024 },
21025 enumerable: false,
21026 configurable: true
21027 });
21028 Object.defineProperty(NbSelectComponent.prototype, "large", {
21029 get: function () {
21030 return this.size === 'large';
21031 },
21032 enumerable: false,
21033 configurable: true
21034 });
21035 Object.defineProperty(NbSelectComponent.prototype, "giant", {
21036 get: function () {
21037 return this.size === 'giant';
21038 },
21039 enumerable: false,
21040 configurable: true
21041 });
21042 Object.defineProperty(NbSelectComponent.prototype, "primary", {
21043 get: function () {
21044 return this.status === 'primary';
21045 },
21046 enumerable: false,
21047 configurable: true
21048 });
21049 Object.defineProperty(NbSelectComponent.prototype, "info", {
21050 get: function () {
21051 return this.status === 'info';
21052 },
21053 enumerable: false,
21054 configurable: true
21055 });
21056 Object.defineProperty(NbSelectComponent.prototype, "success", {
21057 get: function () {
21058 return this.status === 'success';
21059 },
21060 enumerable: false,
21061 configurable: true
21062 });
21063 Object.defineProperty(NbSelectComponent.prototype, "warning", {
21064 get: function () {
21065 return this.status === 'warning';
21066 },
21067 enumerable: false,
21068 configurable: true
21069 });
21070 Object.defineProperty(NbSelectComponent.prototype, "danger", {
21071 get: function () {
21072 return this.status === 'danger';
21073 },
21074 enumerable: false,
21075 configurable: true
21076 });
21077 Object.defineProperty(NbSelectComponent.prototype, "basic", {
21078 get: function () {
21079 return this.status === 'basic';
21080 },
21081 enumerable: false,
21082 configurable: true
21083 });
21084 Object.defineProperty(NbSelectComponent.prototype, "control", {
21085 get: function () {
21086 return this.status === 'control';
21087 },
21088 enumerable: false,
21089 configurable: true
21090 });
21091 Object.defineProperty(NbSelectComponent.prototype, "rectangle", {
21092 get: function () {
21093 return this.shape === 'rectangle';
21094 },
21095 enumerable: false,
21096 configurable: true
21097 });
21098 Object.defineProperty(NbSelectComponent.prototype, "round", {
21099 get: function () {
21100 return this.shape === 'round';
21101 },
21102 enumerable: false,
21103 configurable: true
21104 });
21105 Object.defineProperty(NbSelectComponent.prototype, "semiRound", {
21106 get: function () {
21107 return this.shape === 'semi-round';
21108 },
21109 enumerable: false,
21110 configurable: true
21111 });
21112 NbSelectComponent.decorators = [
21113 { type: i0.Component, args: [{
21114 selector: 'nb-select',
21115 template: "<button [disabled]=\"disabled\"\n [ngClass]=\"selectButtonClasses\"\n (blur)=\"trySetTouched()\"\n (keydown.arrowDown)=\"show()\"\n (keydown.arrowUp)=\"show()\"\n class=\"select-button\"\n type=\"button\"\n #selectButton>\n\n <ng-container *ngIf=\"selectionModel.length; else placeholderTemplate\">\n <ng-container *ngIf=\"customLabel; else defaultSelectionTemplate\">\n <ng-content select=\"nb-select-label\"></ng-content>\n </ng-container>\n\n <ng-template #defaultSelectionTemplate>{{ selectionView }}</ng-template>\n </ng-container>\n\n <ng-template #placeholderTemplate>{{ placeholder }}</ng-template>\n\n <nb-icon icon=\"chevron-down-outline\" pack=\"nebular-essentials\" (click)=\"disabled && $event.stopPropagation()\" aria-hidden=\"true\">\n </nb-icon>\n</button>\n\n<nb-option-list *nbPortal [size]=\"size\" [position]=\"overlayPosition\" [style.width.px]=\"hostWidth\" [ngClass]=\"optionsListClass\">\n <ng-content select=\"nb-option, nb-option-group\"></ng-content>\n</nb-option-list>\n",
21116 changeDetection: i0.ChangeDetectionStrategy.OnPush,
21117 providers: [
21118 {
21119 provide: _angular_forms.NG_VALUE_ACCESSOR,
21120 useExisting: i0.forwardRef(function () { return NbSelectComponent; }),
21121 multi: true,
21122 },
21123 { provide: NB_SELECT_INJECTION_TOKEN, useExisting: NbSelectComponent },
21124 { provide: NbFormFieldControl, useExisting: NbSelectComponent },
21125 { provide: NbFormFieldControlConfig, useFactory: nbSelectFormFieldControlConfigFactory },
21126 ],
21127 styles: ["/*!\n * @license\n * Copyright Akveo. All Rights Reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n */:host{display:inline-block;max-width:100%}[dir=ltr] :host .select-button{text-align:left}[dir=ltr] :host .select-button nb-icon{right:0.2em}[dir=rtl] :host .select-button{text-align:right}[dir=rtl] :host .select-button nb-icon{left:0.2em}:host(.full-width){width:100%}:host(.nb-transition) .select-button{transition-duration:0.15s;transition-property:background-color,border-color,border-radius,box-shadow,color;transition-timing-function:ease-in}.select-button{position:relative;width:100%;overflow:hidden;text-overflow:ellipsis;text-transform:none;white-space:nowrap}nb-icon{font-size:1.5em;position:absolute;top:50%;transform:translateY(-50%);transition-duration:0.15s;transition-property:transform;transition-timing-function:ease-in}[dir=ltr] nb-icon{right:.5rem}[dir=rtl] nb-icon{left:.5rem}:host(.open) nb-icon{transform:translateY(-50%) rotate(180deg)}\n"]
21128 },] }
21129 ];
21130 NbSelectComponent.ctorParameters = function () { return [
21131 { type: undefined, decorators: [{ type: i0.Inject, args: [NB_DOCUMENT,] }] },
21132 { type: NbOverlayService },
21133 { type: i0.ElementRef },
21134 { type: NbPositionBuilderService },
21135 { type: NbTriggerStrategyBuilderService },
21136 { type: i0.ChangeDetectorRef },
21137 { type: NbFocusKeyManagerFactoryService },
21138 { type: NbFocusMonitor },
21139 { type: i0.Renderer2 },
21140 { type: i0.NgZone },
21141 { type: NbStatusService }
21142 ]; };
21143 NbSelectComponent.propDecorators = {
21144 size: [{ type: i0.Input }],
21145 status: [{ type: i0.Input }],
21146 shape: [{ type: i0.Input }],
21147 appearance: [{ type: i0.Input }],
21148 optionsListClass: [{ type: i0.Input }],
21149 optionsPanelClass: [{ type: i0.Input }],
21150 outline: [{ type: i0.Input }, { type: i0.HostBinding, args: ['class.appearance-outline',] }],
21151 filled: [{ type: i0.Input }, { type: i0.HostBinding, args: ['class.appearance-filled',] }],
21152 hero: [{ type: i0.Input }, { type: i0.HostBinding, args: ['class.appearance-hero',] }],
21153 disabled: [{ type: i0.Input }],
21154 fullWidth: [{ type: i0.Input }, { type: i0.HostBinding, args: ['class.full-width',] }],
21155 placeholder: [{ type: i0.Input }],
21156 compareWith: [{ type: i0.Input }],
21157 selected: [{ type: i0.Input }],
21158 multiple: [{ type: i0.Input }],
21159 optionsOverlayOffset: [{ type: i0.Input }],
21160 scrollStrategy: [{ type: i0.Input }],
21161 additionalClasses: [{ type: i0.HostBinding, args: ['class',] }],
21162 selectedChange: [{ type: i0.Output }],
21163 options: [{ type: i0.ContentChildren, args: [NbOptionComponent, { descendants: true },] }],
21164 customLabel: [{ type: i0.ContentChild, args: [NbSelectLabelComponent,] }],
21165 portal: [{ type: i0.ViewChild, args: [NbPortalDirective,] }],
21166 button: [{ type: i0.ViewChild, args: ['selectButton', { read: i0.ElementRef },] }],
21167 isOpen: [{ type: i0.HostBinding, args: ['class.open',] }],
21168 tiny: [{ type: i0.HostBinding, args: ['class.size-tiny',] }],
21169 small: [{ type: i0.HostBinding, args: ['class.size-small',] }],
21170 medium: [{ type: i0.HostBinding, args: ['class.size-medium',] }],
21171 large: [{ type: i0.HostBinding, args: ['class.size-large',] }],
21172 giant: [{ type: i0.HostBinding, args: ['class.size-giant',] }],
21173 primary: [{ type: i0.HostBinding, args: ['class.status-primary',] }],
21174 info: [{ type: i0.HostBinding, args: ['class.status-info',] }],
21175 success: [{ type: i0.HostBinding, args: ['class.status-success',] }],
21176 warning: [{ type: i0.HostBinding, args: ['class.status-warning',] }],
21177 danger: [{ type: i0.HostBinding, args: ['class.status-danger',] }],
21178 basic: [{ type: i0.HostBinding, args: ['class.status-basic',] }],
21179 control: [{ type: i0.HostBinding, args: ['class.status-control',] }],
21180 rectangle: [{ type: i0.HostBinding, args: ['class.shape-rectangle',] }],
21181 round: [{ type: i0.HostBinding, args: ['class.shape-round',] }],
21182 semiRound: [{ type: i0.HostBinding, args: ['class.shape-semi-round',] }]
21183 };
21184 return NbSelectComponent;
21185}());
21186
21187/*
21188 * @license
21189 * Copyright Akveo. All Rights Reserved.
21190 * Licensed under the MIT License. See License.txt in the project root for license information.
21191 */
21192/**
21193 * NbOptionGroupComponent
21194 *
21195 * @styles
21196 *
21197 * option-group-text-color:
21198 * option-group-tiny-start-padding:
21199 * option-group-small-start-padding:
21200 * option-group-medium-start-padding:
21201 * option-group-large-start-padding:
21202 * option-group-giant-start-padding:
21203 **/
21204var NbOptionGroupComponent = /** @class */ (function () {
21205 function NbOptionGroupComponent() {
21206 this.destroy$ = new rxjs.Subject();
21207 this._disabled = false;
21208 }
21209 Object.defineProperty(NbOptionGroupComponent.prototype, "disabled", {
21210 get: function () {
21211 return this._disabled;
21212 },
21213 set: function (value) {
21214 this._disabled = convertToBoolProperty(value);
21215 if (this.options) {
21216 this.updateOptionsDisabledState();
21217 }
21218 },
21219 enumerable: false,
21220 configurable: true
21221 });
21222 Object.defineProperty(NbOptionGroupComponent.prototype, "disabledAttribute", {
21223 get: function () {
21224 return this.disabled ? '' : null;
21225 },
21226 enumerable: false,
21227 configurable: true
21228 });
21229 NbOptionGroupComponent.prototype.ngAfterContentInit = function () {
21230 var _this = this;
21231 if (this.options.length) {
21232 this.asyncUpdateOptionsDisabledState();
21233 }
21234 this.options.changes
21235 .pipe(rxjs_operators.takeUntil(this.destroy$))
21236 .subscribe(function () { return _this.asyncUpdateOptionsDisabledState(); });
21237 };
21238 NbOptionGroupComponent.prototype.ngOnDestroy = function () {
21239 this.destroy$.next();
21240 this.destroy$.complete();
21241 };
21242 /**
21243 * Sets disabled state for each option to current group disabled state.
21244 */
21245 NbOptionGroupComponent.prototype.updateOptionsDisabledState = function () {
21246 var _this = this;
21247 this.options.forEach(function (option) { return option.setDisabledByGroupState(_this.disabled); });
21248 };
21249 /**
21250 * Updates options disabled state after promise resolution.
21251 * This way change detection will be triggered after options state updated.
21252 * Use this method when updating options during change detection run (e.g. QueryList.changes, lifecycle hooks).
21253 */
21254 NbOptionGroupComponent.prototype.asyncUpdateOptionsDisabledState = function () {
21255 var _this = this;
21256 // Wrap Promise into Observable with `takeUntil(this.destroy$)` to prevent update if component destroyed.
21257 rxjs.from(Promise.resolve())
21258 .pipe(rxjs_operators.takeUntil(this.destroy$))
21259 .subscribe(function () { return _this.updateOptionsDisabledState(); });
21260 };
21261 NbOptionGroupComponent.decorators = [
21262 { type: i0.Component, args: [{
21263 selector: 'nb-option-group',
21264 changeDetection: i0.ChangeDetectionStrategy.OnPush,
21265 template: "\n <span class=\"option-group-title\">{{ title }}</span>\n <ng-content select=\"nb-option, ng-container\"></ng-content>\n ",
21266 styles: [":host{display:block}.option-group-title{display:block}\n"]
21267 },] }
21268 ];
21269 NbOptionGroupComponent.propDecorators = {
21270 title: [{ type: i0.Input }],
21271 disabled: [{ type: i0.Input }],
21272 disabledAttribute: [{ type: i0.HostBinding, args: ['attr.disabled',] }],
21273 options: [{ type: i0.ContentChildren, args: [NbOptionComponent, { descendants: true },] }]
21274 };
21275 return NbOptionGroupComponent;
21276}());
21277
21278/**
21279 * The `NbOptionListComponent` is container component for `NbOptionGroupComponent` and`NbOptionComponent` list.
21280 *
21281 * @styles
21282 *
21283 * option-list-max-height:
21284 * option-list-shadow:
21285 * option-list-background-color:
21286 * option-list-border-style:
21287 * option-list-border-width:
21288 * option-list-border-color:
21289 * option-list-border-radius:
21290 * option-list-adjacent-border-color:
21291 * option-list-adjacent-border-style:
21292 * option-list-adjacent-border-width:
21293 * */
21294var NbOptionListComponent = /** @class */ (function () {
21295 function NbOptionListComponent() {
21296 this.size = 'medium';
21297 }
21298 Object.defineProperty(NbOptionListComponent.prototype, "positionTop", {
21299 get: function () {
21300 return this.position === exports.NbPosition.TOP;
21301 },
21302 enumerable: false,
21303 configurable: true
21304 });
21305 Object.defineProperty(NbOptionListComponent.prototype, "positionBottom", {
21306 get: function () {
21307 return this.position === exports.NbPosition.BOTTOM;
21308 },
21309 enumerable: false,
21310 configurable: true
21311 });
21312 Object.defineProperty(NbOptionListComponent.prototype, "sizeTiny", {
21313 get: function () {
21314 return this.size === 'tiny';
21315 },
21316 enumerable: false,
21317 configurable: true
21318 });
21319 Object.defineProperty(NbOptionListComponent.prototype, "sizeSmall", {
21320 get: function () {
21321 return this.size === 'small';
21322 },
21323 enumerable: false,
21324 configurable: true
21325 });
21326 Object.defineProperty(NbOptionListComponent.prototype, "sizeMedium", {
21327 get: function () {
21328 return this.size === 'medium';
21329 },
21330 enumerable: false,
21331 configurable: true
21332 });
21333 Object.defineProperty(NbOptionListComponent.prototype, "sizeLarge", {
21334 get: function () {
21335 return this.size === 'large';
21336 },
21337 enumerable: false,
21338 configurable: true
21339 });
21340 Object.defineProperty(NbOptionListComponent.prototype, "sizeGiant", {
21341 get: function () {
21342 return this.size === 'giant';
21343 },
21344 enumerable: false,
21345 configurable: true
21346 });
21347 NbOptionListComponent.decorators = [
21348 { type: i0.Component, args: [{
21349 selector: 'nb-option-list',
21350 template: "\n <ul class=\"option-list\">\n <ng-content></ng-content>\n </ul>\n ",
21351 changeDetection: i0.ChangeDetectionStrategy.OnPush
21352 },] }
21353 ];
21354 NbOptionListComponent.propDecorators = {
21355 size: [{ type: i0.Input }],
21356 position: [{ type: i0.Input }],
21357 positionTop: [{ type: i0.HostBinding, args: ['class.position-top',] }],
21358 positionBottom: [{ type: i0.HostBinding, args: ['class.position-bottom',] }],
21359 sizeTiny: [{ type: i0.HostBinding, args: ['class.size-tiny',] }],
21360 sizeSmall: [{ type: i0.HostBinding, args: ['class.size-small',] }],
21361 sizeMedium: [{ type: i0.HostBinding, args: ['class.size-medium',] }],
21362 sizeLarge: [{ type: i0.HostBinding, args: ['class.size-large',] }],
21363 sizeGiant: [{ type: i0.HostBinding, args: ['class.size-giant',] }]
21364 };
21365 return NbOptionListComponent;
21366}());
21367
21368var NB_OPTION_LIST_COMPONENTS = [
21369 NbOptionListComponent,
21370 NbOptionComponent,
21371 NbOptionGroupComponent,
21372];
21373var NbOptionModule = /** @class */ (function () {
21374 function NbOptionModule() {
21375 }
21376 NbOptionModule.decorators = [
21377 { type: i0.NgModule, args: [{
21378 declarations: tslib.__spreadArray([], NB_OPTION_LIST_COMPONENTS),
21379 imports: [
21380 _angular_common.CommonModule,
21381 NbCheckboxModule,
21382 ],
21383 exports: tslib.__spreadArray([], NB_OPTION_LIST_COMPONENTS),
21384 },] }
21385 ];
21386 return NbOptionModule;
21387}());
21388
21389var NB_SELECT_COMPONENTS = [
21390 NbSelectComponent,
21391 NbSelectLabelComponent,
21392];
21393var NbSelectModule = /** @class */ (function () {
21394 function NbSelectModule() {
21395 }
21396 NbSelectModule.decorators = [
21397 { type: i0.NgModule, args: [{
21398 imports: [
21399 NbSharedModule,
21400 NbOverlayModule,
21401 NbButtonModule,
21402 NbInputModule,
21403 NbCardModule,
21404 NbIconModule,
21405 NbOptionModule,
21406 ],
21407 exports: tslib.__spreadArray(tslib.__spreadArray([], NB_SELECT_COMPONENTS), [
21408 NbOptionModule,
21409 ]),
21410 declarations: tslib.__spreadArray([], NB_SELECT_COMPONENTS),
21411 },] }
21412 ];
21413 return NbSelectModule;
21414}());
21415
21416/**
21417 * @license
21418 * Copyright Akveo. All Rights Reserved.
21419 * Licensed under the MIT License. See License.txt in the project root for license information.
21420 */
21421// Component class scoped counter for aria attributes.
21422var lastAutocompleteId = 0;
21423/**
21424 * The `NbAutocompleteComponent` overlay component.
21425 * Provides an `NbOptionList` overlay component.
21426 * */
21427var NbAutocompleteComponent = /** @class */ (function () {
21428 function NbAutocompleteComponent(cd) {
21429 this.cd = cd;
21430 this.destroy$ = new rxjs.Subject();
21431 /**
21432 * Component scoped id for aria attributes.
21433 * */
21434 this.id = "nb-autocomplete-" + lastAutocompleteId++;
21435 /**
21436 * @docs-private
21437 * Current overlay position because of we have to toggle overlayPosition
21438 * in [ngClass] direction.
21439 */
21440 this._overlayPosition = '';
21441 /**
21442 * Autocomplete size, available sizes:
21443 * `tiny`, `small`, `medium` (default), `large`, `giant`
21444 */
21445 this.size = 'medium';
21446 /**
21447 * Flag passed as input to always make first option active.
21448 * */
21449 this.activeFirst = false;
21450 /**
21451 * Will be emitted when selected value changes.
21452 * */
21453 this.selectedChange = new i0.EventEmitter();
21454 }
21455 Object.defineProperty(NbAutocompleteComponent.prototype, "overlayPosition", {
21456 get: function () {
21457 return this._overlayPosition;
21458 },
21459 set: function (value) {
21460 this._overlayPosition = value;
21461 // Need run change detection after first set from NbAutocompleteDirective
21462 this.cd.detectChanges();
21463 },
21464 enumerable: false,
21465 configurable: true
21466 });
21467 Object.defineProperty(NbAutocompleteComponent.prototype, "hostWidth", {
21468 /**
21469 * Returns width of the input.
21470 * */
21471 get: function () {
21472 return this.hostRef.nativeElement.getBoundingClientRect().width;
21473 },
21474 enumerable: false,
21475 configurable: true
21476 });
21477 NbAutocompleteComponent.prototype.ngAfterContentInit = function () {
21478 var _this = this;
21479 this.options.changes
21480 .pipe(rxjs_operators.takeUntil(this.destroy$))
21481 .subscribe(function () { return _this.cd.detectChanges(); });
21482 };
21483 NbAutocompleteComponent.prototype.ngOnDestroy = function () {
21484 this.destroy$.next();
21485 this.destroy$.complete();
21486 };
21487 /**
21488 * Autocomplete knows nothing about host html input element.
21489 * So, attach method set input hostRef for styling.
21490 * */
21491 NbAutocompleteComponent.prototype.setHost = function (hostRef) {
21492 this.hostRef = hostRef;
21493 };
21494 /**
21495 * Propagate selected value.
21496 * */
21497 NbAutocompleteComponent.prototype.emitSelected = function (selected) {
21498 this.selectedChange.emit(selected);
21499 };
21500 Object.defineProperty(NbAutocompleteComponent.prototype, "tiny", {
21501 get: function () {
21502 return this.size === 'tiny';
21503 },
21504 enumerable: false,
21505 configurable: true
21506 });
21507 Object.defineProperty(NbAutocompleteComponent.prototype, "small", {
21508 get: function () {
21509 return this.size === 'small';
21510 },
21511 enumerable: false,
21512 configurable: true
21513 });
21514 Object.defineProperty(NbAutocompleteComponent.prototype, "medium", {
21515 get: function () {
21516 return this.size === 'medium';
21517 },
21518 enumerable: false,
21519 configurable: true
21520 });
21521 Object.defineProperty(NbAutocompleteComponent.prototype, "large", {
21522 get: function () {
21523 return this.size === 'large';
21524 },
21525 enumerable: false,
21526 configurable: true
21527 });
21528 Object.defineProperty(NbAutocompleteComponent.prototype, "giant", {
21529 get: function () {
21530 return this.size === 'giant';
21531 },
21532 enumerable: false,
21533 configurable: true
21534 });
21535 NbAutocompleteComponent.decorators = [
21536 { type: i0.Component, args: [{
21537 selector: 'nb-autocomplete',
21538 template: "<nb-option-list *nbPortal\n [size]=\"size\"\n [position]=\"overlayPosition\"\n [style.width.px]=\"hostWidth\"\n role=\"listbox\"\n [id]=\"id\"\n [class.empty]=\"!options?.length\"\n [ngClass]=\"optionsListClass\">\n <ng-content select=\"nb-option, nb-option-group\"></ng-content>\n</nb-option-list>\n",
21539 changeDetection: i0.ChangeDetectionStrategy.OnPush,
21540 styles: [":host(:hover){cursor:pointer}nb-option-list.empty{border:none}\n"]
21541 },] }
21542 ];
21543 NbAutocompleteComponent.ctorParameters = function () { return [
21544 { type: i0.ChangeDetectorRef }
21545 ]; };
21546 NbAutocompleteComponent.propDecorators = {
21547 handleDisplayFn: [{ type: i0.Input }],
21548 size: [{ type: i0.Input }],
21549 activeFirst: [{ type: i0.Input }],
21550 optionsListClass: [{ type: i0.Input }],
21551 optionsPanelClass: [{ type: i0.Input }],
21552 selectedChange: [{ type: i0.Output }],
21553 options: [{ type: i0.ContentChildren, args: [NbOptionComponent, { descendants: true },] }],
21554 portal: [{ type: i0.ViewChild, args: [NbPortalDirective,] }],
21555 tiny: [{ type: i0.HostBinding, args: ['class.size-tiny',] }],
21556 small: [{ type: i0.HostBinding, args: ['class.size-small',] }],
21557 medium: [{ type: i0.HostBinding, args: ['class.size-medium',] }],
21558 large: [{ type: i0.HostBinding, args: ['class.size-large',] }],
21559 giant: [{ type: i0.HostBinding, args: ['class.size-giant',] }]
21560 };
21561 return NbAutocompleteComponent;
21562}());
21563
21564/**
21565 * @license
21566 * Copyright Akveo. All Rights Reserved.
21567 * Licensed under the MIT License. See License.txt in the project root for license information.
21568 */
21569/**
21570 * The `NbAutocompleteDirective` provides a capability to expand input with
21571 * `NbAutocompleteComponent` overlay containing options to select and fill input with.
21572 *
21573 * @stacked-example(Showcase, autocomplete/autocomplete-showcase.component)
21574 *
21575 * ### Installation
21576 *
21577 * Import `NbAutocompleteModule` to your feature module.
21578 * ```ts
21579 * @NgModule({
21580 * imports: [
21581 * // ...
21582 * NbAutocompleteModule,
21583 * ],
21584 * })
21585 * export class PageModule { }
21586 * ```
21587 * ### Usage
21588 *
21589 * You can bind control with form controls or ngModel.
21590 *
21591 * @stacked-example(Autocomplete form binding, autocomplete/autocomplete-form.component)
21592 *
21593 * Options in the autocomplete may be grouped using `nb-option-group` component.
21594 *
21595 * @stacked-example(Grouping, autocomplete/autocomplete-group.component)
21596 *
21597 * Autocomplete may change selected option value via provided function.
21598 *
21599 * @stacked-example(Custom display, autocomplete/autocomplete-custom-display.component)
21600 *
21601 * Also, autocomplete may make first option in option list active automatically.
21602 *
21603 * @stacked-example(Active first, autocomplete/autocomplete-active-first.component)
21604 *
21605 * */
21606var NbAutocompleteDirective = /** @class */ (function () {
21607 function NbAutocompleteDirective(hostRef, overlay, cd, triggerStrategyBuilder, positionBuilder, activeDescendantKeyManagerFactory, renderer) {
21608 this.hostRef = hostRef;
21609 this.overlay = overlay;
21610 this.cd = cd;
21611 this.triggerStrategyBuilder = triggerStrategyBuilder;
21612 this.positionBuilder = positionBuilder;
21613 this.activeDescendantKeyManagerFactory = activeDescendantKeyManagerFactory;
21614 this.renderer = renderer;
21615 this.destroy$ = new rxjs.Subject();
21616 this._onChange = function () { };
21617 this._onTouched = function () { };
21618 /**
21619 * Determines options overlay offset (in pixels).
21620 **/
21621 this.overlayOffset = 8;
21622 this._focusInputOnValueChange = true;
21623 /**
21624 * Determines options overlay scroll strategy.
21625 **/
21626 this.scrollStrategy = 'block';
21627 this.role = 'combobox';
21628 this.ariaAutocomplete = 'list';
21629 this.hasPopup = 'true';
21630 }
21631 Object.defineProperty(NbAutocompleteDirective.prototype, "isOpen", {
21632 /**
21633 * Determines is autocomplete overlay opened.
21634 * */
21635 get: function () {
21636 return this.overlayRef && this.overlayRef.hasAttached();
21637 },
21638 enumerable: false,
21639 configurable: true
21640 });
21641 Object.defineProperty(NbAutocompleteDirective.prototype, "isClosed", {
21642 /**
21643 * Determines is autocomplete overlay closed.
21644 * */
21645 get: function () {
21646 return !this.isOpen;
21647 },
21648 enumerable: false,
21649 configurable: true
21650 });
21651 Object.defineProperty(NbAutocompleteDirective.prototype, "autocomplete", {
21652 /**
21653 * Provides autocomplete component.
21654 * */
21655 get: function () {
21656 return this._autocomplete;
21657 },
21658 set: function (autocomplete) {
21659 this._autocomplete = autocomplete;
21660 },
21661 enumerable: false,
21662 configurable: true
21663 });
21664 Object.defineProperty(NbAutocompleteDirective.prototype, "focusInputOnValueChange", {
21665 /**
21666 * Determines if the input will be focused when the control value is changed
21667 * */
21668 get: function () {
21669 return this._focusInputOnValueChange;
21670 },
21671 set: function (value) {
21672 this._focusInputOnValueChange = convertToBoolProperty(value);
21673 },
21674 enumerable: false,
21675 configurable: true
21676 });
21677 Object.defineProperty(NbAutocompleteDirective.prototype, "top", {
21678 get: function () {
21679 return this.isOpen && this.autocomplete.options.length && this.autocomplete.overlayPosition === exports.NbPosition.TOP;
21680 },
21681 enumerable: false,
21682 configurable: true
21683 });
21684 Object.defineProperty(NbAutocompleteDirective.prototype, "bottom", {
21685 get: function () {
21686 return this.isOpen && this.autocomplete.options.length && this.autocomplete.overlayPosition === exports.NbPosition.BOTTOM;
21687 },
21688 enumerable: false,
21689 configurable: true
21690 });
21691 Object.defineProperty(NbAutocompleteDirective.prototype, "ariaExpanded", {
21692 get: function () {
21693 return this.isOpen && this.isOpen.toString();
21694 },
21695 enumerable: false,
21696 configurable: true
21697 });
21698 Object.defineProperty(NbAutocompleteDirective.prototype, "ariaOwns", {
21699 get: function () {
21700 return this.isOpen ? this.autocomplete.id : null;
21701 },
21702 enumerable: false,
21703 configurable: true
21704 });
21705 Object.defineProperty(NbAutocompleteDirective.prototype, "ariaActiveDescendant", {
21706 get: function () {
21707 return (this.isOpen && this.keyManager.activeItem) ? this.keyManager.activeItem.id : null;
21708 },
21709 enumerable: false,
21710 configurable: true
21711 });
21712 NbAutocompleteDirective.prototype.ngAfterViewInit = function () {
21713 this.triggerStrategy = this.createTriggerStrategy();
21714 this.subscribeOnTriggers();
21715 };
21716 NbAutocompleteDirective.prototype.ngOnDestroy = function () {
21717 if (this.triggerStrategy) {
21718 this.triggerStrategy.destroy();
21719 }
21720 if (this.positionStrategy) {
21721 this.positionStrategy.dispose();
21722 }
21723 if (this.overlayRef) {
21724 this.overlayRef.dispose();
21725 }
21726 this.destroy$.next();
21727 this.destroy$.complete();
21728 };
21729 NbAutocompleteDirective.prototype.handleInput = function () {
21730 var currentValue = this.hostRef.nativeElement.value;
21731 this._onChange(currentValue);
21732 this.setHostInputValue(this.getDisplayValue(currentValue));
21733 this.show();
21734 };
21735 NbAutocompleteDirective.prototype.handleKeydown = function () {
21736 this.show();
21737 };
21738 NbAutocompleteDirective.prototype.handleBlur = function () {
21739 this._onTouched();
21740 };
21741 NbAutocompleteDirective.prototype.show = function () {
21742 if (this.isClosed) {
21743 this.attachToOverlay();
21744 this.setActiveItem();
21745 }
21746 };
21747 NbAutocompleteDirective.prototype.hide = function () {
21748 if (this.isOpen) {
21749 this.overlayRef.detach();
21750 // Need to update class via @HostBinding
21751 this.cd.markForCheck();
21752 }
21753 };
21754 NbAutocompleteDirective.prototype.writeValue = function (value) {
21755 this.handleInputValueUpdate(value);
21756 };
21757 NbAutocompleteDirective.prototype.registerOnChange = function (fn) {
21758 this._onChange = fn;
21759 };
21760 NbAutocompleteDirective.prototype.registerOnTouched = function (fn) {
21761 this._onTouched = fn;
21762 };
21763 NbAutocompleteDirective.prototype.setDisabledState = function (disabled) {
21764 this.renderer.setProperty(this.hostRef.nativeElement, 'disabled', disabled);
21765 };
21766 NbAutocompleteDirective.prototype.subscribeOnOptionClick = function () {
21767 var _this = this;
21768 /**
21769 * If the user changes provided options list in the runtime we have to handle this
21770 * and resubscribe on options selection changes event.
21771 * Otherwise, the user will not be able to select new options.
21772 * */
21773 this.autocomplete.options.changes
21774 .pipe(rxjs_operators.tap(function () { return _this.setActiveItem(); }), rxjs_operators.startWith(this.autocomplete.options), rxjs_operators.switchMap(function (options) {
21775 return rxjs.merge.apply(void 0, options.map(function (option) { return option.click; }));
21776 }), rxjs_operators.takeUntil(this.destroy$))
21777 .subscribe(function (clickedOption) { return _this.handleInputValueUpdate(clickedOption.value); });
21778 };
21779 NbAutocompleteDirective.prototype.subscribeOnPositionChange = function () {
21780 var _this = this;
21781 this.positionStrategy.positionChange
21782 .pipe(rxjs_operators.takeUntil(this.destroy$))
21783 .subscribe(function (position) {
21784 _this.autocomplete.overlayPosition = position;
21785 _this.cd.detectChanges();
21786 });
21787 };
21788 NbAutocompleteDirective.prototype.getActiveItem = function () {
21789 return this.keyManager.activeItem;
21790 };
21791 NbAutocompleteDirective.prototype.setupAutocomplete = function () {
21792 this.autocomplete.setHost(this.customOverlayHost || this.hostRef);
21793 };
21794 NbAutocompleteDirective.prototype.getDisplayValue = function (value) {
21795 var displayFn = this.autocomplete.handleDisplayFn;
21796 return displayFn ? displayFn(value) : value;
21797 };
21798 NbAutocompleteDirective.prototype.getContainer = function () {
21799 return this.overlayRef && this.isOpen && {
21800 location: {
21801 nativeElement: this.overlayRef.overlayElement,
21802 },
21803 };
21804 };
21805 NbAutocompleteDirective.prototype.handleInputValueUpdate = function (value) {
21806 if (value === undefined || value === null) {
21807 return;
21808 }
21809 this.setHostInputValue(value);
21810 this._onChange(value);
21811 if (this.focusInputOnValueChange) {
21812 this.hostRef.nativeElement.focus();
21813 }
21814 this.autocomplete.emitSelected(value);
21815 this.hide();
21816 };
21817 NbAutocompleteDirective.prototype.subscribeOnTriggers = function () {
21818 var _this = this;
21819 this.triggerStrategy.show$
21820 .pipe(rxjs_operators.filter(function () { return _this.isClosed; }))
21821 .subscribe(function () { return _this.show(); });
21822 this.triggerStrategy.hide$
21823 .pipe(rxjs_operators.filter(function () { return _this.isOpen; }))
21824 .subscribe(function () { return _this.hide(); });
21825 };
21826 NbAutocompleteDirective.prototype.createTriggerStrategy = function () {
21827 var _this = this;
21828 return this.triggerStrategyBuilder
21829 .trigger(exports.NbTrigger.FOCUS)
21830 .host(this.hostRef.nativeElement)
21831 .container(function () { return _this.getContainer(); })
21832 .build();
21833 };
21834 NbAutocompleteDirective.prototype.createKeyManager = function () {
21835 this.keyManager = this.activeDescendantKeyManagerFactory
21836 .create(this.autocomplete.options);
21837 };
21838 NbAutocompleteDirective.prototype.setHostInputValue = function (value) {
21839 this.hostRef.nativeElement.value = this.getDisplayValue(value);
21840 };
21841 NbAutocompleteDirective.prototype.createPositionStrategy = function () {
21842 return this.positionBuilder
21843 .connectedTo(this.customOverlayHost || this.hostRef)
21844 .position(exports.NbPosition.BOTTOM)
21845 .offset(this.overlayOffset)
21846 .adjustment(exports.NbAdjustment.VERTICAL);
21847 };
21848 NbAutocompleteDirective.prototype.subscribeOnOverlayKeys = function () {
21849 var _this = this;
21850 this.overlayRef.keydownEvents()
21851 .pipe(rxjs_operators.takeUntil(this.destroy$))
21852 .subscribe(function (event) {
21853 if (event.keyCode === _angular_cdk_keycodes.ESCAPE && _this.isOpen) {
21854 event.preventDefault();
21855 _this.hostRef.nativeElement.focus();
21856 _this.hide();
21857 }
21858 else if (event.keyCode === _angular_cdk_keycodes.ENTER) {
21859 event.preventDefault();
21860 var activeItem = _this.getActiveItem();
21861 if (!activeItem) {
21862 return;
21863 }
21864 _this.handleInputValueUpdate(activeItem.value);
21865 }
21866 else {
21867 _this.keyManager.onKeydown(event);
21868 }
21869 });
21870 };
21871 NbAutocompleteDirective.prototype.setActiveItem = function () {
21872 // If autocomplete has activeFirst input set to true,
21873 // keyManager set first option active, otherwise - reset active option.
21874 var mode = this.autocomplete.activeFirst
21875 ? NbKeyManagerActiveItemMode.FIRST_ACTIVE
21876 : NbKeyManagerActiveItemMode.RESET_ACTIVE;
21877 this.keyManager.setActiveItem(mode);
21878 this.cd.detectChanges();
21879 };
21880 NbAutocompleteDirective.prototype.attachToOverlay = function () {
21881 if (!this.overlayRef) {
21882 this.setupAutocomplete();
21883 this.initOverlay();
21884 }
21885 this.overlayRef.attach(this.autocomplete.portal);
21886 };
21887 NbAutocompleteDirective.prototype.createOverlay = function () {
21888 var scrollStrategy = this.createScrollStrategy();
21889 this.overlayRef = this.overlay.create({ positionStrategy: this.positionStrategy, scrollStrategy: scrollStrategy, panelClass: this.autocomplete.optionsPanelClass });
21890 };
21891 NbAutocompleteDirective.prototype.initOverlay = function () {
21892 this.positionStrategy = this.createPositionStrategy();
21893 this.createKeyManager();
21894 this.subscribeOnPositionChange();
21895 this.subscribeOnOptionClick();
21896 this.checkOverlayVisibility();
21897 this.createOverlay();
21898 this.subscribeOnOverlayKeys();
21899 };
21900 NbAutocompleteDirective.prototype.checkOverlayVisibility = function () {
21901 var _this = this;
21902 this.autocomplete.options.changes
21903 .pipe(rxjs_operators.takeUntil(this.destroy$)).subscribe(function () {
21904 if (!_this.autocomplete.options.length) {
21905 _this.hide();
21906 }
21907 });
21908 };
21909 NbAutocompleteDirective.prototype.createScrollStrategy = function () {
21910 return this.overlay.scrollStrategies[this.scrollStrategy]();
21911 };
21912 NbAutocompleteDirective.decorators = [
21913 { type: i0.Directive, args: [{
21914 selector: 'input[nbAutocomplete]',
21915 providers: [{
21916 provide: _angular_forms.NG_VALUE_ACCESSOR,
21917 useExisting: i0.forwardRef(function () { return NbAutocompleteDirective; }),
21918 multi: true,
21919 }],
21920 },] }
21921 ];
21922 NbAutocompleteDirective.ctorParameters = function () { return [
21923 { type: i0.ElementRef },
21924 { type: NbOverlayService },
21925 { type: i0.ChangeDetectorRef },
21926 { type: NbTriggerStrategyBuilderService },
21927 { type: NbPositionBuilderService },
21928 { type: NbActiveDescendantKeyManagerFactoryService },
21929 { type: i0.Renderer2 }
21930 ]; };
21931 NbAutocompleteDirective.propDecorators = {
21932 autocomplete: [{ type: i0.Input, args: ['nbAutocomplete',] }],
21933 overlayOffset: [{ type: i0.Input }],
21934 focusInputOnValueChange: [{ type: i0.Input }],
21935 scrollStrategy: [{ type: i0.Input }],
21936 customOverlayHost: [{ type: i0.Input }],
21937 top: [{ type: i0.HostBinding, args: ['class.nb-autocomplete-position-top',] }],
21938 bottom: [{ type: i0.HostBinding, args: ['class.nb-autocomplete-position-bottom',] }],
21939 role: [{ type: i0.HostBinding, args: ['attr.role',] }],
21940 ariaAutocomplete: [{ type: i0.HostBinding, args: ['attr.aria-autocomplete',] }],
21941 hasPopup: [{ type: i0.HostBinding, args: ['attr.haspopup',] }],
21942 ariaExpanded: [{ type: i0.HostBinding, args: ['attr.aria-expanded',] }],
21943 ariaOwns: [{ type: i0.HostBinding, args: ['attr.aria-owns',] }],
21944 ariaActiveDescendant: [{ type: i0.HostBinding, args: ['attr.aria-activedescendant',] }],
21945 handleInput: [{ type: i0.HostListener, args: ['input',] }],
21946 handleKeydown: [{ type: i0.HostListener, args: ['keydown.arrowDown',] }, { type: i0.HostListener, args: ['keydown.arrowUp',] }],
21947 handleBlur: [{ type: i0.HostListener, args: ['blur',] }]
21948 };
21949 return NbAutocompleteDirective;
21950}());
21951
21952/**
21953 * @license
21954 * Copyright Akveo. All Rights Reserved.
21955 * Licensed under the MIT License. See License.txt in the project root for license information.
21956 */
21957var NB_AUTOCOMPLETE_COMPONENTS = [
21958 NbAutocompleteComponent,
21959 NbAutocompleteDirective,
21960];
21961var NbAutocompleteModule = /** @class */ (function () {
21962 function NbAutocompleteModule() {
21963 }
21964 NbAutocompleteModule.decorators = [
21965 { type: i0.NgModule, args: [{
21966 imports: [
21967 _angular_common.CommonModule,
21968 _angular_forms.FormsModule,
21969 NbOverlayModule,
21970 NbCardModule,
21971 NbOptionModule,
21972 ],
21973 exports: tslib.__spreadArray(tslib.__spreadArray([], NB_AUTOCOMPLETE_COMPONENTS), [
21974 NbOptionModule,
21975 ]),
21976 declarations: tslib.__spreadArray([], NB_AUTOCOMPLETE_COMPONENTS),
21977 },] }
21978 ];
21979 return NbAutocompleteModule;
21980}());
21981
21982(function (NbWindowState) {
21983 NbWindowState["MINIMIZED"] = "minimized";
21984 NbWindowState["MAXIMIZED"] = "maximized";
21985 NbWindowState["FULL_SCREEN"] = "full-screen";
21986})(exports.NbWindowState || (exports.NbWindowState = {}));
21987var NB_WINDOW_DEFAULT_BUTTONS_CONFIG = {
21988 minimize: true,
21989 maximize: true,
21990 fullScreen: true,
21991};
21992/**
21993 * Window configuration options.
21994 */
21995var NbWindowConfig = /** @class */ (function () {
21996 function NbWindowConfig() {
21997 var configs = [];
21998 for (var _i = 0; _i < arguments.length; _i++) {
21999 configs[_i] = arguments[_i];
22000 }
22001 /**
22002 * Window title.
22003 */
22004 this.title = '';
22005 /**
22006 * Initial window state. Full screen by default.
22007 */
22008 this.initialState = exports.NbWindowState.FULL_SCREEN;
22009 /**
22010 * If true than backdrop will be rendered behind window.
22011 * By default set to true.
22012 */
22013 this.hasBackdrop = true;
22014 /**
22015 * If set to true mouse clicks on backdrop will close a window.
22016 * Default is true.
22017 */
22018 this.closeOnBackdropClick = true;
22019 /**
22020 * If true then escape press will close a window.
22021 * Default is true.
22022 */
22023 this.closeOnEsc = true;
22024 /**
22025 * Class to be applied to the window.
22026 */
22027 this.windowClass = '';
22028 /**
22029 * Both, template and component may receive data through `config.context` property.
22030 * For components, this data will be set as component properties.
22031 * For templates, you can access it inside template as $implicit.
22032 */
22033 this.context = {};
22034 /**
22035 * Where the attached component should live in Angular's *logical* component tree.
22036 * This affects what is available for injection and the change detection order for the
22037 * component instantiated inside of the window. This does not affect where the window
22038 * content will be rendered.
22039 */
22040 this.viewContainerRef = null;
22041 /**
22042 * Windows control buttons can be hidden by setting according property to false.
22043 */
22044 this.buttons = {};
22045 Object.assign.apply(Object, tslib.__spreadArray([this], configs));
22046 this.applyDefaultButtonConfig();
22047 }
22048 NbWindowConfig.prototype.applyDefaultButtonConfig = function () {
22049 Object.assign(this, { buttons: tslib.__assign(tslib.__assign({}, NB_WINDOW_DEFAULT_BUTTONS_CONFIG), this.buttons) });
22050 };
22051 return NbWindowConfig;
22052}());
22053var NB_WINDOW_CONTENT = new i0.InjectionToken('Nebular Window Content');
22054var NB_WINDOW_CONFIG = new i0.InjectionToken('Nebular Window Config');
22055var NB_WINDOW_CONTEXT = new i0.InjectionToken('Nebular Window Context');
22056
22057/**
22058 * The `NbWindowRef` helps to manipulate window after it was created.
22059 * The window can be dismissed by using `close` method of the windowRef.
22060 * You can access rendered component as `componentRef` property of the windowRef.
22061 */
22062var NbWindowRef = /** @class */ (function () {
22063 function NbWindowRef(config) {
22064 this.config = config;
22065 this.stateChange$ = new rxjs.ReplaySubject(1);
22066 this._closed = false;
22067 this.closed$ = new rxjs.Subject();
22068 this.state = config.initialState;
22069 }
22070 Object.defineProperty(NbWindowRef.prototype, "state", {
22071 /**
22072 * Current window state.
22073 */
22074 get: function () {
22075 return this.stateValue;
22076 },
22077 set: function (newState) {
22078 if (newState && this.stateValue !== newState) {
22079 this.prevStateValue = this.state;
22080 this.stateValue = newState;
22081 this.stateChange$.next({ oldState: this.prevStateValue, newState: newState });
22082 }
22083 },
22084 enumerable: false,
22085 configurable: true
22086 });
22087 Object.defineProperty(NbWindowRef.prototype, "stateChange", {
22088 /**
22089 * Emits when window state change.
22090 */
22091 get: function () {
22092 return this.stateChange$.asObservable();
22093 },
22094 enumerable: false,
22095 configurable: true
22096 });
22097 Object.defineProperty(NbWindowRef.prototype, "onClose", {
22098 /**
22099 * Emits when window was closed.
22100 */
22101 get: function () {
22102 return this.closed$.asObservable();
22103 },
22104 enumerable: false,
22105 configurable: true
22106 });
22107 /**
22108 * Minimize window.
22109 */
22110 NbWindowRef.prototype.minimize = function () {
22111 this.state = exports.NbWindowState.MINIMIZED;
22112 };
22113 /**
22114 * Maximize window.
22115 */
22116 NbWindowRef.prototype.maximize = function () {
22117 this.state = exports.NbWindowState.MAXIMIZED;
22118 };
22119 /**
22120 * Set window on top.
22121 */
22122 NbWindowRef.prototype.fullScreen = function () {
22123 this.state = exports.NbWindowState.FULL_SCREEN;
22124 };
22125 NbWindowRef.prototype.toPreviousState = function () {
22126 this.state = this.prevStateValue;
22127 };
22128 /**
22129 * Closes window.
22130 * */
22131 NbWindowRef.prototype.close = function () {
22132 if (this._closed) {
22133 return;
22134 }
22135 this._closed = true;
22136 this.componentRef.destroy();
22137 this.stateChange$.complete();
22138 this.closed$.next();
22139 this.closed$.complete();
22140 };
22141 return NbWindowRef;
22142}());
22143
22144var NbWindowsContainerComponent = /** @class */ (function () {
22145 function NbWindowsContainerComponent() {
22146 }
22147 NbWindowsContainerComponent.decorators = [
22148 { type: i0.Component, args: [{
22149 selector: 'nb-windows-container',
22150 template: "<ng-container #viewContainerRef></ng-container>",
22151 styles: [":host{display:flex;align-items:flex-end;overflow-x:auto}:host ::ng-deep nb-window:not(.full-screen){margin:0 2rem}\n"]
22152 },] }
22153 ];
22154 NbWindowsContainerComponent.propDecorators = {
22155 viewContainerRef: [{ type: i0.ViewChild, args: ['viewContainerRef', { read: i0.ViewContainerRef, static: true },] }]
22156 };
22157 return NbWindowsContainerComponent;
22158}());
22159
22160var NbWindowComponent = /** @class */ (function () {
22161 function NbWindowComponent(content, context, windowRef, config, focusTrapFactory, elementRef, renderer) {
22162 this.content = content;
22163 this.context = context;
22164 this.windowRef = windowRef;
22165 this.config = config;
22166 this.focusTrapFactory = focusTrapFactory;
22167 this.elementRef = elementRef;
22168 this.renderer = renderer;
22169 }
22170 Object.defineProperty(NbWindowComponent.prototype, "isFullScreen", {
22171 get: function () {
22172 return this.windowRef.state === exports.NbWindowState.FULL_SCREEN;
22173 },
22174 enumerable: false,
22175 configurable: true
22176 });
22177 Object.defineProperty(NbWindowComponent.prototype, "maximized", {
22178 get: function () {
22179 return this.windowRef.state === exports.NbWindowState.MAXIMIZED;
22180 },
22181 enumerable: false,
22182 configurable: true
22183 });
22184 Object.defineProperty(NbWindowComponent.prototype, "minimized", {
22185 get: function () {
22186 return this.windowRef.state === exports.NbWindowState.MINIMIZED;
22187 },
22188 enumerable: false,
22189 configurable: true
22190 });
22191 Object.defineProperty(NbWindowComponent.prototype, "showMinimize", {
22192 get: function () {
22193 return this.config.buttons.minimize;
22194 },
22195 enumerable: false,
22196 configurable: true
22197 });
22198 Object.defineProperty(NbWindowComponent.prototype, "showMaximize", {
22199 get: function () {
22200 return this.config.buttons.maximize;
22201 },
22202 enumerable: false,
22203 configurable: true
22204 });
22205 Object.defineProperty(NbWindowComponent.prototype, "showFullScreen", {
22206 get: function () {
22207 return this.config.buttons.fullScreen;
22208 },
22209 enumerable: false,
22210 configurable: true
22211 });
22212 NbWindowComponent.prototype.ngOnInit = function () {
22213 this.focusTrap = this.focusTrapFactory.create(this.elementRef.nativeElement);
22214 this.focusTrap.blurPreviouslyFocusedElement();
22215 this.focusTrap.focusInitialElement();
22216 if (this.config.windowClass) {
22217 this.renderer.addClass(this.elementRef.nativeElement, this.config.windowClass);
22218 }
22219 };
22220 NbWindowComponent.prototype.ngAfterViewChecked = function () {
22221 if (!this.overlayContainer || this.overlayContainer.isAttached) {
22222 return;
22223 }
22224 if (this.content instanceof i0.TemplateRef) {
22225 this.attachTemplate();
22226 }
22227 else {
22228 this.attachComponent();
22229 }
22230 };
22231 NbWindowComponent.prototype.ngOnDestroy = function () {
22232 if (this.focusTrap) {
22233 this.focusTrap.restoreFocus();
22234 }
22235 this.close();
22236 };
22237 NbWindowComponent.prototype.minimize = function () {
22238 if (this.windowRef.state === exports.NbWindowState.MINIMIZED) {
22239 this.windowRef.toPreviousState();
22240 }
22241 else {
22242 this.windowRef.minimize();
22243 }
22244 };
22245 NbWindowComponent.prototype.maximize = function () {
22246 this.windowRef.maximize();
22247 };
22248 NbWindowComponent.prototype.fullScreen = function () {
22249 this.windowRef.fullScreen();
22250 };
22251 NbWindowComponent.prototype.maximizeOrFullScreen = function () {
22252 if (this.windowRef.state === exports.NbWindowState.MINIMIZED && this.showMaximize) {
22253 this.maximize();
22254 }
22255 else {
22256 this.fullScreen();
22257 }
22258 };
22259 NbWindowComponent.prototype.close = function () {
22260 this.windowRef.close();
22261 };
22262 NbWindowComponent.prototype.attachTemplate = function () {
22263 this.overlayContainer
22264 .attachTemplatePortal(new NbTemplatePortal(this.content, null, this.context));
22265 };
22266 NbWindowComponent.prototype.attachComponent = function () {
22267 var portal = new NbComponentPortal(this.content, null, null, this.cfr);
22268 var ref = this.overlayContainer.attachComponentPortal(portal, this.context);
22269 ref.changeDetectorRef.detectChanges();
22270 };
22271 NbWindowComponent.decorators = [
22272 { type: i0.Component, args: [{
22273 selector: 'nb-window',
22274 template: "\n <nb-card>\n <nb-card-header>\n <div cdkFocusInitial class=\"title\" tabindex=\"-1\">{{ config.title }}</div>\n\n <div class=\"buttons\">\n <ng-container *ngIf=\"showMinimize\">\n <button nbButton ghost (click)=\"minimize()\">\n <nb-icon icon=\"minus-outline\" pack=\"nebular-essentials\"></nb-icon>\n </button>\n </ng-container>\n\n <ng-container *ngIf=\"showMaximize\">\n <button nbButton ghost *ngIf=\"isFullScreen\" (click)=\"maximize()\">\n <nb-icon icon=\"collapse-outline\" pack=\"nebular-essentials\"></nb-icon>\n </button>\n </ng-container>\n\n <ng-container *ngIf=\"showFullScreen\">\n <button nbButton ghost *ngIf=\"minimized || maximized\" (click)=\"maximizeOrFullScreen()\">\n <nb-icon icon=\"expand-outline\" pack=\"nebular-essentials\"></nb-icon>\n </button>\n </ng-container>\n\n <button nbButton ghost (click)=\"close()\">\n <nb-icon icon=\"close-outline\" pack=\"nebular-essentials\"></nb-icon>\n </button>\n </div>\n </nb-card-header>\n <nb-card-body *ngIf=\"maximized || isFullScreen\">\n <nb-overlay-container></nb-overlay-container>\n </nb-card-body>\n </nb-card>\n ",
22275 styles: [":host{flex:1 0 auto;min-width:20rem}:host nb-card{margin:0}:host nb-card-header{display:flex;justify-content:space-between;align-items:center;overflow:hidden}:host .title{flex:1 0 auto;margin-right:3rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}:host .buttons{width:9.5rem;display:flex;justify-content:flex-end}:host .buttons [nbButton]{flex:0 0 3rem}:host(.full-screen){position:fixed;top:50%;left:50%;transform:translate(-50%, -50%)}:host(.maximized) nb-card{border-bottom-left-radius:0;border-bottom-right-radius:0}:host(.minimized) nb-card{border-bottom-left-radius:0;border-bottom-right-radius:0;height:auto}:host(.minimized) nb-card nb-card-header{border-bottom:none}\n"]
22276 },] }
22277 ];
22278 NbWindowComponent.ctorParameters = function () { return [
22279 { type: undefined, decorators: [{ type: i0.Inject, args: [NB_WINDOW_CONTENT,] }] },
22280 { type: Object, decorators: [{ type: i0.Inject, args: [NB_WINDOW_CONTEXT,] }] },
22281 { type: NbWindowRef },
22282 { type: NbWindowConfig },
22283 { type: NbFocusTrapFactoryService },
22284 { type: i0.ElementRef },
22285 { type: i0.Renderer2 }
22286 ]; };
22287 NbWindowComponent.propDecorators = {
22288 cfr: [{ type: i0.Input }],
22289 isFullScreen: [{ type: i0.HostBinding, args: ['class.full-screen',] }],
22290 maximized: [{ type: i0.HostBinding, args: ['class.maximized',] }],
22291 minimized: [{ type: i0.HostBinding, args: ['class.minimized',] }],
22292 overlayContainer: [{ type: i0.ViewChild, args: [NbOverlayContainerComponent,] }]
22293 };
22294 return NbWindowComponent;
22295}());
22296
22297/**
22298 * The `NbWindowService` can be used to open windows.
22299 *
22300 * @stacked-example(Showcase, window/window-showcase.component)
22301 *
22302 * ### Installation
22303 *
22304 * Import `NbWindowModule` to your app module.
22305 * ```ts
22306 * @NgModule({
22307 * imports: [
22308 * // ...
22309 * NbWindowModule.forRoot(config),
22310 * ],
22311 * })
22312 * export class AppModule { }
22313 * ```
22314 *
22315 * If you are using it in a lazy loaded module than you have to install `NbWindowModule.forChild`:
22316 * ```ts
22317 * @NgModule({
22318 * imports: [
22319 * // ...
22320 * NbWindowModule.forChild(config),
22321 * ],
22322 * })
22323 * export class LazyLoadedModule { }
22324 * ```
22325 *
22326 * ### Usage
22327 *
22328 * A new window can be opened by calling the `open` method with a component or template to be loaded
22329 * and an optional configuration.
22330 * `open` method will return `NbWindowRef` that can be used for the further manipulations.
22331 *
22332 * ```ts
22333 * const windowRef = this.windowService.open(MyComponent, { ... });
22334 * ```
22335 *
22336 * `NbWindowRef` gives you ability manipulate opened window.
22337 * Also, you can inject `NbWindowRef` inside provided component which rendered in window.
22338 *
22339 * ```ts
22340 * this.windowService.open(MyWindowComponent, { ... });
22341 *
22342 * // my.component.ts
22343 * constructor(protected windowRef: NbWindowRef) {
22344 * }
22345 *
22346 * minimize() {
22347 * this.windowRef.minimize();
22348 * }
22349 *
22350 * close() {
22351 * this.windowRef.close();
22352 * }
22353 * ```
22354 *
22355 * Instead of component you can create window from TemplateRef. As usual you can access context provided via config
22356 * via `let-` variables. Also you can get reference to the `NbWindowRef` in context's `windowRef` property.
22357 *
22358 * @stacked-example(Window content from TemplateRef, window/template-window.component)
22359 *
22360 * ### Configuration
22361 *
22362 * As mentioned above, `open` method of the `NbWindowService` may receive optional configuration options.
22363 * Also, you can modify default windows configuration through `NbWindowModule.forRoot({ ... })`.
22364 * You can read about all available options on [API tab](docs/components/window/api#nbwindowconfig).
22365 *
22366 * @stacked-example(Configuration, window/windows-backdrop.component)
22367 *
22368 * You can configure which buttons are available in a window via the `buttons` property of the window config.
22369 * @stacked-example(Control buttons, window/window-controls.component)
22370 *
22371 */
22372var NbWindowService = /** @class */ (function () {
22373 function NbWindowService(componentFactoryResolver, overlayService, overlayPositionBuilder, blockScrollStrategy, defaultWindowsConfig, cfr, document) {
22374 this.componentFactoryResolver = componentFactoryResolver;
22375 this.overlayService = overlayService;
22376 this.overlayPositionBuilder = overlayPositionBuilder;
22377 this.blockScrollStrategy = blockScrollStrategy;
22378 this.defaultWindowsConfig = defaultWindowsConfig;
22379 this.cfr = cfr;
22380 this.openWindows = [];
22381 this.document = document;
22382 }
22383 /**
22384 * Opens new window.
22385 * @param windowContent
22386 * @param windowConfig
22387 * */
22388 NbWindowService.prototype.open = function (windowContent, windowConfig) {
22389 if (windowConfig === void 0) { windowConfig = {}; }
22390 if (this.shouldCreateWindowsContainer()) {
22391 this.createWindowsContainer();
22392 }
22393 var config = new NbWindowConfig(this.defaultWindowsConfig, windowConfig);
22394 var windowRef = new NbWindowRef(config);
22395 windowRef.componentRef = this.appendWindow(windowContent, config, windowRef);
22396 this.openWindows.push(windowRef);
22397 this.subscribeToEvents(windowRef);
22398 return windowRef;
22399 };
22400 NbWindowService.prototype.shouldCreateWindowsContainer = function () {
22401 if (this.windowsContainerViewRef) {
22402 var containerEl = this.windowsContainerViewRef.element.nativeElement;
22403 return !this.document.body.contains(containerEl);
22404 }
22405 return true;
22406 };
22407 NbWindowService.prototype.createWindowsContainer = function () {
22408 if (this.overlayRef) {
22409 this.overlayRef.dispose();
22410 }
22411 this.overlayRef = this.overlayService.create({
22412 scrollStrategy: this.overlayService.scrollStrategies.noop(),
22413 positionStrategy: this.overlayPositionBuilder.global().bottom().right(),
22414 hasBackdrop: true,
22415 });
22416 var windowsContainerPortal = new NbComponentPortal(NbWindowsContainerComponent, null, null, this.cfr);
22417 var overlayRef = this.overlayRef.attach(windowsContainerPortal);
22418 this.windowsContainerViewRef = overlayRef.instance.viewContainerRef;
22419 };
22420 NbWindowService.prototype.appendWindow = function (content, config, windowRef) {
22421 var context = content instanceof i0.TemplateRef
22422 ? { $implicit: config.context, windowRef: windowRef }
22423 : config.context;
22424 var providers = [
22425 { provide: NB_WINDOW_CONTENT, useValue: content },
22426 { provide: NB_WINDOW_CONTEXT, useValue: context },
22427 { provide: NbWindowConfig, useValue: config },
22428 { provide: NbWindowRef, useValue: windowRef },
22429 ];
22430 var parentInjector = config.viewContainerRef
22431 ? config.viewContainerRef.injector
22432 : this.windowsContainerViewRef.injector;
22433 var injector = i0.Injector.create({ parent: parentInjector, providers: providers });
22434 var windowFactory = this.componentFactoryResolver.resolveComponentFactory(NbWindowComponent);
22435 var ref = this.windowsContainerViewRef.createComponent(windowFactory, null, injector);
22436 ref.instance.cfr = this.cfr;
22437 ref.changeDetectorRef.detectChanges();
22438 return ref;
22439 };
22440 NbWindowService.prototype.subscribeToEvents = function (windowRef) {
22441 var _this = this;
22442 if (windowRef.config.closeOnBackdropClick) {
22443 this.overlayRef.backdropClick().subscribe(function () { return windowRef.close(); });
22444 }
22445 if (windowRef.config.closeOnEsc) {
22446 this.overlayRef.keydownEvents()
22447 .pipe(rxjs_operators.filter(function (event) { return event.keyCode === 27; }))
22448 .subscribe(function () { return windowRef.close(); });
22449 }
22450 windowRef.stateChange.subscribe(function () { return _this.checkAndUpdateOverlay(); });
22451 windowRef.onClose.subscribe(function () {
22452 _this.openWindows.splice(_this.openWindows.indexOf(windowRef), 1);
22453 _this.checkAndUpdateOverlay();
22454 });
22455 };
22456 NbWindowService.prototype.checkAndUpdateOverlay = function () {
22457 var fullScreenWindows = this.openWindows.filter(function (w) { return w.state === exports.NbWindowState.FULL_SCREEN; });
22458 if (fullScreenWindows.length > 0) {
22459 this.blockScrollStrategy.enable();
22460 }
22461 else {
22462 this.blockScrollStrategy.disable();
22463 }
22464 if (fullScreenWindows.some(function (w) { return w.config.hasBackdrop; })) {
22465 this.overlayRef.backdropElement.removeAttribute('hidden');
22466 }
22467 else {
22468 this.overlayRef.backdropElement.setAttribute('hidden', '');
22469 }
22470 };
22471 NbWindowService.decorators = [
22472 { type: i0.Injectable }
22473 ];
22474 NbWindowService.ctorParameters = function () { return [
22475 { type: i0.ComponentFactoryResolver },
22476 { type: NbOverlayService },
22477 { type: NbOverlayPositionBuilder },
22478 { type: NbBlockScrollStrategyAdapter },
22479 { type: NbWindowConfig, decorators: [{ type: i0.Inject, args: [NB_WINDOW_CONFIG,] }] },
22480 { type: i0.ComponentFactoryResolver },
22481 { type: undefined, decorators: [{ type: i0.Inject, args: [NB_DOCUMENT,] }] }
22482 ]; };
22483 return NbWindowService;
22484}());
22485
22486var NbWindowModule = /** @class */ (function () {
22487 function NbWindowModule() {
22488 }
22489 NbWindowModule.forRoot = function (defaultConfig) {
22490 return {
22491 ngModule: NbWindowModule,
22492 providers: [
22493 NbWindowService,
22494 { provide: NB_WINDOW_CONFIG, useValue: defaultConfig },
22495 ],
22496 };
22497 };
22498 NbWindowModule.forChild = function (defaultConfig) {
22499 return {
22500 ngModule: NbWindowModule,
22501 providers: [
22502 NbWindowService,
22503 { provide: NB_WINDOW_CONFIG, useValue: defaultConfig },
22504 ],
22505 };
22506 };
22507 NbWindowModule.decorators = [
22508 { type: i0.NgModule, args: [{
22509 imports: [_angular_common.CommonModule, NbOverlayModule, NbCardModule, NbIconModule, NbButtonModule],
22510 declarations: [
22511 NbWindowsContainerComponent,
22512 NbWindowComponent,
22513 ],
22514 entryComponents: [NbWindowsContainerComponent, NbWindowComponent],
22515 },] }
22516 ];
22517 return NbWindowModule;
22518}());
22519
22520/**
22521 * The `NbTimePickerDirective` is form control that gives you ability to select a time. The timepicker
22522 * is shown when input receives a `focus` event.
22523 * ```html
22524 * <input [nbTimepicker]="timepicker">
22525 * <nb-timepicker #timepicker></nb-timepicker>
22526 * ```
22527 *
22528 * @stacked-example(Showcase, timepicker/timepicker-showcase.component)
22529 *
22530 * ### Installation
22531 *
22532 * Import `NbTimepickerModule.forRoot()` to your root module.
22533 * ```ts
22534 * @NgModule({
22535 * imports: [
22536 * // ...
22537 * NbTimepickerModule.forRoot(),
22538 * ],
22539 * })
22540 * export class AppModule { }
22541 * ```
22542 * And `NbTimepickerModule` to your feature module.
22543 * ```ts
22544 * @NgModule({
22545 * imports: [
22546 * // ...
22547 * NbTimepickerModule,
22548 * ],
22549 * })
22550 * export class PageModule { }
22551 *
22552 * ```
22553 * <div id="native-parse-issue" class="note note-warning">
22554 * <div class="note-title">Note</div>
22555 * <div class="note-body">
22556 * Timepicker uses native Date object by default, which doesn't support parsing by custom format.
22557 * According to the ECMAScript specification, the only supported format is a format described by ISO 8061 standard.
22558 * This standard requires date part to be included in the date string,
22559 * meaning you have to type a date+time in the input.
22560 * We highly recommend you to use NbDateFnsDateModule or NbMomentDateModule to be able to support time only strings in
22561 * the timepicker inputs. These modules use date-fns and moment date libraries, which provide capabilities
22562 * to parse time only strings.
22563 * See "Formatting Issue" at
22564 * <a href="https://akveo.github.io/nebular/docs/components/datepicker/overview#formatting-issue">Date picker docs</a>
22565 * for installation instructions.
22566 * </div>
22567 * </div>
22568 * <hr>
22569 *
22570 * ### Usage
22571 *
22572 * To show seconds column along with hours and minutes use `withSeconds` input
22573 *
22574 * ```html
22575 * <input [nbTimepicker]="timepicker">
22576 * <nb-timepicker #timepicker withSeconds></nb-timepicker>
22577 * ```
22578 * @stacked-example(Time picker with seconds, timepicker/timepicker-with-seconds.component)
22579 *
22580 * To force timepicker work in 12 hours format, use `twelveHoursFormat` input.
22581 * By default, timepicker choose 12 or 24 formats based on application locale standards
22582 *
22583 * ```html
22584 * <input [nbTimepicker]="timepicker" twelveHoursFormat>
22585 * <nb-timepicker #timepicker></nb-timepicker>
22586 * ```
22587 *
22588 * @stacked-example(Twelve hours format showcase, timepicker/timepicker-twelve-hours-format.component)
22589 *
22590 * A single column picker with options value as time and minute, so users won’t be able to pick
22591 * hours and minutes individually.
22592 * You can control options minutes offset via `step` input, e.g.: 11:00, 11:20, 11:40...'
22593 *
22594 * @stacked-example(Single column, timepicker/timepicker-single-column.component)
22595 *
22596 * Timepicker support forms and reactive forms API so you can provide value using `formControl` and `ngModel` directives
22597 * @stacked-example(Form control, timepicker/timepicker-form-control.component)
22598 *
22599 * <input [nbTimepicker]="timepicker" twelveHoursFormat>
22600 * <nb-timepicker #timepicke [formControl]="formControl"></nb-timepicker>
22601 *
22602 * @stacked-example(NgModel, timepicker/timepicker-ng-model.component)
22603 *
22604 * <input [nbTimepicker]="timepicker" twelveHoursFormat>
22605 * <nb-timepicker #timepicke [ngModel]="date"></nb-timepicker>
22606 *
22607 * You can provide localized versions of the timepicker text via the `localization` property of the config
22608 * object passed to the `forRoot` or `forChild` methods of the `NbTimepickerModule`:
22609 * ```ts
22610 * @NgModule({
22611 * imports: [
22612 * // ...
22613 * NbTimepickerModule.forRoot({
22614 * localization: {
22615 * hoursText: 'Hr',
22616 * minutesText: 'Min',
22617 * secondsText: 'Sec',
22618 * ampmText: 'Am/Pm',
22619 * }
22620 * }),
22621 * ],
22622 * })
22623 * export class AppModule { }
22624 * ```
22625 *
22626 * @styles
22627 *
22628 * timepicker-cell-text-color:
22629 * timepicker-cell-hover-background-color:
22630 * timepicker-cell-hover-text-color:
22631 * timepicker-cell-focus-background-color:
22632 * timepicker-cell-focus-text-color:
22633 * timepicker-cell-active-background-color:
22634 * timepicker-cell-active-text-color:
22635 * timepicker-cell-text-font-size:
22636 * timepicker-cell-text-font-family:
22637 * timepicker-cell-text-line-height:
22638 * timepicker-cell-text-font-weight:
22639 * timepicker-cell-height:
22640 * timepicker-header-cell-text-color:
22641 * timepicker-header-cell-text-font-size:
22642 * timepicker-header-cell-text-font-family:
22643 * timepicker-header-cell-height:
22644 * timepicker-header-cell-text-line-height:
22645 * timepicker-header-cell-text-font-weight:
22646 * timepicker-border-color:
22647 * timepicker-border-style:
22648 * timepicker-border-width:
22649 * timepicker-scrollbar-color:
22650 * timepicker-scrollbar-background-color:
22651 * timepicker-scrollbar-width:
22652 * timepicker-single-column-width:
22653 * timepicker-multiple-column-width:
22654 * timepicker-title-height:
22655 * timepicker-title-padding:
22656 * timepicker-container-width:
22657 * timepicker-container-height:
22658 * */
22659var NbTimePickerDirective = /** @class */ (function () {
22660 function NbTimePickerDirective(document, positionBuilder, hostRef, triggerStrategyBuilder, overlay, cd, calendarTimeModelService, dateService, renderer, placeholder) {
22661 this.document = document;
22662 this.positionBuilder = positionBuilder;
22663 this.hostRef = hostRef;
22664 this.triggerStrategyBuilder = triggerStrategyBuilder;
22665 this.overlay = overlay;
22666 this.cd = cd;
22667 this.calendarTimeModelService = calendarTimeModelService;
22668 this.dateService = dateService;
22669 this.renderer = renderer;
22670 this.placeholder = placeholder;
22671 /**
22672 * Time picker overlay offset.
22673 * */
22674 this.overlayOffset = 8;
22675 this.destroy$ = new rxjs.Subject();
22676 this.onChange = function () {
22677 };
22678 this.onTouched = function () {
22679 };
22680 }
22681 Object.defineProperty(NbTimePickerDirective.prototype, "timepicker", {
22682 /**
22683 * Provides timepicker component.
22684 * */
22685 get: function () {
22686 return this._timePickerComponent;
22687 },
22688 set: function (timePicker) {
22689 this._timePickerComponent = timePicker;
22690 },
22691 enumerable: false,
22692 configurable: true
22693 });
22694 Object.defineProperty(NbTimePickerDirective.prototype, "input", {
22695 /**
22696 * Returns html input element.
22697 * @docs-private
22698 * */
22699 get: function () {
22700 return this.hostRef.nativeElement;
22701 },
22702 enumerable: false,
22703 configurable: true
22704 });
22705 Object.defineProperty(NbTimePickerDirective.prototype, "isOpen", {
22706 /**
22707 * Determines is timepicker overlay opened.
22708 * @docs-private
22709 * */
22710 get: function () {
22711 return this.overlayRef && this.overlayRef.hasAttached();
22712 },
22713 enumerable: false,
22714 configurable: true
22715 });
22716 Object.defineProperty(NbTimePickerDirective.prototype, "isClosed", {
22717 /**
22718 * Determines is timepicker overlay closed.
22719 * @docs-private
22720 * */
22721 get: function () {
22722 return !this.isOpen;
22723 },
22724 enumerable: false,
22725 configurable: true
22726 });
22727 Object.defineProperty(NbTimePickerDirective.prototype, "inputValue", {
22728 /**
22729 * Returns host input value.
22730 * @docs-private
22731 * */
22732 get: function () {
22733 return this.input.value;
22734 },
22735 set: function (value) {
22736 this.input.value = value;
22737 },
22738 enumerable: false,
22739 configurable: true
22740 });
22741 NbTimePickerDirective.prototype.ngAfterViewInit = function () {
22742 this.subscribeOnInputChange();
22743 if (!this.placeholder) {
22744 this.renderer.setProperty(this.input, 'placeholder', this.timepicker.timeFormat);
22745 }
22746 this.triggerStrategy = this.createTriggerStrategy();
22747 this.subscribeOnTriggers();
22748 this.subscribeToBlur();
22749 };
22750 NbTimePickerDirective.prototype.show = function () {
22751 if (this.isClosed) {
22752 this.attachToOverlay();
22753 }
22754 };
22755 NbTimePickerDirective.prototype.hide = function () {
22756 if (this.isOpen) {
22757 this.overlayRef.detach();
22758 this.cd.markForCheck();
22759 }
22760 };
22761 /**
22762 * Attaches picker to the timepicker portal.
22763 * @docs-private
22764 * */
22765 NbTimePickerDirective.prototype.attachToOverlay = function () {
22766 if (!this.overlayRef) {
22767 this.setupTimepicker();
22768 this.initOverlay();
22769 }
22770 this.overlayRef.attach(this.timepicker.portal);
22771 };
22772 NbTimePickerDirective.prototype.setupTimepicker = function () {
22773 if (this.dateService.getId() === 'native' && i0.isDevMode()) {
22774 console.warn('Date.parse does not support parsing time with custom format.' +
22775 ' See details here https://akveo.github.io/nebular/docs/components/datepicker/overview#native-parse-issue');
22776 }
22777 this.timepicker.setHost(this.hostRef);
22778 if (this.inputValue) {
22779 var val = this.dateService.getId() === 'native' ? this.parseNativeDateString(this.inputValue) : this.inputValue;
22780 this.timepicker.date = this.dateService.parse(val, this.timepicker.timeFormat);
22781 }
22782 else {
22783 this.timepicker.date = this.calendarTimeModelService.getResetTime();
22784 }
22785 };
22786 NbTimePickerDirective.prototype.initOverlay = function () {
22787 this.positionStrategy = this.createPositionStrategy();
22788 this.subscribeOnApplyClick();
22789 this.createOverlay();
22790 };
22791 NbTimePickerDirective.prototype.subscribeOnApplyClick = function () {
22792 var _this = this;
22793 this.timepicker.onSelectTime.pipe(rxjs_operators.takeUntil(this.destroy$)).subscribe(function (value) {
22794 var time = _this.dateService.format(value.time, _this.timepicker.timeFormat).toUpperCase();
22795 _this.inputValue = time;
22796 _this.timepicker.date = value.time;
22797 _this.onChange(value.time);
22798 if (value.save) {
22799 _this.lastInputValue = time;
22800 _this.hide();
22801 }
22802 });
22803 };
22804 NbTimePickerDirective.prototype.createOverlay = function () {
22805 var scrollStrategy = this.createScrollStrategy();
22806 this.overlayRef = this.overlay.create({ positionStrategy: this.positionStrategy, scrollStrategy: scrollStrategy });
22807 };
22808 NbTimePickerDirective.prototype.subscribeOnTriggers = function () {
22809 var _this = this;
22810 this.triggerStrategy.show$
22811 .pipe(rxjs_operators.filter(function () { return _this.isClosed; }))
22812 .subscribe(function () { return _this.show(); });
22813 this.triggerStrategy.hide$
22814 .pipe(rxjs_operators.filter(function () { return _this.isOpen; }))
22815 .subscribe(function () {
22816 _this.inputValue = _this.lastInputValue || '';
22817 _this.hide();
22818 });
22819 };
22820 NbTimePickerDirective.prototype.createTriggerStrategy = function () {
22821 var _this = this;
22822 return this.triggerStrategyBuilder
22823 .trigger(exports.NbTrigger.FOCUS)
22824 .host(this.hostRef.nativeElement)
22825 .container(function () { return _this.getContainer(); })
22826 .build();
22827 };
22828 NbTimePickerDirective.prototype.createPositionStrategy = function () {
22829 return this.positionBuilder
22830 .connectedTo(this.hostRef)
22831 .position(exports.NbPosition.BOTTOM)
22832 .offset(this.overlayOffset)
22833 .adjustment(exports.NbAdjustment.VERTICAL);
22834 };
22835 NbTimePickerDirective.prototype.getContainer = function () {
22836 return this.overlayRef && this.isOpen && {
22837 location: {
22838 nativeElement: this.overlayRef.overlayElement,
22839 },
22840 };
22841 };
22842 NbTimePickerDirective.prototype.createScrollStrategy = function () {
22843 return this.overlay.scrollStrategies.block();
22844 };
22845 NbTimePickerDirective.prototype.subscribeOnInputChange = function () {
22846 var _this = this;
22847 rxjs.fromEvent(this.input, 'input')
22848 .pipe(rxjs_operators.map(function () { return _this.inputValue; }), rxjs_operators.takeUntil(this.destroy$))
22849 .subscribe(function (value) { return _this.handleInputChange(value); });
22850 };
22851 NbTimePickerDirective.prototype.subscribeToBlur = function () {
22852 var _this = this;
22853 rxjs.merge(this.timepicker.blur, rxjs.fromEvent(this.input, 'blur').pipe(rxjs_operators.filter(function () { return !_this.isOpen && _this.document.activeElement !== _this.input; }))).pipe(rxjs_operators.takeUntil(this.destroy$))
22854 .subscribe(function () { return _this.onTouched(); });
22855 };
22856 /**
22857 * Parses input value and write if it isn't null.
22858 * @docs-private
22859 * */
22860 NbTimePickerDirective.prototype.handleInputChange = function (value) {
22861 if (this.dateService.getId() === 'native') {
22862 /**
22863 * Native date service dont parse only time string value,
22864 * and we adding year mouth and day to convert string to valid date format
22865 **/
22866 value = this.parseNativeDateString(value);
22867 }
22868 var isValidDate = this.dateService.isValidDateString(value, this.timepicker.timeFormat);
22869 if (isValidDate) {
22870 this.lastInputValue = value;
22871 var date = this.dateService.parse(value, this.timepicker.timeFormat);
22872 this.onChange(date);
22873 this.timepicker.date = date;
22874 }
22875 };
22876 NbTimePickerDirective.prototype.updateValue = function (value) {
22877 if (value) {
22878 this.timepicker.date = value;
22879 var timeString = this.dateService.format(value, this.timepicker.timeFormat).toUpperCase();
22880 this.inputValue = timeString;
22881 this.lastInputValue = timeString;
22882 }
22883 };
22884 NbTimePickerDirective.prototype.writeValue = function (value) {
22885 this.updateValue(value);
22886 };
22887 NbTimePickerDirective.prototype.registerOnChange = function (fn) {
22888 this.onChange = fn;
22889 };
22890 NbTimePickerDirective.prototype.registerOnTouched = function (fn) {
22891 this.onTouched = fn;
22892 };
22893 NbTimePickerDirective.prototype.parseNativeDateString = function (value) {
22894 var date = this.dateService.today();
22895 var year = this.dateService.getYear(date);
22896 var month = this.calendarTimeModelService.paddToTwoSymbols(this.dateService.getMonth(date));
22897 var day = this.calendarTimeModelService.paddToTwoSymbols(this.dateService.getDate(date));
22898 return year + "-" + month + "-" + day + " " + value;
22899 };
22900 NbTimePickerDirective.decorators = [
22901 { type: i0.Directive, args: [{
22902 selector: 'input[nbTimepicker]',
22903 providers: [{
22904 provide: _angular_forms.NG_VALUE_ACCESSOR,
22905 useExisting: i0.forwardRef(function () { return NbTimePickerDirective; }),
22906 multi: true,
22907 }],
22908 },] }
22909 ];
22910 NbTimePickerDirective.ctorParameters = function () { return [
22911 { type: undefined, decorators: [{ type: i0.Inject, args: [NB_DOCUMENT,] }] },
22912 { type: NbPositionBuilderService },
22913 { type: i0.ElementRef },
22914 { type: NbTriggerStrategyBuilderService },
22915 { type: NbOverlayService },
22916 { type: i0.ChangeDetectorRef },
22917 { type: NbCalendarTimeModelService },
22918 { type: NbDateService },
22919 { type: i0.Renderer2 },
22920 { type: String, decorators: [{ type: i0.Attribute, args: ['placeholder',] }] }
22921 ]; };
22922 NbTimePickerDirective.propDecorators = {
22923 timepicker: [{ type: i0.Input, args: ['nbTimepicker',] }],
22924 overlayOffset: [{ type: i0.Input }]
22925 };
22926 return NbTimePickerDirective;
22927}());
22928
22929var NbTimePickerCellComponent = /** @class */ (function () {
22930 function NbTimePickerCellComponent(ngZone, platformService) {
22931 this.ngZone = ngZone;
22932 this.platformService = platformService;
22933 this.selectedChange$ = new rxjs.Subject();
22934 this.unselected$ = this.selectedChange$.pipe(rxjs_operators.filter(function (selected) { return !selected; }));
22935 this.destroy$ = new rxjs.Subject();
22936 this.select = new i0.EventEmitter();
22937 }
22938 Object.defineProperty(NbTimePickerCellComponent.prototype, "selected", {
22939 get: function () {
22940 return this._selected;
22941 },
22942 set: function (selected) {
22943 if (selected) {
22944 this._selected = selected;
22945 this.scrollToElement();
22946 }
22947 this.selectedChange$.next(selected);
22948 },
22949 enumerable: false,
22950 configurable: true
22951 });
22952
22953 NbTimePickerCellComponent.prototype.onClick = function () {
22954 this.select.emit({ value: this.value });
22955 };
22956 NbTimePickerCellComponent.prototype.ngAfterViewInit = function () {
22957 var _this = this;
22958 if (this.selected) {
22959 // Since we render timepicker in the overlay, at the moment this hook called,
22960 // timepicker could be not fully rendered and placed. Because of it, we're waiting for Angular
22961 // to finish change detection run and only then scroll to the selected cell.
22962 this.ngZone.onStable
22963 .pipe(rxjs_operators.take(1), rxjs_operators.takeUntil(rxjs.merge(this.unselected$, this.destroy$)))
22964 .subscribe(function () { return _this.scrollToElement(); });
22965 }
22966 };
22967 NbTimePickerCellComponent.prototype.scrollToElement = function () {
22968 var _this = this;
22969 if (this.valueContainerElement && this.platformService.isBrowser) {
22970 this.ngZone.runOutsideAngular(function () {
22971 return _this.valueContainerElement.nativeElement.scrollIntoView({ block: 'center' });
22972 });
22973 }
22974 };
22975 NbTimePickerCellComponent.prototype.ngOnDestroy = function () {
22976 this.destroy$.next();
22977 this.destroy$.complete();
22978 };
22979 NbTimePickerCellComponent.decorators = [
22980 { type: i0.Component, args: [{
22981 selector: 'nb-timepicker-cell',
22982 template: "\n <div #valueContainer>{{ value }}</div>\n ",
22983 changeDetection: i0.ChangeDetectionStrategy.OnPush,
22984 styles: [":host{width:100%;height:100%;display:flex;align-items:center;justify-content:center;user-select:none}\n"]
22985 },] }
22986 ];
22987 NbTimePickerCellComponent.ctorParameters = function () { return [
22988 { type: i0.NgZone },
22989 { type: NbPlatform }
22990 ]; };
22991 NbTimePickerCellComponent.propDecorators = {
22992 selected: [{ type: i0.Input }],
22993 value: [{ type: i0.Input }],
22994 select: [{ type: i0.Output }],
22995 valueContainerElement: [{ type: i0.ViewChild, args: ['valueContainer',] }],
22996 onClick: [{ type: i0.HostListener, args: ['click',] }]
22997 };
22998 return NbTimePickerCellComponent;
22999}());
23000
23001/*
23002 * @license
23003 * Copyright Akveo. All Rights Reserved.
23004 * Licensed under the MIT License. See License.txt in the project root for license information.
23005 */
23006var NbTimepickerModule = /** @class */ (function () {
23007 function NbTimepickerModule() {
23008 }
23009 NbTimepickerModule.forRoot = function (config) {
23010 if (config === void 0) { config = {}; }
23011 return {
23012 ngModule: NbTimepickerModule,
23013 providers: [{ provide: NB_TIME_PICKER_CONFIG, useValue: config }],
23014 };
23015 };
23016 NbTimepickerModule.forChild = function (config) {
23017 if (config === void 0) { config = {}; }
23018 return {
23019 ngModule: NbTimepickerModule,
23020 providers: [{ provide: NB_TIME_PICKER_CONFIG, useValue: config }],
23021 };
23022 };
23023 NbTimepickerModule.decorators = [
23024 { type: i0.NgModule, args: [{
23025 imports: [
23026 _angular_common.CommonModule,
23027 NbOverlayModule,
23028 NbListModule,
23029 NbCardModule,
23030 NbCalendarKitModule,
23031 ],
23032 providers: [NbCalendarTimeModelService],
23033 exports: [NbTimePickerComponent, NbTimePickerCellComponent, NbTimePickerDirective],
23034 declarations: [NbTimePickerComponent, NbTimePickerCellComponent, NbTimePickerDirective],
23035 },] }
23036 ];
23037 return NbTimepickerModule;
23038}());
23039
23040/*
23041 * @license
23042 * Copyright Akveo. All Rights Reserved.
23043 * Licensed under the MIT License. See License.txt in the project root for license information.
23044 */
23045var NbDateAdapterService = /** @class */ (function (_super) {
23046 tslib.__extends(NbDateAdapterService, _super);
23047 function NbDateAdapterService(dateService) {
23048 var _this = _super.call(this) || this;
23049 _this.dateService = dateService;
23050 _this.picker = NbDatepickerComponent;
23051 return _this;
23052 }
23053 NbDateAdapterService.prototype.parse = function (date, format) {
23054 return this.dateService.parse(date, format);
23055 };
23056 NbDateAdapterService.prototype.format = function (date, format) {
23057 return this.dateService.format(date, format);
23058 };
23059 NbDateAdapterService.prototype.isValid = function (date, format) {
23060 return this.dateService.isValidDateString(date, format);
23061 };
23062 NbDateAdapterService.decorators = [
23063 { type: i0.Injectable }
23064 ];
23065 NbDateAdapterService.ctorParameters = function () { return [
23066 { type: NbDateService }
23067 ]; };
23068 return NbDateAdapterService;
23069}(NbDatepickerAdapter));
23070var NbRangeAdapterService = /** @class */ (function (_super) {
23071 tslib.__extends(NbRangeAdapterService, _super);
23072 function NbRangeAdapterService(dateService) {
23073 var _this = _super.call(this) || this;
23074 _this.dateService = dateService;
23075 _this.picker = NbRangepickerComponent;
23076 return _this;
23077 }
23078 NbRangeAdapterService.prototype.parse = function (range, format) {
23079 var _a = range.split('-').map(function (subDate) { return subDate.trim(); }), start = _a[0], end = _a[1];
23080 return {
23081 start: this.dateService.parse(start, format),
23082 end: this.dateService.parse(end, format),
23083 };
23084 };
23085 NbRangeAdapterService.prototype.format = function (range, format) {
23086 if (!range) {
23087 return '';
23088 }
23089 var start = this.dateService.format(range.start, format);
23090 var isStartValid = this.dateService.isValidDateString(start, format);
23091 if (!isStartValid) {
23092 return '';
23093 }
23094 var end = this.dateService.format(range.end, format);
23095 var isEndValid = this.dateService.isValidDateString(end, format);
23096 if (isEndValid) {
23097 return start + " - " + end;
23098 }
23099 else {
23100 return start;
23101 }
23102 };
23103 NbRangeAdapterService.prototype.isValid = function (range, format) {
23104 var _a = range.split('-').map(function (subDate) { return subDate.trim(); }), start = _a[0], end = _a[1];
23105 return this.dateService.isValidDateString(start, format) && this.dateService.isValidDateString(end, format);
23106 };
23107 NbRangeAdapterService.decorators = [
23108 { type: i0.Injectable }
23109 ];
23110 NbRangeAdapterService.ctorParameters = function () { return [
23111 { type: NbDateService }
23112 ]; };
23113 return NbRangeAdapterService;
23114}(NbDatepickerAdapter));
23115var NbDateTimeAdapterService = /** @class */ (function (_super) {
23116 tslib.__extends(NbDateTimeAdapterService, _super);
23117 function NbDateTimeAdapterService(dateService) {
23118 var _this = _super.call(this) || this;
23119 _this.dateService = dateService;
23120 _this.picker = NbDateTimePickerComponent;
23121 return _this;
23122 }
23123 NbDateTimeAdapterService.prototype.parse = function (date, format) {
23124 return this.dateService.parse(date, format);
23125 };
23126 NbDateTimeAdapterService.prototype.format = function (date, format) {
23127 return this.dateService.format(date, format);
23128 };
23129 NbDateTimeAdapterService.prototype.isValid = function (date, format) {
23130 return this.dateService.isValidDateString(date, format);
23131 };
23132 NbDateTimeAdapterService.decorators = [
23133 { type: i0.Injectable }
23134 ];
23135 NbDateTimeAdapterService.ctorParameters = function () { return [
23136 { type: NbDateService }
23137 ]; };
23138 return NbDateTimeAdapterService;
23139}(NbDatepickerAdapter));
23140
23141/*
23142 * @license
23143 * Copyright Akveo. All Rights Reserved.
23144 * Licensed under the MIT License. See License.txt in the project root for license information.
23145 */
23146var NbDatepickerModule = /** @class */ (function () {
23147 function NbDatepickerModule() {
23148 }
23149 NbDatepickerModule.forRoot = function () {
23150 return {
23151 ngModule: NbDatepickerModule,
23152 providers: [
23153 _angular_common.DatePipe,
23154 {
23155 provide: NB_DATE_ADAPTER,
23156 multi: true,
23157 useClass: NbDateAdapterService,
23158 },
23159 {
23160 provide: NB_DATE_ADAPTER,
23161 multi: true,
23162 useClass: NbRangeAdapterService,
23163 },
23164 {
23165 provide: NB_DATE_ADAPTER,
23166 multi: true,
23167 useClass: NbDateTimeAdapterService,
23168 },
23169 ],
23170 };
23171 };
23172 NbDatepickerModule.decorators = [
23173 { type: i0.NgModule, args: [{
23174 imports: [
23175 NbOverlayModule,
23176 NbCalendarModule,
23177 NbCalendarRangeModule,
23178 NbCardModule,
23179 NbBaseCalendarModule,
23180 NbTimepickerModule,
23181 NbCalendarKitModule,
23182 ],
23183 exports: [
23184 NbDatepickerDirective,
23185 NbDatepickerComponent,
23186 NbRangepickerComponent,
23187 NbDateTimePickerComponent,
23188 NbCalendarWithTimeComponent,
23189 ],
23190 declarations: [
23191 NbDatepickerDirective,
23192 NbDatepickerContainerComponent,
23193 NbCalendarWithTimeComponent,
23194 NbDateTimePickerComponent,
23195 NbDatepickerComponent,
23196 NbRangepickerComponent,
23197 NbBasePickerComponent,
23198 ],
23199 entryComponents: [
23200 NbCalendarComponent,
23201 NbCalendarRangeComponent,
23202 NbDatepickerContainerComponent,
23203 NbCalendarWithTimeComponent,
23204 ],
23205 },] }
23206 ];
23207 return NbDatepickerModule;
23208}());
23209
23210/*
23211 * @license
23212 * Copyright Akveo. All Rights Reserved.
23213 * Licensed under the MIT License. See License.txt in the project root for license information.
23214 */
23215/**
23216 * The `NbRadioComponent` provides the same functionality as native `<input type="radio">`
23217 * with Nebular styles and animations.
23218 *
23219 * @stacked-example(Showcase, radio/radio-showcase.component)
23220 *
23221 * ### Installation
23222 *
23223 * Import `NbRadioModule` to your feature module.
23224 *
23225 * ```ts
23226 * @NgModule({
23227 * imports: [
23228 * // ...
23229 * NbRadioModule,
23230 * ],
23231 * })
23232 * export class PageModule { }
23233 * ```
23234 *
23235 * ### Usage
23236 *
23237 * Radio buttons should be wrapped in `nb-radio-group` to provide form bindings.
23238 *
23239 * ```html
23240 * <nb-radio-group [(ngModel)]="selectedOption">
23241 * <nb-radio value="1">Option 1</nb-radio>
23242 * <nb-radio value="2">Option 2</nb-radio>
23243 * <nb-radio value="3">Option 3</nb-radio>
23244 * </nb-radio-group>
23245 * ```
23246 *
23247 * You can disable some radios in the group using a `disabled` attribute.
23248 *
23249 * @stacked-example(Disabled, radio/radio-disabled.component)
23250 *
23251 *
23252 * @styles
23253 *
23254 * radio-width:
23255 * radio-height:
23256 * radio-border-style:
23257 * radio-border-width:
23258 * radio-text-font-family:
23259 * radio-text-font-size:
23260 * radio-text-font-weight:
23261 * radio-text-line-height:
23262 * radio-outline-color:
23263 * radio-outline-width:
23264 * radio-basic-text-color:
23265 * radio-basic-border-color:
23266 * radio-basic-background-color:
23267 * radio-basic-checked-background-color:
23268 * radio-basic-checked-border-color:
23269 * radio-basic-inner-circle-color:
23270 * radio-basic-focus-border-color:
23271 * radio-basic-focus-inner-circle-color:
23272 * radio-basic-hover-background-color:
23273 * radio-basic-hover-border-color:
23274 * radio-basic-hover-inner-circle-color:
23275 * radio-basic-hover-checked-background-color:
23276 * radio-basic-active-border-color:
23277 * radio-basic-active-inner-circle-color:
23278 * radio-basic-disabled-background-color:
23279 * radio-basic-disabled-border-color:
23280 * radio-basic-disabled-text-color:
23281 * radio-basic-disabled-checked-background-color:
23282 * radio-basic-disabled-checked-border-color:
23283 * radio-basic-disabled-checked-inner-circle-color:
23284 * radio-primary-text-color:
23285 * radio-primary-border-color:
23286 * radio-primary-background-color:
23287 * radio-primary-checked-background-color:
23288 * radio-primary-checked-border-color:
23289 * radio-primary-inner-circle-color:
23290 * radio-primary-focus-border-color:
23291 * radio-primary-focus-inner-circle-color:
23292 * radio-primary-hover-background-color:
23293 * radio-primary-hover-border-color:
23294 * radio-primary-hover-inner-circle-color:
23295 * radio-primary-hover-checked-background-color:
23296 * radio-primary-active-border-color:
23297 * radio-primary-active-inner-circle-color:
23298 * radio-primary-disabled-background-color:
23299 * radio-primary-disabled-border-color:
23300 * radio-primary-disabled-text-color:
23301 * radio-primary-disabled-checked-background-color:
23302 * radio-primary-disabled-checked-border-color:
23303 * radio-primary-disabled-checked-inner-circle-color:
23304 * radio-success-text-color:
23305 * radio-success-border-color:
23306 * radio-success-background-color:
23307 * radio-success-checked-background-color:
23308 * radio-success-checked-border-color:
23309 * radio-success-inner-circle-color:
23310 * radio-success-focus-border-color:
23311 * radio-success-focus-inner-circle-color:
23312 * radio-success-hover-background-color:
23313 * radio-success-hover-border-color:
23314 * radio-success-hover-inner-circle-color:
23315 * radio-success-hover-checked-background-color:
23316 * radio-success-active-border-color:
23317 * radio-success-active-inner-circle-color:
23318 * radio-success-disabled-background-color:
23319 * radio-success-disabled-border-color:
23320 * radio-success-disabled-text-color:
23321 * radio-success-disabled-checked-background-color:
23322 * radio-success-disabled-checked-border-color:
23323 * radio-success-disabled-checked-inner-circle-color:
23324 * radio-info-text-color:
23325 * radio-info-border-color:
23326 * radio-info-background-color:
23327 * radio-info-checked-background-color:
23328 * radio-info-checked-border-color:
23329 * radio-info-inner-circle-color:
23330 * radio-info-focus-border-color:
23331 * radio-info-focus-inner-circle-color:
23332 * radio-info-hover-background-color:
23333 * radio-info-hover-border-color:
23334 * radio-info-hover-inner-circle-color:
23335 * radio-info-hover-checked-background-color:
23336 * radio-info-active-border-color:
23337 * radio-info-active-inner-circle-color:
23338 * radio-info-disabled-background-color:
23339 * radio-info-disabled-border-color:
23340 * radio-info-disabled-text-color:
23341 * radio-info-disabled-checked-background-color:
23342 * radio-info-disabled-checked-border-color:
23343 * radio-info-disabled-checked-inner-circle-color:
23344 * radio-warning-text-color:
23345 * radio-warning-border-color:
23346 * radio-warning-background-color:
23347 * radio-warning-checked-background-color:
23348 * radio-warning-checked-border-color:
23349 * radio-warning-inner-circle-color:
23350 * radio-warning-focus-border-color:
23351 * radio-warning-focus-inner-circle-color:
23352 * radio-warning-hover-background-color:
23353 * radio-warning-hover-border-color:
23354 * radio-warning-hover-inner-circle-color:
23355 * radio-warning-hover-checked-background-color:
23356 * radio-warning-active-border-color:
23357 * radio-warning-active-inner-circle-color:
23358 * radio-warning-disabled-background-color:
23359 * radio-warning-disabled-border-color:
23360 * radio-warning-disabled-text-color:
23361 * radio-warning-disabled-checked-background-color:
23362 * radio-warning-disabled-checked-border-color:
23363 * radio-warning-disabled-checked-inner-circle-color:
23364 * radio-danger-text-color:
23365 * radio-danger-border-color:
23366 * radio-danger-background-color:
23367 * radio-danger-checked-background-color:
23368 * radio-danger-checked-border-color:
23369 * radio-danger-inner-circle-color:
23370 * radio-danger-focus-border-color:
23371 * radio-danger-focus-inner-circle-color:
23372 * radio-danger-hover-background-color:
23373 * radio-danger-hover-border-color:
23374 * radio-danger-hover-inner-circle-color:
23375 * radio-danger-hover-checked-background-color:
23376 * radio-danger-active-border-color:
23377 * radio-danger-active-inner-circle-color:
23378 * radio-danger-disabled-background-color:
23379 * radio-danger-disabled-border-color:
23380 * radio-danger-disabled-text-color:
23381 * radio-danger-disabled-checked-background-color:
23382 * radio-danger-disabled-checked-border-color:
23383 * radio-danger-disabled-checked-inner-circle-color:
23384 * radio-control-text-color:
23385 * radio-control-background-color:
23386 * radio-control-border-color:
23387 * radio-control-checked-background-color:
23388 * radio-control-checked-border-color:
23389 * radio-control-inner-circle-color:
23390 * radio-control-focus-border-color:
23391 * radio-control-focus-inner-circle-color:
23392 * radio-control-hover-background-color:
23393 * radio-control-hover-border-color:
23394 * radio-control-hover-inner-circle-color:
23395 * radio-control-hover-checked-background-color:
23396 * radio-control-active-border-color:
23397 * radio-control-active-inner-circle-color:
23398 * radio-control-disabled-background-color:
23399 * radio-control-disabled-border-color:
23400 * radio-control-disabled-text-color:
23401 * radio-control-disabled-checked-background-color:
23402 * radio-control-disabled-checked-border-color:
23403 * radio-control-disabled-checked-inner-circle-color:
23404 * */
23405var NbRadioComponent = /** @class */ (function () {
23406 function NbRadioComponent(cd, renderer, statusService) {
23407 this.cd = cd;
23408 this.renderer = renderer;
23409 this.statusService = statusService;
23410 this._checked = false;
23411 this._disabled = false;
23412 this.status = 'basic';
23413 this.valueChange = new i0.EventEmitter();
23414 this.blur = new i0.EventEmitter();
23415 }
23416 Object.defineProperty(NbRadioComponent.prototype, "name", {
23417 get: function () {
23418 return this._name;
23419 },
23420 set: function (value) {
23421 if (this._name !== value) {
23422 this._name = value;
23423 }
23424 },
23425 enumerable: false,
23426 configurable: true
23427 });
23428 Object.defineProperty(NbRadioComponent.prototype, "checked", {
23429 get: function () {
23430 return this._checked;
23431 },
23432 set: function (value) {
23433 var boolValue = convertToBoolProperty(value);
23434 if (this._checked !== boolValue) {
23435 this._checked = boolValue;
23436 }
23437 },
23438 enumerable: false,
23439 configurable: true
23440 });
23441 Object.defineProperty(NbRadioComponent.prototype, "value", {
23442 get: function () {
23443 return this._value;
23444 },
23445 set: function (value) {
23446 if (this._value !== value) {
23447 this._value = value;
23448 }
23449 },
23450 enumerable: false,
23451 configurable: true
23452 });
23453 Object.defineProperty(NbRadioComponent.prototype, "disabled", {
23454 get: function () {
23455 return this._disabled;
23456 },
23457 set: function (disabled) {
23458 var boolValue = convertToBoolProperty(disabled);
23459 if (this._disabled !== boolValue) {
23460 this._disabled = boolValue;
23461 }
23462 },
23463 enumerable: false,
23464 configurable: true
23465 });
23466 Object.defineProperty(NbRadioComponent.prototype, "isPrimary", {
23467 get: function () {
23468 return this.status === 'primary';
23469 },
23470 enumerable: false,
23471 configurable: true
23472 });
23473 Object.defineProperty(NbRadioComponent.prototype, "isSuccess", {
23474 get: function () {
23475 return this.status === 'success';
23476 },
23477 enumerable: false,
23478 configurable: true
23479 });
23480 Object.defineProperty(NbRadioComponent.prototype, "isWarning", {
23481 get: function () {
23482 return this.status === 'warning';
23483 },
23484 enumerable: false,
23485 configurable: true
23486 });
23487 Object.defineProperty(NbRadioComponent.prototype, "isDanger", {
23488 get: function () {
23489 return this.status === 'danger';
23490 },
23491 enumerable: false,
23492 configurable: true
23493 });
23494 Object.defineProperty(NbRadioComponent.prototype, "isInfo", {
23495 get: function () {
23496 return this.status === 'info';
23497 },
23498 enumerable: false,
23499 configurable: true
23500 });
23501 Object.defineProperty(NbRadioComponent.prototype, "isBasic", {
23502 get: function () {
23503 return this.status === 'basic';
23504 },
23505 enumerable: false,
23506 configurable: true
23507 });
23508 Object.defineProperty(NbRadioComponent.prototype, "isControl", {
23509 get: function () {
23510 return this.status === 'control';
23511 },
23512 enumerable: false,
23513 configurable: true
23514 });
23515 Object.defineProperty(NbRadioComponent.prototype, "additionalClasses", {
23516 get: function () {
23517 if (this.statusService.isCustomStatus(this.status)) {
23518 return [this.statusService.getStatusClass(this.status)];
23519 }
23520 return [];
23521 },
23522 enumerable: false,
23523 configurable: true
23524 });
23525 NbRadioComponent.prototype.onChange = function (event) {
23526 event.stopPropagation();
23527 this.checked = true;
23528 this.valueChange.emit(this.value);
23529 };
23530 NbRadioComponent.prototype.onClick = function (event) {
23531 event.stopPropagation();
23532 };
23533 /*
23534 * @docs-private
23535 * We use this method when setting radio inputs from radio group component.
23536 * Otherwise Angular won't detect changes in radio template as cached last rendered
23537 * value didn't updated.
23538 **/
23539 NbRadioComponent.prototype._markForCheck = function () {
23540 this.cd.markForCheck();
23541 };
23542 /*
23543 * @docs-private
23544 * Use this method when setting radio name from radio group component.
23545 * In case option 'name' isn't set on nb-radio component we need to set name
23546 * right away, so it won't overlap with options without names from other radio
23547 * groups. Otherwise they all would have same name and will be considered as
23548 * options from one group so only the last option will stay selected.
23549 **/
23550 NbRadioComponent.prototype._setName = function (name) {
23551 this.name = name;
23552 if (this.input) {
23553 this.renderer.setProperty(this.input.nativeElement, 'name', name);
23554 }
23555 };
23556 NbRadioComponent.decorators = [
23557 { type: i0.Component, args: [{
23558 selector: 'nb-radio',
23559 template: "\n <label>\n <input\n #input\n type=\"radio\"\n class=\"native-input visually-hidden\"\n [name]=\"name\"\n [value]=\"value\"\n [checked]=\"checked\"\n [disabled]=\"disabled\"\n (change)=\"onChange($event)\"\n (click)=\"onClick($event)\">\n <span class=\"outer-circle\"></span>\n <span class=\"inner-circle\"></span>\n <span class=\"text\">\n <ng-content></ng-content>\n </span>\n </label>\n ",
23560 changeDetection: i0.ChangeDetectionStrategy.OnPush,
23561 styles: [":host{display:block;position:relative}:host label{display:inline-flex;margin:0;min-height:inherit;padding:0.375rem 0;align-items:center}[dir=ltr] :host label{padding-right:1.5rem}[dir=rtl] :host label{padding-left:1.5rem}:host .outer-circle,:host .inner-circle{border-radius:50%;position:absolute;top:50%;transform:translateY(-50%)}[dir=ltr] :host .outer-circle,[dir=ltr] :host .inner-circle{left:0}[dir=rtl] :host .outer-circle,[dir=rtl] :host .inner-circle{right:0}:host .inner-circle{transform:translateY(-50%) scale(0.6)}[dir=ltr] :host .text{padding-left:.5rem}[dir=rtl] :host .text{padding-right:.5rem}\n"]
23562 },] }
23563 ];
23564 NbRadioComponent.ctorParameters = function () { return [
23565 { type: i0.ChangeDetectorRef },
23566 { type: i0.Renderer2 },
23567 { type: NbStatusService }
23568 ]; };
23569 NbRadioComponent.propDecorators = {
23570 name: [{ type: i0.Input }],
23571 checked: [{ type: i0.Input }],
23572 value: [{ type: i0.Input }],
23573 disabled: [{ type: i0.Input }],
23574 status: [{ type: i0.Input }],
23575 valueChange: [{ type: i0.Output }],
23576 blur: [{ type: i0.Output }],
23577 input: [{ type: i0.ViewChild, args: ['input', { read: i0.ElementRef },] }],
23578 isPrimary: [{ type: i0.HostBinding, args: ['class.status-primary',] }],
23579 isSuccess: [{ type: i0.HostBinding, args: ['class.status-success',] }],
23580 isWarning: [{ type: i0.HostBinding, args: ['class.status-warning',] }],
23581 isDanger: [{ type: i0.HostBinding, args: ['class.status-danger',] }],
23582 isInfo: [{ type: i0.HostBinding, args: ['class.status-info',] }],
23583 isBasic: [{ type: i0.HostBinding, args: ['class.status-basic',] }],
23584 isControl: [{ type: i0.HostBinding, args: ['class.status-control',] }],
23585 additionalClasses: [{ type: i0.HostBinding, args: ['class',] }]
23586 };
23587 return NbRadioComponent;
23588}());
23589
23590/*
23591 * @license
23592 * Copyright Akveo. All Rights Reserved.
23593 * Licensed under the MIT License. See License.txt in the project root for license information.
23594 */
23595/**
23596 * The `NbRadioGroupComponent` is the wrapper for `nb-radio` button.
23597 * It provides form bindings:
23598 *
23599 * ```html
23600 * <nb-radio-group [(ngModel)]="selectedOption">
23601 * <nb-radio value="1">Option 1</nb-radio>
23602 * <nb-radio value="2">Option 2</nb-radio>
23603 * <nb-radio value="3">Option 3</nb-radio>
23604 * </nb-radio-group>
23605 * ```
23606 *
23607 * Also, you can use `value` and `valueChange` for binding without forms.
23608 *
23609 * ```html
23610 * <nb-radio-group [(value)]="selectedOption">
23611 * <nb-radio value="1">Option 1</nb-radio>
23612 * <nb-radio value="2">Option 2</nb-radio>
23613 * <nb-radio value="3">Option 3</nb-radio>
23614 * </nb-radio-group>
23615 * ```
23616 *
23617 * Radio items name has to be provided through `name` input property of the radio group.
23618 *
23619 * ```html
23620 * <nb-radio-group name="my-radio-group">
23621 * ...
23622 * </nb-radio-group>
23623 * ```
23624 *
23625 * You can change radio group status by setting `status` input.
23626 * @stacked-example(Statuses, radio/radio-statuses.component)
23627 *
23628 * Also, you can disable the whole group using `disabled` attribute.
23629 * @stacked-example(Disabled group, radio/radio-disabled-group.component)
23630 *
23631 * Radio group supports `ngModel` and reactive forms:
23632 * @stacked-example(Radio Group with forms, radio/radio-form.component)
23633 *
23634 * */
23635var NbRadioGroupComponent = /** @class */ (function () {
23636 function NbRadioGroupComponent(hostElement, platformId, document) {
23637 this.hostElement = hostElement;
23638 this.platformId = platformId;
23639 this.document = document;
23640 this.destroy$ = new rxjs.Subject();
23641 this.onChange = function (value) { };
23642 this.onTouched = function () { };
23643 this._status = 'basic';
23644 this.valueChange = new i0.EventEmitter();
23645 }
23646 Object.defineProperty(NbRadioGroupComponent.prototype, "value", {
23647 get: function () {
23648 return this._value;
23649 },
23650 set: function (value) {
23651 this._value = value;
23652 this.updateValues();
23653 },
23654 enumerable: false,
23655 configurable: true
23656 });
23657 Object.defineProperty(NbRadioGroupComponent.prototype, "name", {
23658 get: function () {
23659 return this._name;
23660 },
23661 set: function (name) {
23662 this._name = name;
23663 this.updateNames();
23664 },
23665 enumerable: false,
23666 configurable: true
23667 });
23668 Object.defineProperty(NbRadioGroupComponent.prototype, "disabled", {
23669 get: function () {
23670 return this._disabled;
23671 },
23672 set: function (disabled) {
23673 this._disabled = convertToBoolProperty(disabled);
23674 this.updateDisabled();
23675 },
23676 enumerable: false,
23677 configurable: true
23678 });
23679 Object.defineProperty(NbRadioGroupComponent.prototype, "status", {
23680 /**
23681 * Radio buttons status.
23682 * Possible values are `primary` (default), `success`, `warning`, `danger`, `info`.
23683 */
23684 get: function () {
23685 return this._status;
23686 },
23687 set: function (value) {
23688 if (this._status !== value) {
23689 this._status = value;
23690 this.updateStatus();
23691 }
23692 },
23693 enumerable: false,
23694 configurable: true
23695 });
23696 NbRadioGroupComponent.prototype.ngAfterContentInit = function () {
23697 var _this = this;
23698 // In case option 'name' isn't set on nb-radio component,
23699 // we need to set it's name right away, so it won't overlap with options
23700 // without names from other radio groups. Otherwise they all would have
23701 // same name and will be considered as options from one group so only the
23702 // last option will stay selected.
23703 this.updateNames();
23704 this.radios.changes
23705 .pipe(rxjs_operators.startWith(this.radios),
23706 // 'changes' emit during change detection run and we can't update
23707 // option properties right of since they already was initialized.
23708 // Instead we schedule microtask to update radios after change detection
23709 // run is finished and trigger one more change detection run.
23710 rxjs_operators.switchMap(function (radios) { return rxjs.from(Promise.resolve(radios)); }), rxjs_operators.takeUntil(this.destroy$))
23711 .subscribe(function () { return _this.updateAndSubscribeToRadios(); });
23712 };
23713 NbRadioGroupComponent.prototype.ngOnDestroy = function () {
23714 this.destroy$.next();
23715 this.destroy$.complete();
23716 };
23717 NbRadioGroupComponent.prototype.registerOnChange = function (fn) {
23718 this.onChange = fn;
23719 };
23720 NbRadioGroupComponent.prototype.registerOnTouched = function (fn) {
23721 this.onTouched = fn;
23722 };
23723 NbRadioGroupComponent.prototype.writeValue = function (value) {
23724 this.value = value;
23725 };
23726 NbRadioGroupComponent.prototype.setDisabledState = function (isDisabled) {
23727 this.disabled = isDisabled;
23728 };
23729 NbRadioGroupComponent.prototype.updateAndSubscribeToRadios = function () {
23730 this.updateValueFromCheckedOption();
23731 this.updateNames();
23732 this.updateValues();
23733 this.updateDisabled();
23734 this.updateStatus();
23735 this.subscribeOnRadiosValueChange();
23736 this.subscribeOnRadiosBlur();
23737 };
23738 NbRadioGroupComponent.prototype.updateNames = function () {
23739 var _this = this;
23740 if (this.radios) {
23741 this.radios.forEach(function (radio) { return radio._setName(_this.name); });
23742 }
23743 };
23744 NbRadioGroupComponent.prototype.updateValues = function () {
23745 var _this = this;
23746 this.updateAndMarkForCheckRadios(function (radio) { return radio.checked = radio.value === _this.value; });
23747 };
23748 NbRadioGroupComponent.prototype.updateDisabled = function () {
23749 var _this = this;
23750 if (typeof this.disabled !== 'undefined') {
23751 this.updateAndMarkForCheckRadios(function (radio) { return radio.disabled = _this.disabled; });
23752 }
23753 };
23754 NbRadioGroupComponent.prototype.subscribeOnRadiosValueChange = function () {
23755 var _this = this;
23756 if (!this.radios || !this.radios.length) {
23757 return;
23758 }
23759 rxjs.merge.apply(void 0, this.radios.map(function (radio) { return radio.valueChange; })).pipe(rxjs_operators.takeUntil(rxjs.merge(this.radios.changes, this.destroy$)))
23760 .subscribe(function (value) {
23761 _this.writeValue(value);
23762 _this.propagateValue(value);
23763 });
23764 };
23765 NbRadioGroupComponent.prototype.propagateValue = function (value) {
23766 this.valueChange.emit(value);
23767 this.onChange(value);
23768 };
23769 NbRadioGroupComponent.prototype.subscribeOnRadiosBlur = function () {
23770 var _this = this;
23771 var hasNoRadios = !this.radios || !this.radios.length;
23772 if (!_angular_common.isPlatformBrowser(this.platformId) || hasNoRadios) {
23773 return;
23774 }
23775 var hostElement = this.hostElement.nativeElement;
23776 rxjs.fromEvent(hostElement, 'focusin')
23777 .pipe(rxjs_operators.filter(function (event) { return hostElement.contains(event.target); }), rxjs_operators.switchMap(function () { return rxjs.merge(rxjs.fromEvent(_this.document, 'focusin'), rxjs.fromEvent(_this.document, 'click')); }), rxjs_operators.filter(function (event) { return !hostElement.contains(event.target); }), rxjs_operators.takeUntil(rxjs.merge(this.radios.changes, this.destroy$)))
23778 .subscribe(function () { return _this.onTouched(); });
23779 };
23780 NbRadioGroupComponent.prototype.updateStatus = function () {
23781 var _this = this;
23782 this.updateAndMarkForCheckRadios(function (radio) { return radio.status = _this.status; });
23783 };
23784 NbRadioGroupComponent.prototype.updateAndMarkForCheckRadios = function (updateFn) {
23785 if (this.radios) {
23786 this.radios.forEach(function (radio) {
23787 updateFn(radio);
23788 radio._markForCheck();
23789 });
23790 }
23791 };
23792 NbRadioGroupComponent.prototype.updateValueFromCheckedOption = function () {
23793 var checkedRadio = this.radios.find(function (radio) { return radio.checked; });
23794 var isValueMissing = this.value === undefined || this.value === null;
23795 if (checkedRadio && isValueMissing && checkedRadio.value !== this.value) {
23796 this.value = checkedRadio.value;
23797 }
23798 };
23799 NbRadioGroupComponent.decorators = [
23800 { type: i0.Component, args: [{
23801 selector: 'nb-radio-group',
23802 template: "\n <ng-content select=\"nb-radio\"></ng-content>",
23803 providers: [
23804 {
23805 provide: _angular_forms.NG_VALUE_ACCESSOR,
23806 useExisting: i0.forwardRef(function () { return NbRadioGroupComponent; }),
23807 multi: true,
23808 },
23809 ],
23810 changeDetection: i0.ChangeDetectionStrategy.OnPush
23811 },] }
23812 ];
23813 NbRadioGroupComponent.ctorParameters = function () { return [
23814 { type: i0.ElementRef },
23815 { type: undefined, decorators: [{ type: i0.Inject, args: [i0.PLATFORM_ID,] }] },
23816 { type: undefined, decorators: [{ type: i0.Inject, args: [NB_DOCUMENT,] }] }
23817 ]; };
23818 NbRadioGroupComponent.propDecorators = {
23819 value: [{ type: i0.Input }],
23820 name: [{ type: i0.Input }],
23821 disabled: [{ type: i0.Input }],
23822 status: [{ type: i0.Input }],
23823 radios: [{ type: i0.ContentChildren, args: [NbRadioComponent, { descendants: true },] }],
23824 valueChange: [{ type: i0.Output }]
23825 };
23826 return NbRadioGroupComponent;
23827}());
23828
23829/*
23830 * @license
23831 * Copyright Akveo. All Rights Reserved.
23832 * Licensed under the MIT License. See License.txt in the project root for license information.
23833 */
23834var NbRadioModule = /** @class */ (function () {
23835 function NbRadioModule() {
23836 }
23837 NbRadioModule.decorators = [
23838 { type: i0.NgModule, args: [{
23839 imports: [],
23840 exports: [NbRadioComponent, NbRadioGroupComponent],
23841 declarations: [NbRadioComponent, NbRadioGroupComponent],
23842 },] }
23843 ];
23844 return NbRadioModule;
23845}());
23846
23847/**
23848 * @license
23849 * Copyright Akveo. All Rights Reserved.
23850 * Licensed under the MIT License. See License.txt in the project root for license information.
23851 */
23852var tagUniqueId = 0;
23853/**
23854 *
23855 * To show a cross on a tag and enable `remove` event add the `removable` attribute.
23856 * @stacked-example(Removable tags, tag/tag-removable.component)
23857 *
23858 * You can change appearance via `appearance` input:
23859 * @stacked-example(Tag Appearance, tag/tag-appearance.component)
23860 *
23861 * You can change status via `status` input:
23862 * @stacked-example(Tag Status, tag/tag-status.component)
23863 *
23864 * @styles
23865 *
23866 * tag-text-font-family:
23867 * tag-text-transform:
23868 * tag-border-width:
23869 * tag-border-style:
23870 * tag-border-radius:
23871 * tag-tiny-text-font-size:
23872 * tag-tiny-text-font-weight:
23873 * tag-tiny-text-line-height:
23874 * tag-tiny-padding:
23875 * tag-tiny-close-offset:
23876 * tag-small-text-font-size:
23877 * tag-small-text-font-weight:
23878 * tag-small-text-line-height:
23879 * tag-small-padding:
23880 * tag-small-close-offset:
23881 * tag-medium-text-font-size:
23882 * tag-medium-text-font-weight:
23883 * tag-medium-text-line-height:
23884 * tag-medium-padding:
23885 * tag-medium-close-offset:
23886 * tag-large-text-font-size:
23887 * tag-large-text-font-weight:
23888 * tag-large-text-line-height:
23889 * tag-large-padding:
23890 * tag-large-close-offset:
23891 * tag-giant-text-font-size:
23892 * tag-giant-text-font-weight:
23893 * tag-giant-text-line-height:
23894 * tag-giant-padding:
23895 * tag-giant-close-offset:
23896 * tag-filled-basic-background-color:
23897 * tag-filled-basic-border-color:
23898 * tag-filled-basic-text-color:
23899 * tag-filled-basic-active-background-color:
23900 * tag-filled-basic-active-border-color:
23901 * tag-filled-basic-hover-background-color:
23902 * tag-filled-basic-hover-border-color:
23903 * tag-filled-basic-selected-background-color:
23904 * tag-filled-basic-selected-border-color:
23905 * tag-filled-primary-background-color:
23906 * tag-filled-primary-border-color:
23907 * tag-filled-primary-text-color:
23908 * tag-filled-primary-active-background-color:
23909 * tag-filled-primary-active-border-color:
23910 * tag-filled-primary-hover-background-color:
23911 * tag-filled-primary-hover-border-color:
23912 * tag-filled-primary-selected-background-color:
23913 * tag-filled-primary-selected-border-color:
23914 * tag-filled-success-background-color:
23915 * tag-filled-success-border-color:
23916 * tag-filled-success-text-color:
23917 * tag-filled-success-active-background-color:
23918 * tag-filled-success-active-border-color:
23919 * tag-filled-success-hover-background-color:
23920 * tag-filled-success-hover-border-color:
23921 * tag-filled-success-selected-background-color:
23922 * tag-filled-success-selected-border-color:
23923 * tag-filled-info-background-color:
23924 * tag-filled-info-border-color:
23925 * tag-filled-info-text-color:
23926 * tag-filled-info-active-background-color:
23927 * tag-filled-info-active-border-color:
23928 * tag-filled-info-hover-background-color:
23929 * tag-filled-info-hover-border-color:
23930 * tag-filled-info-selected-background-color:
23931 * tag-filled-info-selected-border-color:
23932 * tag-filled-warning-background-color:
23933 * tag-filled-warning-border-color:
23934 * tag-filled-warning-text-color:
23935 * tag-filled-warning-active-background-color:
23936 * tag-filled-warning-active-border-color:
23937 * tag-filled-warning-hover-background-color:
23938 * tag-filled-warning-hover-border-color:
23939 * tag-filled-warning-selected-background-color:
23940 * tag-filled-warning-selected-border-color:
23941 * tag-filled-danger-background-color:
23942 * tag-filled-danger-border-color:
23943 * tag-filled-danger-text-color:
23944 * tag-filled-danger-active-background-color:
23945 * tag-filled-danger-active-border-color:
23946 * tag-filled-danger-hover-background-color:
23947 * tag-filled-danger-hover-border-color:
23948 * tag-filled-danger-selected-background-color:
23949 * tag-filled-danger-selected-border-color:
23950 * tag-filled-control-background-color:
23951 * tag-filled-control-border-color:
23952 * tag-filled-control-text-color:
23953 * tag-filled-control-active-background-color:
23954 * tag-filled-control-active-border-color:
23955 * tag-filled-control-hover-background-color:
23956 * tag-filled-control-hover-border-color:
23957 * tag-filled-control-selected-background-color:
23958 * tag-filled-control-selected-border-color:
23959 * tag-outline-basic-background-color:
23960 * tag-outline-basic-border-color:
23961 * tag-outline-basic-text-color:
23962 * tag-outline-basic-active-background-color:
23963 * tag-outline-basic-active-border-color:
23964 * tag-outline-basic-active-text-color:
23965 * tag-outline-basic-hover-background-color:
23966 * tag-outline-basic-hover-border-color:
23967 * tag-outline-basic-hover-text-color:
23968 * tag-outline-basic-selected-background-color:
23969 * tag-outline-basic-selected-border-color:
23970 * tag-outline-basic-selected-text-color:
23971 * tag-outline-primary-background-color:
23972 * tag-outline-primary-border-color:
23973 * tag-outline-primary-text-color:
23974 * tag-outline-primary-active-background-color:
23975 * tag-outline-primary-active-border-color:
23976 * tag-outline-primary-active-text-color:
23977 * tag-outline-primary-hover-background-color:
23978 * tag-outline-primary-hover-border-color:
23979 * tag-outline-primary-hover-text-color:
23980 * tag-outline-primary-selected-background-color:
23981 * tag-outline-primary-selected-border-color:
23982 * tag-outline-primary-selected-text-color:
23983 * tag-outline-success-background-color:
23984 * tag-outline-success-border-color:
23985 * tag-outline-success-text-color:
23986 * tag-outline-success-active-background-color:
23987 * tag-outline-success-active-border-color:
23988 * tag-outline-success-active-text-color:
23989 * tag-outline-success-hover-background-color:
23990 * tag-outline-success-hover-border-color:
23991 * tag-outline-success-hover-text-color:
23992 * tag-outline-success-selected-background-color:
23993 * tag-outline-success-selected-border-color:
23994 * tag-outline-success-selected-text-color:
23995 * tag-outline-info-background-color:
23996 * tag-outline-info-border-color:
23997 * tag-outline-info-text-color:
23998 * tag-outline-info-active-background-color:
23999 * tag-outline-info-active-border-color:
24000 * tag-outline-info-active-text-color:
24001 * tag-outline-info-hover-background-color:
24002 * tag-outline-info-hover-border-color:
24003 * tag-outline-info-hover-text-color:
24004 * tag-outline-info-selected-background-color:
24005 * tag-outline-info-selected-border-color:
24006 * tag-outline-info-selected-text-color:
24007 * tag-outline-warning-background-color:
24008 * tag-outline-warning-border-color:
24009 * tag-outline-warning-text-color:
24010 * tag-outline-warning-active-background-color:
24011 * tag-outline-warning-active-border-color:
24012 * tag-outline-warning-active-text-color:
24013 * tag-outline-warning-hover-background-color:
24014 * tag-outline-warning-hover-border-color:
24015 * tag-outline-warning-hover-text-color:
24016 * tag-outline-warning-selected-background-color:
24017 * tag-outline-warning-selected-border-color:
24018 * tag-outline-warning-selected-text-color:
24019 * tag-outline-danger-background-color:
24020 * tag-outline-danger-border-color:
24021 * tag-outline-danger-text-color:
24022 * tag-outline-danger-active-background-color:
24023 * tag-outline-danger-active-border-color:
24024 * tag-outline-danger-active-text-color:
24025 * tag-outline-danger-hover-background-color:
24026 * tag-outline-danger-hover-border-color:
24027 * tag-outline-danger-hover-text-color:
24028 * tag-outline-danger-selected-background-color:
24029 * tag-outline-danger-selected-border-color:
24030 * tag-outline-danger-selected-text-color:
24031 * tag-outline-control-background-color:
24032 * tag-outline-control-border-color:
24033 * tag-outline-control-text-color:
24034 * tag-outline-control-active-background-color:
24035 * tag-outline-control-active-border-color:
24036 * tag-outline-control-active-text-color:
24037 * tag-outline-control-hover-background-color:
24038 * tag-outline-control-hover-border-color:
24039 * tag-outline-control-hover-text-color:
24040 * tag-outline-control-selected-background-color:
24041 * tag-outline-control-selected-border-color:
24042 * tag-outline-control-selected-text-color:
24043 */
24044var NbTagComponent = /** @class */ (function () {
24045 function NbTagComponent(_hostElement, cd, renderer, zone, statusService) {
24046 this._hostElement = _hostElement;
24047 this.cd = cd;
24048 this.renderer = renderer;
24049 this.zone = zone;
24050 this.statusService = statusService;
24051 this._destroy$ = new rxjs.Subject();
24052 this._selected = false;
24053 this._removable = false;
24054 /**
24055 * Tag appearance: `filled`, `outline`.
24056 */
24057 this.appearance = 'filled';
24058 /**
24059 * Tag status: `basic`, `primary`, `info`, `success`, `warning`, `danger`, `control`.
24060 */
24061 this.status = 'basic';
24062 /**
24063 * Tag size: `tiny`, `small`, `medium`, `large`, `giant`.
24064 */
24065 this.size = 'medium';
24066 this.role = 'option';
24067 /**
24068 * Emits when the user removes the tag
24069 * (whether by clicking on the remove button or by pressing `delete` or `backspace` key).
24070 */
24071 this.remove = new i0.EventEmitter();
24072 this.selectedChange = new i0.EventEmitter();
24073 this._isActive = false;
24074 this._id = "nb-tag-" + tagUniqueId++;
24075 }
24076 Object.defineProperty(NbTagComponent.prototype, "destroy$", {
24077 get: function () {
24078 return this._destroy$.asObservable();
24079 },
24080 enumerable: false,
24081 configurable: true
24082 });
24083 Object.defineProperty(NbTagComponent.prototype, "selected", {
24084 get: function () {
24085 return this._selected;
24086 },
24087 set: function (value) {
24088 if (this.selected !== convertToBoolProperty(value)) {
24089 this._selected = !this.selected;
24090 this.selectedChange.emit({ tag: this, selected: this.selected });
24091 }
24092 },
24093 enumerable: false,
24094 configurable: true
24095 });
24096 Object.defineProperty(NbTagComponent.prototype, "removable", {
24097 /**
24098 * Controls whether the user can remove a tag or not.
24099 */
24100 get: function () {
24101 return this._removable;
24102 },
24103 set: function (value) {
24104 this._removable = convertToBoolProperty(value);
24105 },
24106 enumerable: false,
24107 configurable: true
24108 });
24109 Object.defineProperty(NbTagComponent.prototype, "filled", {
24110 get: function () {
24111 return this.appearance === 'filled';
24112 },
24113 set: function (value) {
24114 if (convertToBoolProperty(value)) {
24115 this.appearance = 'filled';
24116 }
24117 },
24118 enumerable: false,
24119 configurable: true
24120 });
24121 Object.defineProperty(NbTagComponent.prototype, "outline", {
24122 get: function () {
24123 return this.appearance === 'outline';
24124 },
24125 set: function (value) {
24126 if (convertToBoolProperty(value)) {
24127 this.appearance = 'outline';
24128 }
24129 },
24130 enumerable: false,
24131 configurable: true
24132 });
24133 Object.defineProperty(NbTagComponent.prototype, "basic", {
24134 get: function () {
24135 return this.status === 'basic';
24136 },
24137 enumerable: false,
24138 configurable: true
24139 });
24140 Object.defineProperty(NbTagComponent.prototype, "primary", {
24141 get: function () {
24142 return this.status === 'primary';
24143 },
24144 enumerable: false,
24145 configurable: true
24146 });
24147 Object.defineProperty(NbTagComponent.prototype, "success", {
24148 get: function () {
24149 return this.status === 'success';
24150 },
24151 enumerable: false,
24152 configurable: true
24153 });
24154 Object.defineProperty(NbTagComponent.prototype, "info", {
24155 get: function () {
24156 return this.status === 'info';
24157 },
24158 enumerable: false,
24159 configurable: true
24160 });
24161 Object.defineProperty(NbTagComponent.prototype, "warning", {
24162 get: function () {
24163 return this.status === 'warning';
24164 },
24165 enumerable: false,
24166 configurable: true
24167 });
24168 Object.defineProperty(NbTagComponent.prototype, "danger", {
24169 get: function () {
24170 return this.status === 'danger';
24171 },
24172 enumerable: false,
24173 configurable: true
24174 });
24175 Object.defineProperty(NbTagComponent.prototype, "control", {
24176 get: function () {
24177 return this.status === 'control';
24178 },
24179 enumerable: false,
24180 configurable: true
24181 });
24182 Object.defineProperty(NbTagComponent.prototype, "tiny", {
24183 get: function () {
24184 return this.size === 'tiny';
24185 },
24186 enumerable: false,
24187 configurable: true
24188 });
24189 Object.defineProperty(NbTagComponent.prototype, "small", {
24190 get: function () {
24191 return this.size === 'small';
24192 },
24193 enumerable: false,
24194 configurable: true
24195 });
24196 Object.defineProperty(NbTagComponent.prototype, "medium", {
24197 get: function () {
24198 return this.size === 'medium';
24199 },
24200 enumerable: false,
24201 configurable: true
24202 });
24203 Object.defineProperty(NbTagComponent.prototype, "large", {
24204 get: function () {
24205 return this.size === 'large';
24206 },
24207 enumerable: false,
24208 configurable: true
24209 });
24210 Object.defineProperty(NbTagComponent.prototype, "giant", {
24211 get: function () {
24212 return this.size === 'giant';
24213 },
24214 enumerable: false,
24215 configurable: true
24216 });
24217 Object.defineProperty(NbTagComponent.prototype, "additionalClasses", {
24218 get: function () {
24219 if (this.statusService.isCustomStatus(this.status)) {
24220 return [this.statusService.getStatusClass(this.status)];
24221 }
24222 return [];
24223 },
24224 enumerable: false,
24225 configurable: true
24226 });
24227 NbTagComponent.prototype._remove = function () {
24228 if (this.removable) {
24229 this.remove.emit(this);
24230 }
24231 };
24232 NbTagComponent.prototype.ngAfterViewInit = function () {
24233 var _this = this;
24234 // TODO: #2254
24235 this.zone.runOutsideAngular(function () { return setTimeout(function () {
24236 _this.renderer.addClass(_this._hostElement.nativeElement, 'nb-transition');
24237 }); });
24238 };
24239 NbTagComponent.prototype.ngOnDestroy = function () {
24240 this._destroy$.next(this);
24241 };
24242 NbTagComponent.prototype._toggleSelection = function () {
24243 this.selected = !this.selected;
24244 this.cd.markForCheck();
24245 };
24246 NbTagComponent.prototype.setActiveStyles = function () {
24247 if (!this._isActive) {
24248 this._isActive = true;
24249 this.cd.markForCheck();
24250 }
24251 };
24252 NbTagComponent.prototype.setInactiveStyles = function () {
24253 if (this._isActive) {
24254 this._isActive = false;
24255 this.cd.markForCheck();
24256 }
24257 };
24258 NbTagComponent.decorators = [
24259 { type: i0.Component, args: [{
24260 selector: 'nb-tag',
24261 template: "{{ text }}\n<nb-icon *ngIf=\"removable\"\n (click)=\"_remove()\"\n class=\"nb-tag-remove size-{{size}}\"\n icon=\"close-outline\"\n pack=\"nebular-essentials\"\n aria-hidden=\"true\">\n</nb-icon>\n",
24262 exportAs: 'nbTag',
24263 changeDetection: i0.ChangeDetectionStrategy.OnPush
24264 },] }
24265 ];
24266 NbTagComponent.ctorParameters = function () { return [
24267 { type: i0.ElementRef },
24268 { type: i0.ChangeDetectorRef },
24269 { type: i0.Renderer2 },
24270 { type: i0.NgZone },
24271 { type: NbStatusService }
24272 ]; };
24273 NbTagComponent.propDecorators = {
24274 text: [{ type: i0.Input }],
24275 selected: [{ type: i0.Input }, { type: i0.HostBinding, args: ['class.selected',] }, { type: i0.HostBinding, args: ['attr.aria-selected',] }],
24276 removable: [{ type: i0.Input }],
24277 appearance: [{ type: i0.Input }],
24278 status: [{ type: i0.Input }],
24279 size: [{ type: i0.Input }],
24280 role: [{ type: i0.Input }, { type: i0.HostBinding, args: ['attr.role',] }],
24281 remove: [{ type: i0.Output }],
24282 selectedChange: [{ type: i0.Output }],
24283 _isActive: [{ type: i0.HostBinding, args: ['class.active',] }],
24284 _id: [{ type: i0.HostBinding, args: ['attr.id',] }],
24285 filled: [{ type: i0.HostBinding, args: ['class.appearance-filled',] }],
24286 outline: [{ type: i0.HostBinding, args: ['class.appearance-outline',] }],
24287 basic: [{ type: i0.HostBinding, args: ['class.status-basic',] }],
24288 primary: [{ type: i0.HostBinding, args: ['class.status-primary',] }],
24289 success: [{ type: i0.HostBinding, args: ['class.status-success',] }],
24290 info: [{ type: i0.HostBinding, args: ['class.status-info',] }],
24291 warning: [{ type: i0.HostBinding, args: ['class.status-warning',] }],
24292 danger: [{ type: i0.HostBinding, args: ['class.status-danger',] }],
24293 control: [{ type: i0.HostBinding, args: ['class.status-control',] }],
24294 tiny: [{ type: i0.HostBinding, args: ['class.size-tiny',] }],
24295 small: [{ type: i0.HostBinding, args: ['class.size-small',] }],
24296 medium: [{ type: i0.HostBinding, args: ['class.size-medium',] }],
24297 large: [{ type: i0.HostBinding, args: ['class.size-large',] }],
24298 giant: [{ type: i0.HostBinding, args: ['class.size-giant',] }],
24299 additionalClasses: [{ type: i0.HostBinding, args: ['class',] }],
24300 _remove: [{ type: i0.HostListener, args: ['keydown.delete',] }, { type: i0.HostListener, args: ['keydown.backspace',] }]
24301 };
24302 return NbTagComponent;
24303}());
24304
24305/**
24306 * @license
24307 * Copyright Akveo. All Rights Reserved.
24308 * Licensed under the MIT License. See License.txt in the project root for license information.
24309 */
24310/**
24311 *
24312 * `[nbTagInput]` directive connects input with a `nb-tag-list` component.
24313 *
24314 * @stacked-example(Tag Input, tag/tag-input.component)
24315 *
24316 * @additional-example(Tag Input with Autocomplete, tag/tag-input-with-autocomplete.component)
24317 *
24318 * @styles
24319 *
24320 * tag-list-tiny-tag-offset:
24321 * tag-list-small-tag-offset:
24322 * tag-list-medium-tag-offset:
24323 * tag-list-large-tag-offset:
24324 * tag-list-giant-tag-offset:
24325 * tag-list-with-input-tiny-padding:
24326 * tag-list-with-input-small-padding:
24327 * tag-list-with-input-medium-padding:
24328 * tag-list-with-input-large-padding:
24329 * tag-list-with-input-giant-padding:
24330 */
24331var NbTagInputDirective = /** @class */ (function (_super) {
24332 tslib.__extends(NbTagInputDirective, _super);
24333 function NbTagInputDirective(_hostElement, focusMonitor, renderer, zone, statusService) {
24334 var _this = _super.call(this, _hostElement, focusMonitor, renderer, zone, statusService) || this;
24335 _this._hostElement = _hostElement;
24336 _this.focusMonitor = focusMonitor;
24337 _this.renderer = renderer;
24338 _this.zone = zone;
24339 _this.statusService = statusService;
24340 _this.keyDown$ = new rxjs.Subject();
24341 /**
24342 * Controls which keys should trigger tag add event.
24343 */
24344 _this.separatorKeys = [_angular_cdk_keycodes.ENTER];
24345 /**
24346 * Emits when a tag need to be added.
24347 */
24348 _this.tagAdd = new i0.EventEmitter();
24349 _this.nbTagInputClass = true;
24350 return _this;
24351 }
24352 Object.defineProperty(NbTagInputDirective.prototype, "_value", {
24353 get: function () {
24354 return this._hostElement.nativeElement.value;
24355 },
24356 enumerable: false,
24357 configurable: true
24358 });
24359 NbTagInputDirective.prototype._onKeydown = function (event) {
24360 this.keyDown$.next(event);
24361 };
24362 NbTagInputDirective.prototype.ngAfterViewInit = function () {
24363 var _this = this;
24364 _super.prototype.ngAfterViewInit.call(this);
24365 this.keyDown$
24366 .pipe(rxjs_operators.filter(function (_a) {
24367 var keyCode = _a.keyCode;
24368 return _this.isSeparatorKey(keyCode);
24369 }), rxjs_operators.map(function () { return _this._value; }), rxjs_operators.takeUntil(this.destroy$))
24370 .subscribe(function (value) { return _this.tagAdd.emit({ value: value, input: _this._hostElement }); });
24371 };
24372 NbTagInputDirective.prototype.isSeparatorKey = function (keyCode) {
24373 return this.separatorKeys.includes(keyCode);
24374 };
24375 NbTagInputDirective.decorators = [
24376 { type: i0.Directive, args: [{
24377 selector: 'input[nbTagInput]',
24378 exportAs: 'nbTagInput',
24379 providers: [
24380 { provide: NbFormFieldControl, useExisting: NbTagInputDirective },
24381 ],
24382 },] }
24383 ];
24384 NbTagInputDirective.ctorParameters = function () { return [
24385 { type: i0.ElementRef },
24386 { type: NbFocusMonitor },
24387 { type: i0.Renderer2 },
24388 { type: i0.NgZone },
24389 { type: NbStatusService }
24390 ]; };
24391 NbTagInputDirective.propDecorators = {
24392 separatorKeys: [{ type: i0.Input }],
24393 tagAdd: [{ type: i0.Output }],
24394 nbTagInputClass: [{ type: i0.HostBinding, args: ['class.nb-tag-input',] }],
24395 _onKeydown: [{ type: i0.HostListener, args: ['keydown', ['$event'],] }]
24396 };
24397 return NbTagInputDirective;
24398}(NbInputDirective));
24399
24400/**
24401 * @license
24402 * Copyright Akveo. All Rights Reserved.
24403 * Licensed under the MIT License. See License.txt in the project root for license information.
24404 */
24405/**
24406 *
24407 * `nb-tag-list` component displays a list of `nb-tag` components.
24408 *
24409 * @stacked-example(Tag List Showcase, tag/tag-showcase.component)
24410 *
24411 * @styles
24412 *
24413 * tag-list-tiny-tag-offset:
24414 * tag-list-small-tag-offset:
24415 * tag-list-medium-tag-offset:
24416 * tag-list-large-tag-offset:
24417 * tag-list-giant-tag-offset:
24418 * tag-list-with-input-tiny-padding:
24419 * tag-list-with-input-small-padding:
24420 * tag-list-with-input-medium-padding:
24421 * tag-list-with-input-large-padding:
24422 * tag-list-with-input-giant-padding:
24423 * tag-list-with-input-rectangle-border-radius:
24424 * tag-list-with-input-semi-round-border-radius:
24425 * tag-list-with-input-round-border-radius:
24426 */
24427var NbTagListComponent = /** @class */ (function () {
24428 function NbTagListComponent(hostElement, cd, renderer, zone, focusMonitor, activeDescendantKeyManagerFactory, directionService, statusService) {
24429 this.hostElement = hostElement;
24430 this.cd = cd;
24431 this.renderer = renderer;
24432 this.zone = zone;
24433 this.focusMonitor = focusMonitor;
24434 this.activeDescendantKeyManagerFactory = activeDescendantKeyManagerFactory;
24435 this.directionService = directionService;
24436 this.statusService = statusService;
24437 this.destroy$ = new rxjs.Subject();
24438 this.keyDown$ = new rxjs.Subject();
24439 this.tagClick$ = new rxjs.Subject();
24440 this.focused = false;
24441 /**
24442 * Controls tags offset.
24443 */
24444 this.size = 'medium';
24445 this.tabIndex = 0;
24446 this.role = 'listbox';
24447 this._multiple = false;
24448 this.activeTagId = null;
24449 /**
24450 * Emits when tag need to be removed (whether because of click on the remove button
24451 * or when `delete` or `backspace` key pressed).
24452 */
24453 this.tagRemove = new i0.EventEmitter();
24454 }
24455 Object.defineProperty(NbTagListComponent.prototype, "multiple", {
24456 get: function () {
24457 return this._multiple;
24458 },
24459 set: function (value) {
24460 this._multiple = convertToBoolProperty(value);
24461 },
24462 enumerable: false,
24463 configurable: true
24464 });
24465 Object.defineProperty(NbTagListComponent.prototype, "_hasInput", {
24466 get: function () {
24467 return !!this.tagInput;
24468 },
24469 enumerable: false,
24470 configurable: true
24471 });
24472 Object.defineProperty(NbTagListComponent.prototype, "_isFocused", {
24473 get: function () {
24474 return this.focused;
24475 },
24476 enumerable: false,
24477 configurable: true
24478 });
24479 Object.defineProperty(NbTagListComponent.prototype, "_isFullWidth", {
24480 get: function () {
24481 var _a;
24482 return !!((_a = this.tagInput) === null || _a === void 0 ? void 0 : _a.fullWidth);
24483 },
24484 enumerable: false,
24485 configurable: true
24486 });
24487 Object.defineProperty(NbTagListComponent.prototype, "_inputClasses", {
24488 get: function () {
24489 if (this._hasInput) {
24490 return [
24491 "shape-" + this.tagInput.shape,
24492 "size-" + this.tagInput.fieldSize,
24493 this.statusService.getStatusClass(this.tagInput.status),
24494 ];
24495 }
24496 return ["size-" + this.size];
24497 },
24498 enumerable: false,
24499 configurable: true
24500 });
24501 NbTagListComponent.prototype._onKeydown = function (event) {
24502 this.keyDown$.next(event);
24503 };
24504 NbTagListComponent.prototype._onClick = function (_a) {
24505 var target = _a.target;
24506 var clickedTag = this.tags.find(function (tag) { return tag._hostElement.nativeElement === target; });
24507 if (clickedTag) {
24508 this.tagClick$.next(clickedTag);
24509 }
24510 };
24511 NbTagListComponent.prototype.ngOnInit = function () {
24512 var _this = this;
24513 this.focusMonitor.monitor(this.hostElement, true)
24514 .pipe(rxjs_operators.map(function (origin) { return !!origin; }), rxjs_operators.finalize(function () { return _this.focusMonitor.stopMonitoring(_this.hostElement); }), rxjs_operators.takeUntil(this.destroy$))
24515 .subscribe(function (isFocused) { return _this.onFocusChange(isFocused); });
24516 };
24517 NbTagListComponent.prototype.ngAfterContentInit = function () {
24518 this.initKeyManager();
24519 this.setAutocompleteCustomHost();
24520 };
24521 NbTagListComponent.prototype.ngAfterViewInit = function () {
24522 var _this = this;
24523 this.listenToLayoutDirectionChange();
24524 this.listenListKeyDown();
24525 this.listenInputKeyDown();
24526 this.listenTagClick();
24527 this.listenTagRemove();
24528 this.listenTagDestroy();
24529 this.listenActiveTagChange();
24530 this.listenNoTags();
24531 // TODO: #2254
24532 this.zone.runOutsideAngular(function () { return setTimeout(function () {
24533 _this.renderer.addClass(_this.hostElement.nativeElement, 'nb-transition');
24534 }); });
24535 };
24536 NbTagListComponent.prototype.ngOnDestroy = function () {
24537 this.destroy$.next();
24538 };
24539 NbTagListComponent.prototype.initKeyManager = function () {
24540 this.keyManager = this.activeDescendantKeyManagerFactory
24541 .create(this.tags)
24542 .withHorizontalOrientation(this.directionService.getDirection())
24543 .withWrap();
24544 };
24545 NbTagListComponent.prototype.listenToLayoutDirectionChange = function () {
24546 var _this = this;
24547 this.directionService.onDirectionChange()
24548 .pipe(rxjs_operators.takeUntil(this.destroy$))
24549 .subscribe(function (direction) { return _this.keyManager.withHorizontalOrientation(direction); });
24550 };
24551 NbTagListComponent.prototype.listenListKeyDown = function () {
24552 var _this = this;
24553 var tagListKeyDown$ = this.keyDown$
24554 .pipe(rxjs_operators.filter(function (_a) {
24555 var target = _a.target;
24556 return target === _this.hostElement.nativeElement;
24557 }));
24558 var activeTagKeyDown$ = tagListKeyDown$
24559 .pipe(rxjs_operators.filter(function () { return !!_this.keyManager.activeItem; }));
24560 tagListKeyDown$
24561 .pipe(rxjs_operators.takeUntil(this.destroy$))
24562 .subscribe(function (event) { return _this.keyManager.onKeydown(event); });
24563 activeTagKeyDown$
24564 .pipe(rxjs_operators.filter(function (_a) {
24565 var keyCode = _a.keyCode;
24566 return keyCode === _angular_cdk_keycodes.SPACE;
24567 }), rxjs_operators.takeUntil(this.destroy$))
24568 .subscribe(function (event) {
24569 _this.toggleTag(_this.keyManager.activeItem);
24570 // Prevents page scroll.
24571 event.preventDefault();
24572 });
24573 activeTagKeyDown$
24574 .pipe(rxjs_operators.filter(function (_a) {
24575 var keyCode = _a.keyCode;
24576 return _this.isBackspaceOrDelete(keyCode);
24577 }), rxjs_operators.map(function () { return _this.keyManager.activeItem; }), rxjs_operators.takeUntil(this.destroy$))
24578 .subscribe(function (tagToRemove) { return tagToRemove._remove(); });
24579 };
24580 NbTagListComponent.prototype.listenInputKeyDown = function () {
24581 var _this = this;
24582 var inputKeyDown$ = this.keyDown$
24583 .pipe(rxjs_operators.filter(function (_a) {
24584 var _b;
24585 var target = _a.target;
24586 return target === ((_b = _this.tagInput) === null || _b === void 0 ? void 0 : _b._hostElement.nativeElement);
24587 }));
24588 inputKeyDown$
24589 .pipe(rxjs_operators.filter(function (_a) {
24590 var keyCode = _a.keyCode;
24591 return _this.tagInput._value === '' && _this.isBackspaceOrDelete(keyCode) && _this.tags.length > 0;
24592 }), rxjs_operators.takeUntil(this.destroy$))
24593 .subscribe(function () {
24594 _this.hostElement.nativeElement.focus();
24595 _this.keyManager.setLastItemActive();
24596 _this.cd.markForCheck();
24597 });
24598 };
24599 NbTagListComponent.prototype.listenTagClick = function () {
24600 var _this = this;
24601 this.tagClick$
24602 .pipe(rxjs_operators.takeUntil(this.destroy$))
24603 .subscribe(function (clickedTag) {
24604 _this.toggleTag(clickedTag);
24605 _this.keyManager.setActiveItem(clickedTag);
24606 });
24607 };
24608 NbTagListComponent.prototype.listenTagRemove = function () {
24609 var _this = this;
24610 this.tags.changes
24611 .pipe(rxjs_operators.startWith(this.tags), rxjs_operators.switchMap(function (tags) { return rxjs.merge.apply(void 0, tags.map(function (tag) { return tag.remove; })); }), rxjs_operators.takeUntil(this.destroy$))
24612 .subscribe(function (tagToRemove) { return _this.tagRemove.emit(tagToRemove); });
24613 };
24614 NbTagListComponent.prototype.listenTagDestroy = function () {
24615 var _this = this;
24616 this.tags.changes
24617 .pipe(rxjs_operators.startWith(this.tags), rxjs_operators.switchMap(function (tags) { return rxjs.merge.apply(void 0, tags.map(function (tag) { return tag.destroy$; })); }), rxjs_operators.filter(function (destroyedTag) { return destroyedTag === _this.keyManager.activeItem; }), rxjs_operators.map(function (destroyedTag) { return destroyedTag === _this.tags.last; }), rxjs_operators.takeUntil(this.destroy$))
24618 .subscribe(function (isLastTagDestroyed) {
24619 if (isLastTagDestroyed) {
24620 _this.keyManager.setPreviousItemActive();
24621 }
24622 else {
24623 _this.keyManager.setNextItemActive();
24624 }
24625 });
24626 };
24627 NbTagListComponent.prototype.listenNoTags = function () {
24628 var _this = this;
24629 this.tags.changes
24630 .pipe(rxjs_operators.startWith(this.tags), rxjs_operators.filter(function (tags) { return tags.length === 0; }), rxjs_operators.takeUntil(this.destroy$))
24631 .subscribe(function () { return _this.focusInputIfActive(); });
24632 };
24633 NbTagListComponent.prototype.listenActiveTagChange = function () {
24634 var _this = this;
24635 this.keyManager.change
24636 .pipe(rxjs_operators.map(function () { var _a; return (_a = _this.keyManager.activeItem) === null || _a === void 0 ? void 0 : _a._id; }), rxjs_operators.takeUntil(this.destroy$))
24637 .subscribe(function (activeTagId) {
24638 _this.activeTagId = activeTagId;
24639 _this.cd.markForCheck();
24640 });
24641 };
24642 NbTagListComponent.prototype.onFocusChange = function (isFocused) {
24643 var _a;
24644 this.focused = isFocused;
24645 this.cd.markForCheck();
24646 if (!isFocused || ((_a = this.tagInput) === null || _a === void 0 ? void 0 : _a.focused$.value)) {
24647 this.keyManager.setActiveItem(-1);
24648 return;
24649 }
24650 // Focus input when focusing tag list without tags. Otherwise select first tag.
24651 if (this.tags.length === 0 && this._hasInput) {
24652 this.focusInput();
24653 }
24654 else {
24655 this.keyManager.setFirstItemActive();
24656 }
24657 };
24658 NbTagListComponent.prototype.isBackspaceOrDelete = function (keyCode) {
24659 return keyCode === _angular_cdk_keycodes.BACKSPACE || keyCode === _angular_cdk_keycodes.DELETE;
24660 };
24661 NbTagListComponent.prototype.setAutocompleteCustomHost = function () {
24662 if (this.autocompleteDirective) {
24663 this.autocompleteDirective.customOverlayHost = this.hostElement;
24664 }
24665 };
24666 NbTagListComponent.prototype.toggleTag = function (tagToToggle) {
24667 tagToToggle._toggleSelection();
24668 if (tagToToggle.selected && !this.multiple) {
24669 this.tags.forEach(function (tag) {
24670 if (tag !== tagToToggle) {
24671 tag.selected = false;
24672 }
24673 });
24674 }
24675 };
24676 NbTagListComponent.prototype.focusInput = function () {
24677 if (this._hasInput) {
24678 this.tagInput._hostElement.nativeElement.focus();
24679 }
24680 };
24681 NbTagListComponent.prototype.focusInputIfActive = function () {
24682 if (this._isFocused) {
24683 this.focusInput();
24684 }
24685 };
24686 NbTagListComponent.decorators = [
24687 { type: i0.Component, args: [{
24688 selector: 'nb-tag-list',
24689 template: "\n <div class=\"nb-tag-list-tags-wrapper\">\n <ng-content select=\"nb-tag, input[nbTagInput]\"></ng-content>\n </div>\n ",
24690 exportAs: 'nbTagList',
24691 changeDetection: i0.ChangeDetectionStrategy.OnPush
24692 },] }
24693 ];
24694 NbTagListComponent.ctorParameters = function () { return [
24695 { type: i0.ElementRef },
24696 { type: i0.ChangeDetectorRef },
24697 { type: i0.Renderer2 },
24698 { type: i0.NgZone },
24699 { type: NbFocusMonitor },
24700 { type: NbActiveDescendantKeyManagerFactoryService },
24701 { type: NbLayoutDirectionService },
24702 { type: NbStatusService }
24703 ]; };
24704 NbTagListComponent.propDecorators = {
24705 tags: [{ type: i0.ContentChildren, args: [NbTagComponent,] }],
24706 tagInput: [{ type: i0.ContentChild, args: [NbTagInputDirective,] }],
24707 autocompleteDirective: [{ type: i0.ContentChild, args: [NbAutocompleteDirective,] }],
24708 size: [{ type: i0.Input }],
24709 tabIndex: [{ type: i0.Input }, { type: i0.HostBinding, args: ['attr.tabindex',] }],
24710 role: [{ type: i0.Input }, { type: i0.HostBinding, args: ['attr.role',] }],
24711 multiple: [{ type: i0.Input }, { type: i0.HostBinding, args: ['attr.aria-multiselectable',] }],
24712 activeTagId: [{ type: i0.HostBinding, args: ['attr.aria-activedescendant',] }],
24713 tagRemove: [{ type: i0.Output }],
24714 _hasInput: [{ type: i0.HostBinding, args: ['class.nb-tag-list-with-input',] }],
24715 _isFocused: [{ type: i0.HostBinding, args: ['class.focus',] }],
24716 _isFullWidth: [{ type: i0.HostBinding, args: ['class.input-full-width',] }],
24717 _inputClasses: [{ type: i0.HostBinding, args: ['class',] }],
24718 _onKeydown: [{ type: i0.HostListener, args: ['keydown', ['$event'],] }],
24719 _onClick: [{ type: i0.HostListener, args: ['click', ['$event'],] }]
24720 };
24721 return NbTagListComponent;
24722}());
24723
24724/**
24725 * @license
24726 * Copyright Akveo. All Rights Reserved.
24727 * Licensed under the MIT License. See License.txt in the project root for license information.
24728 */
24729var NbTagModule = /** @class */ (function () {
24730 function NbTagModule() {
24731 }
24732 NbTagModule.decorators = [
24733 { type: i0.NgModule, args: [{
24734 imports: [
24735 _angular_common.CommonModule,
24736 NbIconModule,
24737 ],
24738 declarations: [
24739 NbTagComponent,
24740 NbTagListComponent,
24741 NbTagInputDirective,
24742 ],
24743 exports: [
24744 NbTagComponent,
24745 NbTagListComponent,
24746 NbTagInputDirective,
24747 ],
24748 },] }
24749 ];
24750 return NbTagModule;
24751}());
24752
24753/*
24754 * @license
24755 * Copyright Akveo. All Rights Reserved.
24756 * Licensed under the MIT License. See License.txt in the project root for license information.
24757 */
24758var NB_DEFAULT_ROW_LEVEL = 0;
24759/**
24760 * Implicit context of cells and rows
24761 */
24762var NbTreeGridPresentationNode = /** @class */ (function () {
24763 function NbTreeGridPresentationNode(
24764 /**
24765 * Data object associated with row
24766 */
24767 data, children,
24768 /**
24769 * Row expand state
24770 */
24771 expanded, level) {
24772 this.data = data;
24773 this.children = children;
24774 this.expanded = expanded;
24775 this.level = level;
24776 }
24777 /**
24778 * True if row has child rows
24779 */
24780 NbTreeGridPresentationNode.prototype.hasChildren = function () {
24781 return !!this.children && !!this.children.length;
24782 };
24783 return NbTreeGridPresentationNode;
24784}());
24785
24786/*
24787 * @license
24788 * Copyright Akveo. All Rights Reserved.
24789 * Licensed under the MIT License. See License.txt in the project root for license information.
24790 */
24791var NbTreeGridDataService = /** @class */ (function () {
24792 function NbTreeGridDataService() {
24793 this.defaultGetters = {
24794 dataGetter: function (node) { return node.data; },
24795 childrenGetter: function (d) { return d.children || undefined; },
24796 expandedGetter: function (d) { return !!d.expanded; },
24797 };
24798 }
24799 NbTreeGridDataService.prototype.toPresentationNodes = function (nodes, customGetters, level) {
24800 if (level === void 0) { level = NB_DEFAULT_ROW_LEVEL; }
24801 var getters = tslib.__assign(tslib.__assign({}, this.defaultGetters), customGetters);
24802 return this.mapNodes(nodes, getters, level);
24803 };
24804 NbTreeGridDataService.prototype.mapNodes = function (nodes, getters, level) {
24805 var _this = this;
24806 var dataGetter = getters.dataGetter, childrenGetter = getters.childrenGetter, expandedGetter = getters.expandedGetter;
24807 return nodes.map(function (node) {
24808 var childrenNodes = childrenGetter(node);
24809 var children;
24810 if (childrenNodes) {
24811 children = _this.toPresentationNodes(childrenNodes, getters, level + 1);
24812 }
24813 return new NbTreeGridPresentationNode(dataGetter(node), children, expandedGetter(node), level);
24814 });
24815 };
24816 NbTreeGridDataService.prototype.flattenExpanded = function (nodes) {
24817 var _this = this;
24818 return nodes.reduce(function (res, node) {
24819 res.push(node);
24820 if (node.expanded && node.hasChildren()) {
24821 res.push.apply(res, _this.flattenExpanded(node.children));
24822 }
24823 return res;
24824 }, []);
24825 };
24826 NbTreeGridDataService.prototype.copy = function (nodes) {
24827 var _this = this;
24828 return nodes.map(function (node) {
24829 var children;
24830 if (node.hasChildren()) {
24831 children = _this.copy(node.children);
24832 }
24833 return new NbTreeGridPresentationNode(node.data, children, node.expanded, node.level);
24834 });
24835 };
24836 NbTreeGridDataService.decorators = [
24837 { type: i0.Injectable }
24838 ];
24839 return NbTreeGridDataService;
24840}());
24841
24842/*
24843 * @license
24844 * Copyright Akveo. All Rights Reserved.
24845 * Licensed under the MIT License. See License.txt in the project root for license information.
24846 */
24847/**
24848 * Service used to filter tree grid data. Searched searchString in all object values.
24849 * If you need custom filter, you can extend this service and override filterPredicate or whole filter method.
24850 */
24851var NbTreeGridFilterService = /** @class */ (function () {
24852 function NbTreeGridFilterService() {
24853 }
24854 NbTreeGridFilterService.prototype.filter = function (query, data) {
24855 var _this = this;
24856 if (!query) {
24857 return data;
24858 }
24859 return data.reduce(function (filtered, node) {
24860 var filteredChildren;
24861 if (node.children) {
24862 filteredChildren = _this.filter(query, node.children);
24863 node.children = filteredChildren;
24864 }
24865 node.expanded = false;
24866 if (filteredChildren && filteredChildren.length) {
24867 node.expanded = true;
24868 filtered.push(node);
24869 }
24870 else if (_this.filterPredicate(node.data, query)) {
24871 filtered.push(node);
24872 }
24873 return filtered;
24874 }, []);
24875 };
24876 NbTreeGridFilterService.prototype.filterPredicate = function (data, searchQuery) {
24877 var preparedQuery = searchQuery.trim().toLocaleLowerCase();
24878 for (var _i = 0, _a = Object.values(data); _i < _a.length; _i++) {
24879 var val = _a[_i];
24880 var preparedVal = ("" + val).trim().toLocaleLowerCase();
24881 if (preparedVal.includes(preparedQuery)) {
24882 return true;
24883 }
24884 }
24885 return false;
24886 };
24887 NbTreeGridFilterService.decorators = [
24888 { type: i0.Injectable }
24889 ];
24890 return NbTreeGridFilterService;
24891}());
24892
24893/*
24894 * @license
24895 * Copyright Akveo. All Rights Reserved.
24896 * Licensed under the MIT License. See License.txt in the project root for license information.
24897 */
24898
24899(function (NbSortDirection) {
24900 NbSortDirection["ASCENDING"] = "asc";
24901 NbSortDirection["DESCENDING"] = "desc";
24902 NbSortDirection["NONE"] = "";
24903})(exports.NbSortDirection || (exports.NbSortDirection = {}));
24904var sortDirections = [
24905 exports.NbSortDirection.ASCENDING,
24906 exports.NbSortDirection.DESCENDING,
24907 exports.NbSortDirection.NONE,
24908];
24909/**
24910 * Directive triggers sort method of passed object when sort header changes direction
24911 */
24912var NbSortDirective = /** @class */ (function () {
24913 function NbSortDirective() {
24914 this.sort = new i0.EventEmitter();
24915 }
24916 NbSortDirective.prototype.emitSort = function (sortRequest) {
24917 if (this.sortable && this.sortable.sort) {
24918 this.sortable.sort(sortRequest);
24919 }
24920 this.sort.emit(sortRequest);
24921 };
24922 NbSortDirective.decorators = [
24923 { type: i0.Directive, args: [{ selector: '[nbSort]' },] }
24924 ];
24925 NbSortDirective.propDecorators = {
24926 sortable: [{ type: i0.Input, args: ['nbSort',] }],
24927 sort: [{ type: i0.Output }]
24928 };
24929 return NbSortDirective;
24930}());
24931/**
24932 * Directive for headers sort icons. Mark you icon implementation with this structural directive and
24933 * it'll set template's implicit context with current direction. Context also has `isAscending`,
24934 * `isDescending` and `isNone` properties.
24935 */
24936var NbSortHeaderIconDirective = /** @class */ (function () {
24937 function NbSortHeaderIconDirective() {
24938 }
24939 NbSortHeaderIconDirective.decorators = [
24940 { type: i0.Directive, args: [{ selector: '[nbSortHeaderIcon]' },] }
24941 ];
24942 return NbSortHeaderIconDirective;
24943}());
24944var NbSortIconComponent = /** @class */ (function () {
24945 function NbSortIconComponent() {
24946 this.direction = exports.NbSortDirection.NONE;
24947 }
24948 NbSortIconComponent.prototype.isAscending = function () {
24949 return this.direction === exports.NbSortDirection.ASCENDING;
24950 };
24951 NbSortIconComponent.prototype.isDescending = function () {
24952 return this.direction === exports.NbSortDirection.DESCENDING;
24953 };
24954 NbSortIconComponent.prototype.isDirectionSet = function () {
24955 return this.isAscending() || this.isDescending();
24956 };
24957 NbSortIconComponent.decorators = [
24958 { type: i0.Component, args: [{
24959 selector: 'nb-sort-icon',
24960 template: "\n <ng-container *ngIf=\"isDirectionSet()\">\n <nb-icon *ngIf=\"isAscending()\" icon=\"chevron-down-outline\" pack=\"nebular-essentials\" aria-hidden=\"true\"></nb-icon>\n <nb-icon *ngIf=\"isDescending()\" icon=\"chevron-up-outline\" pack=\"nebular-essentials\" aria-hidden=\"true\"></nb-icon>\n </ng-container>\n "
24961 },] }
24962 ];
24963 NbSortIconComponent.propDecorators = {
24964 direction: [{ type: i0.Input }]
24965 };
24966 return NbSortIconComponent;
24967}());
24968/**
24969 * Marks header as sort header so it emitting sort event when clicked.
24970 */
24971var NbSortHeaderComponent = /** @class */ (function () {
24972 function NbSortHeaderComponent(sort, columnDef) {
24973 this.sort = sort;
24974 this.columnDef = columnDef;
24975 this.disabledValue = false;
24976 }
24977 Object.defineProperty(NbSortHeaderComponent.prototype, "disabled", {
24978 get: function () {
24979 return this.disabledValue;
24980 },
24981 /**
24982 * Disable sort header
24983 */
24984 set: function (value) {
24985 this.disabledValue = convertToBoolProperty(value);
24986 },
24987 enumerable: false,
24988 configurable: true
24989 });
24990 NbSortHeaderComponent.prototype.sortIfEnabled = function () {
24991 if (!this.disabled) {
24992 this.sortData();
24993 }
24994 };
24995 NbSortHeaderComponent.prototype.isAscending = function () {
24996 return this.direction === exports.NbSortDirection.ASCENDING;
24997 };
24998 NbSortHeaderComponent.prototype.isDescending = function () {
24999 return this.direction === exports.NbSortDirection.DESCENDING;
25000 };
25001 NbSortHeaderComponent.prototype.sortData = function () {
25002 var sortRequest = this.createSortRequest();
25003 this.sort.emitSort(sortRequest);
25004 };
25005 NbSortHeaderComponent.prototype.getIconContext = function () {
25006 return {
25007 $implicit: this.direction,
25008 isAscending: this.isAscending(),
25009 isDescending: this.isDescending(),
25010 isNone: !this.isAscending() && !this.isDescending(),
25011 };
25012 };
25013 NbSortHeaderComponent.prototype.getDisabledAttributeValue = function () {
25014 return this.disabled ? '' : null;
25015 };
25016 NbSortHeaderComponent.prototype.createSortRequest = function () {
25017 this.direction = this.getNextDirection();
25018 return { direction: this.direction, column: this.columnDef.name };
25019 };
25020 NbSortHeaderComponent.prototype.getNextDirection = function () {
25021 var sortDirectionCycle = sortDirections;
25022 var nextDirectionIndex = sortDirectionCycle.indexOf(this.direction) + 1;
25023 if (nextDirectionIndex >= sortDirectionCycle.length) {
25024 nextDirectionIndex = 0;
25025 }
25026 return sortDirectionCycle[nextDirectionIndex];
25027 };
25028 NbSortHeaderComponent.decorators = [
25029 { type: i0.Component, args: [{
25030 selector: '[nbSortHeader]',
25031 template: "\n <button\n class=\"nb-tree-grid-header-change-sort-button\"\n type=\"button\"\n [attr.disabled]=\"getDisabledAttributeValue()\"\n (click)=\"sortData()\">\n <ng-content></ng-content>\n </button>\n <nb-sort-icon *ngIf=\"!sortIcon; else customIcon\" [direction]=\"direction\"></nb-sort-icon>\n <ng-template #customIcon [ngTemplateOutlet]=\"sortIcon\" [ngTemplateOutletContext]=\"getIconContext()\"></ng-template>\n "
25032 },] }
25033 ];
25034 NbSortHeaderComponent.ctorParameters = function () { return [
25035 { type: NbSortDirective },
25036 { type: undefined, decorators: [{ type: i0.Inject, args: [NB_SORT_HEADER_COLUMN_DEF,] }] }
25037 ]; };
25038 NbSortHeaderComponent.propDecorators = {
25039 sortIcon: [{ type: i0.ContentChild, args: [NbSortHeaderIconDirective, { read: i0.TemplateRef },] }],
25040 direction: [{ type: i0.Input, args: ['nbSortHeader',] }],
25041 disabled: [{ type: i0.Input }, { type: i0.HostBinding, args: ['class.disabled',] }],
25042 sortIfEnabled: [{ type: i0.HostListener, args: ['click',] }]
25043 };
25044 return NbSortHeaderComponent;
25045}());
25046
25047/*
25048 * @license
25049 * Copyright Akveo. All Rights Reserved.
25050 * Licensed under the MIT License. See License.txt in the project root for license information.
25051 */
25052/**
25053 * Service used to sort tree grid data. Uses Array.prototype.sort method.
25054 * If you need custom sorting, you can extend this service and override comparator or whole sort method.
25055 */
25056var NbTreeGridSortService = /** @class */ (function () {
25057 function NbTreeGridSortService() {
25058 }
25059 NbTreeGridSortService.prototype.sort = function (request, data) {
25060 var _this = this;
25061 if (!request) {
25062 return data;
25063 }
25064 var sorted = data.sort(function (na, nb) { return _this.comparator(request, na, nb); });
25065 for (var _i = 0, data_1 = data; _i < data_1.length; _i++) {
25066 var node = data_1[_i];
25067 if (node.children) {
25068 node.children = this.sort(request, node.children);
25069 }
25070 }
25071 return sorted;
25072 };
25073 NbTreeGridSortService.prototype.comparator = function (request, na, nb) {
25074 var key = request.column;
25075 var dir = request.direction;
25076 var a = na.data[key];
25077 var b = nb.data[key];
25078 var res = 0;
25079 if (a > b) {
25080 res = 1;
25081 }
25082 if (a < b) {
25083 res = -1;
25084 }
25085 return dir === exports.NbSortDirection.ASCENDING ? res : res * -1;
25086 };
25087 NbTreeGridSortService.decorators = [
25088 { type: i0.Injectable }
25089 ];
25090 return NbTreeGridSortService;
25091}());
25092
25093/*
25094 * @license
25095 * Copyright Akveo. All Rights Reserved.
25096 * Licensed under the MIT License. See License.txt in the project root for license information.
25097 */
25098var NbTreeGridService = /** @class */ (function () {
25099 function NbTreeGridService() {
25100 }
25101 NbTreeGridService.prototype.expand = function (data, row, options) {
25102 var _this = this;
25103 if (options === void 0) { options = {}; }
25104 var node = this.find(data, row);
25105 node.expanded = true;
25106 if (options.deep && node.hasChildren()) {
25107 node.children.forEach(function (n) { return _this.expand(data, n.data, options); });
25108 }
25109 };
25110 NbTreeGridService.prototype.collapse = function (data, row, options) {
25111 var _this = this;
25112 if (options === void 0) { options = {}; }
25113 var node = this.find(data, row);
25114 node.expanded = false;
25115 if (options.deep && node.hasChildren()) {
25116 node.children.forEach(function (n) { return _this.collapse(data, n.data, options); });
25117 }
25118 };
25119 NbTreeGridService.prototype.toggle = function (data, row, options) {
25120 if (options === void 0) { options = {}; }
25121 var node = this.find(data, row);
25122 if (node.expanded) {
25123 this.collapse(data, row, options);
25124 }
25125 else {
25126 this.expand(data, row, options);
25127 }
25128 };
25129 NbTreeGridService.prototype.find = function (data, row) {
25130 var toCheck = tslib.__spreadArray([], data);
25131 for (var _i = 0, toCheck_1 = toCheck; _i < toCheck_1.length; _i++) {
25132 var node = toCheck_1[_i];
25133 if (node.data === row) {
25134 return node;
25135 }
25136 if (node.hasChildren()) {
25137 toCheck.push.apply(toCheck, node.children);
25138 }
25139 }
25140 };
25141 NbTreeGridService.decorators = [
25142 { type: i0.Injectable }
25143 ];
25144 return NbTreeGridService;
25145}());
25146
25147/*
25148 * @license
25149 * Copyright Akveo. All Rights Reserved.
25150 * Licensed under the MIT License. See License.txt in the project root for license information.
25151 */
25152var NbTreeGridDataSource = /** @class */ (function (_super) {
25153 tslib.__extends(NbTreeGridDataSource, _super);
25154 function NbTreeGridDataSource(sortService, filterService, treeGridService, treeGridDataService) {
25155 var _this = _super.call(this) || this;
25156 _this.sortService = sortService;
25157 _this.filterService = filterService;
25158 _this.treeGridService = treeGridService;
25159 _this.treeGridDataService = treeGridDataService;
25160 /** Stream emitting render data to the table (depends on ordered data changes). */
25161 _this.renderData = new rxjs.BehaviorSubject([]);
25162 _this.filterRequest = new rxjs.BehaviorSubject('');
25163 _this.sortRequest = new rxjs.BehaviorSubject(null);
25164 return _this;
25165 }
25166 NbTreeGridDataSource.prototype.setData = function (data, customGetters) {
25167 var presentationData = [];
25168 if (data) {
25169 presentationData = this.treeGridDataService.toPresentationNodes(data, customGetters);
25170 }
25171 this.data = new rxjs.BehaviorSubject(presentationData);
25172 this.updateChangeSubscription();
25173 };
25174 NbTreeGridDataSource.prototype.connect = function (collectionViewer) {
25175 return this.renderData;
25176 };
25177 NbTreeGridDataSource.prototype.disconnect = function (collectionViewer) {
25178 };
25179 NbTreeGridDataSource.prototype.expand = function (row) {
25180 this.treeGridService.expand(this.data.value, row);
25181 this.data.next(this.data.value);
25182 };
25183 NbTreeGridDataSource.prototype.collapse = function (row) {
25184 this.treeGridService.collapse(this.data.value, row);
25185 this.data.next(this.data.value);
25186 };
25187 NbTreeGridDataSource.prototype.toggle = function (row, options) {
25188 this.treeGridService.toggle(this.data.value, row, options);
25189 this.data.next(this.data.value);
25190 };
25191 NbTreeGridDataSource.prototype.toggleByIndex = function (dataIndex, options) {
25192 var node = this.renderData.value && this.renderData.value[dataIndex];
25193 if (node) {
25194 this.toggle(node.data, options);
25195 }
25196 };
25197 NbTreeGridDataSource.prototype.getLevel = function (rowIndex) {
25198 var row = this.renderData.value[rowIndex];
25199 return row ? row.level : NB_DEFAULT_ROW_LEVEL;
25200 };
25201 NbTreeGridDataSource.prototype.sort = function (sortRequest) {
25202 this.sortRequest.next(sortRequest);
25203 };
25204 NbTreeGridDataSource.prototype.filter = function (searchQuery) {
25205 this.filterRequest.next(searchQuery);
25206 };
25207 NbTreeGridDataSource.prototype.updateChangeSubscription = function () {
25208 var _this = this;
25209 var dataStream = this.data;
25210 var filteredData = rxjs.combineLatest([dataStream, this.filterRequest])
25211 .pipe(rxjs_operators.map(function (_a) {
25212 var data = _a[0];
25213 return _this.treeGridDataService.copy(data);
25214 }), rxjs_operators.map(function (data) { return _this.filterData(data); }));
25215 var sortedData = rxjs.combineLatest([filteredData, this.sortRequest])
25216 .pipe(rxjs_operators.map(function (_a) {
25217 var data = _a[0];
25218 return _this.sortData(data);
25219 }));
25220 sortedData
25221 .pipe(rxjs_operators.map(function (data) { return _this.treeGridDataService.flattenExpanded(data); }))
25222 .subscribe(function (data) { return _this.renderData.next(data); });
25223 };
25224 NbTreeGridDataSource.prototype.filterData = function (data) {
25225 return this.filterService.filter(this.filterRequest.value, data);
25226 };
25227 NbTreeGridDataSource.prototype.sortData = function (data) {
25228 return this.sortService.sort(this.sortRequest.value, data);
25229 };
25230 return NbTreeGridDataSource;
25231}(NbDataSource));
25232var NbTreeGridDataSourceBuilder = /** @class */ (function () {
25233 function NbTreeGridDataSourceBuilder(filterService, sortService, treeGridService, treeGridDataService) {
25234 this.filterService = filterService;
25235 this.sortService = sortService;
25236 this.treeGridService = treeGridService;
25237 this.treeGridDataService = treeGridDataService;
25238 }
25239 NbTreeGridDataSourceBuilder.prototype.create = function (data, customGetters) {
25240 var dataSource = new NbTreeGridDataSource(this.sortService, this.filterService, this.treeGridService, this.treeGridDataService);
25241 dataSource.setData(data, customGetters);
25242 return dataSource;
25243 };
25244 NbTreeGridDataSourceBuilder.decorators = [
25245 { type: i0.Injectable }
25246 ];
25247 NbTreeGridDataSourceBuilder.ctorParameters = function () { return [
25248 { type: NbTreeGridFilterService },
25249 { type: NbTreeGridSortService },
25250 { type: NbTreeGridService },
25251 { type: NbTreeGridDataService }
25252 ]; };
25253 return NbTreeGridDataSourceBuilder;
25254}());
25255
25256/*
25257 * @license
25258 * Copyright Akveo. All Rights Reserved.
25259 * Licensed under the MIT License. See License.txt in the project root for license information.
25260 */
25261var NB_TREE_GRID = new i0.InjectionToken('NB_TREE_GRID');
25262
25263var NbColumnsService = /** @class */ (function () {
25264 function NbColumnsService(differs) {
25265 this.differs = differs;
25266 this.columnHide$ = new rxjs.Subject();
25267 this.columnShow$ = new rxjs.Subject();
25268 }
25269 NbColumnsService.prototype.setColumns = function (columns) {
25270 if (!this.changesDiffer) {
25271 this.changesDiffer = this.differs.find(columns || []).create();
25272 }
25273 if (this.changesDiffer.diff(columns)) {
25274 this.allColumns = Array.from(columns);
25275 this.visibleColumns = Array.from(columns);
25276 }
25277 };
25278 NbColumnsService.prototype.getVisibleColumns = function () {
25279 return this.visibleColumns;
25280 };
25281 NbColumnsService.prototype.hideColumn = function (column) {
25282 var toRemove = this.visibleColumns.indexOf(column);
25283 if (toRemove > -1) {
25284 this.visibleColumns.splice(toRemove, 1);
25285 this.columnHide$.next();
25286 }
25287 };
25288 NbColumnsService.prototype.showColumn = function (column) {
25289 if (this.visibleColumns.includes(column)) {
25290 return;
25291 }
25292 this.visibleColumns.splice(this.findInsertIndex(column), 0, column);
25293 this.columnShow$.next();
25294 };
25295 NbColumnsService.prototype.onColumnsChange = function () {
25296 return rxjs.merge(this.columnShow$, this.columnHide$);
25297 };
25298 NbColumnsService.prototype.findInsertIndex = function (column) {
25299 var initialIndex = this.allColumns.indexOf(column);
25300 if (initialIndex === 0 || !this.visibleColumns.length) {
25301 return 0;
25302 }
25303 if (initialIndex === this.allColumns.length - 1) {
25304 return this.visibleColumns.length;
25305 }
25306 var leftSiblingIndex = initialIndex - 1;
25307 for (var i = leftSiblingIndex; i >= 0; i--) {
25308 var leftSibling = this.allColumns[i];
25309 var index = this.visibleColumns.indexOf(leftSibling);
25310 if (index !== -1) {
25311 return index + 1;
25312 }
25313 }
25314 var rightSiblingIndex = initialIndex + 1;
25315 for (var i = rightSiblingIndex; i < this.allColumns.length; i++) {
25316 var rightSibling = this.allColumns[i];
25317 var index = this.visibleColumns.indexOf(rightSibling);
25318 if (index !== -1) {
25319 return index;
25320 }
25321 }
25322 throw new Error("Can't restore column position.");
25323 };
25324 NbColumnsService.decorators = [
25325 { type: i0.Injectable }
25326 ];
25327 NbColumnsService.ctorParameters = function () { return [
25328 { type: i0.IterableDiffers }
25329 ]; };
25330 return NbColumnsService;
25331}());
25332
25333/*
25334 * @license
25335 * Copyright Akveo. All Rights Reserved.
25336 * Licensed under the MIT License. See License.txt in the project root for license information.
25337 */
25338/**
25339 * Tree grid component that can be used to display nested rows of data.
25340 * Supports filtering and sorting.
25341 * @stacked-example(Showcase, tree-grid/tree-grid-showcase.component)
25342 *
25343 * ### Installation
25344 *
25345 * Import `NbTreeGridModule` to your feature module.
25346 * ```ts
25347 * @NgModule({
25348 * imports: [
25349 * // ...
25350 * NbTreeGridModule,
25351 * ],
25352 * })
25353 * export class PageModule { }
25354 * ```
25355 *
25356 * ### Usage
25357 *
25358 * As the most basic usage you need to define [nbTreeGridRowDef](docs/components/treegrid/api#nbtreegridrowdefdirective)
25359 * where you should pass columns to display in rows and
25360 * [nbTreeGridColumnDef](docs/components/treegrid/api#nbtreegridcolumndefdirective) - component containing cell
25361 * definitions for each column passed to row definition.
25362 * @stacked-example(Basic, tree-grid/tree-grid-basic.component)
25363 *
25364 * `NbTreeGridComponent`'s source input and `NbTreeGridDataSourceBuilder.create` expecting data to be an array of
25365 * objects with `data`, `children` and `expanded` properties. If your data doesn't match this interface, you can pass
25366 * getter functions for each property as arguments to `NbTreeGridDataSourceBuilder.create` method.
25367 * @stacked-example(Custom node structure, tree-grid/tree-grid-custom-node-structure.component)
25368 *
25369 * To use sorting you can add `nbSort` directive to table and subscribe to `sort` method. When user click on header,
25370 * sort event will be emitted. Event object contain clicked column name and desired sort direction.
25371 * @stacked-example(Sortable, tree-grid/tree-grid-sortable.component)
25372 *
25373 * You can use `Data Source Builder` to create `NbTreeGridDataSource` which would have toggle, sort and
25374 * filter methods. Then you can call this methods to change sort or toggle rows programmatically. Also `nbSort` and
25375 * `nbFilterInput` directives both support `NbTreeGridDataSource`, so you can pass it directly as an input and
25376 * directives will trigger sort, toggle themselves.
25377 * @stacked-example(Data Source Builder, tree-grid/tree-grid-showcase.component)
25378 *
25379 * You can create responsive grid by setting `hideOn` and `showOn` inputs of
25380 * [nbTreeGridColumnDef](docs/components/tree-grid/api#nbtreegridcolumndefdirective) directive.
25381 * When viewport reaches specified width grid hides or shows columns.
25382 * @stacked-example(Responsive columns, tree-grid/tree-grid-responsive.component)
25383 *
25384 * To customize sort or row toggle icons you can use `nbSortHeaderIcon` and `nbTreeGridRowToggle` directives
25385 * respectively. `nbSortHeaderIcon` is a structural directive and it's implicit context set to current direction.
25386 * Also context has three properties: `isAscending`, `isDescending` and `isNone`.
25387 * @stacked-example(Custom icons, tree-grid/tree-grid-custom-icons.component)
25388 *
25389 * By default, row to toggle happens when user clicks anywhere in the row. Also double click expands row deeply.
25390 * To disable this you can set `[clickToToggle]="false"` input of `nbTreeGridRow`.
25391 * @stacked-example(Disable click toggle, tree-grid/tree-grid-disable-click-toggle.component)
25392 *
25393 * @styles
25394 *
25395 * tree-grid-cell-border-width:
25396 * tree-grid-cell-border-style:
25397 * tree-grid-cell-border-color:
25398 * tree-grid-row-min-height:
25399 * tree-grid-cell-padding:
25400 * tree-grid-header-background-color:
25401 * tree-grid-header-text-color:
25402 * tree-grid-header-text-font-family:
25403 * tree-grid-header-text-font-size:
25404 * tree-grid-header-text-font-weight:
25405 * tree-grid-header-text-line-height:
25406 * tree-grid-footer-background-color:
25407 * tree-grid-footer-text-color:
25408 * tree-grid-footer-text-font-family:
25409 * tree-grid-footer-text-font-size:
25410 * tree-grid-footer-text-font-weight:
25411 * tree-grid-footer-text-line-height:
25412 * tree-grid-row-background-color:
25413 * tree-grid-row-even-background-color:
25414 * tree-grid-row-hover-background-color:
25415 * tree-grid-row-text-color:
25416 * tree-grid-row-text-font-family:
25417 * tree-grid-row-text-font-size:
25418 * tree-grid-row-text-font-weight:
25419 * tree-grid-row-text-line-height:
25420 * tree-grid-sort-header-button-background-color:
25421 * tree-grid-sort-header-button-border:
25422 * tree-grid-sort-header-button-padding:
25423 */
25424var NbTreeGridComponent = /** @class */ (function (_super) {
25425 tslib.__extends(NbTreeGridComponent, _super);
25426 function NbTreeGridComponent(dataSourceBuilder, differs, changeDetectorRef, elementRef, role, dir, document, platform, window, _viewRepeater, _coalescedStyleScheduler, _viewportRuler, _stickyPositioningListener) {
25427 var _this = _super.call(this, differs, changeDetectorRef, elementRef, role, dir, document, platform, _viewRepeater, _coalescedStyleScheduler, _viewportRuler, _stickyPositioningListener) || this;
25428 _this.dataSourceBuilder = dataSourceBuilder;
25429 _this.window = window;
25430 _this._viewRepeater = _viewRepeater;
25431 _this._coalescedStyleScheduler = _coalescedStyleScheduler;
25432 _this._stickyPositioningListener = _stickyPositioningListener;
25433 _this.destroy$ = new rxjs.Subject();
25434 _this.levelPadding = '';
25435 _this.equalColumnsWidthValue = false;
25436 _this.treeClass = true;
25437 _this.platform = platform;
25438 return _this;
25439 }
25440 Object.defineProperty(NbTreeGridComponent.prototype, "source", {
25441 /**
25442 * The table's data
25443 * @param data
25444 * @type {<T>[] | NbTreeGridDataSource}
25445 */
25446 set: function (data) {
25447 if (!data) {
25448 return;
25449 }
25450 if (data instanceof NbTreeGridDataSource) {
25451 this._source = data;
25452 }
25453 else {
25454 this._source = this.dataSourceBuilder.create(data);
25455 }
25456 this.dataSource = this._source;
25457 },
25458 enumerable: false,
25459 configurable: true
25460 });
25461 Object.defineProperty(NbTreeGridComponent.prototype, "equalColumnsWidth", {
25462 get: function () {
25463 return this.equalColumnsWidthValue;
25464 },
25465 /**
25466 * Make all columns equal width. False by default.
25467 */
25468 set: function (value) {
25469 this.equalColumnsWidthValue = convertToBoolProperty(value);
25470 },
25471 enumerable: false,
25472 configurable: true
25473 });
25474 NbTreeGridComponent.prototype.ngAfterViewInit = function () {
25475 var _this = this;
25476 this.checkDefsCount();
25477 var rowsChange$ = rxjs.merge(this._contentRowDefs.changes, this._contentHeaderRowDefs.changes, this._contentFooterRowDefs.changes);
25478 rowsChange$.pipe(rxjs_operators.takeUntil(this.destroy$))
25479 .subscribe(function () { return _this.checkDefsCount(); });
25480 if (this.platform.isBrowser) {
25481 this.updateVisibleColumns();
25482 var windowResize$ = rxjs.fromEvent(this.window, 'resize').pipe(rxjs_operators.debounceTime(50));
25483 rxjs.merge(rowsChange$, this._contentColumnDefs.changes, windowResize$)
25484 .pipe(rxjs_operators.takeUntil(this.destroy$))
25485 .subscribe(function () { return _this.updateVisibleColumns(); });
25486 }
25487 };
25488 NbTreeGridComponent.prototype.ngOnDestroy = function () {
25489 _super.prototype.ngOnDestroy.call(this);
25490 this.destroy$.next();
25491 this.destroy$.complete();
25492 };
25493 NbTreeGridComponent.prototype.toggleRow = function (row, options) {
25494 var context = this.getRowContext(row);
25495 this._source.toggle(context.$implicit.data, options);
25496 };
25497 NbTreeGridComponent.prototype.toggleCellRow = function (cell) {
25498 var context = this.getCellContext(cell);
25499 this._source.toggle(context.$implicit.data);
25500 };
25501 NbTreeGridComponent.prototype.getColumnWidth = function () {
25502 if (this.equalColumnsWidth) {
25503 return 100 / this.getColumnsCount() + "%";
25504 }
25505 return '';
25506 };
25507 NbTreeGridComponent.prototype.getCellLevel = function (cell, columnName) {
25508 if (this.isFirstColumn(columnName)) {
25509 return this.getCellContext(cell).$implicit.level;
25510 }
25511 return NB_DEFAULT_ROW_LEVEL;
25512 };
25513 NbTreeGridComponent.prototype.getRowContext = function (row) {
25514 return this.getContextByRowEl(row.elementRef.nativeElement);
25515 };
25516 NbTreeGridComponent.prototype.getCellContext = function (cell) {
25517 return this.getContextByCellEl(cell.elementRef.nativeElement);
25518 };
25519 NbTreeGridComponent.prototype.getContextByCellEl = function (cellEl) {
25520 return this.getContextByRowEl(cellEl.parentElement);
25521 };
25522 NbTreeGridComponent.prototype.getContextByRowEl = function (rowEl) {
25523 var rowsContainer = this._rowOutlet.viewContainer;
25524 for (var i = 0; i < rowsContainer.length; i++) {
25525 var rowViewRef = rowsContainer.get(i);
25526 if (rowViewRef.rootNodes.includes(rowEl)) {
25527 return rowViewRef.context;
25528 }
25529 }
25530 };
25531 NbTreeGridComponent.prototype.getColumns = function () {
25532 var rowDef;
25533 if (this._contentHeaderRowDefs.length) {
25534 rowDef = this._contentHeaderRowDefs.first;
25535 }
25536 else {
25537 rowDef = this._contentRowDefs.first;
25538 }
25539 return Array.from(rowDef.getVisibleColumns() || []);
25540 };
25541 NbTreeGridComponent.prototype.getColumnsCount = function () {
25542 return this.getColumns().length;
25543 };
25544 NbTreeGridComponent.prototype.isFirstColumn = function (columnName) {
25545 return this.getColumns()[0] === columnName;
25546 };
25547 NbTreeGridComponent.prototype.checkDefsCount = function () {
25548 if (this._contentRowDefs.length > 1) {
25549 throw new Error("Found multiple row definitions");
25550 }
25551 if (this._contentHeaderRowDefs.length > 1) {
25552 throw new Error("Found multiple header row definitions");
25553 }
25554 if (this._contentFooterRowDefs.length > 1) {
25555 throw new Error("Found multiple footer row definitions");
25556 }
25557 };
25558 NbTreeGridComponent.prototype.updateVisibleColumns = function () {
25559 var width = this.window.innerWidth;
25560 var columnDefs = this._contentColumnDefs;
25561 var columnsToHide = columnDefs
25562 .filter(function (col) { return col.shouldHide(width); })
25563 .map(function (col) { return col.name; });
25564 var columnsToShow = columnDefs
25565 .filter(function (col) { return col.shouldShow(width); })
25566 .map(function (col) { return col.name; });
25567 if (!columnsToHide.length && !columnsToShow.length) {
25568 return;
25569 }
25570 var rowDefs = [
25571 this._contentHeaderRowDefs.first,
25572 this._contentRowDefs.first,
25573 this._contentFooterRowDefs.first,
25574 ].filter(function (d) { return !!d; });
25575 for (var _i = 0, rowDefs_1 = rowDefs; _i < rowDefs_1.length; _i++) {
25576 var rowDef = rowDefs_1[_i];
25577 for (var _a = 0, columnsToHide_1 = columnsToHide; _a < columnsToHide_1.length; _a++) {
25578 var column = columnsToHide_1[_a];
25579 rowDef.hideColumn(column);
25580 }
25581 for (var _b = 0, columnsToShow_1 = columnsToShow; _b < columnsToShow_1.length; _b++) {
25582 var column = columnsToShow_1[_b];
25583 rowDef.showColumn(column);
25584 }
25585 }
25586 };
25587 NbTreeGridComponent.decorators = [
25588 { type: i0.Component, args: [{
25589 selector: 'table[nbTreeGrid]',
25590 template: NB_TABLE_TEMPLATE,
25591 providers: tslib.__spreadArray([
25592 { provide: NB_TREE_GRID, useExisting: NbTreeGridComponent },
25593 NbColumnsService
25594 ], NB_TABLE_PROVIDERS),
25595 styles: [":host{table-layout:fixed;border-spacing:0;border-collapse:collapse;width:100%;max-width:100%;overflow:auto}::ng-deep .nb-tree-grid-cell,::ng-deep .nb-tree-grid-header-cell,::ng-deep .nb-tree-grid-footer-cell{overflow:hidden}\n"]
25596 },] }
25597 ];
25598 NbTreeGridComponent.ctorParameters = function () { return [
25599 { type: NbTreeGridDataSourceBuilder },
25600 { type: i0.IterableDiffers },
25601 { type: i0.ChangeDetectorRef },
25602 { type: i0.ElementRef },
25603 { type: String, decorators: [{ type: i0.Attribute, args: ['role',] }] },
25604 { type: NbDirectionality },
25605 { type: undefined, decorators: [{ type: i0.Inject, args: [NB_DOCUMENT,] }] },
25606 { type: NbPlatform },
25607 { type: undefined, decorators: [{ type: i0.Inject, args: [NB_WINDOW,] }] },
25608 { type: undefined, decorators: [{ type: i0.Inject, args: [NB_VIEW_REPEATER_STRATEGY,] }] },
25609 { type: undefined, decorators: [{ type: i0.Inject, args: [NB_COALESCED_STYLE_SCHEDULER,] }] },
25610 { type: NbViewportRulerAdapter },
25611 { type: undefined, decorators: [{ type: i0.Optional }, { type: i0.SkipSelf }, { type: i0.Inject, args: [NB_STICKY_POSITIONING_LISTENER,] }] }
25612 ]; };
25613 NbTreeGridComponent.propDecorators = {
25614 source: [{ type: i0.Input, args: ['nbTreeGrid',] }],
25615 levelPadding: [{ type: i0.Input }],
25616 equalColumnsWidth: [{ type: i0.Input }],
25617 treeClass: [{ type: i0.HostBinding, args: ['class.nb-tree-grid',] }]
25618 };
25619 return NbTreeGridComponent;
25620}(NbTable));
25621
25622/**
25623 * Data row definition for the tree-grid.
25624 * Captures the header row's template and columns to display.
25625 */
25626var NbTreeGridRowDefDirective = /** @class */ (function (_super) {
25627 tslib.__extends(NbTreeGridRowDefDirective, _super);
25628 function NbTreeGridRowDefDirective(template, differs, columnsService) {
25629 var _this = _super.call(this, template, differs) || this;
25630 _this.columnsService = columnsService;
25631 return _this;
25632 }
25633 NbTreeGridRowDefDirective.prototype.ngOnChanges = function (changes) {
25634 _super.prototype.ngOnChanges.call(this, changes);
25635 if (changes['columns']) {
25636 this.updateColumns(this.columns);
25637 }
25638 };
25639 NbTreeGridRowDefDirective.prototype.updateColumns = function (columns) {
25640 this.columnsService.setColumns(columns);
25641 };
25642 NbTreeGridRowDefDirective.prototype.getVisibleColumns = function () {
25643 return this.columnsService.getVisibleColumns();
25644 };
25645 /** @docs-private */
25646 NbTreeGridRowDefDirective.prototype.hideColumn = function (column) {
25647 this.columnsService.hideColumn(column);
25648 };
25649 /** @docs-private */
25650 NbTreeGridRowDefDirective.prototype.showColumn = function (column) {
25651 this.columnsService.showColumn(column);
25652 };
25653 NbTreeGridRowDefDirective.decorators = [
25654 { type: i0.Directive, args: [{
25655 selector: '[nbTreeGridRowDef]',
25656 providers: [{ provide: NbCdkRowDef, useExisting: NbTreeGridRowDefDirective }],
25657 },] }
25658 ];
25659 NbTreeGridRowDefDirective.ctorParameters = function () { return [
25660 { type: i0.TemplateRef },
25661 { type: i0.IterableDiffers },
25662 { type: NbColumnsService }
25663 ]; };
25664 NbTreeGridRowDefDirective.propDecorators = {
25665 columns: [{ type: i0.Input, args: ['nbTreeGridRowDefColumns',] }]
25666 };
25667 return NbTreeGridRowDefDirective;
25668}(NbRowDefDirective));
25669var NbTreeGridHeaderRowDefDirective = /** @class */ (function (_super) {
25670 tslib.__extends(NbTreeGridHeaderRowDefDirective, _super);
25671 function NbTreeGridHeaderRowDefDirective(template, differs, columnsService) {
25672 var _this = _super.call(this, template, differs) || this;
25673 _this.columnsService = columnsService;
25674 return _this;
25675 }
25676 NbTreeGridHeaderRowDefDirective.prototype.ngOnChanges = function (changes) {
25677 _super.prototype.ngOnChanges.call(this, changes);
25678 if (changes['columns']) {
25679 this.updateColumns(this.columns);
25680 }
25681 };
25682 NbTreeGridHeaderRowDefDirective.prototype.updateColumns = function (columns) {
25683 this.columnsService.setColumns(columns);
25684 };
25685 NbTreeGridHeaderRowDefDirective.prototype.getVisibleColumns = function () {
25686 return this.columnsService.getVisibleColumns();
25687 };
25688 /** @docs-private */
25689 NbTreeGridHeaderRowDefDirective.prototype.hideColumn = function (column) {
25690 this.columnsService.hideColumn(column);
25691 };
25692 /** @docs-private */
25693 NbTreeGridHeaderRowDefDirective.prototype.showColumn = function (column) {
25694 this.columnsService.showColumn(column);
25695 };
25696 NbTreeGridHeaderRowDefDirective.decorators = [
25697 { type: i0.Directive, args: [{
25698 selector: '[nbTreeGridHeaderRowDef]',
25699 providers: [{ provide: NbCdkHeaderRowDef, useExisting: NbTreeGridHeaderRowDefDirective }],
25700 },] }
25701 ];
25702 NbTreeGridHeaderRowDefDirective.ctorParameters = function () { return [
25703 { type: i0.TemplateRef },
25704 { type: i0.IterableDiffers },
25705 { type: NbColumnsService }
25706 ]; };
25707 NbTreeGridHeaderRowDefDirective.propDecorators = {
25708 columns: [{ type: i0.Input, args: ['nbTreeGridHeaderRowDef',] }]
25709 };
25710 return NbTreeGridHeaderRowDefDirective;
25711}(NbHeaderRowDefDirective));
25712var NbTreeGridFooterRowDefDirective = /** @class */ (function (_super) {
25713 tslib.__extends(NbTreeGridFooterRowDefDirective, _super);
25714 function NbTreeGridFooterRowDefDirective(template, differs, columnsService) {
25715 var _this = _super.call(this, template, differs) || this;
25716 _this.columnsService = columnsService;
25717 return _this;
25718 }
25719 NbTreeGridFooterRowDefDirective.prototype.ngOnChanges = function (changes) {
25720 _super.prototype.ngOnChanges.call(this, changes);
25721 if (changes['columns']) {
25722 this.updateColumns(this.columns);
25723 }
25724 };
25725 NbTreeGridFooterRowDefDirective.prototype.updateColumns = function (columns) {
25726 this.columnsService.setColumns(columns);
25727 };
25728 NbTreeGridFooterRowDefDirective.prototype.getVisibleColumns = function () {
25729 return this.columnsService.getVisibleColumns();
25730 };
25731 /** @docs-private */
25732 NbTreeGridFooterRowDefDirective.prototype.hideColumn = function (column) {
25733 this.columnsService.hideColumn(column);
25734 };
25735 /** @docs-private */
25736 NbTreeGridFooterRowDefDirective.prototype.showColumn = function (column) {
25737 this.columnsService.showColumn(column);
25738 };
25739 NbTreeGridFooterRowDefDirective.decorators = [
25740 { type: i0.Directive, args: [{
25741 selector: '[nbTreeGridFooterRowDef]',
25742 providers: [{ provide: NbCdkFooterRowDef, useExisting: NbTreeGridFooterRowDefDirective }],
25743 },] }
25744 ];
25745 NbTreeGridFooterRowDefDirective.ctorParameters = function () { return [
25746 { type: i0.TemplateRef },
25747 { type: i0.IterableDiffers },
25748 { type: NbColumnsService }
25749 ]; };
25750 NbTreeGridFooterRowDefDirective.propDecorators = {
25751 columns: [{ type: i0.Input, args: ['nbTreeGridFooterRowDef',] }]
25752 };
25753 return NbTreeGridFooterRowDefDirective;
25754}(NbFooterRowDefDirective));
25755/**
25756 * Cell definition for a nb-table.
25757 * Captures the template of a column's data row cell as well as cell-specific properties.
25758 */
25759var NbTreeGridCellDefDirective = /** @class */ (function (_super) {
25760 tslib.__extends(NbTreeGridCellDefDirective, _super);
25761 function NbTreeGridCellDefDirective() {
25762 return _super !== null && _super.apply(this, arguments) || this;
25763 }
25764 NbTreeGridCellDefDirective.decorators = [
25765 { type: i0.Directive, args: [{
25766 selector: '[nbTreeGridCellDef]',
25767 providers: [{ provide: NbCdkCellDef, useExisting: NbTreeGridCellDefDirective }],
25768 },] }
25769 ];
25770 return NbTreeGridCellDefDirective;
25771}(NbCellDefDirective));
25772/**
25773 * Header cell definition for the nb-table.
25774 * Captures the template of a column's header cell and as well as cell-specific properties.
25775 */
25776var NbTreeGridHeaderCellDefDirective = /** @class */ (function (_super) {
25777 tslib.__extends(NbTreeGridHeaderCellDefDirective, _super);
25778 function NbTreeGridHeaderCellDefDirective() {
25779 return _super !== null && _super.apply(this, arguments) || this;
25780 }
25781 NbTreeGridHeaderCellDefDirective.decorators = [
25782 { type: i0.Directive, args: [{
25783 selector: '[nbTreeGridHeaderCellDef]',
25784 providers: [{ provide: NbCdkHeaderCellDef, useExisting: NbTreeGridHeaderCellDefDirective }],
25785 },] }
25786 ];
25787 return NbTreeGridHeaderCellDefDirective;
25788}(NbHeaderCellDefDirective));
25789/**
25790 * Footer cell definition for the nb-table.
25791 * Captures the template of a column's footer cell and as well as cell-specific properties.
25792 */
25793var NbTreeGridFooterCellDefDirective = /** @class */ (function (_super) {
25794 tslib.__extends(NbTreeGridFooterCellDefDirective, _super);
25795 function NbTreeGridFooterCellDefDirective() {
25796 return _super !== null && _super.apply(this, arguments) || this;
25797 }
25798 NbTreeGridFooterCellDefDirective.decorators = [
25799 { type: i0.Directive, args: [{
25800 selector: '[nbTreeGridFooterCellDef]',
25801 providers: [{ provide: NbCdkFooterCellDef, useExisting: NbTreeGridFooterCellDefDirective }],
25802 },] }
25803 ];
25804 return NbTreeGridFooterCellDefDirective;
25805}(NbFooterCellDefDirective));
25806
25807var NB_ROW_DOUBLE_CLICK_DELAY = 200;
25808/**
25809 * Cells container. Adds the right class and role.
25810 */
25811var NbTreeGridRowComponent = /** @class */ (function (_super) {
25812 tslib.__extends(NbTreeGridRowComponent, _super);
25813 function NbTreeGridRowComponent(tree, elementRef) {
25814 var _this = _super.call(this) || this;
25815 _this.elementRef = elementRef;
25816 _this.doubleClick$ = new rxjs.Subject();
25817 /**
25818 * Time to wait for second click to expand row deeply.
25819 * 200ms by default.
25820 */
25821 _this.doubleClickDelay = NB_ROW_DOUBLE_CLICK_DELAY;
25822 /**
25823 * Toggle row on click. Enabled by default.
25824 */
25825 _this.clickToToggle = true;
25826 _this.tree = tree;
25827 return _this;
25828 }
25829 NbTreeGridRowComponent.prototype.toggleIfEnabledNode = function () {
25830 var _this = this;
25831 if (!this.clickToToggle) {
25832 return;
25833 }
25834 rxjs.timer(NB_ROW_DOUBLE_CLICK_DELAY)
25835 .pipe(rxjs_operators.take(1), rxjs_operators.takeUntil(this.doubleClick$))
25836 .subscribe(function () { return _this.tree.toggleRow(_this); });
25837 };
25838 NbTreeGridRowComponent.prototype.toggleIfEnabledNodeDeep = function () {
25839 if (!this.clickToToggle) {
25840 return;
25841 }
25842 this.doubleClick$.next();
25843 this.tree.toggleRow(this, { deep: true });
25844 };
25845 NbTreeGridRowComponent.prototype.ngOnDestroy = function () {
25846 this.doubleClick$.complete();
25847 };
25848 NbTreeGridRowComponent.decorators = [
25849 { type: i0.Component, args: [{
25850 selector: 'tr[nbTreeGridRow]',
25851 template: "<ng-container nbCellOutlet></ng-container>",
25852 host: {
25853 'class': 'nb-tree-grid-row',
25854 'role': 'row',
25855 },
25856 providers: [{ provide: NbCdkRow, useExisting: NbTreeGridRowComponent }]
25857 },] }
25858 ];
25859 NbTreeGridRowComponent.ctorParameters = function () { return [
25860 { type: undefined, decorators: [{ type: i0.Inject, args: [NB_TREE_GRID,] }] },
25861 { type: i0.ElementRef }
25862 ]; };
25863 NbTreeGridRowComponent.propDecorators = {
25864 doubleClickDelay: [{ type: i0.Input }],
25865 clickToToggle: [{ type: i0.Input }],
25866 toggleIfEnabledNode: [{ type: i0.HostListener, args: ['click',] }],
25867 toggleIfEnabledNodeDeep: [{ type: i0.HostListener, args: ['dblclick',] }]
25868 };
25869 return NbTreeGridRowComponent;
25870}(NbRowComponent));
25871var NbTreeGridHeaderRowComponent = /** @class */ (function (_super) {
25872 tslib.__extends(NbTreeGridHeaderRowComponent, _super);
25873 function NbTreeGridHeaderRowComponent() {
25874 return _super !== null && _super.apply(this, arguments) || this;
25875 }
25876 NbTreeGridHeaderRowComponent.decorators = [
25877 { type: i0.Component, args: [{
25878 selector: 'tr[nbTreeGridHeaderRow]',
25879 template: "\n <ng-container nbCellOutlet></ng-container>",
25880 host: {
25881 'class': 'nb-tree-grid-header-row',
25882 'role': 'row',
25883 },
25884 providers: [{ provide: NbCdkHeaderRow, useExisting: NbTreeGridHeaderRowComponent }]
25885 },] }
25886 ];
25887 return NbTreeGridHeaderRowComponent;
25888}(NbHeaderRowComponent));
25889var NbTreeGridFooterRowComponent = /** @class */ (function (_super) {
25890 tslib.__extends(NbTreeGridFooterRowComponent, _super);
25891 function NbTreeGridFooterRowComponent() {
25892 return _super !== null && _super.apply(this, arguments) || this;
25893 }
25894 NbTreeGridFooterRowComponent.decorators = [
25895 { type: i0.Component, args: [{
25896 selector: 'tr[nbTreeGridFooterRow]',
25897 template: "\n <ng-container nbCellOutlet></ng-container>",
25898 host: {
25899 'class': 'nb-tree-grid-footer-row',
25900 'role': 'row',
25901 },
25902 providers: [{ provide: NbCdkFooterRow, useExisting: NbTreeGridFooterRowComponent }]
25903 },] }
25904 ];
25905 return NbTreeGridFooterRowComponent;
25906}(NbFooterRowComponent));
25907
25908/**
25909 * Column definition for the tree-grid.
25910 * Defines a set of cells available for a table column.
25911 */
25912var NbTreeGridColumnDefDirective = /** @class */ (function (_super) {
25913 tslib.__extends(NbTreeGridColumnDefDirective, _super);
25914 function NbTreeGridColumnDefDirective() {
25915 var _this = _super !== null && _super.apply(this, arguments) || this;
25916 _this.hideOnValue = null;
25917 _this.showOnValue = null;
25918 return _this;
25919 }
25920 Object.defineProperty(NbTreeGridColumnDefDirective.prototype, "name", {
25921 /**
25922 * Column name
25923 */
25924 get: function () {
25925 return this._name;
25926 },
25927 set: function (value) {
25928 this._setNameInput(value);
25929 },
25930 enumerable: false,
25931 configurable: true
25932 });
25933 Object.defineProperty(NbTreeGridColumnDefDirective.prototype, "hideOn", {
25934 /**
25935 * Amount of pixels of viewport at which column should be hidden.
25936 * type number
25937 */
25938 get: function () {
25939 return this.hideOnValue;
25940 },
25941 set: function (value) {
25942 this.hideOnValue = !value && value !== 0
25943 ? null
25944 : parseInt(value, 10);
25945 },
25946 enumerable: false,
25947 configurable: true
25948 });
25949 Object.defineProperty(NbTreeGridColumnDefDirective.prototype, "showOn", {
25950 /**
25951 * Amount of pixels of viewport at which column should be shown.
25952 * type number
25953 */
25954 get: function () {
25955 return this.showOnValue;
25956 },
25957 set: function (value) {
25958 this.showOnValue = !value && value !== 0
25959 ? null
25960 : parseInt(value, 10);
25961 },
25962 enumerable: false,
25963 configurable: true
25964 });
25965 NbTreeGridColumnDefDirective.prototype.ngOnChanges = function () {
25966 if (this.hideOn != null && this.showOn != null) {
25967 throw new Error("hideOn and showOn are mutually exclusive and can't be used simultaneously.");
25968 }
25969 };
25970 NbTreeGridColumnDefDirective.prototype.shouldHide = function (width) {
25971 return !this.shouldShow(width);
25972 };
25973 NbTreeGridColumnDefDirective.prototype.shouldShow = function (width) {
25974 if (this.hideOn == null && this.showOn == null) {
25975 return true;
25976 }
25977 if (this.hideOn != null) {
25978 return width > this.hideOn;
25979 }
25980 return width >= this.showOn;
25981 };
25982 NbTreeGridColumnDefDirective.decorators = [
25983 { type: i0.Directive, args: [{
25984 selector: '[nbTreeGridColumnDef]',
25985 providers: [
25986 { provide: NbCdkColumnDef, useExisting: NbTreeGridColumnDefDirective },
25987 { provide: NB_SORT_HEADER_COLUMN_DEF, useExisting: NbTreeGridColumnDefDirective },
25988 ],
25989 },] }
25990 ];
25991 NbTreeGridColumnDefDirective.propDecorators = {
25992 name: [{ type: i0.Input, args: ['nbTreeGridColumnDef',] }],
25993 hideOn: [{ type: i0.Input }],
25994 showOn: [{ type: i0.Input }]
25995 };
25996 return NbTreeGridColumnDefDirective;
25997}(NbColumnDefDirective));
25998
25999/*
26000 * @license
26001 * Copyright Akveo. All Rights Reserved.
26002 * Licensed under the MIT License. See License.txt in the project root for license information.
26003 */
26004var NbTreeGridCellDirective = /** @class */ (function (_super) {
26005 tslib.__extends(NbTreeGridCellDirective, _super);
26006 function NbTreeGridCellDirective(columnDef, elementRef, tree, platformId, window, sanitizer, directionService, columnService, cd) {
26007 var _this = _super.call(this, columnDef, elementRef) || this;
26008 _this.platformId = platformId;
26009 _this.window = window;
26010 _this.sanitizer = sanitizer;
26011 _this.directionService = directionService;
26012 _this.columnService = columnService;
26013 _this.cd = cd;
26014 _this.destroy$ = new rxjs.Subject();
26015 _this.initialLeftPadding = '';
26016 _this.initialRightPadding = '';
26017 _this.tree = tree;
26018 _this.columnDef = columnDef;
26019 _this.elementRef = elementRef;
26020 return _this;
26021 }
26022 Object.defineProperty(NbTreeGridCellDirective.prototype, "columnWidth", {
26023 get: function () {
26024 this.latestWidth = this.tree.getColumnWidth();
26025 if (this.latestWidth) {
26026 return this.latestWidth;
26027 }
26028 return null;
26029 },
26030 enumerable: false,
26031 configurable: true
26032 });
26033 Object.defineProperty(NbTreeGridCellDirective.prototype, "leftPadding", {
26034 get: function () {
26035 if (this.directionService.isLtr()) {
26036 return this.getStartPadding();
26037 }
26038 return null;
26039 },
26040 enumerable: false,
26041 configurable: true
26042 });
26043 Object.defineProperty(NbTreeGridCellDirective.prototype, "rightPadding", {
26044 get: function () {
26045 if (this.directionService.isRtl()) {
26046 return this.getStartPadding();
26047 }
26048 return null;
26049 },
26050 enumerable: false,
26051 configurable: true
26052 });
26053 NbTreeGridCellDirective.prototype.ngOnInit = function () {
26054 var _this = this;
26055 if (_angular_common.isPlatformBrowser(this.platformId)) {
26056 var style$$1 = this.window.getComputedStyle(this.elementRef.nativeElement);
26057 this.initialLeftPadding = style$$1.paddingLeft;
26058 this.initialRightPadding = style$$1.paddingRight;
26059 }
26060 this.columnService.onColumnsChange()
26061 .pipe(rxjs_operators.filter(function () { return _this.latestWidth !== _this.tree.getColumnWidth(); }), rxjs_operators.takeUntil(this.destroy$))
26062 .subscribe(function () { return _this.cd.detectChanges(); });
26063 };
26064 NbTreeGridCellDirective.prototype.ngOnDestroy = function () {
26065 this.destroy$.next();
26066 this.destroy$.complete();
26067 };
26068 NbTreeGridCellDirective.prototype.toggleRow = function () {
26069 this.tree.toggleCellRow(this);
26070 };
26071 Object.defineProperty(NbTreeGridCellDirective.prototype, "initialStartPadding", {
26072 get: function () {
26073 return this.directionService.isLtr()
26074 ? this.initialLeftPadding
26075 : this.initialRightPadding;
26076 },
26077 enumerable: false,
26078 configurable: true
26079 });
26080 NbTreeGridCellDirective.prototype.getStartPadding = function () {
26081 var rowLevel = this.tree.getCellLevel(this, this.columnDef.name);
26082 if (rowLevel === NB_DEFAULT_ROW_LEVEL) {
26083 return null;
26084 }
26085 var nestingLevel = rowLevel + 1;
26086 var padding = '';
26087 if (this.tree.levelPadding) {
26088 padding = "calc(" + this.tree.levelPadding + " * " + nestingLevel + ")";
26089 }
26090 else if (this.initialStartPadding) {
26091 padding = "calc(" + this.initialStartPadding + " * " + nestingLevel + ")";
26092 }
26093 if (!padding) {
26094 return null;
26095 }
26096 return this.sanitizer.bypassSecurityTrustStyle(padding);
26097 };
26098 NbTreeGridCellDirective.decorators = [
26099 { type: i0.Directive, args: [{
26100 selector: 'td[nbTreeGridCell]',
26101 host: {
26102 'class': 'nb-tree-grid-cell',
26103 'role': 'gridcell',
26104 },
26105 providers: [{ provide: NbCdkCell, useExisting: NbTreeGridCellDirective }],
26106 },] }
26107 ];
26108 NbTreeGridCellDirective.ctorParameters = function () { return [
26109 { type: NbTreeGridColumnDefDirective },
26110 { type: i0.ElementRef },
26111 { type: undefined, decorators: [{ type: i0.Inject, args: [NB_TREE_GRID,] }] },
26112 { type: undefined, decorators: [{ type: i0.Inject, args: [i0.PLATFORM_ID,] }] },
26113 { type: undefined, decorators: [{ type: i0.Inject, args: [NB_WINDOW,] }] },
26114 { type: _angular_platformBrowser.DomSanitizer },
26115 { type: NbLayoutDirectionService },
26116 { type: NbColumnsService },
26117 { type: i0.ChangeDetectorRef }
26118 ]; };
26119 NbTreeGridCellDirective.propDecorators = {
26120 columnWidth: [{ type: i0.HostBinding, args: ['style.width',] }],
26121 leftPadding: [{ type: i0.HostBinding, args: ['style.padding-left',] }],
26122 rightPadding: [{ type: i0.HostBinding, args: ['style.padding-right',] }]
26123 };
26124 return NbTreeGridCellDirective;
26125}(NbCellDirective));
26126var NbTreeGridHeaderCellDirective = /** @class */ (function (_super) {
26127 tslib.__extends(NbTreeGridHeaderCellDirective, _super);
26128 function NbTreeGridHeaderCellDirective(columnDef, elementRef, tree, columnService, cd) {
26129 var _this = _super.call(this, columnDef, elementRef) || this;
26130 _this.columnService = columnService;
26131 _this.cd = cd;
26132 _this.destroy$ = new rxjs.Subject();
26133 _this.tree = tree;
26134 return _this;
26135 }
26136 Object.defineProperty(NbTreeGridHeaderCellDirective.prototype, "columnWidth", {
26137 get: function () {
26138 this.latestWidth = this.tree.getColumnWidth();
26139 return this.latestWidth || null;
26140 },
26141 enumerable: false,
26142 configurable: true
26143 });
26144 NbTreeGridHeaderCellDirective.prototype.ngOnInit = function () {
26145 var _this = this;
26146 this.columnService.onColumnsChange()
26147 .pipe(rxjs_operators.filter(function () { return _this.latestWidth !== _this.tree.getColumnWidth(); }), rxjs_operators.takeUntil(this.destroy$))
26148 .subscribe(function () { return _this.cd.detectChanges(); });
26149 };
26150 NbTreeGridHeaderCellDirective.prototype.ngOnDestroy = function () {
26151 this.destroy$.next();
26152 this.destroy$.complete();
26153 };
26154 NbTreeGridHeaderCellDirective.decorators = [
26155 { type: i0.Directive, args: [{
26156 selector: 'th[nbTreeGridHeaderCell]',
26157 host: {
26158 'class': 'nb-tree-grid-header-cell',
26159 'role': 'columnheader',
26160 },
26161 providers: [{ provide: NbCdkHeaderCell, useExisting: NbTreeGridHeaderCellDirective }],
26162 },] }
26163 ];
26164 NbTreeGridHeaderCellDirective.ctorParameters = function () { return [
26165 { type: NbTreeGridColumnDefDirective },
26166 { type: i0.ElementRef },
26167 { type: undefined, decorators: [{ type: i0.Inject, args: [NB_TREE_GRID,] }] },
26168 { type: NbColumnsService },
26169 { type: i0.ChangeDetectorRef }
26170 ]; };
26171 NbTreeGridHeaderCellDirective.propDecorators = {
26172 columnWidth: [{ type: i0.HostBinding, args: ['style.width',] }]
26173 };
26174 return NbTreeGridHeaderCellDirective;
26175}(NbHeaderCellDirective));
26176var NbTreeGridFooterCellDirective = /** @class */ (function (_super) {
26177 tslib.__extends(NbTreeGridFooterCellDirective, _super);
26178 function NbTreeGridFooterCellDirective(columnDef, elementRef, tree, columnService, cd) {
26179 var _this = _super.call(this, columnDef, elementRef) || this;
26180 _this.columnService = columnService;
26181 _this.cd = cd;
26182 _this.destroy$ = new rxjs.Subject();
26183 _this.tree = tree;
26184 return _this;
26185 }
26186 Object.defineProperty(NbTreeGridFooterCellDirective.prototype, "columnWidth", {
26187 get: function () {
26188 this.latestWidth = this.tree.getColumnWidth();
26189 return this.latestWidth || null;
26190 },
26191 enumerable: false,
26192 configurable: true
26193 });
26194 NbTreeGridFooterCellDirective.prototype.ngOnInit = function () {
26195 var _this = this;
26196 this.columnService.onColumnsChange()
26197 .pipe(rxjs_operators.filter(function () { return _this.latestWidth !== _this.tree.getColumnWidth(); }), rxjs_operators.takeUntil(this.destroy$))
26198 .subscribe(function () { return _this.cd.detectChanges(); });
26199 };
26200 NbTreeGridFooterCellDirective.prototype.ngOnDestroy = function () {
26201 this.destroy$.next();
26202 this.destroy$.complete();
26203 };
26204 NbTreeGridFooterCellDirective.decorators = [
26205 { type: i0.Directive, args: [{
26206 selector: 'td[nbTreeGridFooterCell]',
26207 host: {
26208 'class': 'nb-tree-grid-footer-cell',
26209 'role': 'gridcell',
26210 },
26211 providers: [{ provide: NbCdkFooterCell, useExisting: NbTreeGridFooterCellDirective }],
26212 },] }
26213 ];
26214 NbTreeGridFooterCellDirective.ctorParameters = function () { return [
26215 { type: NbTreeGridColumnDefDirective },
26216 { type: i0.ElementRef },
26217 { type: undefined, decorators: [{ type: i0.Inject, args: [NB_TREE_GRID,] }] },
26218 { type: NbColumnsService },
26219 { type: i0.ChangeDetectorRef }
26220 ]; };
26221 NbTreeGridFooterCellDirective.propDecorators = {
26222 columnWidth: [{ type: i0.HostBinding, args: ['style.width',] }]
26223 };
26224 return NbTreeGridFooterCellDirective;
26225}(NbFooterCellDirective));
26226
26227/*
26228 * @license
26229 * Copyright Akveo. All Rights Reserved.
26230 * Licensed under the MIT License. See License.txt in the project root for license information.
26231 */
26232var NbFilterDirective = /** @class */ (function () {
26233 function NbFilterDirective() {
26234 }
26235 NbFilterDirective.prototype.filter = function (filterRequest) {
26236 this.filterable.filter(filterRequest);
26237 };
26238 NbFilterDirective.decorators = [
26239 { type: i0.Directive, args: [{ selector: '[nbFilter]' },] }
26240 ];
26241 NbFilterDirective.propDecorators = {
26242 filterable: [{ type: i0.Input, args: ['nbFilter',] }]
26243 };
26244 return NbFilterDirective;
26245}());
26246/**
26247 * Helper directive to trigger data source's filter method when user types in input
26248 */
26249var NbFilterInputDirective = /** @class */ (function (_super) {
26250 tslib.__extends(NbFilterInputDirective, _super);
26251 function NbFilterInputDirective() {
26252 var _this = _super !== null && _super.apply(this, arguments) || this;
26253 _this.search$ = new rxjs.Subject();
26254 _this.destroy$ = new rxjs.Subject();
26255 /**
26256 * Debounce time before triggering filter method. Set in milliseconds.
26257 * Default 200.
26258 */
26259 _this.debounceTime = 200;
26260 return _this;
26261 }
26262 NbFilterInputDirective.prototype.ngOnInit = function () {
26263 var _this = this;
26264 this.search$
26265 .pipe(rxjs_operators.debounceTime(this.debounceTime), rxjs_operators.takeUntil(this.destroy$))
26266 .subscribe(function (query) {
26267 _super.prototype.filter.call(_this, query);
26268 });
26269 };
26270 NbFilterInputDirective.prototype.ngOnDestroy = function () {
26271 this.destroy$.next();
26272 this.destroy$.complete();
26273 this.search$.complete();
26274 };
26275 NbFilterInputDirective.prototype.filter = function (event) {
26276 this.search$.next(event.target.value);
26277 };
26278 NbFilterInputDirective.decorators = [
26279 { type: i0.Directive, args: [{
26280 selector: '[nbFilterInput]',
26281 providers: [{ provide: NbFilterDirective, useExisting: NbFilterInputDirective }],
26282 },] }
26283 ];
26284 NbFilterInputDirective.propDecorators = {
26285 filterable: [{ type: i0.Input, args: ['nbFilterInput',] }],
26286 debounceTime: [{ type: i0.Input }],
26287 filter: [{ type: i0.HostListener, args: ['input', ['$event'],] }]
26288 };
26289 return NbFilterInputDirective;
26290}(NbFilterDirective));
26291
26292/*
26293 * @license
26294 * Copyright Akveo. All Rights Reserved.
26295 * Licensed under the MIT License. See License.txt in the project root for license information.
26296 */
26297/**
26298 * When using custom row toggle, apply this directive on your toggle to toggle row on element click.
26299 */
26300var NbTreeGridRowToggleDirective = /** @class */ (function () {
26301 function NbTreeGridRowToggleDirective(cell) {
26302 this.cell = cell;
26303 }
26304 NbTreeGridRowToggleDirective.prototype.toggleRow = function ($event) {
26305 this.cell.toggleRow();
26306 $event.stopPropagation();
26307 };
26308 NbTreeGridRowToggleDirective.decorators = [
26309 { type: i0.Directive, args: [{
26310 selector: '[nbTreeGridRowToggle]',
26311 },] }
26312 ];
26313 NbTreeGridRowToggleDirective.ctorParameters = function () { return [
26314 { type: NbTreeGridCellDirective }
26315 ]; };
26316 NbTreeGridRowToggleDirective.propDecorators = {
26317 toggleRow: [{ type: i0.HostListener, args: ['click', ['$event'],] }]
26318 };
26319 return NbTreeGridRowToggleDirective;
26320}());
26321
26322/*
26323 * @license
26324 * Copyright Akveo. All Rights Reserved.
26325 * Licensed under the MIT License. See License.txt in the project root for license information.
26326 */
26327/**
26328 * NbTreeGridRowToggleComponent
26329 */
26330var NbTreeGridRowToggleComponent = /** @class */ (function () {
26331 function NbTreeGridRowToggleComponent(cell) {
26332 this.cell = cell;
26333 }
26334 Object.defineProperty(NbTreeGridRowToggleComponent.prototype, "expanded", {
26335 get: function () {
26336 return this.expandedValue;
26337 },
26338 set: function (value) {
26339 this.expandedValue = value;
26340 },
26341 enumerable: false,
26342 configurable: true
26343 });
26344 NbTreeGridRowToggleComponent.prototype.toggleRow = function ($event) {
26345 this.cell.toggleRow();
26346 $event.stopPropagation();
26347 };
26348 NbTreeGridRowToggleComponent.decorators = [
26349 { type: i0.Component, args: [{
26350 selector: 'nb-tree-grid-row-toggle',
26351 template: "\n <button class=\"row-toggle-button\" [attr.aria-label]=\"expanded ? 'collapse' : 'expand'\">\n <nb-icon [icon]=\"expanded ? 'chevron-down-outline' : 'chevron-right-outline'\"\n pack=\"nebular-essentials\"\n aria-hidden=\"true\">\n </nb-icon>\n </button>\n ",
26352 styles: ["\n button {\n background: transparent;\n border: none;\n padding: 0;\n }\n "]
26353 },] }
26354 ];
26355 NbTreeGridRowToggleComponent.ctorParameters = function () { return [
26356 { type: NbTreeGridCellDirective }
26357 ]; };
26358 NbTreeGridRowToggleComponent.propDecorators = {
26359 expanded: [{ type: i0.Input }],
26360 toggleRow: [{ type: i0.HostListener, args: ['click', ['$event'],] }]
26361 };
26362 return NbTreeGridRowToggleComponent;
26363}());
26364
26365/*
26366 * @license
26367 * Copyright Akveo. All Rights Reserved.
26368 * Licensed under the MIT License. See License.txt in the project root for license information.
26369 */
26370var COMPONENTS$2 = [
26371 // Tree Grid
26372 NbTreeGridComponent,
26373 NbTreeGridRowDefDirective,
26374 NbTreeGridRowComponent,
26375 NbTreeGridCellDefDirective,
26376 NbTreeGridCellDirective,
26377 NbTreeGridHeaderRowDefDirective,
26378 NbTreeGridHeaderRowComponent,
26379 NbTreeGridHeaderCellDefDirective,
26380 NbTreeGridHeaderCellDirective,
26381 NbTreeGridFooterRowDefDirective,
26382 NbTreeGridFooterRowComponent,
26383 NbTreeGridFooterCellDefDirective,
26384 NbTreeGridFooterCellDirective,
26385 NbTreeGridColumnDefDirective,
26386 // Sort directives
26387 NbSortDirective,
26388 NbSortHeaderComponent,
26389 NbSortIconComponent,
26390 // Filter directives
26391 NbFilterDirective,
26392 NbFilterInputDirective,
26393 NbTreeGridRowToggleDirective,
26394 NbTreeGridRowToggleComponent,
26395 NbSortHeaderIconDirective,
26396];
26397var NbTreeGridModule = /** @class */ (function () {
26398 function NbTreeGridModule() {
26399 }
26400 NbTreeGridModule.decorators = [
26401 { type: i0.NgModule, args: [{
26402 imports: [_angular_common.CommonModule, NbTableModule, NbIconModule],
26403 declarations: tslib.__spreadArray([], COMPONENTS$2),
26404 exports: tslib.__spreadArray([NbTableModule], COMPONENTS$2),
26405 providers: [
26406 NbTreeGridSortService,
26407 NbTreeGridFilterService,
26408 NbTreeGridService,
26409 NbTreeGridDataService,
26410 NbTreeGridDataSourceBuilder,
26411 ],
26412 },] }
26413 ];
26414 return NbTreeGridModule;
26415}());
26416
26417/**
26418 * @license
26419 * Copyright Akveo. All Rights Reserved.
26420 * Licensed under the MIT License. See License.txt in the project root for license information.
26421 */
26422/**
26423 * Toggle is a control representing `on` and `off` states.
26424 *
26425 * @stacked-example(Showcase, toggle/toggle-showcase.component)
26426 *
26427 * ### Installation
26428 *
26429 * Import `NbToggleComponent` to your feature module.
26430 * ```ts
26431 * @NgModule({
26432 * imports: [
26433 * // ...
26434 * NbToggleModule,
26435 * ],
26436 * })
26437 * export class PageModule { }
26438 * ```
26439 * ### Usage
26440 *
26441 * Toggle may have one of the following statuses: `basic`, `primary`, `success`, `warning`, `danger`, `info`, `control`
26442 *
26443 * @stacked-example(Toggle status, toggle/toggle-status.component)
26444 *
26445 * Toggle can be disabled via `disabled` input.
26446 *
26447 * @stacked-example(Disabled Toggles, toggle/toggle-disabled.component)
26448 *
26449 * Toggle may have a label with following positions: `left`, `right`, `start`, `end` (default)
26450 *
26451 * @stacked-example(Toggles With Labels, toggle/toggle-label-position.component.ts)
26452 *
26453 * You can set control state via `checked` binding:
26454 *
26455 * ```html
26456 * <nb-toggle [(checked)]="checked"></nb-toggle>
26457 * ```
26458 *
26459 * Or it could be set via reactive forms or ngModel bindings:
26460 *
26461 * @stacked-example(Toggle form binding, toggle/toggle-form.component)
26462 *
26463 * @styles
26464 *
26465 * toggle-height:
26466 * toggle-width:
26467 * toggle-border-width:
26468 * toggle-border-radius:
26469 * toggle-outline-width:
26470 * toggle-outline-color:
26471 * toggle-switcher-size:
26472 * toggle-switcher-icon-size:
26473 * toggle-text-font-family:
26474 * toggle-text-font-size:
26475 * toggle-text-font-weight:
26476 * toggle-text-line-height:
26477 * toggle-cursor:
26478 * toggle-disabled-cursor:
26479 * toggle-basic-text-color:
26480 * toggle-basic-background-color:
26481 * toggle-basic-border-color:
26482 * toggle-basic-checked-background-color:
26483 * toggle-basic-checked-border-color:
26484 * toggle-basic-checked-switcher-background-color:
26485 * toggle-basic-checked-switcher-checkmark-color:
26486 * toggle-basic-focus-background-color:
26487 * toggle-basic-focus-border-color:
26488 * toggle-basic-focus-checked-background-color:
26489 * toggle-basic-focus-checked-border-color:
26490 * toggle-basic-hover-background-color:
26491 * toggle-basic-hover-border-color:
26492 * toggle-basic-hover-checked-background-color:
26493 * toggle-basic-hover-checked-border-color:
26494 * toggle-basic-active-background-color:
26495 * toggle-basic-active-border-color:
26496 * toggle-basic-active-checked-background-color:
26497 * toggle-basic-active-checked-border-color:
26498 * toggle-basic-disabled-background-color:
26499 * toggle-basic-disabled-border-color:
26500 * toggle-basic-disabled-switcher-background-color:
26501 * toggle-basic-disabled-checked-switcher-checkmark-color:
26502 * toggle-basic-disabled-text-color:
26503 * toggle-primary-text-color:
26504 * toggle-primary-background-color:
26505 * toggle-primary-border-color:
26506 * toggle-primary-checked-background-color:
26507 * toggle-primary-checked-border-color:
26508 * toggle-primary-checked-switcher-background-color:
26509 * toggle-primary-checked-switcher-checkmark-color:
26510 * toggle-primary-focus-background-color:
26511 * toggle-primary-focus-border-color:
26512 * toggle-primary-focus-checked-background-color:
26513 * toggle-primary-focus-checked-border-color:
26514 * toggle-primary-hover-background-color:
26515 * toggle-primary-hover-border-color:
26516 * toggle-primary-hover-checked-background-color:
26517 * toggle-primary-hover-checked-border-color:
26518 * toggle-primary-active-background-color:
26519 * toggle-primary-active-border-color:
26520 * toggle-primary-active-checked-background-color:
26521 * toggle-primary-active-checked-border-color:
26522 * toggle-primary-disabled-background-color:
26523 * toggle-primary-disabled-border-color:
26524 * toggle-primary-disabled-switcher-background-color:
26525 * toggle-primary-disabled-checked-switcher-checkmark-color:
26526 * toggle-primary-disabled-text-color:
26527 * toggle-success-text-color:
26528 * toggle-success-background-color:
26529 * toggle-success-border-color:
26530 * toggle-success-checked-background-color:
26531 * toggle-success-checked-border-color:
26532 * toggle-success-checked-switcher-background-color:
26533 * toggle-success-checked-switcher-checkmark-color:
26534 * toggle-success-focus-background-color:
26535 * toggle-success-focus-border-color:
26536 * toggle-success-focus-checked-background-color:
26537 * toggle-success-focus-checked-border-color:
26538 * toggle-success-hover-background-color:
26539 * toggle-success-hover-border-color:
26540 * toggle-success-hover-checked-background-color:
26541 * toggle-success-hover-checked-border-color:
26542 * toggle-success-active-background-color:
26543 * toggle-success-active-border-color:
26544 * toggle-success-active-checked-background-color:
26545 * toggle-success-active-checked-border-color:
26546 * toggle-success-disabled-background-color:
26547 * toggle-success-disabled-border-color:
26548 * toggle-success-disabled-switcher-background-color:
26549 * toggle-success-disabled-checked-switcher-checkmark-color:
26550 * toggle-success-disabled-text-color:
26551 * toggle-info-text-color:
26552 * toggle-info-background-color:
26553 * toggle-info-border-color:
26554 * toggle-info-checked-background-color:
26555 * toggle-info-checked-border-color:
26556 * toggle-info-checked-switcher-background-color:
26557 * toggle-info-checked-switcher-checkmark-color:
26558 * toggle-info-focus-background-color:
26559 * toggle-info-focus-border-color:
26560 * toggle-info-focus-checked-background-color:
26561 * toggle-info-focus-checked-border-color:
26562 * toggle-info-hover-background-color:
26563 * toggle-info-hover-border-color:
26564 * toggle-info-hover-checked-background-color:
26565 * toggle-info-hover-checked-border-color:
26566 * toggle-info-active-background-color:
26567 * toggle-info-active-border-color:
26568 * toggle-info-active-checked-background-color:
26569 * toggle-info-active-checked-border-color:
26570 * toggle-info-disabled-background-color:
26571 * toggle-info-disabled-border-color:
26572 * toggle-info-disabled-switcher-background-color:
26573 * toggle-info-disabled-checked-switcher-checkmark-color:
26574 * toggle-info-disabled-text-color:
26575 * toggle-warning-text-color:
26576 * toggle-warning-background-color:
26577 * toggle-warning-border-color:
26578 * toggle-warning-checked-background-color:
26579 * toggle-warning-checked-border-color:
26580 * toggle-warning-checked-switcher-background-color:
26581 * toggle-warning-checked-switcher-checkmark-color:
26582 * toggle-warning-focus-background-color:
26583 * toggle-warning-focus-border-color:
26584 * toggle-warning-focus-checked-background-color:
26585 * toggle-warning-focus-checked-border-color:
26586 * toggle-warning-hover-background-color:
26587 * toggle-warning-hover-border-color:
26588 * toggle-warning-hover-checked-background-color:
26589 * toggle-warning-hover-checked-border-color:
26590 * toggle-warning-active-background-color:
26591 * toggle-warning-active-border-color:
26592 * toggle-warning-active-checked-background-color:
26593 * toggle-warning-active-checked-border-color:
26594 * toggle-warning-disabled-background-color:
26595 * toggle-warning-disabled-border-color:
26596 * toggle-warning-disabled-switcher-background-color:
26597 * toggle-warning-disabled-checked-switcher-checkmark-color:
26598 * toggle-warning-disabled-text-color:
26599 * toggle-danger-text-color:
26600 * toggle-danger-background-color:
26601 * toggle-danger-border-color:
26602 * toggle-danger-checked-background-color:
26603 * toggle-danger-checked-border-color:
26604 * toggle-danger-checked-switcher-background-color:
26605 * toggle-danger-checked-switcher-checkmark-color:
26606 * toggle-danger-focus-background-color:
26607 * toggle-danger-focus-border-color:
26608 * toggle-danger-focus-checked-background-color:
26609 * toggle-danger-focus-checked-border-color:
26610 * toggle-danger-hover-background-color:
26611 * toggle-danger-hover-border-color:
26612 * toggle-danger-hover-checked-background-color:
26613 * toggle-danger-hover-checked-border-color:
26614 * toggle-danger-active-background-color:
26615 * toggle-danger-active-border-color:
26616 * toggle-danger-active-checked-background-color:
26617 * toggle-danger-active-checked-border-color:
26618 * toggle-danger-disabled-background-color:
26619 * toggle-danger-disabled-border-color:
26620 * toggle-danger-disabled-switcher-background-color:
26621 * toggle-danger-disabled-checked-switcher-checkmark-color:
26622 * toggle-danger-disabled-text-color:
26623 * toggle-control-text-color:
26624 * toggle-control-background-color:
26625 * toggle-control-border-color:
26626 * toggle-control-checked-background-color:
26627 * toggle-control-checked-border-color:
26628 * toggle-control-checked-switcher-background-color:
26629 * toggle-control-checked-switcher-checkmark-color:
26630 * toggle-control-focus-background-color:
26631 * toggle-control-focus-border-color:
26632 * toggle-control-focus-checked-background-color:
26633 * toggle-control-focus-checked-border-color:
26634 * toggle-control-hover-background-color:
26635 * toggle-control-hover-border-color:
26636 * toggle-control-hover-checked-background-color:
26637 * toggle-control-hover-checked-border-color:
26638 * toggle-control-active-background-color:
26639 * toggle-control-active-border-color:
26640 * toggle-control-active-checked-background-color:
26641 * toggle-control-active-checked-border-color:
26642 * toggle-control-disabled-background-color:
26643 * toggle-control-disabled-border-color:
26644 * toggle-control-disabled-switcher-background-color:
26645 * toggle-control-disabled-checked-switcher-checkmark-color:
26646 * toggle-control-disabled-text-color:
26647 */
26648var NbToggleComponent = /** @class */ (function () {
26649 function NbToggleComponent(changeDetector, layoutDirection, renderer, hostElement, zone, statusService) {
26650 this.changeDetector = changeDetector;
26651 this.layoutDirection = layoutDirection;
26652 this.renderer = renderer;
26653 this.hostElement = hostElement;
26654 this.zone = zone;
26655 this.statusService = statusService;
26656 this.onChange = function () { };
26657 this.onTouched = function () { };
26658 this.destroy$ = new rxjs.Subject();
26659 this._checked = false;
26660 this._disabled = false;
26661 /**
26662 * Toggle status.
26663 * Possible values are: `basic`, `primary`, `success`, `warning`, `danger`, `info`, `control`.
26664 */
26665 this.status = 'basic';
26666 /**
26667 * Toggle label position.
26668 * Possible values are: `left`, `right`, `start`, `end` (default)
26669 */
26670 this.labelPosition = 'end';
26671 /**
26672 * Output when checked state is changed by a user
26673 * @type EventEmitter<boolean>
26674 */
26675 this.checkedChange = new i0.EventEmitter();
26676 }
26677 Object.defineProperty(NbToggleComponent.prototype, "checked", {
26678 /**
26679 * Toggle checked
26680 * @type {boolean}
26681 */
26682 get: function () {
26683 return this._checked;
26684 },
26685 set: function (value) {
26686 this._checked = convertToBoolProperty(value);
26687 },
26688 enumerable: false,
26689 configurable: true
26690 });
26691 Object.defineProperty(NbToggleComponent.prototype, "disabled", {
26692 /**
26693 * Controls input disabled state
26694 */
26695 get: function () {
26696 return this._disabled;
26697 },
26698 set: function (value) {
26699 this._disabled = convertToBoolProperty(value);
26700 },
26701 enumerable: false,
26702 configurable: true
26703 });
26704 Object.defineProperty(NbToggleComponent.prototype, "primary", {
26705 get: function () {
26706 return this.status === 'primary';
26707 },
26708 enumerable: false,
26709 configurable: true
26710 });
26711 Object.defineProperty(NbToggleComponent.prototype, "success", {
26712 get: function () {
26713 return this.status === 'success';
26714 },
26715 enumerable: false,
26716 configurable: true
26717 });
26718 Object.defineProperty(NbToggleComponent.prototype, "warning", {
26719 get: function () {
26720 return this.status === 'warning';
26721 },
26722 enumerable: false,
26723 configurable: true
26724 });
26725 Object.defineProperty(NbToggleComponent.prototype, "danger", {
26726 get: function () {
26727 return this.status === 'danger';
26728 },
26729 enumerable: false,
26730 configurable: true
26731 });
26732 Object.defineProperty(NbToggleComponent.prototype, "info", {
26733 get: function () {
26734 return this.status === 'info';
26735 },
26736 enumerable: false,
26737 configurable: true
26738 });
26739 Object.defineProperty(NbToggleComponent.prototype, "basic", {
26740 get: function () {
26741 return this.status === 'basic';
26742 },
26743 enumerable: false,
26744 configurable: true
26745 });
26746 Object.defineProperty(NbToggleComponent.prototype, "control", {
26747 get: function () {
26748 return this.status === 'control';
26749 },
26750 enumerable: false,
26751 configurable: true
26752 });
26753 Object.defineProperty(NbToggleComponent.prototype, "additionalClasses", {
26754 get: function () {
26755 if (this.statusService.isCustomStatus(this.status)) {
26756 return [this.statusService.getStatusClass(this.status)];
26757 }
26758 return [];
26759 },
26760 enumerable: false,
26761 configurable: true
26762 });
26763 Object.defineProperty(NbToggleComponent.prototype, "labelLeft", {
26764 get: function () {
26765 return this.labelPosition === 'left';
26766 },
26767 enumerable: false,
26768 configurable: true
26769 });
26770 Object.defineProperty(NbToggleComponent.prototype, "labelRight", {
26771 get: function () {
26772 return this.labelPosition === 'right';
26773 },
26774 enumerable: false,
26775 configurable: true
26776 });
26777 Object.defineProperty(NbToggleComponent.prototype, "labelStart", {
26778 get: function () {
26779 return this.labelPosition === 'start';
26780 },
26781 enumerable: false,
26782 configurable: true
26783 });
26784 Object.defineProperty(NbToggleComponent.prototype, "labelEnd", {
26785 get: function () {
26786 return this.labelPosition === 'end';
26787 },
26788 enumerable: false,
26789 configurable: true
26790 });
26791 NbToggleComponent.prototype.ngOnInit = function () {
26792 var _this = this;
26793 this.layoutDirection.onDirectionChange()
26794 .pipe(rxjs_operators.takeUntil(this.destroy$))
26795 .subscribe(function () { return _this.changeDetector.detectChanges(); });
26796 };
26797 NbToggleComponent.prototype.ngAfterViewInit = function () {
26798 var _this = this;
26799 // TODO: #2254
26800 this.zone.runOutsideAngular(function () { return setTimeout(function () {
26801 _this.renderer.addClass(_this.hostElement.nativeElement, 'nb-transition');
26802 }); });
26803 };
26804 NbToggleComponent.prototype.ngOnDestroy = function () {
26805 this.destroy$.next();
26806 this.destroy$.complete();
26807 };
26808 NbToggleComponent.prototype.checkState = function () {
26809 if (this.checked) {
26810 return this.layoutDirection.isLtr() ? 'right' : 'left';
26811 }
26812 return this.layoutDirection.isLtr() ? 'left' : 'right';
26813 };
26814 NbToggleComponent.prototype.registerOnChange = function (fn) {
26815 this.onChange = fn;
26816 };
26817 NbToggleComponent.prototype.registerOnTouched = function (fn) {
26818 this.onTouched = fn;
26819 };
26820 NbToggleComponent.prototype.writeValue = function (val) {
26821 this.checked = val;
26822 this.changeDetector.markForCheck();
26823 };
26824 NbToggleComponent.prototype.setDisabledState = function (val) {
26825 this.disabled = convertToBoolProperty(val);
26826 this.changeDetector.markForCheck();
26827 };
26828 NbToggleComponent.prototype.updateValue = function (event) {
26829 var input = event.target;
26830 this.checked = input.checked;
26831 this.checkedChange.emit(this.checked);
26832 this.onChange(this.checked);
26833 };
26834 NbToggleComponent.prototype.onInputClick = function (event) {
26835 event.stopPropagation();
26836 };
26837 NbToggleComponent.decorators = [
26838 { type: i0.Component, args: [{
26839 selector: 'nb-toggle',
26840 animations: [
26841 _angular_animations.trigger('position', [
26842 _angular_animations.state('right', _angular_animations.style({ right: 0, left: '*' })),
26843 _angular_animations.state('left', _angular_animations.style({ left: 0, right: '*' })),
26844 _angular_animations.transition(':enter', [_angular_animations.animate(0)]),
26845 _angular_animations.transition('right <=> left', [_angular_animations.animate('0.15s')]),
26846 ]),
26847 ],
26848 template: "\n <label class=\"toggle-label\">\n <input type=\"checkbox\"\n class=\"native-input visually-hidden\"\n role=\"switch\"\n [attr.aria-checked]=\"checked\"\n [disabled]=\"disabled\"\n [checked]=\"checked\"\n (change)=\"updateValue($event)\"\n (blur)=\"onTouched()\"\n (click)=\"onInputClick($event)\">\n <div class=\"toggle\" [class.checked]=\"checked\">\n <span [@position]=\"checkState()\" class=\"toggle-switcher\">\n <nb-icon *ngIf=\"checked\" icon=\"checkmark-bold-outline\" pack=\"nebular-essentials\"></nb-icon>\n </span>\n </div>\n <span class=\"text\">\n <ng-content></ng-content>\n </span>\n </label>\n ",
26849 providers: [{
26850 provide: _angular_forms.NG_VALUE_ACCESSOR,
26851 useExisting: i0.forwardRef(function () { return NbToggleComponent; }),
26852 multi: true,
26853 }],
26854 changeDetection: i0.ChangeDetectionStrategy.OnPush,
26855 styles: [":host{display:inline-flex;outline:none}:host(.toggle-label-left) .text:not(:empty){padding-right:0.6875rem}[dir=ltr] :host(.toggle-label-left) .text:not(:empty){order:-1}[dir=rtl] :host(.toggle-label-left) .text:not(:empty){order:1}:host(.toggle-label-right) .text:not(:empty){padding-left:0.6875rem}[dir=ltr] :host(.toggle-label-right) .text:not(:empty){order:1}[dir=rtl] :host(.toggle-label-right) .text:not(:empty){order:-1}:host(.toggle-label-start) .toggle-label{flex-direction:row-reverse}[dir=ltr] :host(.toggle-label-start) .toggle-label .text:not(:empty){padding-right:.6875rem}[dir=rtl] :host(.toggle-label-start) .toggle-label .text:not(:empty){padding-left:.6875rem}[dir=ltr] :host(.toggle-label-end) .text:not(:empty){padding-left:.6875rem}[dir=rtl] :host(.toggle-label-end) .text:not(:empty){padding-right:.6875rem}:host(.nb-transition) .toggle{transition-duration:0.15s;transition-property:background-color,border,box-shadow;transition-timing-function:ease-in}.toggle-label{position:relative;display:inline-flex;align-items:center}.toggle{position:relative;display:inline-flex;box-sizing:content-box}.toggle-switcher{position:absolute;border-radius:50%;margin:1px}.toggle-switcher nb-icon{position:absolute;top:50%;left:50%;transform:translate(-50%, -50%)}\n"]
26856 },] }
26857 ];
26858 NbToggleComponent.ctorParameters = function () { return [
26859 { type: i0.ChangeDetectorRef },
26860 { type: NbLayoutDirectionService },
26861 { type: i0.Renderer2 },
26862 { type: i0.ElementRef },
26863 { type: i0.NgZone },
26864 { type: NbStatusService }
26865 ]; };
26866 NbToggleComponent.propDecorators = {
26867 checked: [{ type: i0.Input }],
26868 disabled: [{ type: i0.Input }],
26869 status: [{ type: i0.Input }],
26870 labelPosition: [{ type: i0.Input }],
26871 checkedChange: [{ type: i0.Output }],
26872 primary: [{ type: i0.HostBinding, args: ['class.status-primary',] }],
26873 success: [{ type: i0.HostBinding, args: ['class.status-success',] }],
26874 warning: [{ type: i0.HostBinding, args: ['class.status-warning',] }],
26875 danger: [{ type: i0.HostBinding, args: ['class.status-danger',] }],
26876 info: [{ type: i0.HostBinding, args: ['class.status-info',] }],
26877 basic: [{ type: i0.HostBinding, args: ['class.status-basic',] }],
26878 control: [{ type: i0.HostBinding, args: ['class.status-control',] }],
26879 additionalClasses: [{ type: i0.HostBinding, args: ['class',] }],
26880 labelLeft: [{ type: i0.HostBinding, args: ['class.toggle-label-left',] }],
26881 labelRight: [{ type: i0.HostBinding, args: ['class.toggle-label-right',] }],
26882 labelStart: [{ type: i0.HostBinding, args: ['class.toggle-label-start',] }],
26883 labelEnd: [{ type: i0.HostBinding, args: ['class.toggle-label-end',] }]
26884 };
26885 return NbToggleComponent;
26886}());
26887
26888/**
26889 * @license
26890 * Copyright Akveo. All Rights Reserved.
26891 * Licensed under the MIT License. See License.txt in the project root for license information.
26892 */
26893var NbToggleModule = /** @class */ (function () {
26894 function NbToggleModule() {
26895 }
26896 NbToggleModule.decorators = [
26897 { type: i0.NgModule, args: [{
26898 imports: [
26899 _angular_common.CommonModule,
26900 NbIconModule,
26901 ],
26902 declarations: [NbToggleComponent],
26903 exports: [NbToggleComponent],
26904 },] }
26905 ];
26906 return NbToggleModule;
26907}());
26908
26909var NbPrefixDirective = /** @class */ (function () {
26910 function NbPrefixDirective() {
26911 }
26912 NbPrefixDirective.decorators = [
26913 { type: i0.Directive, args: [{
26914 selector: '[nbPrefix]',
26915 },] }
26916 ];
26917 return NbPrefixDirective;
26918}());
26919
26920var NbSuffixDirective = /** @class */ (function () {
26921 function NbSuffixDirective() {
26922 }
26923 NbSuffixDirective.decorators = [
26924 { type: i0.Directive, args: [{
26925 selector: '[nbSuffix]',
26926 },] }
26927 ];
26928 return NbSuffixDirective;
26929}());
26930
26931/**
26932 * @license
26933 * Copyright Akveo. All Rights Reserved.
26934 * Licensed under the MIT License. See License.txt in the project root for license information.
26935 */
26936function throwFormControlElementNotFound() {
26937 throw new Error("NbFormFieldComponent must contain [nbInput]");
26938}
26939/*
26940 * NbFormFieldComponent
26941 *
26942 * @styles
26943 *
26944 * form-field-addon-basic-text-color:
26945 * form-field-addon-basic-highlight-text-color:
26946 * form-field-addon-primary-text-color:
26947 * form-field-addon-primary-highlight-text-color:
26948 * form-field-addon-success-text-color:
26949 * form-field-addon-success-highlight-text-color:
26950 * form-field-addon-info-text-color:
26951 * form-field-addon-info-highlight-text-color:
26952 * form-field-addon-warning-text-color:
26953 * form-field-addon-warning-highlight-text-color:
26954 * form-field-addon-danger-text-color:
26955 * form-field-addon-danger-highlight-text-color:
26956 * form-field-addon-control-text-color:
26957 * form-field-addon-control-highlight-text-color:
26958 * form-field-addon-disabled-text-color:
26959 * form-field-addon-tiny-height:
26960 * form-field-addon-tiny-width:
26961 * form-field-addon-tiny-icon-size:
26962 * form-field-addon-tiny-font-size:
26963 * form-field-addon-tiny-line-height:
26964 * form-field-addon-tiny-font-weight:
26965 * form-field-addon-small-height:
26966 * form-field-addon-small-width:
26967 * form-field-addon-small-icon-size:
26968 * form-field-addon-small-font-size:
26969 * form-field-addon-small-line-height:
26970 * form-field-addon-small-font-weight:
26971 * form-field-addon-medium-height:
26972 * form-field-addon-medium-width:
26973 * form-field-addon-medium-icon-size:
26974 * form-field-addon-medium-font-size:
26975 * form-field-addon-medium-line-height:
26976 * form-field-addon-medium-font-weight:
26977 * form-field-addon-large-height:
26978 * form-field-addon-large-width:
26979 * form-field-addon-large-icon-size:
26980 * form-field-addon-large-font-size:
26981 * form-field-addon-large-line-height:
26982 * form-field-addon-large-font-weight:
26983 * form-field-addon-giant-height:
26984 * form-field-addon-giant-width:
26985 * form-field-addon-giant-icon-size:
26986 * form-field-addon-giant-font-size:
26987 * form-field-addon-giant-line-height:
26988 * form-field-addon-giant-font-weight:
26989 **/
26990var NbFormFieldComponent = /** @class */ (function () {
26991 function NbFormFieldComponent(cd, zone, elementRef, renderer) {
26992 var _this = this;
26993 this.cd = cd;
26994 this.zone = zone;
26995 this.elementRef = elementRef;
26996 this.renderer = renderer;
26997 this.destroy$ = new rxjs.Subject();
26998 this.formControlState$ = new rxjs.ReplaySubject(1);
26999 this.prefixClasses$ = this.formControlState$.pipe(rxjs_operators.map(function (s) { return _this.getAddonClasses('prefix', s); }));
27000 this.suffixClasses$ = this.formControlState$.pipe(rxjs_operators.map(function (s) { return _this.getAddonClasses('suffix', s); }));
27001 }
27002 NbFormFieldComponent.prototype.ngAfterContentChecked = function () {
27003 if (!this.formControl) {
27004 throwFormControlElementNotFound();
27005 }
27006 };
27007 NbFormFieldComponent.prototype.ngAfterContentInit = function () {
27008 this.subscribeToFormControlStateChange();
27009 this.subscribeToAddonChange();
27010 };
27011 NbFormFieldComponent.prototype.ngAfterViewInit = function () {
27012 var _this = this;
27013 // TODO: #2254
27014 this.zone.runOutsideAngular(function () { return setTimeout(function () {
27015 _this.renderer.addClass(_this.elementRef.nativeElement, 'nb-transition');
27016 }); });
27017 };
27018 NbFormFieldComponent.prototype.ngOnDestroy = function () {
27019 this.destroy$.next();
27020 };
27021 NbFormFieldComponent.prototype.shouldShowPrefix = function () {
27022 return this.getFormControlConfig().supportsPrefix && !!this.prefix.length;
27023 };
27024 NbFormFieldComponent.prototype.shouldShowSuffix = function () {
27025 return this.getFormControlConfig().supportsSuffix && !!this.suffix.length;
27026 };
27027 NbFormFieldComponent.prototype.subscribeToFormControlStateChange = function () {
27028 var _this = this;
27029 var _a = this.formControl, disabled$ = _a.disabled$, focused$ = _a.focused$, size$ = _a.size$, status$ = _a.status$, fullWidth$ = _a.fullWidth$;
27030 rxjs.combineLatest([disabled$, focused$, size$, status$, fullWidth$])
27031 .pipe(rxjs_operators.map(function (_a) {
27032 var disabled = _a[0], focused = _a[1], size = _a[2], status = _a[3], fullWidth = _a[4];
27033 return ({ disabled: disabled, focused: focused, size: size, status: status, fullWidth: fullWidth });
27034 }), rxjs_operators.distinctUntilChanged(function (oldState, state$$1) { return _this.isStatesEqual(oldState, state$$1); }), rxjs_operators.tap(function (_a) {
27035 var size = _a.size, fullWidth = _a.fullWidth;
27036 var formFieldClasses = ["nb-form-field-size-" + size];
27037 if (!fullWidth) {
27038 formFieldClasses.push('nb-form-field-limited-width');
27039 }
27040 _this.formFieldClasses = formFieldClasses.join(' ');
27041 }), rxjs_operators.takeUntil(this.destroy$))
27042 .subscribe(this.formControlState$);
27043 };
27044 NbFormFieldComponent.prototype.subscribeToAddonChange = function () {
27045 var _this = this;
27046 rxjs.merge(this.prefix.changes, this.suffix.changes)
27047 .pipe(rxjs_operators.takeUntil(this.destroy$))
27048 .subscribe(function () { return _this.cd.markForCheck(); });
27049 };
27050 NbFormFieldComponent.prototype.getAddonClasses = function (addon, state$$1) {
27051 var classes = [
27052 'nb-form-field-addon',
27053 "nb-form-field-" + addon + "-" + state$$1.size,
27054 ];
27055 if (state$$1.disabled) {
27056 classes.push("nb-form-field-addon-disabled");
27057 }
27058 else if (state$$1.focused) {
27059 classes.push("nb-form-field-addon-" + state$$1.status + "-highlight");
27060 }
27061 else {
27062 classes.push("nb-form-field-addon-" + state$$1.status);
27063 }
27064 return classes;
27065 };
27066 NbFormFieldComponent.prototype.getFormControlConfig = function () {
27067 return this.formControlConfig || new NbFormFieldControlConfig();
27068 };
27069 NbFormFieldComponent.prototype.isStatesEqual = function (oldState, state$$1) {
27070 return oldState.status === state$$1.status &&
27071 oldState.disabled === state$$1.disabled &&
27072 oldState.focused === state$$1.focused &&
27073 oldState.fullWidth === state$$1.fullWidth &&
27074 oldState.size === state$$1.size;
27075 };
27076 NbFormFieldComponent.decorators = [
27077 { type: i0.Component, args: [{
27078 selector: 'nb-form-field',
27079 template: "<div *ngIf=\"shouldShowPrefix()\" [ngClass]=\"prefixClasses$ | async\">\n <ng-content select=\"[nbPrefix]\"></ng-content>\n</div>\n\n<div class=\"nb-form-control-container\"\n [class.nb-form-field-control-with-prefix]=\"shouldShowPrefix()\"\n [class.nb-form-field-control-with-suffix]=\"shouldShowSuffix()\">\n <ng-content></ng-content>\n</div>\n\n<div *ngIf=\"shouldShowSuffix()\" [ngClass]=\"suffixClasses$ | async\">\n <ng-content select=\"[nbSuffix]\"></ng-content>\n</div>\n",
27080 changeDetection: i0.ChangeDetectionStrategy.OnPush,
27081 styles: [":host{display:flex;align-items:center}.nb-form-control-container{width:100%}\n"]
27082 },] }
27083 ];
27084 NbFormFieldComponent.ctorParameters = function () { return [
27085 { type: i0.ChangeDetectorRef },
27086 { type: i0.NgZone },
27087 { type: i0.ElementRef },
27088 { type: i0.Renderer2 }
27089 ]; };
27090 NbFormFieldComponent.propDecorators = {
27091 prefix: [{ type: i0.ContentChildren, args: [NbPrefixDirective, { descendants: true },] }],
27092 suffix: [{ type: i0.ContentChildren, args: [NbSuffixDirective, { descendants: true },] }],
27093 formControl: [{ type: i0.ContentChild, args: [NbFormFieldControl, { static: false },] }],
27094 formControlConfig: [{ type: i0.ContentChild, args: [NbFormFieldControlConfig, { static: false },] }],
27095 formFieldClasses: [{ type: i0.HostBinding, args: ['class',] }]
27096 };
27097 return NbFormFieldComponent;
27098}());
27099
27100/**
27101 * @license
27102 * Copyright Akveo. All Rights Reserved.
27103 * Licensed under the MIT License. See License.txt in the project root for license information.
27104 */
27105var COMPONENTS$3 = [
27106 NbFormFieldComponent,
27107 NbPrefixDirective,
27108 NbSuffixDirective,
27109];
27110var NbFormFieldModule = /** @class */ (function () {
27111 function NbFormFieldModule() {
27112 }
27113 NbFormFieldModule.decorators = [
27114 { type: i0.NgModule, args: [{
27115 imports: [_angular_common.CommonModule],
27116 declarations: tslib.__spreadArray([], COMPONENTS$3),
27117 exports: tslib.__spreadArray([], COMPONENTS$3),
27118 },] }
27119 ];
27120 return NbFormFieldModule;
27121}());
27122
27123/**
27124 * @license
27125 * Copyright Akveo. All Rights Reserved.
27126 * Licensed under the MIT License. See License.txt in the project root for license information.
27127 */
27128// TODO: export all components
27129
27130/**
27131 * Generated bundle index. Do not edit.
27132 */
27133
27134exports.ɵe = NbCalendarActionsComponent;
27135exports.ɵd = NbActiveDescendantKeyManagerFactoryService;
27136exports.ɵc = NbFocusKeyManagerFactoryService;
27137exports.ɵf = NbCustomMessageService;
27138exports.ɵh = NbCalendarWithTimeComponent;
27139exports.ɵa = NbMenuInternalService;
27140exports.ɵb = NbSharedModule;
27141exports.ɵg = NbTimePickerCellComponent;
27142exports.NbCalendarDayCellComponent = NbCalendarDayCellComponent;
27143exports.NbDateTimePickerComponent = NbDateTimePickerComponent;
27144exports.NbCalendarYearPickerComponent = NbCalendarYearPickerComponent;
27145exports.NbCalendarMonthPickerComponent = NbCalendarMonthPickerComponent;
27146exports.MONTHS_IN_VIEW = MONTHS_IN_VIEW;
27147exports.MONTHS_IN_COLUMN = MONTHS_IN_COLUMN;
27148exports.NbCalendarDayPickerComponent = NbCalendarDayPickerComponent;
27149exports.NbCalendarViewModeComponent = NbCalendarViewModeComponent;
27150exports.NbCalendarPageableNavigationComponent = NbCalendarPageableNavigationComponent;
27151exports.NbCalendarDaysNamesComponent = NbCalendarDaysNamesComponent;
27152exports.NbCalendarWeekNumberComponent = NbCalendarWeekNumberComponent;
27153exports.NbCalendarMonthCellComponent = NbCalendarMonthCellComponent;
27154exports.NbCalendarYearCellComponent = NbCalendarYearCellComponent;
27155exports.NbCalendarPickerRowComponent = NbCalendarPickerRowComponent;
27156exports.NbCalendarPickerComponent = NbCalendarPickerComponent;
27157exports.NbCalendarMonthModelService = NbCalendarMonthModelService;
27158exports.NbNativeDateService = NbNativeDateService;
27159exports.NbDateService = NbDateService;
27160exports.NbMenuService = NbMenuService;
27161exports.NbMenuItem = NbMenuItem;
27162exports.NbSidebarService = NbSidebarService;
27163exports.NB_THEME_OPTIONS = NB_THEME_OPTIONS;
27164exports.NB_MEDIA_BREAKPOINTS = NB_MEDIA_BREAKPOINTS;
27165exports.NB_BUILT_IN_JS_THEMES = NB_BUILT_IN_JS_THEMES;
27166exports.NB_JS_THEMES = NB_JS_THEMES;
27167exports.NB_WINDOW = NB_WINDOW;
27168exports.NB_DOCUMENT = NB_DOCUMENT;
27169exports.windowFactory = windowFactory;
27170exports.NbThemeModule = NbThemeModule;
27171exports.NbThemeService = NbThemeService;
27172exports.NbSpinnerService = NbSpinnerService;
27173exports.DEFAULT_MEDIA_BREAKPOINTS = DEFAULT_MEDIA_BREAKPOINTS;
27174exports.NbMediaBreakpointsService = NbMediaBreakpointsService;
27175exports.NbColorHelper = NbColorHelper;
27176exports.NB_LAYOUT_DIRECTION = NB_LAYOUT_DIRECTION;
27177exports.NbLayoutDirectionService = NbLayoutDirectionService;
27178exports.NbLayoutScrollService = NbLayoutScrollService;
27179exports.NbLayoutRulerService = NbLayoutRulerService;
27180exports.NbStatusService = NbStatusService;
27181exports.BUILT_IN_THEMES = BUILT_IN_THEMES;
27182exports.NbJSThemesRegistry = NbJSThemesRegistry;
27183exports.CORPORATE_THEME = CORPORATE_THEME;
27184exports.COSMIC_THEME = COSMIC_THEME;
27185exports.DEFAULT_THEME = DEFAULT_THEME;
27186exports.DARK_THEME = DARK_THEME;
27187exports.NbCardModule = NbCardModule;
27188exports.NbCardHeaderComponent = NbCardHeaderComponent;
27189exports.NbCardBodyComponent = NbCardBodyComponent;
27190exports.NbCardFooterComponent = NbCardFooterComponent;
27191exports.NbCardComponent = NbCardComponent;
27192exports.NbFlipCardComponent = NbFlipCardComponent;
27193exports.NbRevealCardComponent = NbRevealCardComponent;
27194exports.NbCardFrontComponent = NbCardFrontComponent;
27195exports.NbCardBackComponent = NbCardBackComponent;
27196exports.NbCalendarModule = NbCalendarModule;
27197exports.NbCalendarComponent = NbCalendarComponent;
27198exports.NbCalendarRangeModule = NbCalendarRangeModule;
27199exports.NbCalendarRangeComponent = NbCalendarRangeComponent;
27200exports.NbBaseCalendarComponent = NbBaseCalendarComponent;
27201exports.NbBaseCalendarModule = NbBaseCalendarModule;
27202exports.NbBaseCalendarRangeCell = NbBaseCalendarRangeCell;
27203exports.NbCalendarRangeDayCellComponent = NbCalendarRangeDayCellComponent;
27204exports.NbCalendarRangeMonthCellComponent = NbCalendarRangeMonthCellComponent;
27205exports.NbCalendarRangeYearCellComponent = NbCalendarRangeYearCellComponent;
27206exports.NbCalendarYearModelService = NbCalendarYearModelService;
27207exports.NbCalendarTimeModelService = NbCalendarTimeModelService;
27208exports.NbCalendarKitModule = NbCalendarKitModule;
27209exports.NbLayoutModule = NbLayoutModule;
27210exports.NbLayoutComponent = NbLayoutComponent;
27211exports.NbLayoutColumnComponent = NbLayoutColumnComponent;
27212exports.NbLayoutHeaderComponent = NbLayoutHeaderComponent;
27213exports.NbLayoutFooterComponent = NbLayoutFooterComponent;
27214exports.NbRestoreScrollTopHelper = NbRestoreScrollTopHelper;
27215exports.NbMenuModule = NbMenuModule;
27216exports.NbMenuItemComponent = NbMenuItemComponent;
27217exports.NbMenuComponent = NbMenuComponent;
27218exports.NbRouteTabsetModule = NbRouteTabsetModule;
27219exports.NbRouteTabsetComponent = NbRouteTabsetComponent;
27220exports.NbSidebarModule = NbSidebarModule;
27221exports.NbSidebarHeaderComponent = NbSidebarHeaderComponent;
27222exports.NbSidebarFooterComponent = NbSidebarFooterComponent;
27223exports.NbSidebarComponent = NbSidebarComponent;
27224exports.NbTabsetModule = NbTabsetModule;
27225exports.NbTabComponent = NbTabComponent;
27226exports.NbTabsetComponent = NbTabsetComponent;
27227exports.NbUserModule = NbUserModule;
27228exports.NbUserComponent = NbUserComponent;
27229exports.NbActionsModule = NbActionsModule;
27230exports.NbActionComponent = NbActionComponent;
27231exports.NbActionsComponent = NbActionsComponent;
27232exports.NbSearchModule = NbSearchModule;
27233exports.NbSearchService = NbSearchService;
27234exports.NbSearchFieldComponent = NbSearchFieldComponent;
27235exports.NbSearchComponent = NbSearchComponent;
27236exports.NbCheckboxComponent = NbCheckboxComponent;
27237exports.NbCheckboxModule = NbCheckboxModule;
27238exports.NbBadgeComponent = NbBadgeComponent;
27239exports.NbBadgeModule = NbBadgeModule;
27240exports.NbPopoverDirective = NbPopoverDirective;
27241exports.NbPopoverModule = NbPopoverModule;
27242exports.NbPopoverComponent = NbPopoverComponent;
27243exports.NbContextMenuDirective = NbContextMenuDirective;
27244exports.NbContextMenuComponent = NbContextMenuComponent;
27245exports.NbContextMenuModule = NbContextMenuModule;
27246exports.NbProgressBarComponent = NbProgressBarComponent;
27247exports.NbProgressBarModule = NbProgressBarModule;
27248exports.NbAlertComponent = NbAlertComponent;
27249exports.NbAlertModule = NbAlertModule;
27250exports.NbChatComponent = NbChatComponent;
27251exports.NbChatMessageComponent = NbChatMessageComponent;
27252exports.NbChatMessageMapComponent = NbChatMessageMapComponent;
27253exports.NbChatMessageFileComponent = NbChatMessageFileComponent;
27254exports.NbChatMessageQuoteComponent = NbChatMessageQuoteComponent;
27255exports.NbChatMessageTextComponent = NbChatMessageTextComponent;
27256exports.NbChatFormComponent = NbChatFormComponent;
27257exports.NbChatModule = NbChatModule;
27258exports.NbChatOptions = NbChatOptions;
27259exports.NbChatAvatarComponent = NbChatAvatarComponent;
27260exports.NbChatCustomMessageDirective = NbChatCustomMessageDirective;
27261exports.NbSpinnerComponent = NbSpinnerComponent;
27262exports.NbSpinnerDirective = NbSpinnerDirective;
27263exports.NbSpinnerModule = NbSpinnerModule;
27264exports.NB_STEPPER = NB_STEPPER;
27265exports.NbStepperComponent = NbStepperComponent;
27266exports.NbStepComponent = NbStepComponent;
27267exports.NbStepperNextDirective = NbStepperNextDirective;
27268exports.NbStepperPreviousDirective = NbStepperPreviousDirective;
27269exports.NbStepperModule = NbStepperModule;
27270exports.NbAccordionComponent = NbAccordionComponent;
27271exports.NbAccordionItemComponent = NbAccordionItemComponent;
27272exports.NbAccordionItemBodyComponent = NbAccordionItemBodyComponent;
27273exports.NbAccordionItemHeaderComponent = NbAccordionItemHeaderComponent;
27274exports.NbAccordionModule = NbAccordionModule;
27275exports.NbButton = NbButton;
27276exports.NbButtonComponent = NbButtonComponent;
27277exports.NbButtonModule = NbButtonModule;
27278exports.NbButtonGroupComponent = NbButtonGroupComponent;
27279exports.NbButtonGroupModule = NbButtonGroupModule;
27280exports.NbButtonToggleDirective = NbButtonToggleDirective;
27281exports.NbListComponent = NbListComponent;
27282exports.NbListItemComponent = NbListItemComponent;
27283exports.NbListModule = NbListModule;
27284exports.NbListPageTrackerDirective = NbListPageTrackerDirective;
27285exports.NbScrollableContainerDimentions = NbScrollableContainerDimentions;
27286exports.NbInfiniteListDirective = NbInfiniteListDirective;
27287exports.NbInputDirective = NbInputDirective;
27288exports.NbInputModule = NbInputModule;
27289exports.NbOverlayModule = NbOverlayModule;
27290exports.patch = patch;
27291exports.createContainer = createContainer;
27292exports.NbOverlayService = NbOverlayService;
27293exports.NbAdjustableConnectedPositionStrategy = NbAdjustableConnectedPositionStrategy;
27294exports.NbGlobalPositionStrategy = NbGlobalPositionStrategy;
27295exports.NbPositionBuilderService = NbPositionBuilderService;
27296exports.NbPositionedContainerComponent = NbPositionedContainerComponent;
27297exports.NbOverlayContainerComponent = NbOverlayContainerComponent;
27298exports.NbTriggerStrategyBase = NbTriggerStrategyBase;
27299exports.NbClickTriggerStrategy = NbClickTriggerStrategy;
27300exports.NbHoverTriggerStrategy = NbHoverTriggerStrategy;
27301exports.NbHintTriggerStrategy = NbHintTriggerStrategy;
27302exports.NbFocusTriggerStrategy = NbFocusTriggerStrategy;
27303exports.NbNoopTriggerStrategy = NbNoopTriggerStrategy;
27304exports.NbTriggerStrategyBuilderService = NbTriggerStrategyBuilderService;
27305exports.NbPortalDirective = NbPortalDirective;
27306exports.NbPortalOutletDirective = NbPortalOutletDirective;
27307exports.NbComponentPortal = NbComponentPortal;
27308exports.NbOverlay = NbOverlay;
27309exports.NbOverlayPositionBuilder = NbOverlayPositionBuilder;
27310exports.NbTemplatePortal = NbTemplatePortal;
27311exports.NbOverlayContainer = NbOverlayContainer;
27312exports.NbFlexibleConnectedPositionStrategy = NbFlexibleConnectedPositionStrategy;
27313exports.NbPortalInjector = NbPortalInjector;
27314exports.NbCdkMappingModule = NbCdkMappingModule;
27315exports.NbPositionHelper = NbPositionHelper;
27316exports.NbDynamicOverlay = NbDynamicOverlay;
27317exports.NbDynamicOverlayChange = NbDynamicOverlayChange;
27318exports.NbDynamicOverlayHandler = NbDynamicOverlayHandler;
27319exports.NbPlatform = NbPlatform;
27320exports.NbFocusMonitor = NbFocusMonitor;
27321exports.NbA11yModule = NbA11yModule;
27322exports.NbFocusTrap = NbFocusTrap;
27323exports.NbFocusTrapFactoryService = NbFocusTrapFactoryService;
27324exports.NbCdkAdapterModule = NbCdkAdapterModule;
27325exports.NbBlockScrollStrategyAdapter = NbBlockScrollStrategyAdapter;
27326exports.NbScrollStrategyOptions = NbScrollStrategyOptions;
27327exports.NbOverlayContainerAdapter = NbOverlayContainerAdapter;
27328exports.NbScrollDispatcherAdapter = NbScrollDispatcherAdapter;
27329exports.NbViewportRulerAdapter = NbViewportRulerAdapter;
27330exports.NbDirectionality = NbDirectionality;
27331exports.NbBidiModule = NbBidiModule;
27332exports.NbCellDefDirective = NbCellDefDirective;
27333exports.NbHeaderCellDefDirective = NbHeaderCellDefDirective;
27334exports.NbFooterCellDefDirective = NbFooterCellDefDirective;
27335exports.NB_SORT_HEADER_COLUMN_DEF = NB_SORT_HEADER_COLUMN_DEF;
27336exports.NbColumnDefDirective = NbColumnDefDirective;
27337exports.NbHeaderCellDirective = NbHeaderCellDirective;
27338exports.NbFooterCellDirective = NbFooterCellDirective;
27339exports.NbCellDirective = NbCellDirective;
27340exports.NbDataSource = NbDataSource;
27341exports.NbDataRowOutletDirective = NbDataRowOutletDirective;
27342exports.NbHeaderRowOutletDirective = NbHeaderRowOutletDirective;
27343exports.NbFooterRowOutletDirective = NbFooterRowOutletDirective;
27344exports.NbNoDataRowOutletDirective = NbNoDataRowOutletDirective;
27345exports.NbCellOutletDirective = NbCellOutletDirective;
27346exports.NbHeaderRowDefDirective = NbHeaderRowDefDirective;
27347exports.NbFooterRowDefDirective = NbFooterRowDefDirective;
27348exports.NbRowDefDirective = NbRowDefDirective;
27349exports.NbHeaderRowComponent = NbHeaderRowComponent;
27350exports.NbFooterRowComponent = NbFooterRowComponent;
27351exports.NbRowComponent = NbRowComponent;
27352exports.NB_TABLE_TEMPLATE = NB_TABLE_TEMPLATE;
27353exports.NB_VIEW_REPEATER_STRATEGY = NB_VIEW_REPEATER_STRATEGY;
27354exports.NB_COALESCED_STYLE_SCHEDULER = NB_COALESCED_STYLE_SCHEDULER;
27355exports.NB_TABLE_PROVIDERS = NB_TABLE_PROVIDERS;
27356exports.NbTable = NbTable;
27357exports.NbTableModule = NbTableModule;
27358exports.NB_DIALOG_CONFIG = NB_DIALOG_CONFIG;
27359exports.NbDialogConfig = NbDialogConfig;
27360exports.NbDialogRef = NbDialogRef;
27361exports.NbDialogService = NbDialogService;
27362exports.NbDialogModule = NbDialogModule;
27363exports.NbToastrModule = NbToastrModule;
27364exports.NbToastRef = NbToastRef;
27365exports.NbToastContainer = NbToastContainer;
27366exports.NbToastrContainerRegistry = NbToastrContainerRegistry;
27367exports.NbToastrService = NbToastrService;
27368exports.NbToast = NbToast;
27369exports.NbToastComponent = NbToastComponent;
27370exports.NB_TOASTR_CONFIG = NB_TOASTR_CONFIG;
27371exports.NbToastrConfig = NbToastrConfig;
27372exports.NbToastrContainerComponent = NbToastrContainerComponent;
27373exports.NbTooltipModule = NbTooltipModule;
27374exports.NbTooltipDirective = NbTooltipDirective;
27375exports.NbTooltipComponent = NbTooltipComponent;
27376exports.NbSelectModule = NbSelectModule;
27377exports.NbSelectLabelComponent = NbSelectLabelComponent;
27378exports.nbSelectFormFieldControlConfigFactory = nbSelectFormFieldControlConfigFactory;
27379exports.NbSelectComponent = NbSelectComponent;
27380exports.NbOptionModule = NbOptionModule;
27381exports.NbOptionComponent = NbOptionComponent;
27382exports.NbOptionGroupComponent = NbOptionGroupComponent;
27383exports.NbOptionListComponent = NbOptionListComponent;
27384exports.NB_SELECT_INJECTION_TOKEN = NB_SELECT_INJECTION_TOKEN;
27385exports.NbAutocompleteModule = NbAutocompleteModule;
27386exports.NbAutocompleteComponent = NbAutocompleteComponent;
27387exports.NbAutocompleteDirective = NbAutocompleteDirective;
27388exports.NbWindowModule = NbWindowModule;
27389exports.NbWindowService = NbWindowService;
27390exports.NbWindowRef = NbWindowRef;
27391exports.NB_WINDOW_DEFAULT_BUTTONS_CONFIG = NB_WINDOW_DEFAULT_BUTTONS_CONFIG;
27392exports.NbWindowConfig = NbWindowConfig;
27393exports.NB_WINDOW_CONTENT = NB_WINDOW_CONTENT;
27394exports.NB_WINDOW_CONFIG = NB_WINDOW_CONFIG;
27395exports.NB_WINDOW_CONTEXT = NB_WINDOW_CONTEXT;
27396exports.NbWindowComponent = NbWindowComponent;
27397exports.NbWindowsContainerComponent = NbWindowsContainerComponent;
27398exports.NbTimepickerModule = NbTimepickerModule;
27399exports.NB_TIME_PICKER_CONFIG = NB_TIME_PICKER_CONFIG;
27400exports.NB_DEFAULT_TIMEPICKER_LOCALIZATION_CONFIG = NB_DEFAULT_TIMEPICKER_LOCALIZATION_CONFIG;
27401exports.NbTimePickerComponent = NbTimePickerComponent;
27402exports.NbTimePickerDirective = NbTimePickerDirective;
27403exports.NbDatepickerModule = NbDatepickerModule;
27404exports.NbDatepickerAdapter = NbDatepickerAdapter;
27405exports.NbDatepicker = NbDatepicker;
27406exports.NB_DATE_ADAPTER = NB_DATE_ADAPTER;
27407exports.NB_DATE_SERVICE_OPTIONS = NB_DATE_SERVICE_OPTIONS;
27408exports.NbDatepickerDirective = NbDatepickerDirective;
27409exports.NbDateAdapterService = NbDateAdapterService;
27410exports.NbRangeAdapterService = NbRangeAdapterService;
27411exports.NbDateTimeAdapterService = NbDateTimeAdapterService;
27412exports.NbDatepickerContainerComponent = NbDatepickerContainerComponent;
27413exports.NbBasePicker = NbBasePicker;
27414exports.NbBasePickerComponent = NbBasePickerComponent;
27415exports.NbDatepickerComponent = NbDatepickerComponent;
27416exports.NbRangepickerComponent = NbRangepickerComponent;
27417exports.NbDialogContainerComponent = NbDialogContainerComponent;
27418exports.NbRadioModule = NbRadioModule;
27419exports.NbRadioGroupComponent = NbRadioGroupComponent;
27420exports.NbRadioComponent = NbRadioComponent;
27421exports.NbTagModule = NbTagModule;
27422exports.NbTagComponent = NbTagComponent;
27423exports.NbTagListComponent = NbTagListComponent;
27424exports.NbTagInputDirective = NbTagInputDirective;
27425exports.NbTreeGridModule = NbTreeGridModule;
27426exports.NbTreeGridComponent = NbTreeGridComponent;
27427exports.NB_ROW_DOUBLE_CLICK_DELAY = NB_ROW_DOUBLE_CLICK_DELAY;
27428exports.NbTreeGridRowComponent = NbTreeGridRowComponent;
27429exports.NbTreeGridHeaderRowComponent = NbTreeGridHeaderRowComponent;
27430exports.NbTreeGridFooterRowComponent = NbTreeGridFooterRowComponent;
27431exports.NB_TREE_GRID = NB_TREE_GRID;
27432exports.NbSortDirective = NbSortDirective;
27433exports.NbSortHeaderIconDirective = NbSortHeaderIconDirective;
27434exports.NbSortIconComponent = NbSortIconComponent;
27435exports.NbSortHeaderComponent = NbSortHeaderComponent;
27436exports.NbTreeGridRowToggleComponent = NbTreeGridRowToggleComponent;
27437exports.NbTreeGridColumnDefDirective = NbTreeGridColumnDefDirective;
27438exports.NbTreeGridCellDirective = NbTreeGridCellDirective;
27439exports.NbTreeGridHeaderCellDirective = NbTreeGridHeaderCellDirective;
27440exports.NbTreeGridFooterCellDirective = NbTreeGridFooterCellDirective;
27441exports.NbTreeGridRowDefDirective = NbTreeGridRowDefDirective;
27442exports.NbTreeGridHeaderRowDefDirective = NbTreeGridHeaderRowDefDirective;
27443exports.NbTreeGridFooterRowDefDirective = NbTreeGridFooterRowDefDirective;
27444exports.NbTreeGridCellDefDirective = NbTreeGridCellDefDirective;
27445exports.NbTreeGridHeaderCellDefDirective = NbTreeGridHeaderCellDefDirective;
27446exports.NbTreeGridFooterCellDefDirective = NbTreeGridFooterCellDefDirective;
27447exports.NbFilterDirective = NbFilterDirective;
27448exports.NbFilterInputDirective = NbFilterInputDirective;
27449exports.NbTreeGridRowToggleDirective = NbTreeGridRowToggleDirective;
27450exports.NB_DEFAULT_ROW_LEVEL = NB_DEFAULT_ROW_LEVEL;
27451exports.NbTreeGridPresentationNode = NbTreeGridPresentationNode;
27452exports.NbTreeGridDataSource = NbTreeGridDataSource;
27453exports.NbTreeGridDataSourceBuilder = NbTreeGridDataSourceBuilder;
27454exports.NbTreeGridDataService = NbTreeGridDataService;
27455exports.NbTreeGridFilterService = NbTreeGridFilterService;
27456exports.NbTreeGridService = NbTreeGridService;
27457exports.NbTreeGridSortService = NbTreeGridSortService;
27458exports.NbColumnsService = NbColumnsService;
27459exports.NbIconModule = NbIconModule;
27460exports.NbIconComponent = NbIconComponent;
27461exports.NbFontIcon = NbFontIcon;
27462exports.NbSvgIcon = NbSvgIcon;
27463exports.NbIconDefinition = NbIconDefinition;
27464exports.NbIconLibraries = NbIconLibraries;
27465exports.NbToggleModule = NbToggleModule;
27466exports.NbToggleComponent = NbToggleComponent;
27467exports.NbFormFieldModule = NbFormFieldModule;
27468exports.NbFormFieldComponent = NbFormFieldComponent;
27469exports.NbPrefixDirective = NbPrefixDirective;
27470exports.NbSuffixDirective = NbSuffixDirective;
27471exports.NbFormFieldControl = NbFormFieldControl;
27472exports.NbFormFieldControlConfig = NbFormFieldControlConfig;
27473
27474Object.defineProperty(exports, '__esModule', { value: true });
27475
27476})));