ez-web-toolkit
Version:
EZ Web Toolkit
1,312 lines (1,225 loc) • 197 kB
JavaScript
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory();
else if(typeof define === 'function' && define.amd)
define([], factory);
else if(typeof exports === 'object')
exports["ez-web-toolkit"] = factory();
else
root["ez-web-toolkit"] = factory();
})(typeof self !== 'undefined' ? self : this, function() {
return /******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, {
/******/ configurable: false,
/******/ enumerable: true,
/******/ get: getter
/******/ });
/******/ }
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 18);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, exports) {
module.exports = require("lodash");
/***/ }),
/* 1 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* @namespace toolkit.baseClasses
*/
Object.defineProperty(exports, "__esModule", { value: true });
var _ = __webpack_require__(0);
var BaseComponent = /** @class */ (function () {
/**
* @class toolkit.baseClasses.BaseComponent
* @classdesc Automatically handles the scope destroy callbacks and watches.
* @param {ng.IScope} $scope Scope of the component.
* @param {Function} additionalDestruction Callback which would be called on scope destroy.
*/
function BaseComponent($scope, additionalDestruction) {
var _this = this;
this.unwatchArray = new Array();
this.destroy = function () {
if (_this.unwatchArray) {
_.forEach(_this.unwatchArray, function (unwatch) {
unwatch();
});
}
if (additionalDestruction) {
additionalDestruction();
}
};
$scope.$on('$destroy', this.destroy);
}
return BaseComponent;
}());
exports.BaseComponent = BaseComponent;
/***/ }),
/* 2 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* @namespace toolkit.enums
*/
Object.defineProperty(exports, "__esModule", { value: true });
/**
* @class toolkit.enums.EditorState
* @classdesc States of editor.
*/
var EditorState;
(function (EditorState) {
/**
* The add state.
* @member {number} toolkit.enums.EditorState#Add
*/
EditorState[EditorState["Add"] = 0] = "Add";
/**
* The edit state.
* @member {number} toolkit.enums.EditorState#Edit
*/
EditorState[EditorState["Edit"] = 1] = "Edit";
})(EditorState = exports.EditorState || (exports.EditorState = {}));
/***/ }),
/* 3 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* @namespace toolkit.constants
*/
Object.defineProperty(exports, "__esModule", { value: true });
/**
* @class toolkit.constants.EventConsts
* @classdesc An event constants.
*/
var EventConsts = /** @class */ (function () {
function EventConsts() {
}
/**
* The reload grid event name.
* @member {string} toolkit.constants.EventConsts#reloadGridEvent
*/
EventConsts.reloadGridEvent = 'reloadGrid';
return EventConsts;
}());
exports.EventConsts = EventConsts;
/***/ }),
/* 4 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/* WEBPACK VAR INJECTION */(function($) {
/**
* @namespace toolkit.baseClasses
*/
var __extends = (this && this.__extends) || (function () {
var 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 function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var baseComponent_1 = __webpack_require__(1);
var BaseModalController = /** @class */ (function (_super) {
__extends(BaseModalController, _super);
//#region Constructor
/**
* @class toolkit.baseClasses.BaseModalController
* @extends BaseComponent
* @classdesc Methods for manage modals.
* @param {ng.IScope} $scope Scope of the component.
* @param {IModalService} modalService The modal service.
*/
function BaseModalController($scope, modalService) {
var _this = _super.call(this, $scope) || this;
_this.$scope = $scope;
_this.modalService = modalService;
//#endregion
//#region Functions
_this.modalVisibilityUpdated = function (val, old) {
if (val !== old) {
val ? _this.modalService.show(_this)
: _this.modalService.hide(_this);
}
};
return _this;
}
BaseModalController.prototype.$onInit = function () {
var _this = this;
this.$scope.$watch(function () { return _this.isVisible; }, this.modalVisibilityUpdated);
// https://gist.github.com/gordonbrander/2230317
this.id = Math.random().toString(36).substr(2, 9);
this.unwatchArray.push(function () {
_this.modalService.hide(_this);
if ($("#" + _this.id).modal) {
$("#" + _this.id).modal('hide');
}
$("#" + _this.id).remove();
});
};
BaseModalController.prototype.toggleModalVisibility = function (val) {
this.isVisible = val;
this.isModalVisible = val;
};
BaseModalController.prototype.toggleDomExistence = function (val) {
this.isInDom = val;
};
return BaseModalController;
}(baseComponent_1.BaseComponent));
exports.BaseModalController = BaseModalController;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5)))
/***/ }),
/* 5 */
/***/ (function(module, exports) {
module.exports = require("jquery");
/***/ }),
/* 6 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* @namespace toolkit.constants
*/
Object.defineProperty(exports, "__esModule", { value: true });
/**
* @class toolkit.constants.TypeConsts
* @classdesc The type constants.
*/
var TypeConsts = /** @class */ (function () {
function TypeConsts() {
}
/**
* The empty guid constant.
* @member {string} toolkit.constants.TypeConsts#emptyGuid
*/
TypeConsts.emptyGuid = '00000000-0000-0000-0000-000000000000';
return TypeConsts;
}());
exports.TypeConsts = TypeConsts;
/***/ }),
/* 7 */
/***/ (function(module, exports) {
module.exports = require("angular");
/***/ }),
/* 8 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* @namespace toolkit.baseClasses
*/
var __extends = (this && this.__extends) || (function () {
var 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 function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var baseComponent_1 = __webpack_require__(1);
var eventConsts_1 = __webpack_require__(3);
var BaseLookupController = /** @class */ (function (_super) {
__extends(BaseLookupController, _super);
//#endregion
//#region Constructor
/**
* @class toolkit.baseClasses.BaseLookupController<T extends Object>
* @extends BaseComponent
* @abstract
* @classdesc Methods for handling an angular ng-grid component.
* @param {ng.IScope} $scope Scope of the component.
*/
function BaseLookupController($scope) {
var _this = _super.call(this, $scope) || this;
_this.$scope = $scope;
$scope.rowDblClick = function (row) { return _this.onDoubleClickEvent(row.entity); };
$scope.$on(eventConsts_1.EventConsts.reloadGridEvent, function () {
_this.reloadGrid();
});
return _this;
}
/**
* Calls an onDoubleClick callback and assigns the selected item.
* @method toolkit.baseClasses.BaseLookupController#onDoubleClickEvent
*/
BaseLookupController.prototype.onDoubleClickEvent = function (selectedItem) {
this.selectedItem = selectedItem;
if (this.onDoubleClick) {
this.onDoubleClick();
}
};
return BaseLookupController;
}(baseComponent_1.BaseComponent));
exports.BaseLookupController = BaseLookupController;
/***/ }),
/* 9 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* @namespace toolkit.baseClasses
*/
Object.defineProperty(exports, "__esModule", { value: true });
var managerState_1 = __webpack_require__(10);
var editorState_1 = __webpack_require__(2);
var BaseManagerController = /** @class */ (function () {
/**
* @class toolkit.baseClasses.BaseManagerController<T extends Object>
* @abstract
* @classdesc Methods for manager page where user can delete/create/edit items from grid.
* @param {ng.IScope} $scope Scope of the component.
* @param {ng.ITimoutService} $timeout Angular timeout.
* @param {INotificationService} notificationService Ez notification service.
*/
function BaseManagerController($scope, $timeout, notificationService) {
this.$scope = $scope;
this.$timeout = $timeout;
this.notificationService = notificationService;
this.ManagerState = managerState_1.ManagerState;
this.EditorState = editorState_1.EditorState;
this.clearSelected();
this.state = managerState_1.ManagerState.Lookup;
}
Object.defineProperty(BaseManagerController.prototype, "state", {
get: function () {
return this.managerState;
},
/**
* Needs to be set in a timeout so the page updates accordingly.
*/
set: function (val) {
var _this = this;
this.$timeout(function () {
_this.managerState = val;
});
},
enumerable: true,
configurable: true
});
/**
* Switches to add editor state and editor manager state.
* @method toolkit.baseClasses.BaseManagerController#newItem
*/
BaseManagerController.prototype.newItem = function () {
this.selectedItem = this.prepareNewItem();
this.editorState = editorState_1.EditorState.Add;
this.state = managerState_1.ManagerState.Editor;
};
/**
* Edit the selected item - retrieve the selected item then load the editor page.
* @method toolkit.baseClasses.BaseManagerController#editItem
* @returns {Promise<any>} A promise to the result of retrieving the item
* and moving to the editor page.
*/
BaseManagerController.prototype.editItem = function () {
var _this = this;
if (!this.isRequestRunning
&& this.selectedItem !== null) {
this.isRequestRunning = true;
return this.getItem()
.then(function (resp) {
_this.selectedItem = resp;
_this.editorState = editorState_1.EditorState.Edit;
_this.state = managerState_1.ManagerState.Editor;
})
.catch(function () {
// Do nothing, error was already notified in apiService
})
.then(function () {
_this.$timeout(function () {
_this.isRequestRunning = false;
});
});
}
};
/**
* Clears the selected item.
* @method toolkit.baseClasses.BaseManagerController#clearSelected
*/
BaseManagerController.prototype.clearSelected = function () {
this.selectedItem = null;
};
/**
* Callback executes when add/edit editor is closing.
* @method toolkit.baseClasses.BaseManagerController#closeEditor
*/
BaseManagerController.prototype.closeEditor = function () {
this.clearSelected();
this.state = managerState_1.ManagerState.Lookup;
};
return BaseManagerController;
}());
exports.BaseManagerController = BaseManagerController;
/***/ }),
/* 10 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* @namespace toolkit.enums
*/
Object.defineProperty(exports, "__esModule", { value: true });
/**
* @class toolkit.enums.ManagerState
* @classdesc States for manager.
*/
var ManagerState;
(function (ManagerState) {
/**
* Shows the lookup grid.
* @member {number} toolkit.enums.ManagerState#Lookup
*/
ManagerState[ManagerState["Lookup"] = 0] = "Lookup";
/**
* Shows the editor.
* @member {number} toolkit.enums.ManagerState#Editor
*/
ManagerState[ManagerState["Editor"] = 1] = "Editor";
})(ManagerState = exports.ManagerState || (exports.ManagerState = {}));
/***/ }),
/* 11 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* @namespace toolkit.enums
*/
Object.defineProperty(exports, "__esModule", { value: true });
/**
* @class toolkit.enums.ErrorResponseType
* @classdesc An error reponses.
*/
var ErrorResponseType;
(function (ErrorResponseType) {
/**
* The connection lost.
* @member {number} toolkit.enums.ErrorResponseType#ConnectionLost
*/
ErrorResponseType[ErrorResponseType["ConnectionLost"] = 0] = "ConnectionLost";
/**
* The result has a problem.
* @member {number} toolkit.enums.ErrorResponseType#ProblemResult
*/
ErrorResponseType[ErrorResponseType["ProblemResult"] = 1] = "ProblemResult";
/**
* The result has validation problem.
* @member {number} toolkit.enums.ErrorResponseType#ValidationProblemResult
*/
ErrorResponseType[ErrorResponseType["ValidationProblemResult"] = 2] = "ValidationProblemResult";
})(ErrorResponseType = exports.ErrorResponseType || (exports.ErrorResponseType = {}));
/***/ }),
/* 12 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* @namespace toolkit.enums
*/
Object.defineProperty(exports, "__esModule", { value: true });
/**
* @class toolkit.enums.HttpStatusCode
* @classdesc Enumeration of http status codes.
*/
var HttpStatusCode;
(function (HttpStatusCode) {
//
// Summary:
// Equivalent to HTTP status 100. System.Net.HttpStatusCode.Continue indicates that
// the client can continue with its request.
HttpStatusCode[HttpStatusCode["Continue"] = 100] = "Continue";
//
// Summary:
// Equivalent to HTTP status 101. System.Net.HttpStatusCode.SwitchingProtocols indicates
// that the protocol version or protocol is being changed.
HttpStatusCode[HttpStatusCode["SwitchingProtocols"] = 101] = "SwitchingProtocols";
//
// Summary:
// Equivalent to HTTP status 200. System.Net.HttpStatusCode.OK indicates that the
// request succeeded and that the requested information is in the response. This
// is the most common status code to receive.
HttpStatusCode[HttpStatusCode["OK"] = 200] = "OK";
//
// Summary:
// Equivalent to HTTP status 201. System.Net.HttpStatusCode.Created indicates that
// the request resulted in a new resource created before the response was sent.
HttpStatusCode[HttpStatusCode["Created"] = 201] = "Created";
//
// Summary:
// Equivalent to HTTP status 202. System.Net.HttpStatusCode.Accepted indicates that
// the request has been accepted for further processing.
HttpStatusCode[HttpStatusCode["Accepted"] = 202] = "Accepted";
//
// Summary:
// Equivalent to HTTP status 203. System.Net.HttpStatusCode.NonAuthoritativeInformation
// indicates that the returned metainformation is from a cached copy instead of
// the origin server and therefore may be incorrect.
HttpStatusCode[HttpStatusCode["NonAuthoritativeInformation"] = 203] = "NonAuthoritativeInformation";
//
// Summary:
// Equivalent to HTTP status 204. System.Net.HttpStatusCode.NoContent indicates
// that the request has been successfully processed and that the response is intentionally
// blank.
HttpStatusCode[HttpStatusCode["NoContent"] = 204] = "NoContent";
//
// Summary:
// Equivalent to HTTP status 205. System.Net.HttpStatusCode.ResetContent indicates
// that the client should reset (not reload) the current resource.
HttpStatusCode[HttpStatusCode["ResetContent"] = 205] = "ResetContent";
//
// Summary:
// Equivalent to HTTP status 206. System.Net.HttpStatusCode.PartialContent indicates
// that the response is a partial response as requested by a GET request that includes
// a byte range.
HttpStatusCode[HttpStatusCode["PartialContent"] = 206] = "PartialContent";
//
// Summary:
// Equivalent to HTTP status 300. System.Net.HttpStatusCode.MultipleChoices indicates
// that the requested information has multiple representations. The default action
// is to treat this status as a redirect and follow the contents of the Location
// header associated with this response.
HttpStatusCode[HttpStatusCode["MultipleChoices"] = 300] = "MultipleChoices";
//
// Summary:
// Equivalent to HTTP status 300. System.Net.HttpStatusCode.Ambiguous indicates
// that the requested information has multiple representations. The default action
// is to treat this status as a redirect and follow the contents of the Location
// header associated with this response.
HttpStatusCode[HttpStatusCode["Ambiguous"] = 300] = "Ambiguous";
//
// Summary:
// Equivalent to HTTP status 301. System.Net.HttpStatusCode.MovedPermanently indicates
// that the requested information has been moved to the URI specified in the Location
// header. The default action when this status is received is to follow the Location
// header associated with the response.
HttpStatusCode[HttpStatusCode["MovedPermanently"] = 301] = "MovedPermanently";
//
// Summary:
// Equivalent to HTTP status 301. System.Net.HttpStatusCode.Moved indicates that
// the requested information has been moved to the URI specified in the Location
// header. The default action when this status is received is to follow the Location
// header associated with the response. When the original request method was POST,
// the redirected request will use the GET method.
HttpStatusCode[HttpStatusCode["Moved"] = 301] = "Moved";
//
// Summary:
// Equivalent to HTTP status 302. System.Net.HttpStatusCode.Found indicates that
// the requested information is located at the URI specified in the Location header.
// The default action when this status is received is to follow the Location header
// associated with the response. When the original request method was POST, the
// redirected request will use the GET method.
HttpStatusCode[HttpStatusCode["Found"] = 302] = "Found";
//
// Summary:
// Equivalent to HTTP status 302. System.Net.HttpStatusCode.Redirect indicates that
// the requested information is located at the URI specified in the Location header.
// The default action when this status is received is to follow the Location header
// associated with the response. When the original request method was POST, the
// redirected request will use the GET method.
HttpStatusCode[HttpStatusCode["Redirect"] = 302] = "Redirect";
//
// Summary:
// Equivalent to HTTP status 303. System.Net.HttpStatusCode.SeeOther automatically
// redirects the client to the URI specified in the Location header as the result
// of a POST. The request to the resource specified by the Location header will
// be made with a GET.
HttpStatusCode[HttpStatusCode["SeeOther"] = 303] = "SeeOther";
//
// Summary:
// Equivalent to HTTP status 303. System.Net.HttpStatusCode.RedirectMethod automatically
// redirects the client to the URI specified in the Location header as the result
// of a POST. The request to the resource specified by the Location header will
// be made with a GET.
HttpStatusCode[HttpStatusCode["RedirectMethod"] = 303] = "RedirectMethod";
//
// Summary:
// Equivalent to HTTP status 304. System.Net.HttpStatusCode.NotModified indicates
// that the client's cached copy is up to date. The contents of the resource are
// not transferred.
HttpStatusCode[HttpStatusCode["NotModified"] = 304] = "NotModified";
//
// Summary:
// Equivalent to HTTP status 305. System.Net.HttpStatusCode.UseProxy indicates that
// the request should use the proxy server at the URI specified in the Location
// header.
HttpStatusCode[HttpStatusCode["UseProxy"] = 305] = "UseProxy";
//
// Summary:
// Equivalent to HTTP status 306. System.Net.HttpStatusCode.Unused is a proposed
// extension to the HTTP/1.1 specification that is not fully specified.
HttpStatusCode[HttpStatusCode["Unused"] = 306] = "Unused";
//
// Summary:
// Equivalent to HTTP status 307. System.Net.HttpStatusCode.TemporaryRedirect indicates
// that the request information is located at the URI specified in the Location
// header. The default action when this status is received is to follow the Location
// header associated with the response. When the original request method was POST,
// the redirected request will also use the POST method.
HttpStatusCode[HttpStatusCode["TemporaryRedirect"] = 307] = "TemporaryRedirect";
//
// Summary:
// Equivalent to HTTP status 307. System.Net.HttpStatusCode.RedirectKeepVerb indicates
// that the request information is located at the URI specified in the Location
// header. The default action when this status is received is to follow the Location
// header associated with the response. When the original request method was POST,
// the redirected request will also use the POST method.
HttpStatusCode[HttpStatusCode["RedirectKeepVerb"] = 307] = "RedirectKeepVerb";
//
// Summary:
// Equivalent to HTTP status 400. System.Net.HttpStatusCode.BadRequest indicates
// that the request could not be understood by the server. System.Net.HttpStatusCode.BadRequest
// is sent when no other error is applicable, or if the exact error is unknown or
// does not have its own error code.
HttpStatusCode[HttpStatusCode["BadRequest"] = 400] = "BadRequest";
//
// Summary:
// Equivalent to HTTP status 401. System.Net.HttpStatusCode.Unauthorized indicates
// that the requested resource requires authentication. The WWW-Authenticate header
// contains the details of how to perform the authentication.
HttpStatusCode[HttpStatusCode["Unauthorized"] = 401] = "Unauthorized";
//
// Summary:
// Equivalent to HTTP status 402. System.Net.HttpStatusCode.PaymentRequired is reserved
// for future use.
HttpStatusCode[HttpStatusCode["PaymentRequired"] = 402] = "PaymentRequired";
//
// Summary:
// Equivalent to HTTP status 403. System.Net.HttpStatusCode.Forbidden indicates
// that the server refuses to fulfill the request.
HttpStatusCode[HttpStatusCode["Forbidden"] = 403] = "Forbidden";
//
// Summary:
// Equivalent to HTTP status 404. System.Net.HttpStatusCode.NotFound indicates that
// the requested resource does not exist on the server.
HttpStatusCode[HttpStatusCode["NotFound"] = 404] = "NotFound";
//
// Summary:
// Equivalent to HTTP status 405. System.Net.HttpStatusCode.MethodNotAllowed indicates
// that the request method (POST or GET) is not allowed on the requested resource.
HttpStatusCode[HttpStatusCode["MethodNotAllowed"] = 405] = "MethodNotAllowed";
//
// Summary:
// Equivalent to HTTP status 406. System.Net.HttpStatusCode.NotAcceptable indicates
// that the client has indicated with Accept headers that it will not accept any
// of the available representations of the resource.
HttpStatusCode[HttpStatusCode["NotAcceptable"] = 406] = "NotAcceptable";
//
// Summary:
// Equivalent to HTTP status 407. System.Net.HttpStatusCode.ProxyAuthenticationRequired
// indicates that the requested proxy requires authentication. The Proxy-authenticate
// header contains the details of how to perform the authentication.
HttpStatusCode[HttpStatusCode["ProxyAuthenticationRequired"] = 407] = "ProxyAuthenticationRequired";
//
// Summary:
// Equivalent to HTTP status 408. System.Net.HttpStatusCode.RequestTimeout indicates
// that the client did not send a request within the time the server was expecting
// the request.
HttpStatusCode[HttpStatusCode["RequestTimeout"] = 408] = "RequestTimeout";
//
// Summary:
// Equivalent to HTTP status 409. System.Net.HttpStatusCode.Conflict indicates that
// the request could not be carried out because of a conflict on the server.
HttpStatusCode[HttpStatusCode["Conflict"] = 409] = "Conflict";
//
// Summary:
// Equivalent to HTTP status 410. System.Net.HttpStatusCode.Gone indicates that
// the requested resource is no longer available.
HttpStatusCode[HttpStatusCode["Gone"] = 410] = "Gone";
//
// Summary:
// Equivalent to HTTP status 411. System.Net.HttpStatusCode.LengthRequired indicates
// that the required Content-length header is missing.
HttpStatusCode[HttpStatusCode["LengthRequired"] = 411] = "LengthRequired";
//
// Summary:
// Equivalent to HTTP status 412. System.Net.HttpStatusCode.PreconditionFailed indicates
// that a condition set for this request failed, and the request cannot be carried
// out. Conditions are set with conditional request headers like If-Match, If-None-Match,
// or If-Unmodified-Since.
HttpStatusCode[HttpStatusCode["PreconditionFailed"] = 412] = "PreconditionFailed";
//
// Summary:
// Equivalent to HTTP status 413. System.Net.HttpStatusCode.RequestEntityTooLarge
// indicates that the request is too large for the server to process.
HttpStatusCode[HttpStatusCode["RequestEntityTooLarge"] = 413] = "RequestEntityTooLarge";
//
// Summary:
// Equivalent to HTTP status 414. System.Net.HttpStatusCode.RequestUriTooLong indicates
// that the URI is too long.
HttpStatusCode[HttpStatusCode["RequestUriTooLong"] = 414] = "RequestUriTooLong";
//
// Summary:
// Equivalent to HTTP status 415. System.Net.HttpStatusCode.UnsupportedMediaType
// indicates that the request is an unsupported type.
HttpStatusCode[HttpStatusCode["UnsupportedMediaType"] = 415] = "UnsupportedMediaType";
//
// Summary:
// Equivalent to HTTP status 416. System.Net.HttpStatusCode.RequestedRangeNotSatisfiable
// indicates that the range of data requested from the resource cannot be returned,
// either because the beginning of the range is before the beginning of the resource,
// or the end of the range is after the end of the resource.
HttpStatusCode[HttpStatusCode["RequestedRangeNotSatisfiable"] = 416] = "RequestedRangeNotSatisfiable";
//
// Summary:
// Equivalent to HTTP status 417. System.Net.HttpStatusCode.ExpectationFailed indicates
// that an expectation given in an Expect header could not be met by the server.
HttpStatusCode[HttpStatusCode["ExpectationFailed"] = 417] = "ExpectationFailed";
//
// Summary:
// Equivalent to HTTP status 426. System.Net.HttpStatusCode.UpgradeRequired indicates
// that the client should switch to a different protocol such as TLS/1.0.
HttpStatusCode[HttpStatusCode["UpgradeRequired"] = 426] = "UpgradeRequired";
//
// Summary:
// Equivalent to HTTP status 500. System.Net.HttpStatusCode.InternalServerError
// indicates that a generic error has occurred on the server.
HttpStatusCode[HttpStatusCode["InternalServerError"] = 500] = "InternalServerError";
//
// Summary:
// Equivalent to HTTP status 501. System.Net.HttpStatusCode.NotImplemented indicates
// that the server does not support the requested function.
HttpStatusCode[HttpStatusCode["NotImplemented"] = 501] = "NotImplemented";
//
// Summary:
// Equivalent to HTTP status 502. System.Net.HttpStatusCode.BadGateway indicates
// that an intermediate proxy server received a bad response from another proxy
// or the origin server.
HttpStatusCode[HttpStatusCode["BadGateway"] = 502] = "BadGateway";
//
// Summary:
// Equivalent to HTTP status 503. System.Net.HttpStatusCode.ServiceUnavailable indicates
// that the server is temporarily unavailable, usually due to high load or maintenance.
HttpStatusCode[HttpStatusCode["ServiceUnavailable"] = 503] = "ServiceUnavailable";
//
// Summary:
// Equivalent to HTTP status 504. System.Net.HttpStatusCode.GatewayTimeout indicates
// that an intermediate proxy server timed out while waiting for a response from
// another proxy or the origin server.
HttpStatusCode[HttpStatusCode["GatewayTimeout"] = 504] = "GatewayTimeout";
//
// Summary:
// Equivalent to HTTP status 505. System.Net.HttpStatusCode.HttpVersionNotSupported
// indicates that the requested HTTP version is not supported by the server.
HttpStatusCode[HttpStatusCode["HttpVersionNotSupported"] = 505] = "HttpVersionNotSupported";
})(HttpStatusCode = exports.HttpStatusCode || (exports.HttpStatusCode = {}));
/***/ }),
/* 13 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* @namespace toolkit.exceptions
*/
var __extends = (this && this.__extends) || (function () {
var 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 function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
/**
* @class toolkit.exceptions.ResponseError
* @classdesc Occurs on response error.
*/
var ResponseError = /** @class */ (function (_super) {
__extends(ResponseError, _super);
/**
* Creates a new response error.
* @param message
* @param data
*/
function ResponseError(type, message, data) {
var _this = _super.call(this, message) || this;
_this.type = type;
_this.data = data;
return _this;
}
return ResponseError;
}(Error));
exports.ResponseError = ResponseError;
/***/ }),
/* 14 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* @namespace toolkit.models
*/
Object.defineProperty(exports, "__esModule", { value: true });
/**
* @class toolkit.models.RequestOptions
* @classdesc The request options to be passed to the api service request function.
*/
var RequestOptions = /** @class */ (function () {
// TODO: Reverse order of url, string params.
function RequestOptions(url, method, baseUrl) {
if (baseUrl === void 0) { baseUrl = './'; }
this.url = baseUrl.concat(url);
this.method = method;
this.rethrow = true;
}
return RequestOptions;
}());
exports.RequestOptions = RequestOptions;
/***/ }),
/* 15 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* @namespace toolkit.models
*/
Object.defineProperty(exports, "__esModule", { value: true });
/**
* @class toolkit.models.ProblemResult
* @classdesc The problem result.
*/
var ProblemResult = /** @class */ (function () {
function ProblemResult() {
}
return ProblemResult;
}());
exports.ProblemResult = ProblemResult;
/***/ }),
/* 16 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* @namespace toolkit.models
*/
Object.defineProperty(exports, "__esModule", { value: true });
/**
* @class toolkit.models.UiGridRequest
* @classdesc Request with filterin for angular ui grid.
*/
var UiGridRequest = /** @class */ (function () {
function UiGridRequest() {
}
return UiGridRequest;
}());
exports.UiGridRequest = UiGridRequest;
/**
* sort request model.
*/
var SortRequest = /** @class */ (function () {
function SortRequest() {
}
return SortRequest;
}());
exports.SortRequest = SortRequest;
/**
* filter request.
*/
var FilterRequest = /** @class */ (function () {
function FilterRequest() {
}
return FilterRequest;
}());
exports.FilterRequest = FilterRequest;
/***/ }),
/* 17 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**
* the persistent message class.
*/
var PersistentMessage = /** @class */ (function () {
function PersistentMessage() {
}
return PersistentMessage;
}());
exports.PersistentMessage = PersistentMessage;
/***/ }),
/* 18 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var BaseClasses = __webpack_require__(19);
exports.BaseClasses = BaseClasses;
var Components = __webpack_require__(24);
exports.Components = Components;
var Constants = __webpack_require__(61);
exports.Constants = Constants;
var Enums = __webpack_require__(66);
exports.Enums = Enums;
var Exceptions = __webpack_require__(67);
exports.Exceptions = Exceptions;
var Models = __webpack_require__(68);
exports.Models = Models;
var Services = __webpack_require__(72);
exports.Services = Services;
var Directives = __webpack_require__(83);
exports.Directives = Directives;
var Utils = __webpack_require__(85);
exports.Utils = Utils;
/***/ }),
/* 19 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var baseComponent_1 = __webpack_require__(1);
exports.BaseComponent = baseComponent_1.BaseComponent;
var baseEditorController_1 = __webpack_require__(20);
exports.BaseEditorController = baseEditorController_1.BaseEditorController;
var baseLookupController_1 = __webpack_require__(8);
exports.BaseLookupController = baseLookupController_1.BaseLookupController;
var baseManagerController_1 = __webpack_require__(9);
exports.BaseManagerController = baseManagerController_1.BaseManagerController;
var baseManagerDeletableController_1 = __webpack_require__(23);
exports.BaseManagerDeletableController = baseManagerDeletableController_1.BaseManagerDeletableController;
var baseModalController_1 = __webpack_require__(4);
exports.BaseModalController = baseModalController_1.BaseModalController;
/***/ }),
/* 20 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* @namespace toolkit.baseClasses
*/
Object.defineProperty(exports, "__esModule", { value: true });
var angular_typescript_validation_1 = __webpack_require__(21);
var editorState_1 = __webpack_require__(2);
var validationProcessor_1 = __webpack_require__(22);
var BaseEditorController = /** @class */ (function () {
/**
* @class toolkit.baseClasses.BaseEditorController<T extends Object>
* @implements IValidatableController
* @classdesc Provides methods for validating request before server call, the editor states.
* @param {ng.IScope} $scope Scope of the component.
* @param {ng.ITimeoutService} $timeout Angular timeout.
* @param {INotificationService} notificationService Ez notification service.
* @param {IValidator} validator Validator for item which should be edited.
*/
function BaseEditorController($scope, $timeout, notificationService, validator) {
this.$timeout = $timeout;
this.notificationService = notificationService;
/**
* Whether to clear item on close or not. Close occurs automatically after success submit.
* @member {boolean} toolkit.baseClasses.BaseEditorController#clearItemOnClose
*/
this.clearItemOnClose = true;
this.showMessageOnSuccess = true;
this.successMessage = 'Successfully saved.';
this.validationService = new angular_typescript_validation_1.ValidationService(this, $scope);
this.rulesCustomizer = validator.rulesCustomizer;
this.isRequestRunning = null;
this.isValidationRequestRunning = false;
}
Object.defineProperty(BaseEditorController.prototype, "model", {
/**
* Obsolete. Do not use this property. Returns item.
* @member {T} toolkit.baseClasses.BaseEditorController#model
*/
get: function () {
return this.item;
},
enumerable: true,
configurable: true
});
Object.defineProperty(BaseEditorController.prototype, "isRequestRunning", {
/**
* Checks if request for validating or edit item is currently running.
* @member {boolean} toolkit.baseClasses.BaseEditorController#isRequestRunning
*/
get: function () {
return this.isReqRunning || this.isValidationRequestRunning;
},
set: function (val) {
var _this = this;
this.$timeout(function () {
_this.isReqRunning = val;
});
},
enumerable: true,
configurable: true
});
/**
* Closes the editor. Clears item on close by default and calls onClose callback.
* @method toolkit.baseClasses.BaseEditorController#close
*/
BaseEditorController.prototype.close = function () {
if (this.clearItemOnClose) {
this.clearItem();
}
if (this.onClose) {
this.onClose();
}
};
/**
* Occurs on response success. Could be overriden.
* @method toolkit.baseClasses.BaseEditorController#onResponseSuccess
* @param {any} response The response from the server.
*/
BaseEditorController.prototype.onResponseSuccess = function (response) {
// could be overriden
};
BaseEditorController.prototype.handleWarnResponse = function (response) {
if (response.hasWarning) {
this.notificationService.warn(response.detail);
}
else {
this.notificationService.success(this.successMessage);
}
};
/**
* Notifies user about success save. Could be overriden to provide different notification.
* @method toolkit.baseClasses.BaseEditorController#successNotification
*/
BaseEditorController.prototype.successNotification = function () {
if (this.showMessageOnSuccess) {
this.notificationService.success(this.successMessage);
}
};
/**
* Method is called after validation is occured, if false the do not call the save method.
* @method toolkit.baseClasses.BaseEditorController#afterValidation
* @param {boolean} validationResult The validation result.
*/
BaseEditorController.prototype.afterValidation = function (validationResult) {
return true;
};
/**
* Validates an item, in case of success, makes request to server in order to save item.
* @method toolkit.baseClasses.BaseEditorController#submit
*/
BaseEditorController.prototype.submit = function () {
var _this = this;
if (!this.item) {
this.item = {};
}
if (this.isValidationRequestRunning) {
return;
}
this.isValidationRequestRunning = true;
this.validationService.validate(this.item).then(function (result) {
_this.$timeout(function () {
_this.isValidationRequestRunning = false;
});
if (!_this.afterValidation(result)) {
return;
}
if (result) {
if (!_this.isReqRunning) {
_this.isRequestRunning = true;
_this.save()
.then(function (response) {
_this.successNotification();
_this.onResponseSuccess(response);
_this.close();
})
.catch(function (reject) {
if (reject && reject.data) {
validationProcessor_1.ValidationProcessor.processValidationServerResponse(reject.data, function (fieldName, errorMessage) { return _this.validationService.addServerError(fieldName, errorMessage); });
}
})
.then(function () {
_this.isRequestRunning = false;
});
}
}
});
};
/**
* Whether editor is in add state.
* @method toolkit.baseClasses.BaseEditorController#isInAddState
*/
BaseEditorController.prototype.isInAddState = function () {
return this.state === editorState_1.EditorState.Add;
};
/**
* Whether editor is in edit state.
* @method toolkit.baseClasses.BaseEditorController#isInEditState
*/
BaseEditorController.prototype.isInEditState = function () {
return this.state === editorState_1.EditorState.Edit;
};
/**
* Nulls an item.
* @method toolkit.baseClasses.BaseEditorController#clearItem
*/
BaseEditorController.prototype.clearItem = function () {
this.item = null;
};
return BaseEditorController;
}());
exports.BaseEditorController = BaseEditorController;
/***/ }),
/* 21 */
/***/ (function(module, exports) {
module.exports = require("angular-typescript-validation");
/***/ }),
/* 22 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* @namespace toolkit.services
*/
Object.defineProperty(exports, "__esModule", { value: true });
/**
* @class toolkit.services.ValidationProcessor
* @classdesc Methods for porocessing our validation response.
*/
var ValidationProcessor = /** @class */ (function () {
function ValidationProcessor() {
}
/**
* handles the validation server response.
*/
ValidationProcessor.processValidationServerResponse = function (responseData, errorHandler) {
if (!this.isValidationResultResponse(responseData)) {
return;
}
for (var fieldName in responseData.errors) {
if (responseData.errors.hasOwnProperty(fieldName)) {
var errorMessages = responseData.errors[fieldName];
for (var i = 0; i < errorMessages.length; i++) {
errorHandler(fieldName, errorMessages[i]);
}
}
}
};
/**
* checks if response is validationResult
*/
ValidationProcessor.isValidationResultResponse = function (data) {
if (data && data.hasServerValidationErrors === true) {
return true;
}
return false;
};
return ValidationProcessor;
}());
exports.ValidationProcessor = ValidationProcessor;
/***/ }),
/* 23 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* @namespace toolkit.baseClasses
*/
var __extends = (this && this.__extends) || (function () {
var 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 function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var baseManagerController_1 = __webpack_require__(9);
var eventConsts_1 = __webpack_require__(3);
/**
* @class toolkit.baseClasses.BaseManagerDeletableController<T extends Object>
* @abstract
* @extends BaseManagerController
* @classdesc Methods for manager and extra methods for deleting an item.
*/
var BaseManagerDeletableController = /** @class */ (function (_super) {
__extends(BaseManagerDeletableController, _super);
function BaseManagerDeletableController() {
return _super !== null && _super.apply(this, arguments) || this;
}
/**
* Deletes an item.
* @method toolkit.baseClasses.BaseManagerDeletableController#deleteItem
*/
BaseManagerDeletableController.prototype.deleteItem = function () {
var _this = this;
if (!this.isDeleteRequestRunning) {
this.isDeleteRequestRunning = true;
return this.deleteRequest()
.then(function (resp) {
_this.notificationService.success('Item deleted.');
_this.$scope.$broadcast(eventConsts_1.EventConsts.reloadGridEvent);
_this.isDeleteItemPromptVisible = false;
})
.catch(function (reject) {
_this.handleDeleteError(reject);
})
.then(function () {
_this.$timeout(function () {
_this.isDeleteRequestRunning = false;
});
});
}
};
/**
* Delete error handling. Could be overriden.
* @param {any} reject The sever side data.
* @method toolkit.baseClasses.BaseManagerDeletableController#handleDeleteError
*/
BaseManagerDeletableController.prototype.handleDeleteError = function (reject) {
// could be overriden
};
/**
* Toggles the delete prompt.
* @param {boolean} value Yes or no.
* @method toolkit.baseClasses.BaseManagerDeletableController#toggleDeleteItemPrompt
*/
BaseManagerDeletableController.prototype.toggleDeleteItemPrompt = function (value) {
this.isDeleteItemPromptVisible = value;
};
return BaseManagerDeletableController;
}(baseManagerController_1.BaseManagerController));
exports.BaseManagerDeletableController = BaseManagerDeletableController;
/***/ }),
/