this.show = function (customModalDefaults: angular.ui.bootstrap.IModalSettings, customModalOptions: ModalOptions): angular.IPromise<any> { // Create temp objects to work with since we're in a singleton service let tempModalDefaults: angular.ui.bootstrap.IModalSettings = {}; let tempModalOptions: ModalOptions = {}; // Map angular-ui modal custom defaults to modal defaults defined in service angular.extend(tempModalDefaults, modalDefaults, customModalDefaults); // Map modal.html $scope custom properties to defaults defined in service angular.extend(tempModalOptions, modalOptions, customModalOptions); if (!tempModalDefaults.controller) { tempModalDefaults.controller = ['$scope', '$uibModalInstance', function ($scope: ShowControllerScope, $modalInstance: angular.ui.bootstrap.IModalInstanceService) { $scope.modalOptions = tempModalOptions; $scope.modalOptions.ok = function (result: any) { $modalInstance.close(result); }; $scope.modalOptions.close = function () { $modalInstance.dismiss('cancel'); }; } ]; } return this.open(tempModalDefaults).result; };
angular.forEach(processor.validationErrors, function (error:any) { var copy:any = {}; angular.extend(copy, error); angular.extend(copy, processor); copy.validationErrors = null; errorMap[error.severity].push(copy); count++; });
.config(['$tooltipProvider', '$alertProvider', function ($tooltipProvider: ITooltipProvider, $alertProvider: IAlertProvider) { angular.extend($tooltipProvider.defaults, { container: 'body', trigger: 'hover' }); angular.extend($alertProvider.defaults, { container: '.alerts-wrapper', placement: 'top-right' }); }])
function resourceClassFactory($resource: IResourceService, ...args: any[]): any { const newResource: IResourceClass<any> = $resource(target.url, target.params, target.actions, target.options); return attachInjects(angular.extend(newResource, angular.extend(target, newResource, { prototype: angular.extend(newResource.prototype, angular.extend(target.prototype, { /* tslint:disable:variable-name */ $_Resource: newResource /* tslint:enable:variable-name */ })) })), ...args); }
this.categoryModel.find(this.categories[index].id).then((category: Category): void => { // Disable navigation on the table this.ogTableNavigableService.enabled = false; let modalOptions: IModalSettings = { backdrop: "static" }; // Check if the category has any transactions if (category.num_transactions > 0) { // Show an alert modal modalOptions = angular.extend({ templateUrl: OgModalAlertView, controller: "OgModalAlertController", controllerAs: "vm", resolve: { alert: (): OgModalAlert => ({ header: "Category has existing transactions", message: "You must first delete these transactions, or reassign to another category before attempting to delete this category." }) } }, modalOptions); } else { // Show the delete category modal modalOptions = angular.extend({ templateUrl: CategoryDeleteView, controller: "CategoryDeleteController", controllerAs: "vm", resolve: { category: (): Category => this.categories[index] } }, modalOptions); } // Show the modal this.$uibModal.open(modalOptions).result.then((): void => { // If the deleted category has a parent, decrement the parent's children count if (!isNaN(Number(this.categories[index].parent_id))) { // Find the parent category by it's id const parentIndex = this.categoryIndexById(this.categories[index].parent_id); // If found, decrement the number of children if (!isNaN(parentIndex)) { this.categories[parentIndex].num_children--; } } // Remove the category (and any children) from the array this.categories.splice(index, 1 + this.categories[index].num_children); // Go back to the parent state this.$state.go("root.categories"); }).finally((): true => (this.ogTableNavigableService.enabled = true)); });
function createNgTableParams<T>(settings?: any): INgTableParams<T> { var initialParams: IParamValues<T>; if (arguments.length === 2) { initialParams = arguments[0]; settings = arguments[1]; } settings = ng1.extend({}, settings); settings.filterOptions = ng1.extend({}, { filterDelay: 0 }, settings.filterOptions); var tableParams = new NgTableParams(initialParams, settings); spyOn(tableParams.settings(), 'getData').and.callThrough(); return tableParams; }
this.settings = function(newSettings?: ISettings<T>) { if (ng1.isDefined(newSettings)) { // todo: don't modify newSettings object: this introduces unexpected side effects; // instead take a copy of newSettings if (newSettings.filterOptions){ newSettings.filterOptions = ng1.extend({}, _settings.filterOptions, newSettings.filterOptions); } if (newSettings.groupOptions){ newSettings.groupOptions = ng1.extend({}, _settings.groupOptions, newSettings.groupOptions); } if (ng1.isArray(newSettings.dataset)) { //auto-set the total from passed in dataset newSettings.total = newSettings.dataset.length; } var originalDataset = _settings.dataset; _settings = ng1.extend(_settings, newSettings); if (ng1.isArray(newSettings.dataset)) { optimizeFilterDelay(); } // note: using != as want null and undefined to be treated the same var hasDatasetChanged = newSettings.hasOwnProperty('dataset') && (newSettings.dataset != originalDataset); if (hasDatasetChanged) { if (isCommittedDataset){ this.page(1); // reset page as a new dataset has been supplied } isCommittedDataset = false; var fireEvent = function () { ngTableEventsChannel.publishDatasetChanged(self, newSettings.dataset, originalDataset); }; if (initialEvents){ initialEvents.push(fireEvent); } else { fireEvent(); } } log('ngTable: set settings', _settings); return this; } return _settings; };
return (stencilSetData:any,modelData:any,options?:any):any => { ORYX.Core.UIObject.prototype.addEventHandlers=function(node) { var $node=angular.element(node); $node.on(ORYX.CONFIG.EVENT_MOUSEDOWN, this._delegateEvent.bind(this)); $node.on(ORYX.CONFIG.EVENT_MOUSEMOVE, this._delegateEvent.bind(this)); $node.on(ORYX.CONFIG.EVENT_MOUSEUP, this._delegateEvent.bind(this)); $node.on(ORYX.CONFIG.EVENT_MOUSEOVER, this._delegateEvent.bind(this)); $node.on(ORYX.CONFIG.EVENT_MOUSEOUT, this._delegateEvent.bind(this)); $node.on('click', this._delegateEvent.bind(this)); $node.on(ORYX.CONFIG.EVENT_DBLCLICK, this._delegateEvent.bind(this)); }; if(!options) options={}; var ssUrl = (modelData.model.stencilset.namespace || modelData.model.stencilset.url).replace("#", "%23"); ORYX.Core.StencilSet.loadStencilSet(ORYX.CONFIG.STENCILSET_HANDLER + ssUrl, modelData.model.resourceId, stencilSetData); angular.extend(options,{ createCanvasWrapper:false, isGenerateGUI:false, enableMakeExtModalWindowKeysave:false, enableLoadContentModel:false, enableLoadPlugins:false, }); var editor= new ORYX.Editor(modelData,options); var facade= editor._getPluginFacade(); var oryxDragDropResize=oryxDragDropResizeFactory(facade); editor.registerOnEvent(ORYX.CONFIG.EVENT_SELECTION_CHANGED, oryxDragDropResize.onSelectionChanged.bind(oryxDragDropResize)); return editor; }
app.controller('ContactMapCtrl', ['$scope', function($scope) { const office = { lat: 52.53849, lng: 13.38520 }; angular.extend($scope, { center: { lat: office.lat, lng: office.lng, zoom: 12 }, markers: { officeMarker: { lat: office.lat, lng: office.lng, focus: true, message: '<h4 class="ph-no-margin-top">' + 'PaperHive office ' + '<small class="ph-newline">Room ACK390, Entrance H</small>' + '</h4>' + 'Ackerstr. 76<br/>13355 Berlin<br/>Germany', draggable: false } } }); }]);
function triggerClick(el, options?) { options = angular.extend( { metaKey: false, ctrlKey: false, shiftKey: false, altKey: false, button: 0, }, options || {} ); const e = document.createEvent('MouseEvents'); e.initMouseEvent( 'click', // typeArg of type DOMString, Specifies the event type. true, // canBubbleArg of type boolean, Specifies whether or not the event can bubble. true, // cancelableArg of type boolean, Specifies whether or not the event's default action can be prevented. undefined, // viewArg of type views::AbstractView, Specifies the Event's AbstractView. 0, // detailArg of type long, Specifies the Event's mouse click count. 0, // screenXArg of type long, Specifies the Event's screen x coordinate 0, // screenYArg of type long, Specifies the Event's screen y coordinate 0, // clientXArg of type long, Specifies the Event's client x coordinate 0, // clientYArg of type long, Specifies the Event's client y coordinate options.ctrlKey, // ctrlKeyArg of type boolean, Specifies whether or not control key was depressed during the Event. options.altKey, // altKeyArg of type boolean, Specifies whether or not alt key was depressed during the Event. options.shiftKey, // shiftKeyArg of type boolean, Specifies whether or not shift key was depressed during the Event. options.metaKey, // metaKeyArg of type boolean, Specifies whether or not meta key was depressed during the Event. options.button, // buttonArg of type unsigned short, Specifies the Event's mouse button. null // relatedTargetArg of type EventTarget ); el[0].dispatchEvent(e); }