Skip to content
This repository was archived by the owner on Jun 1, 2025. It is now read-only.

Commit c063860

Browse files
Ghislain BeaulacGhislain Beaulac
authored andcommitted
Add GraphQL flag to keep field with double quotes in query
1 parent bfd292d commit c063860

17 files changed

+50
-24
lines changed

dist/angular-slickgrid.es5.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10590,7 +10590,7 @@ var GraphqlService = /** @class */ (function () {
1059010590
datasetQb.filter(datasetFilters);
1059110591
queryQb.find(datasetQb);
1059210592
var /** @type {?} */ enumSearchProperties = ['direction:', 'field:', 'operator:'];
10593-
return this.trimDoubleQuotesOnEnumField(queryQb.toString(), enumSearchProperties);
10593+
return this.trimDoubleQuotesOnEnumField(queryQb.toString(), enumSearchProperties, this.serviceOptions.keepArgumentFieldDoubleQuotes);
1059410594
};
1059510595
/**
1059610596
* From an input array of strings, we want to build a GraphQL query string.
@@ -10784,17 +10784,22 @@ var GraphqlService = /** @class */ (function () {
1078410784
* query { users (orderBy:[{field:"billing.street.name", direction: ASC}}
1078510785
* @param {?} inputStr input string
1078610786
* @param {?} enumSearchWords array of enum words to filter
10787+
* @param {?} keepArgumentFieldDoubleQuotes
1078710788
* @return {?} outputStr output string
1078810789
*/
10789-
GraphqlService.prototype.trimDoubleQuotesOnEnumField = function (inputStr, enumSearchWords) {
10790+
GraphqlService.prototype.trimDoubleQuotesOnEnumField = function (inputStr, enumSearchWords, keepArgumentFieldDoubleQuotes) {
1079010791
var /** @type {?} */ patternWordInQuotes = "s?((field:s*)?\".*?\")";
1079110792
var /** @type {?} */ patternRegex = enumSearchWords.join(patternWordInQuotes + '|');
1079210793
patternRegex += patternWordInQuotes; // the last one should also have the pattern but without the pipe "|"
1079310794
// example with (field: & direction:): /field:s?(".*?")|direction:s?(".*?")/
1079410795
var /** @type {?} */ reg = new RegExp(patternRegex, 'g');
1079510796
return inputStr.replace(reg, function (group1, group2, group3) {
1079610797
// remove double quotes except when the string starts with a "field:"
10797-
var /** @type {?} */ rep = (group1.startsWith('field:') && group1.includes('.')) ? group1 : group1.replace(/"/g, '');
10798+
var /** @type {?} */ removeDoubleQuotes = true;
10799+
if (group1.startsWith('field:') && keepArgumentFieldDoubleQuotes) {
10800+
removeDoubleQuotes = false;
10801+
}
10802+
var /** @type {?} */ rep = removeDoubleQuotes ? group1.replace(/"/g, '') : group1;
1079810803
return rep;
1079910804
});
1080010805
};

dist/angular-slickgrid.es5.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/angular-slickgrid.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12351,7 +12351,7 @@ class GraphqlService {
1235112351
datasetQb.filter(datasetFilters);
1235212352
queryQb.find(datasetQb);
1235312353
const /** @type {?} */ enumSearchProperties = ['direction:', 'field:', 'operator:'];
12354-
return this.trimDoubleQuotesOnEnumField(queryQb.toString(), enumSearchProperties);
12354+
return this.trimDoubleQuotesOnEnumField(queryQb.toString(), enumSearchProperties, this.serviceOptions.keepArgumentFieldDoubleQuotes);
1235512355
}
1235612356
/**
1235712357
* From an input array of strings, we want to build a GraphQL query string.
@@ -12542,17 +12542,22 @@ class GraphqlService {
1254212542
* query { users (orderBy:[{field:"billing.street.name", direction: ASC}}
1254312543
* @param {?} inputStr input string
1254412544
* @param {?} enumSearchWords array of enum words to filter
12545+
* @param {?} keepArgumentFieldDoubleQuotes
1254512546
* @return {?} outputStr output string
1254612547
*/
12547-
trimDoubleQuotesOnEnumField(inputStr, enumSearchWords) {
12548+
trimDoubleQuotesOnEnumField(inputStr, enumSearchWords, keepArgumentFieldDoubleQuotes) {
1254812549
const /** @type {?} */ patternWordInQuotes = `\s?((field:\s*)?".*?")`;
1254912550
let /** @type {?} */ patternRegex = enumSearchWords.join(patternWordInQuotes + '|');
1255012551
patternRegex += patternWordInQuotes; // the last one should also have the pattern but without the pipe "|"
1255112552
// example with (field: & direction:): /field:s?(".*?")|direction:s?(".*?")/
1255212553
const /** @type {?} */ reg = new RegExp(patternRegex, 'g');
12553-
return inputStr.replace(reg, function (group1, group2, group3) {
12554+
return inputStr.replace(reg, (group1, group2, group3) => {
1255412555
// remove double quotes except when the string starts with a "field:"
12555-
const /** @type {?} */ rep = (group1.startsWith('field:') && group1.includes('.')) ? group1 : group1.replace(/"/g, '');
12556+
let /** @type {?} */ removeDoubleQuotes = true;
12557+
if (group1.startsWith('field:') && keepArgumentFieldDoubleQuotes) {
12558+
removeDoubleQuotes = false;
12559+
}
12560+
const /** @type {?} */ rep = removeDoubleQuotes ? group1.replace(/"/g, '') : group1;
1255612561
return rep;
1255712562
});
1255812563
}

dist/angular-slickgrid.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/bundles/angular-slickgrid.umd.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10589,7 +10589,7 @@ var GraphqlService = /** @class */ (function () {
1058910589
datasetQb.filter(datasetFilters);
1059010590
queryQb.find(datasetQb);
1059110591
var /** @type {?} */ enumSearchProperties = ['direction:', 'field:', 'operator:'];
10592-
return this.trimDoubleQuotesOnEnumField(queryQb.toString(), enumSearchProperties);
10592+
return this.trimDoubleQuotesOnEnumField(queryQb.toString(), enumSearchProperties, this.serviceOptions.keepArgumentFieldDoubleQuotes);
1059310593
};
1059410594
/**
1059510595
* From an input array of strings, we want to build a GraphQL query string.
@@ -10783,17 +10783,22 @@ var GraphqlService = /** @class */ (function () {
1078310783
* query { users (orderBy:[{field:"billing.street.name", direction: ASC}}
1078410784
* @param {?} inputStr input string
1078510785
* @param {?} enumSearchWords array of enum words to filter
10786+
* @param {?} keepArgumentFieldDoubleQuotes
1078610787
* @return {?} outputStr output string
1078710788
*/
10788-
GraphqlService.prototype.trimDoubleQuotesOnEnumField = function (inputStr, enumSearchWords) {
10789+
GraphqlService.prototype.trimDoubleQuotesOnEnumField = function (inputStr, enumSearchWords, keepArgumentFieldDoubleQuotes) {
1078910790
var /** @type {?} */ patternWordInQuotes = "s?((field:s*)?\".*?\")";
1079010791
var /** @type {?} */ patternRegex = enumSearchWords.join(patternWordInQuotes + '|');
1079110792
patternRegex += patternWordInQuotes; // the last one should also have the pattern but without the pipe "|"
1079210793
// example with (field: & direction:): /field:s?(".*?")|direction:s?(".*?")/
1079310794
var /** @type {?} */ reg = new RegExp(patternRegex, 'g');
1079410795
return inputStr.replace(reg, function (group1, group2, group3) {
1079510796
// remove double quotes except when the string starts with a "field:"
10796-
var /** @type {?} */ rep = (group1.startsWith('field:') && group1.includes('.')) ? group1 : group1.replace(/"/g, '');
10797+
var /** @type {?} */ removeDoubleQuotes = true;
10798+
if (group1.startsWith('field:') && keepArgumentFieldDoubleQuotes) {
10799+
removeDoubleQuotes = false;
10800+
}
10801+
var /** @type {?} */ rep = removeDoubleQuotes ? group1.replace(/"/g, '') : group1;
1079710802
return rep;
1079810803
});
1079910804
};

dist/bundles/angular-slickgrid.umd.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/bundles/angular-slickgrid.umd.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/bundles/angular-slickgrid.umd.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"name":"angular-slickgrid","version":"0.7.3","description":"Slickgrid components made available in Angular","keywords":["angular","plugin","datatable","slickgrid"],"license":"MIT","scripts":{"ng":"ng","start":"ng serve","build":"ng build","test":"ng test","lint":"ng lint","e2e":"ng e2e","build-lib":"npm-run-all packagr sass:build sass:copy copy:i18n","build-lib-pack":"npm-run-all build-lib pack-lib copy-pack del-pack","copy:i18n":"cross-env copyfiles -f src/assets/i18n/*.json dist/i18n","copy-pack":"cross-env copyfiles -f *.tgz ../Angular-Slickgrid-PackageTest","del-pack":"cross-env del *.tgz","pack-lib":"npm pack ./dist","packagr":"ng-packagr -p ng-package.json","sass-build-task:scss-compile":"node-sass --source-map true src/app/modules/angular-slickgrid/styles/ -o dist/styles/css","sass-build-task:autoprefixer":"postcss dist/styles/css/*.css --use autoprefixer -d dist/styles/css","sass:build":"npm-run-all -p sass-build-task:*","sass:copy":"cross-env copyfiles -f src/app/modules/angular-slickgrid/styles/*.scss dist/styles/sass","sass:watch":"node-sass 'src/app/modules/angular-slickgrid/styles/**/*.scss' -c 'npm run sass:build'"},"author":"Ghislain B.","repository":{"type":"git","url":"http://github.com/ghiscoding/angular-slickgrid"},"private":false,"dependencies":{"@ngx-translate/core":"^9.0.1","@ngx-translate/http-loader":"^2.0.0","@types/flatpickr":"^3.1.2","@types/moment":"^2.13.0","bootstrap":"^3.3.7","core-js":"^2.5.1","flatpickr":"^4.0.6","font-awesome":"^4.7.0","jquery":"^3.2.1","lodash":"^4.17.4","moment-mini":"^2.18.1","slickgrid":"^2.3.10","vinyl-paths":"^2.1.0"},"devDependencies":{"@angular/animations":"^5.0.0","@angular/cli":"1.5.4","@angular/common":"^5.0.0","@angular/compiler":"^5.0.0","@angular/compiler-cli":"^5.0.0","@angular/core":"^5.0.0","@angular/forms":"^5.0.0","@angular/http":"^5.0.0","@angular/language-service":"^5.0.0","@angular/platform-browser":"^5.0.0","@angular/platform-browser-dynamic":"^5.0.0","@angular/router":"^5.0.0","@types/jasmine":"~2.6.0","@types/jasminewd2":"~2.0.3","@types/node":"^8.0.39","codelyzer":"~3.2.0","copyfiles":"^1.2.0","cross-env":"^5.1.0","del":"^3.0.0","del-cli":"^1.1.0","gulp":"^3.9.1","gulp-bump":"^2.7.0","gulp-sass":"^3.1.0","gulp-yuidoc":"^0.1.2","jasmine-core":"~2.8.0","jasmine-spec-reporter":"~4.2.1","karma":"~1.7.1","karma-chrome-launcher":"~2.2.0","karma-cli":"~1.0.1","karma-coverage-istanbul-reporter":"^1.3.0","karma-jasmine":"~1.1.0","karma-jasmine-html-reporter":"^0.2.2","ng-packagr":"^1.6.0","node-sass":"^4.5.3","npm-run-all":"^4.1.1","postcss-cli":"^4.1.1","protractor":"~5.1.2","require-dir":"^0.3.2","run-sequence":"^2.2.0","rxjs":"^5.4.2","ts-node":"~3.3.0","tslint":"^5.8.0","typescript":"^2.3.4","yargs":"^9.0.1","zone.js":"^0.8.17"},"main":"bundles/angular-slickgrid.umd.js","module":"angular-slickgrid.es5.js","es2015":"angular-slickgrid.js","typings":"angular-slickgrid.d.ts","metadata":"angular-slickgrid.metadata.json"}
1+
{"name":"angular-slickgrid","version":"0.7.4","description":"Slickgrid components made available in Angular","keywords":["angular","plugin","datatable","slickgrid"],"license":"MIT","scripts":{"ng":"ng","start":"ng serve","build":"ng build","test":"ng test","lint":"ng lint","e2e":"ng e2e","build-lib":"npm-run-all packagr sass:build sass:copy copy:i18n","build-lib-pack":"npm-run-all build-lib pack-lib copy-pack del-pack","copy:i18n":"cross-env copyfiles -f src/assets/i18n/*.json dist/i18n","copy-pack":"cross-env copyfiles -f *.tgz ../Angular-Slickgrid-PackageTest","del-pack":"cross-env del *.tgz","pack-lib":"npm pack ./dist","packagr":"ng-packagr -p ng-package.json","sass-build-task:scss-compile":"node-sass --source-map true src/app/modules/angular-slickgrid/styles/ -o dist/styles/css","sass-build-task:autoprefixer":"postcss dist/styles/css/*.css --use autoprefixer -d dist/styles/css","sass:build":"npm-run-all -p sass-build-task:*","sass:copy":"cross-env copyfiles -f src/app/modules/angular-slickgrid/styles/*.scss dist/styles/sass","sass:watch":"node-sass 'src/app/modules/angular-slickgrid/styles/**/*.scss' -c 'npm run sass:build'"},"author":"Ghislain B.","repository":{"type":"git","url":"http://github.com/ghiscoding/angular-slickgrid"},"private":false,"dependencies":{"@ngx-translate/core":"^9.0.1","@ngx-translate/http-loader":"^2.0.0","@types/flatpickr":"^3.1.2","@types/moment":"^2.13.0","bootstrap":"^3.3.7","core-js":"^2.5.1","flatpickr":"^4.0.6","font-awesome":"^4.7.0","jquery":"^3.2.1","lodash":"^4.17.4","moment-mini":"^2.18.1","slickgrid":"^2.3.10","vinyl-paths":"^2.1.0"},"devDependencies":{"@angular/animations":"^5.0.0","@angular/cli":"1.5.4","@angular/common":"^5.0.0","@angular/compiler":"^5.0.0","@angular/compiler-cli":"^5.0.0","@angular/core":"^5.0.0","@angular/forms":"^5.0.0","@angular/http":"^5.0.0","@angular/language-service":"^5.0.0","@angular/platform-browser":"^5.0.0","@angular/platform-browser-dynamic":"^5.0.0","@angular/router":"^5.0.0","@types/jasmine":"~2.6.0","@types/jasminewd2":"~2.0.3","@types/node":"^8.0.39","codelyzer":"~3.2.0","copyfiles":"^1.2.0","cross-env":"^5.1.0","del":"^3.0.0","del-cli":"^1.1.0","gulp":"^3.9.1","gulp-bump":"^2.7.0","gulp-sass":"^3.1.0","gulp-yuidoc":"^0.1.2","jasmine-core":"~2.8.0","jasmine-spec-reporter":"~4.2.1","karma":"~1.7.1","karma-chrome-launcher":"~2.2.0","karma-cli":"~1.0.1","karma-coverage-istanbul-reporter":"^1.3.0","karma-jasmine":"~1.1.0","karma-jasmine-html-reporter":"^0.2.2","ng-packagr":"^1.6.0","node-sass":"^4.5.3","npm-run-all":"^4.1.1","postcss-cli":"^4.1.1","protractor":"~5.1.2","require-dir":"^0.3.2","run-sequence":"^2.2.0","rxjs":"^5.4.2","ts-node":"~3.3.0","tslint":"^5.8.0","typescript":"^2.3.4","yargs":"^9.0.1","zone.js":"^0.8.17"},"main":"bundles/angular-slickgrid.umd.js","module":"angular-slickgrid.es5.js","es2015":"angular-slickgrid.js","typings":"angular-slickgrid.d.ts","metadata":"angular-slickgrid.metadata.json"}

dist/src/app/modules/angular-slickgrid/models/graphqlServiceOption.interface.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@ export interface GraphqlServiceOption extends BackendServiceOption {
1010
filteringOptions?: GraphqlFilteringOption[];
1111
sortingOptions?: GraphqlSortingOption[];
1212
dataFilters?: string[];
13+
keepArgumentFieldDoubleQuotes?: boolean;
1314
}

0 commit comments

Comments
 (0)