ngx-modialog-10
Version:
Modal / Dialog for Angular
1,326 lines (1,290 loc) • 121 kB
JavaScript
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('rxjs'), require('rxjs/operators'), require('@angular/common'), require('@angular/platform-browser')) :
typeof define === 'function' && define.amd ? define('ngxModialog', ['exports', '@angular/core', 'rxjs', 'rxjs/operators', '@angular/common', '@angular/platform-browser'], factory) :
(global = global || self, factory(global.ngxModialog = {}, global.ng.core, global.rxjs, global.rxjs.operators, global.ng.common, global.ng.platformBrowser));
}(this, (function (exports, core, rxjs, operators, common, platformBrowser) { 'use strict';
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/* global Reflect, Promise */
var extendStatics = function(d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
function __extends(d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
}
var __assign = function() {
__assign = Object.assign || function __assign(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
function __rest(s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
}
function __decorate(decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
}
function __param(paramIndex, decorator) {
return function (target, key) { decorator(target, key, paramIndex); }
}
function __metadata(metadataKey, metadataValue) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
}
function __awaiter(thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
}
function __generator(thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
}
function __exportStar(m, exports) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
function __values(o) {
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
if (m) return m.call(o);
if (o && typeof o.length === "number") return {
next: function () {
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
}
};
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
}
function __read(o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
}
function __spread() {
for (var ar = [], i = 0; i < arguments.length; i++)
ar = ar.concat(__read(arguments[i]));
return ar;
}
function __spreadArrays() {
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
for (var r = Array(s), k = 0, i = 0; i < il; i++)
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
r[k] = a[j];
return r;
};
function __await(v) {
return this instanceof __await ? (this.v = v, this) : new __await(v);
}
function __asyncGenerator(thisArg, _arguments, generator) {
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
var g = generator.apply(thisArg, _arguments || []), i, q = [];
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
function fulfill(value) { resume("next", value); }
function reject(value) { resume("throw", value); }
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
}
function __asyncDelegator(o) {
var i, p;
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
}
function __asyncValues(o) {
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
var m = o[Symbol.asyncIterator], i;
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
}
function __makeTemplateObject(cooked, raw) {
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
return cooked;
};
function __importStar(mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result.default = mod;
return result;
}
function __importDefault(mod) {
return (mod && mod.__esModule) ? mod : { default: mod };
}
function __classPrivateFieldGet(receiver, privateMap) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to get private field on non-instance");
}
return privateMap.get(receiver);
}
function __classPrivateFieldSet(receiver, privateMap, value) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to set private field on non-instance");
}
privateMap.set(receiver, value);
return value;
}
/**
* @fileoverview added by tsickle
* Generated from: lib/framework/fluent-assign.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/** @type {?} */
var PRIVATE_PREFIX = '$$';
/** @type {?} */
var RESERVED_REGEX = /^(\$\$).*/;
/**
* @param {?} name
* @return {?}
*/
function validateMethodName(name) {
if (!name) {
throw new Error("Illegal method name. Empty method name is not allowed");
}
else if (name in this) {
throw new Error("A member name '" + name + "' already defined.");
}
}
/**
* Returns a list of assigned property names (non private)
* @param {?} subject
* @return {?}
*/
function getAssignedPropertyNames(subject) {
return Object.getOwnPropertyNames(subject)
.filter((/**
* @param {?} name
* @return {?}
*/
function (name) { return RESERVED_REGEX.test(name); }))
.map((/**
* @param {?} name
* @return {?}
*/
function (name) { return name.substr(2); }));
}
/**
* @param {?} name
* @return {?}
*/
function privateKey(name) {
return PRIVATE_PREFIX + name;
}
/**
* @param {?} obj
* @param {?} propertyName
* @param {?} value
* @return {?}
*/
function objectDefinePropertyValue(obj, propertyName, value) {
Object.defineProperty(obj, propertyName, (/** @type {?} */ ({
configurable: false,
enumerable: false,
writable: false,
value: value
})));
}
/**
* Given a FluentAssign instance, apply all of the supplied default values so calling
* instance.toJSON will return those values (does not create a setter function)
* @param {?} instance
* @param {?} defaultValues
* @return {?}
*/
function applyDefaultValues(instance, defaultValues) {
Object.getOwnPropertyNames(defaultValues)
.forEach((/**
* @param {?} name
* @return {?}
*/
function (name) { return ((/** @type {?} */ (instance)))[privateKey(name)] = ((/** @type {?} */ (defaultValues)))[name]; }));
}
/**
* Create a function for setting a value for a property on a given object.
* @template T
* @param {?} obj The object to apply the key & setter on.
* @param {?} propertyName The name of the property on the object
* @param {?=} writeOnce If true will allow writing once (default: false)
*
* Example:
* let obj = new FluentAssign<any>;
* setAssignMethod(obj, 'myProp');
* obj.myProp('someValue');
* const result = obj.toJSON();
* console.log(result); //{ myProp: 'someValue' }
*
*
* let obj = new FluentAssign<any>;
* setAssignMethod(obj, 'myProp', true); // applying writeOnce
* obj.myProp('someValue');
* obj.myProp('someValue'); // ERROR: Overriding config property 'myProp' is not allowed.
* @return {?}
*/
function setAssignMethod(obj, propertyName, writeOnce) {
var _this = this;
if (writeOnce === void 0) { writeOnce = false; }
validateMethodName.call(obj, propertyName);
/** @type {?} */
var key = privateKey(propertyName);
objectDefinePropertyValue(obj, propertyName, (/**
* @param {?} value
* @return {?}
*/
function (value) {
if (writeOnce && _this.hasOwnProperty(key)) {
throw new Error("Overriding config property '" + propertyName + "' is not allowed.");
}
obj[key] = value;
return obj;
}));
}
/**
* Create a function for setting a value that is an alias to an other setter function.
* @template T
* @param {?} obj The object to apply the key & setter on.
* @param {?} propertyName The name of the property on the object
* @param {?} srcPropertyName The name of the property on the object this alias points to
* @param {?=} hard If true, will set a readonly property on the object that returns
* the value of the source property. Default: false
*
* Example:
* let obj = new FluentAssign<any> ;
* setAssignMethod(obj, 'myProp');
* setAssignAlias(obj, 'myPropAlias', 'myProp');
* obj.myPropAlias('someValue');
* const result = obj.toJSON();
* console.log(result); //{ myProp: 'someValue' }
* result.myPropAlias // undefined
*
*
* let obj = new FluentAssign<any> ;
* setAssignMethod(obj, 'myProp');
* setAssignAlias(obj, 'myPropAlias', 'myProp', true); // setting a hard alias.
* obj.myPropAlias('someValue');
* const result = obj.toJSON();
* console.log(result); //{ myProp: 'someValue' }
* result.myPropAlias // someValue
* @return {?}
*/
function setAssignAlias(obj, propertyName, srcPropertyName, hard) {
if (hard === void 0) { hard = false; }
validateMethodName.call(obj, propertyName);
objectDefinePropertyValue(obj, propertyName, (/**
* @param {?} value
* @return {?}
*/
function (value) {
obj[srcPropertyName](value);
return obj;
}));
if (hard === true) {
/** @type {?} */
var key = privateKey(propertyName);
/** @type {?} */
var srcKey_1 = privateKey(srcPropertyName);
Object.defineProperty(obj, key, (/** @type {?} */ ({
configurable: false,
enumerable: false,
get: (/**
* @return {?}
*/
function () { return obj[srcKey_1]; })
})));
}
}
/**
* @record
* @template Z
*/
function IFluentAssignFactory() { }
if (false) {
/** @type {?} */
IFluentAssignFactory.prototype.fluentAssign;
/**
* @param {?} name
* @param {?=} defaultValue
* @return {?}
*/
IFluentAssignFactory.prototype.setMethod = function (name, defaultValue) { };
}
/**
* Represent a fluent API factory wrapper for defining FluentAssign instances.
* @template T
*/
var /**
* Represent a fluent API factory wrapper for defining FluentAssign instances.
* @template T
*/
FluentAssignFactory = /** @class */ (function () {
function FluentAssignFactory(fluentAssign) {
this._fluentAssign =
fluentAssign instanceof FluentAssign ? fluentAssign : (/** @type {?} */ (new FluentAssign()));
}
/**
* Create a setter method on the FluentAssign instance.
* @param name The name of the setter function.
* @param defaultValue If set (not undefined) set's the value on the instance immediately.
*/
/**
* Create a setter method on the FluentAssign instance.
* @param {?} name The name of the setter function.
* @param {?=} defaultValue If set (not undefined) set's the value on the instance immediately.
* @return {?}
*/
FluentAssignFactory.prototype.setMethod = /**
* Create a setter method on the FluentAssign instance.
* @param {?} name The name of the setter function.
* @param {?=} defaultValue If set (not undefined) set's the value on the instance immediately.
* @return {?}
*/
function (name, defaultValue) {
setAssignMethod(this._fluentAssign, name);
if (defaultValue !== undefined) {
((/** @type {?} */ (this._fluentAssign)))[name](defaultValue);
}
return this;
};
Object.defineProperty(FluentAssignFactory.prototype, "fluentAssign", {
/**
* The FluentAssign instance.
*/
get: /**
* The FluentAssign instance.
* @return {?}
*/
function () {
return this._fluentAssign;
},
enumerable: true,
configurable: true
});
return FluentAssignFactory;
}());
if (false) {
/**
* @type {?}
* @private
*/
FluentAssignFactory.prototype._fluentAssign;
}
/**
* Represent an object where every property is a function representing an assignment function.
* Calling each function with a value will assign the value to the object and return the object.
* Calling 'toJSON' returns an object with the same properties but this time representing the
* assigned values.
*
* This allows setting an object in a fluent API manner.
* Example:
* let fluent = new FluentAssign<any>(undefined, ['some', 'went']);
* fluent.some('thing').went('wrong').toJSON();
* // { some: 'thing', went: 'wrong' }
* @template T
*/
var /**
* Represent an object where every property is a function representing an assignment function.
* Calling each function with a value will assign the value to the object and return the object.
* Calling 'toJSON' returns an object with the same properties but this time representing the
* assigned values.
*
* This allows setting an object in a fluent API manner.
* Example:
* let fluent = new FluentAssign<any>(undefined, ['some', 'went']);
* fluent.some('thing').went('wrong').toJSON();
* // { some: 'thing', went: 'wrong' }
* @template T
*/
FluentAssign = /** @class */ (function () {
/**
*
* @param defaultValues An object representing default values for the underlying object.
* @param initialSetters A list of initial setters for this FluentAssign.
* @param baseType the class/type to create a new base. optional, {} is used if not supplied.
*/
function FluentAssign(defaultValues, initialSetters, baseType) {
var _this = this;
if (Array.isArray(defaultValues)) {
((/** @type {?} */ (defaultValues))).forEach((/**
* @param {?} d
* @return {?}
*/
function (d) { return applyDefaultValues(_this, d); }));
}
else if (defaultValues) {
applyDefaultValues(this, defaultValues);
}
if (Array.isArray(initialSetters)) {
initialSetters.forEach((/**
* @param {?} name
* @return {?}
*/
function (name) { return setAssignMethod(_this, name); }));
}
if (baseType) {
this.__fluent$base__ = baseType;
}
}
/**
* Returns a FluentAssignFactory<FluentAssign<T>> ready to define a FluentAssign type.
* @param defaultValues An object representing default values for the instance.
* @param initialSetters A list of initial setters for the instance.
*/
/**
* Returns a FluentAssignFactory<FluentAssign<T>> ready to define a FluentAssign type.
* @template T
* @param {?=} defaultValues An object representing default values for the instance.
* @param {?=} initialSetters A list of initial setters for the instance.
* @return {?}
*/
FluentAssign.compose = /**
* Returns a FluentAssignFactory<FluentAssign<T>> ready to define a FluentAssign type.
* @template T
* @param {?=} defaultValues An object representing default values for the instance.
* @param {?=} initialSetters A list of initial setters for the instance.
* @return {?}
*/
function (defaultValues, initialSetters) {
return (/** @type {?} */ (FluentAssign.composeWith(new FluentAssign(defaultValues, initialSetters))));
};
/**
* Returns a FluentAssignFactory<Z> where Z is an instance of FluentAssign<?> or a derived
* class of it.
* @param fluentAssign An instance of FluentAssign<?> or a derived class of FluentAssign<?>.
*/
/**
* Returns a FluentAssignFactory<Z> where Z is an instance of FluentAssign<?> or a derived
* class of it.
* @template Z
* @param {?} fluentAssign An instance of FluentAssign<?> or a derived class of FluentAssign<?>.
* @return {?}
*/
FluentAssign.composeWith = /**
* Returns a FluentAssignFactory<Z> where Z is an instance of FluentAssign<?> or a derived
* class of it.
* @template Z
* @param {?} fluentAssign An instance of FluentAssign<?> or a derived class of FluentAssign<?>.
* @return {?}
*/
function (fluentAssign) {
return (/** @type {?} */ (new FluentAssignFactory((/** @type {?} */ (fluentAssign)))));
};
/**
* @return {?}
*/
FluentAssign.prototype.toJSON = /**
* @return {?}
*/
function () {
var _this = this;
return getAssignedPropertyNames(this)
.reduce((/**
* @param {?} obj
* @param {?} name
* @return {?}
*/
function (obj, name) {
/** @type {?} */
var key = privateKey(name);
// re-define property descriptors (we dont want their value)
/** @type {?} */
var propDesc = Object.getOwnPropertyDescriptor(_this, key);
if (propDesc) {
Object.defineProperty(obj, name, propDesc);
}
else {
((/** @type {?} */ (obj)))[name] = ((/** @type {?} */ (_this)))[key];
}
return obj;
}), this.__fluent$base__ ? new this.__fluent$base__() : (/** @type {?} */ ({})));
};
return FluentAssign;
}());
if (false) {
/**
* @type {?}
* @private
*/
FluentAssign.prototype.__fluent$base__;
}
/**
* @fileoverview added by tsickle
* Generated from: lib/framework/utils.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* Simple object extend
* @template T
* @param {?} m1
* @param {?} m2
* @return {?}
*/
function extend(m1, m2) {
/** @type {?} */
var m = (/** @type {?} */ ({}));
for (var attr in m1) {
if (m1.hasOwnProperty(attr)) {
((/** @type {?} */ (m)))[attr] = ((/** @type {?} */ (m1)))[attr];
}
}
for (var attr in m2) {
if (m2.hasOwnProperty(attr)) {
((/** @type {?} */ (m)))[attr] = ((/** @type {?} */ (m2)))[attr];
}
}
return m;
}
/**
* Simple, not optimized, array union of unique values.
* @template T
* @param {?} arr1
* @param {?} arr2
* @return {?}
*/
function arrayUnion(arr1, arr2) {
return arr1
.concat(arr2.filter((/**
* @param {?} v
* @return {?}
*/
function (v) { return arr1.indexOf(v) === -1; })));
}
/**
* Returns true if the config supports a given key.
* @param {?} keyCode
* @param {?} config
* @return {?}
*/
function supportsKey(keyCode, config) {
if (!Array.isArray(config)) {
return config !== null;
}
return config.indexOf(keyCode) > -1;
}
/**
* Given an object representing a key/value map of css properties, returns a valid css string
* representing the object.
* Example:
* console.log(toStyleString({
* position: 'absolute',
* width: '100%',
* height: '100%',
* top: '0',
* left: '0',
* right: '0',
* bottom: '0'
* }));
* // position:absolute;width:100%;height:100%;top:0;left:0;right:0;bottom:0
* @param {?} obj
* @return {?}
*/
function toStyleString(obj) {
return Object.getOwnPropertyNames(obj)
.map((/**
* @param {?} k
* @return {?}
*/
function (k) { return k + ":" + obj[k]; }))
.join(';');
// let objStr = JSON.stringify(obj);
// return objStr.substr(1, objStr.length - 2)
// .replace(/,/g, ';')
// .replace(/"/g, '');
}
/**
* @template R
*/
var /**
* @template R
*/
PromiseCompleter = /** @class */ (function () {
function PromiseCompleter() {
var _this = this;
this.promise = new Promise((/**
* @param {?} res
* @param {?} rej
* @return {?}
*/
function (res, rej) {
_this.resolve = res;
_this.reject = rej;
}));
}
return PromiseCompleter;
}());
if (false) {
/** @type {?} */
PromiseCompleter.prototype.promise;
/** @type {?} */
PromiseCompleter.prototype.resolve;
/** @type {?} */
PromiseCompleter.prototype.reject;
}
/**
* @return {?}
*/
function noop() {
}
/**
* @fileoverview added by tsickle
* Generated from: lib/framework/createComponent.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* @record
*/
function CreateComponentArgs() { }
if (false) {
/** @type {?} */
CreateComponentArgs.prototype.component;
/** @type {?} */
CreateComponentArgs.prototype.vcRef;
/** @type {?|undefined} */
CreateComponentArgs.prototype.injector;
/** @type {?|undefined} */
CreateComponentArgs.prototype.projectableNodes;
}
/**
* @param {?} instructions
* @return {?}
*/
function createComponent(instructions) {
/** @type {?} */
var injector = instructions.injector || instructions.vcRef.injector;
/** @type {?} */
var cmpFactory = injector.get(core.ComponentFactoryResolver).resolveComponentFactory(instructions.component);
if (instructions.vcRef) {
return instructions.vcRef.createComponent(cmpFactory, instructions.vcRef.length, injector, instructions.projectableNodes);
}
else {
return cmpFactory.create(injector);
}
}
/**
* @fileoverview added by tsickle
* Generated from: lib/models/errors.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
var DialogBailOutError = /** @class */ (function (_super) {
__extends(DialogBailOutError, _super);
function DialogBailOutError(value) {
var _this = _super.call(this) || this;
if (!value) {
value = 'Dialog was forced to close by an unknown source.';
}
_this.message = value;
return _this;
}
return DialogBailOutError;
}(Error));
/**
* @fileoverview added by tsickle
* Generated from: lib/models/dialog-ref.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* API to an open modal window.
* @template T
*/
var /**
* API to an open modal window.
* @template T
*/
DialogRef = /** @class */ (function () {
function DialogRef(overlay, context) {
this.overlay = overlay;
this.context = context;
this._resultDeferred = new PromiseCompleter();
this._onDestroy = new rxjs.Subject();
this.onDestroy = this._onDestroy.asObservable();
}
Object.defineProperty(DialogRef.prototype, "result", {
/**
* A Promise that is resolved on a close event and rejected on a dismiss event.
*/
get: /**
* A Promise that is resolved on a close event and rejected on a dismiss event.
* @return {?}
*/
function () {
return this._resultDeferred.promise;
},
enumerable: true,
configurable: true
});
/**
* Set a close/dismiss guard
* @param guard
*/
/**
* Set a close/dismiss guard
* @param {?} guard
* @return {?}
*/
DialogRef.prototype.setCloseGuard = /**
* Set a close/dismiss guard
* @param {?} guard
* @return {?}
*/
function (guard) {
this.closeGuard = guard;
};
/**
* Close the modal with a return value, i.e: result.
*/
/**
* Close the modal with a return value, i.e: result.
* @param {?=} result
* @return {?}
*/
DialogRef.prototype.close = /**
* Close the modal with a return value, i.e: result.
* @param {?=} result
* @return {?}
*/
function (result) {
var _this = this;
if (result === void 0) { result = null; }
/** @type {?} */
var _close = (/**
* @return {?}
*/
function () {
_this.destroy();
_this._resultDeferred.resolve(result);
});
this._fireHook('beforeClose')
.then((/**
* @param {?} value
* @return {?}
*/
function (value) { return value !== true && _close(); }))
.catch(_close);
};
/**
* Close the modal without a return value, i.e: cancelled.
* This call is automatically invoked when a user either:
* - Presses an exit keyboard key (if configured).
* - Clicks outside of the modal window (if configured).
* Usually, dismiss represent a Cancel button or a X button.
*/
/**
* Close the modal without a return value, i.e: cancelled.
* This call is automatically invoked when a user either:
* - Presses an exit keyboard key (if configured).
* - Clicks outside of the modal window (if configured).
* Usually, dismiss represent a Cancel button or a X button.
* @return {?}
*/
DialogRef.prototype.dismiss = /**
* Close the modal without a return value, i.e: cancelled.
* This call is automatically invoked when a user either:
* - Presses an exit keyboard key (if configured).
* - Clicks outside of the modal window (if configured).
* Usually, dismiss represent a Cancel button or a X button.
* @return {?}
*/
function () {
var _this = this;
/** @type {?} */
var _dismiss = (/**
* @return {?}
*/
function () {
_this.destroy();
_this._resultDeferred.promise.catch((/**
* @return {?}
*/
function () { }));
_this._resultDeferred.reject();
});
this._fireHook('beforeDismiss')
.then((/**
* @param {?} value
* @return {?}
*/
function (value) { return value !== true && _dismiss(); }))
.catch(_dismiss);
};
/**
* Gracefully close the overlay/dialog with a rejected result.
* Does not trigger canDestroy on the overlay.
*/
/**
* Gracefully close the overlay/dialog with a rejected result.
* Does not trigger canDestroy on the overlay.
* @return {?}
*/
DialogRef.prototype.bailOut = /**
* Gracefully close the overlay/dialog with a rejected result.
* Does not trigger canDestroy on the overlay.
* @return {?}
*/
function () {
if (this.destroyed !== true) {
this.destroyed = true;
this._onDestroy.next(null);
this._onDestroy.complete();
this._resultDeferred.reject(new DialogBailOutError());
}
};
/**
* @return {?}
*/
DialogRef.prototype.destroy = /**
* @return {?}
*/
function () {
var _this = this;
if (this.destroyed !== true) {
this.destroyed = true;
if (typeof this.overlayRef.instance.canDestroy === 'function') {
this.overlayRef.instance.canDestroy()
.catch((/**
* @return {?}
*/
function () { }))
.then((/**
* @return {?}
*/
function () { return _this._destroy(); }));
}
else {
this._destroy();
}
}
};
/**
* @private
* @return {?}
*/
DialogRef.prototype._destroy = /**
* @private
* @return {?}
*/
function () {
this._onDestroy.next(null);
this._onDestroy.complete();
this.overlayRef.destroy();
};
/**
* @private
* @template G
* @param {?} name
* @return {?}
*/
DialogRef.prototype._fireHook = /**
* @private
* @template G
* @param {?} name
* @return {?}
*/
function (name) {
/** @type {?} */
var guard = this.closeGuard;
/** @type {?} */
var fn = guard && typeof guard[name] === 'function' && guard[name];
return Promise.resolve(fn ? fn.call(guard) : false);
};
return DialogRef;
}());
if (false) {
/**
* Reference to the overlay component ref.
* @type {?}
*/
DialogRef.prototype.overlayRef;
/**
* States if the modal is inside a specific element.
* @type {?}
*/
DialogRef.prototype.inElement;
/** @type {?} */
DialogRef.prototype.destroyed;
/**
* Fired before dialog is destroyed.
* No need to unsubscribe, done automatically.
* Note: Always called.
* When called, overlayRef might or might not be destroyed.
* @type {?}
*/
DialogRef.prototype.onDestroy;
/**
* @type {?}
* @private
*/
DialogRef.prototype._resultDeferred;
/**
* @type {?}
* @private
*/
DialogRef.prototype._onDestroy;
/**
* @type {?}
* @private
*/
DialogRef.prototype.closeGuard;
/** @type {?} */
DialogRef.prototype.overlay;
/** @type {?} */
DialogRef.prototype.context;
}
/**
* @fileoverview added by tsickle
* Generated from: lib/models/tokens.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/** @enum {number} */
var DROP_IN_TYPE = {
alert: 0,
prompt: 1,
confirm: 2,
};
DROP_IN_TYPE[DROP_IN_TYPE.alert] = 'alert';
DROP_IN_TYPE[DROP_IN_TYPE.prompt] = 'prompt';
DROP_IN_TYPE[DROP_IN_TYPE.confirm] = 'confirm';
/**
* @record
*/
function OverlayConfig() { }
if (false) {
/**
* The context for the modal, attached to the dialog instance, DialogRef.context.
* Default: {}
* @type {?|undefined}
*/
OverlayConfig.prototype.context;
/** @type {?|undefined} */
OverlayConfig.prototype.injector;
/**
* The element to block using the modal.
* @type {?|undefined}
*/
OverlayConfig.prototype.viewContainer;
/** @type {?|undefined} */
OverlayConfig.prototype.renderer;
/**
* Not used yet.
* @type {?|undefined}
*/
OverlayConfig.prototype.overlayPlugins;
}
/**
* @record
* @template T
*/
function ModalComponent() { }
if (false) {
/** @type {?} */
ModalComponent.prototype.dialog;
}
/**
* @record
*/
function CloseGuard() { }
if (false) {
/**
* Invoked before a modal is dismissed.
* @return {?}
*/
CloseGuard.prototype.beforeDismiss = function () { };
/**
* Invoked before a modal is closed.
* @return {?}
*/
CloseGuard.prototype.beforeClose = function () { };
}
/**
* @abstract
*/
var /**
* @abstract
*/
OverlayRenderer = /** @class */ (function () {
function OverlayRenderer() {
}
return OverlayRenderer;
}());
if (false) {
/**
* @abstract
* @param {?} dialogRef
* @param {?} vcRef
* @param {?=} injector
* @return {?}
*/
OverlayRenderer.prototype.render = function (dialogRef, vcRef, injector) { };
}
/**
* @fileoverview added by tsickle
* Generated from: lib/models/vc-ref-store.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/** @type {?} */
var vcRefCollection = {};
/**
* @param {?} key
* @return {?}
*/
function getVCRef(key) {
return vcRefCollection[key] ? vcRefCollection[key].slice() : [];
}
/**
* @param {?} key
* @param {?} vcRef
* @return {?}
*/
function setVCRef(key, vcRef) {
if (!vcRefCollection.hasOwnProperty(key)) {
vcRefCollection[key] = [];
}
vcRefCollection[key].push(vcRef);
}
/**
* @param {?} key
* @param {?=} vcRef
* @return {?}
*/
function delVCRef(key, vcRef) {
if (!vcRef) {
vcRefCollection[key] = [];
}
else {
/** @type {?} */
var coll = vcRefCollection[key] || [];
/** @type {?} */
var idx = coll.indexOf(vcRef);
if (idx > -1) {
coll.splice(idx, 1);
}
}
}
/**
* A Simple store that holds a reference to ViewContainerRef instances by a user defined key.
* This, with the OverlayTarget directive makes it easy to block the overlay inside an element
* without having to use the angular query boilerplate.
* @type {?}
*/
var vcRefStore = { getVCRef: getVCRef, setVCRef: setVCRef, delVCRef: delVCRef };
/**
* @fileoverview added by tsickle
* Generated from: lib/overlay/overlay.directives.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* A directive use to signal the overlay that the host of this directive
* is a dialog boundary, i.e: over click outside of the element should close the modal
* (if non blocking)
*/
var OverlayDialogBoundary = /** @class */ (function () {
function OverlayDialogBoundary(el, dialogRef) {
if (dialogRef && el.nativeElement) {
dialogRef.overlayRef.instance.setClickBoundary(el.nativeElement);
}
}
OverlayDialogBoundary.decorators = [
{ type: core.Directive, args: [{
// tslint:disable-next-line:directive-selector
selector: '[overlayDialogBoundary]'
},] }
];
/** @nocollapse */
OverlayDialogBoundary.ctorParameters = function () { return [
{ type: core.ElementRef },
{ type: DialogRef }
]; };
return OverlayDialogBoundary;
}());
var OverlayTarget = /** @class */ (function () {
function OverlayTarget(vcRef) {
this.vcRef = vcRef;
}
Object.defineProperty(OverlayTarget.prototype, "targetKey", {
set: /**
* @param {?} value
* @return {?}
*/
function (value) {
this._targetKey = value;
if (value) {
vcRefStore.setVCRef(value, this.vcRef);
}
},
enumerable: true,
configurable: true
});
/**
* @return {?}
*/
OverlayTarget.prototype.ngOnDestroy = /**
* @return {?}
*/
function () {
if (this._targetKey) {
vcRefStore.delVCRef(this._targetKey, this.vcRef);
}
};
OverlayTarget.decorators = [
{ type: core.Directive, args: [{
// tslint:disable-next-line:directive-selector
selector: '[overlayTarget]'
},] }
];
/** @nocollapse */
OverlayTarget.ctorParameters = function () { return [
{ type: core.ViewContainerRef }
]; };
OverlayTarget.propDecorators = {
targetKey: [{ type: core.Input, args: ['overlayTarget',] }]
};
return OverlayTarget;
}());
if (false) {
/**
* @type {?}
* @private
*/
OverlayTarget.prototype._targetKey;
/**
* @type {?}
* @private
*/
OverlayTarget.prototype.vcRef;
}
/**
* @fileoverview added by tsickle
* Generated from: lib/components/base-dynamic-component.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/** @type {?} */
var BROWSER_PREFIX = ['webkit', 'moz', 'MS', 'o', ''];
/**
* @param {?} eventName
* @param {?} element
* @param {?} cb
* @return {?}
*/
function register(eventName, element, cb) {
BROWSER_PREFIX.forEach((/**
* @param {?} p
* @return {?}
*/
function (p) {
element.addEventListener(p ? p + eventName : eventName.toLowerCase(), cb, false);
}));
}
/**
* A base class for supporting dynamic components.
* There are 3 main support areas:
* 1 - Easy wrapper for dynamic styling via CSS classes and inline styles.
* 2 - Easy wrapper for interception of transition/animation end events.
* 3 - Easy wrapper for component creation and injection.
*
* Dynamic css is done via direct element manipulation (via renderer), it does not use change detection
* or binding. This is to allow better control over animation.
*
* Animation support is limited, only transition/keyframes END even are notified.
* The animation support is needed since currently the angular animation module is limited as well and
* does not support CSS animation that are not pre-parsed and are not in the styles metadata of a component.
*
* Capabilities: Add/Remove styls, Add/Remove classes, listen to animation/transition end event,
* add components
*/
var /**
* A base class for supporting dynamic components.
* There are 3 main support areas:
* 1 - Easy wrapper for dynamic styling via CSS classes and inline styles.
* 2 - Easy wrapper for interception of transition/animation end events.
* 3 - Easy wrapper for component creation and injection.
*
* Dynamic css is done via direct element manipulation (via renderer), it does not use change detection
* or binding. This is to allow better control over animation.
*
* Animation support is limited, only transition/keyframes END even are notified.
* The animation support is needed since currently the angular animation module is limited as well and
* does not support CSS animation that are not pre-parsed and are not in the styles metadata of a component.
*
* Capabilities: Add/Remove styls, Add/Remove classes, listen to animation/transition end event,
* add components
*/
BaseDynamicComponent = /** @class */ (function () {
function BaseDynamicComponent(el, renderer) {
this.el = el;
this.renderer = renderer;
}
/**
* @return {?}
*/
BaseDynamicComponent.prototype.activateAnimationListener = /**
* @return {?}
*/
function () {
var _this = this;
if (this.animationEnd) {
return;
}