Skip to content

Commit

Permalink
Merge pull request #4 from ghiscoding/feature/graphql
Browse files Browse the repository at this point in the history
GraphQL minor patches
  • Loading branch information
ghiscoding authored Oct 24, 2017
2 parents e4af51e + a829bae commit 8b6bf95
Show file tree
Hide file tree
Showing 13 changed files with 64 additions and 13 deletions.
13 changes: 12 additions & 1 deletion dist/angular-slickgrid/angular-slickgrid.es5.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
};
import { Observable as Observable$1 } from 'rxjs/Observable';
import 'rxjs/add/operator/first';
import 'rxjs/add/operator/take';
import 'rxjs/add/operator/toPromise';
import 'rxjs/add/operator/map';
import { Component, Injectable, Input, NgModule } from '@angular/core';
Expand Down Expand Up @@ -86,6 +87,7 @@ var booleanFilterCondition = function (options) {
return parseBoolean(options.cellValue) === parseBoolean(options.searchTerm);
};
var OperatorType = {};
OperatorType.contains = /** @type {?} */ ('Contains');
OperatorType.lessThan = /** @type {?} */ ('LT');
OperatorType.lessThanOrEqual = /** @type {?} */ ('LE');
OperatorType.greaterThan = /** @type {?} */ ('GT');
Expand All @@ -96,6 +98,7 @@ OperatorType.endsWith = /** @type {?} */ ('EndsWith');
OperatorType.startsWith = /** @type {?} */ ('StartsWith');
OperatorType.in = /** @type {?} */ ('IN');
OperatorType.notIn = /** @type {?} */ ('NIN');
OperatorType[OperatorType.contains] = "contains";
OperatorType[OperatorType.lessThan] = "lessThan";
OperatorType[OperatorType.lessThanOrEqual] = "lessThanOrEqual";
OperatorType[OperatorType.greaterThan] = "greaterThan";
Expand Down Expand Up @@ -8979,6 +8982,12 @@ var FilterService = /** @class */ (function () {
processPromise = observableOrPromise;
if (observableOrPromise instanceof Observable$1) {
processPromise = observableOrPromise.first().toPromise();
if (!(processPromise instanceof Promise)) {
processPromise = observableOrPromise.take(1).toPromise();
}
if (!(processPromise instanceof Promise)) {
throw new Error("Something went wrong, Angular-Slickgrid filter.service is not able to convert the Observable into a Promise.\n If you are using Angular HttpClient, you could try converting your http call to a Promise with \".toPromise()\"\n for example:: this.http.post('graphql', { query: graphqlQuery }).toPromise()\n ");
}
}
return [4 /*yield*/, processPromise];
case 2:
Expand Down Expand Up @@ -9506,9 +9515,11 @@ function mapOperatorType(operator) {
break;
case '=':
case '==':
default:
map$$1 = OperatorType.equal;
break;
default:
map$$1 = OperatorType.contains;
break;
}
return map$$1;
}
Expand Down
2 changes: 1 addition & 1 deletion dist/angular-slickgrid/angular-slickgrid.es5.js.map

Large diffs are not rendered by default.

16 changes: 15 additions & 1 deletion dist/angular-slickgrid/angular-slickgrid.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/angular-slickgrid/angular-slickgrid.js.map

Large diffs are not rendered by default.

20 changes: 15 additions & 5 deletions dist/bundles/angular-slickgrid.umd.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('rxjs/Observable'), require('rxjs/add/operator/first'), require('rxjs/add/operator/toPromise'), require('rxjs/add/operator/map'), require('@angular/core'), require('@angular/router'), require('@angular/common')) :
typeof define === 'function' && define.amd ? define(['exports', 'rxjs/Observable', 'rxjs/add/operator/first', 'rxjs/add/operator/toPromise', 'rxjs/add/operator/map', '@angular/core', '@angular/router', '@angular/common'], factory) :
(factory((global['angular-slickgrid'] = {}),global.Rx,global.Rx.Observable.prototype,global.Rx.Observable.prototype,global.Rx.Observable.prototype,global.ng.core,global.ng.router,global.ng.common));
}(this, (function (exports,Observable,first,toPromise,map,core,router,common) { 'use strict';
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('rxjs/Observable'), require('rxjs/add/operator/first'), require('rxjs/add/operator/take'), require('rxjs/add/operator/toPromise'), require('rxjs/add/operator/map'), require('@angular/core'), require('@angular/router'), require('@angular/common')) :
typeof define === 'function' && define.amd ? define(['exports', 'rxjs/Observable', 'rxjs/add/operator/first', 'rxjs/add/operator/take', 'rxjs/add/operator/toPromise', 'rxjs/add/operator/map', '@angular/core', '@angular/router', '@angular/common'], factory) :
(factory((global['angular-slickgrid'] = {}),global.Rx,global.Rx.Observable.prototype,global.Rx.Observable.prototype,global.Rx.Observable.prototype,global.Rx.Observable.prototype,global.ng.core,global.ng.router,global.ng.common));
}(this, (function (exports,Observable,first,take,toPromise,map,core,router,common) { 'use strict';

var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
Expand Down Expand Up @@ -85,6 +85,7 @@ var booleanFilterCondition = function (options) {
return parseBoolean(options.cellValue) === parseBoolean(options.searchTerm);
};
var OperatorType = {};
OperatorType.contains = /** @type {?} */ ('Contains');
OperatorType.lessThan = /** @type {?} */ ('LT');
OperatorType.lessThanOrEqual = /** @type {?} */ ('LE');
OperatorType.greaterThan = /** @type {?} */ ('GT');
Expand All @@ -95,6 +96,7 @@ OperatorType.endsWith = /** @type {?} */ ('EndsWith');
OperatorType.startsWith = /** @type {?} */ ('StartsWith');
OperatorType.in = /** @type {?} */ ('IN');
OperatorType.notIn = /** @type {?} */ ('NIN');
OperatorType[OperatorType.contains] = "contains";
OperatorType[OperatorType.lessThan] = "lessThan";
OperatorType[OperatorType.lessThanOrEqual] = "lessThanOrEqual";
OperatorType[OperatorType.greaterThan] = "greaterThan";
Expand Down Expand Up @@ -8978,6 +8980,12 @@ var FilterService = /** @class */ (function () {
processPromise = observableOrPromise;
if (observableOrPromise instanceof Observable.Observable) {
processPromise = observableOrPromise.first().toPromise();
if (!(processPromise instanceof Promise)) {
processPromise = observableOrPromise.take(1).toPromise();
}
if (!(processPromise instanceof Promise)) {
throw new Error("Something went wrong, Angular-Slickgrid filter.service is not able to convert the Observable into a Promise.\n If you are using Angular HttpClient, you could try converting your http call to a Promise with \".toPromise()\"\n for example:: this.http.post('graphql', { query: graphqlQuery }).toPromise()\n ");
}
}
return [4 /*yield*/, processPromise];
case 2:
Expand Down Expand Up @@ -9505,9 +9513,11 @@ function mapOperatorType(operator) {
break;
case '=':
case '==':
default:
map$$1 = OperatorType.equal;
break;
default:
map$$1 = OperatorType.contains;
break;
}
return map$$1;
}
Expand Down
2 changes: 1 addition & 1 deletion dist/bundles/angular-slickgrid.umd.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "angular-slickgrid",
"version": "0.4.0",
"version": "0.4.1",
"description": "Slickgrid components made available in Angular",
"keywords": [
"angular",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export declare enum OperatorType {
contains,
lessThan,
lessThanOrEqual,
greaterThan,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Column, ColumnFilters, GridOption } from '../models';
import 'rxjs/add/operator/first';
import 'rxjs/add/operator/take';
import 'rxjs/add/operator/toPromise';
import 'rxjs/add/operator/map';
export declare class FilterService {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "angular-slickgrid",
"version": "0.4.0",
"version": "0.4.1",
"description": "Slickgrid components made available in Angular",
"keywords": [
"angular",
Expand Down
1 change: 1 addition & 0 deletions src/app/modules/angular-slickgrid/models/operatorType.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export enum OperatorType {
contains = <any>'Contains',
lessThan = <any>'LT',
lessThanOrEqual = <any>'LE',
greaterThan = <any>'GT',
Expand Down
11 changes: 11 additions & 0 deletions src/app/modules/angular-slickgrid/services/filter.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { BackendServiceOption, Column, ColumnFilters, FieldType, FilterChangedAr
import { FilterTemplates } from './../filter-templates';
import { Observable } from 'rxjs/Observable';
import 'rxjs/add/operator/first';
import 'rxjs/add/operator/take';
import 'rxjs/add/operator/toPromise';
import 'rxjs/add/operator/map';
import $ from 'jquery';
Expand Down Expand Up @@ -56,6 +57,16 @@ export class FilterService {
let processPromise = observableOrPromise;
if (observableOrPromise instanceof Observable) {
processPromise = observableOrPromise.first().toPromise();
if (!(processPromise instanceof Promise)) {
processPromise = observableOrPromise.take(1).toPromise();
}
if (!(processPromise instanceof Promise)) {
throw new Error(
`Something went wrong, Angular-Slickgrid filter.service is not able to convert the Observable into a Promise.
If you are using Angular HttpClient, you could try converting your http call to a Promise with ".toPromise()"
for example:: this.http.post('graphql', { query: graphqlQuery }).toPromise()
`);
}
}
const responseProcess = await processPromise;
if (serviceOptions.onBackendEventChanged.postProcess) {
Expand Down
4 changes: 3 additions & 1 deletion src/app/modules/angular-slickgrid/services/utilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,11 @@ export function mapOperatorType(operator: string): OperatorType {
break;
case '=':
case '==':
default:
map = OperatorType.equal;
break;
default:
map = OperatorType.contains;
break;
}

return map;
Expand Down

0 comments on commit 8b6bf95

Please sign in to comment.