angular-slickgrid 9.0.0 → 9.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/{dist/fesm2022 → fesm2022}/angular-slickgrid.mjs +16 -16
- package/package.json +27 -14
- package/.gitbook.yaml +0 -5
- package/CHANGELOG.md +0 -1691
- package/CONTRIBUTING.md +0 -17
- package/angular.json +0 -133
- package/coverage/base.css +0 -224
- package/coverage/block-navigation.js +0 -87
- package/coverage/clover.xml +0 -1620
- package/coverage/coverage-final.json +0 -9
- package/coverage/favicon.png +0 -0
- package/coverage/index.html +0 -176
- package/coverage/library/components/angular-slickgrid.component.ts.html +0 -5074
- package/coverage/library/components/index.html +0 -116
- package/coverage/library/constants.ts.html +0 -397
- package/coverage/library/extensions/index.html +0 -116
- package/coverage/library/extensions/slickRowDetailView.ts.html +0 -1261
- package/coverage/library/index.html +0 -116
- package/coverage/library/modules/angular-slickgrid.module.ts.html +0 -166
- package/coverage/library/modules/index.html +0 -116
- package/coverage/library/services/angularUtil.service.ts.html +0 -445
- package/coverage/library/services/container.service.ts.html +0 -163
- package/coverage/library/services/index.html +0 -161
- package/coverage/library/services/translater.service.ts.html +0 -199
- package/coverage/library/services/utilities.ts.html +0 -142
- package/coverage/prettify.css +0 -1
- package/coverage/prettify.js +0 -2
- package/coverage/sort-arrow-sprite.png +0 -0
- package/coverage/sorter.js +0 -196
- package/dist/LICENSE +0 -21
- package/dist/README.md +0 -142
- package/docs/README.md +0 -5
- package/docs/TOC.md +0 -105
- package/docs/backend-services/Custom-Backend-Service.md +0 -50
- package/docs/backend-services/GraphQL.md +0 -276
- package/docs/backend-services/OData.md +0 -245
- package/docs/backend-services/graphql/GraphQL-Filtering.md +0 -156
- package/docs/backend-services/graphql/GraphQL-JSON-Result.md +0 -85
- package/docs/backend-services/graphql/GraphQL-Pagination.md +0 -77
- package/docs/backend-services/graphql/GraphQL-Sorting.md +0 -78
- package/docs/column-functionalities/cell-menu.md +0 -212
- package/docs/column-functionalities/editors/autocomplete-editor.md +0 -466
- package/docs/column-functionalities/editors/date-editor-flatpickr.md +0 -71
- package/docs/column-functionalities/editors/date-editor-vanilla-calendar.md +0 -91
- package/docs/column-functionalities/editors/longtext-editor-textarea.md +0 -80
- package/docs/column-functionalities/editors/select-dropdown-editor.md +0 -227
- package/docs/column-functionalities/editors.md +0 -604
- package/docs/column-functionalities/filters/autocomplete-filter.md +0 -183
- package/docs/column-functionalities/filters/compound-filters.md +0 -234
- package/docs/column-functionalities/filters/custom-filter.md +0 -117
- package/docs/column-functionalities/filters/filter-intro.md +0 -81
- package/docs/column-functionalities/filters/input-filter.md +0 -260
- package/docs/column-functionalities/filters/range-filters.md +0 -188
- package/docs/column-functionalities/filters/select-filter.md +0 -695
- package/docs/column-functionalities/filters/single-search-filter.md +0 -77
- package/docs/column-functionalities/filters/styling-filled-filters.md +0 -45
- package/docs/column-functionalities/formatters.md +0 -325
- package/docs/column-functionalities/sorting.md +0 -200
- package/docs/developer-guides/csp-compliance.md +0 -64
- package/docs/events/Available-Events.md +0 -223
- package/docs/events/Grid-&-DataView-Events.md +0 -211
- package/docs/getting-started/quick-start.md +0 -230
- package/docs/getting-started/troubleshooting.md +0 -80
- package/docs/grid-functionalities/Column-Picker.md +0 -22
- package/docs/grid-functionalities/Composite-Editor-Modal.md +0 -627
- package/docs/grid-functionalities/Context-Menu.md +0 -226
- package/docs/grid-functionalities/Custom-Footer.md +0 -80
- package/docs/grid-functionalities/Custom-Tooltip-(plugin).md +0 -258
- package/docs/grid-functionalities/Export-to-Excel.md +0 -457
- package/docs/grid-functionalities/Export-to-Text-File.md +0 -165
- package/docs/grid-functionalities/FAQ.md +0 -53
- package/docs/grid-functionalities/Global-Options.md +0 -29
- package/docs/grid-functionalities/Grid-Auto-Resize.md +0 -218
- package/docs/grid-functionalities/Grid-Menu.md +0 -134
- package/docs/grid-functionalities/Grid-State-&-Preset.md +0 -245
- package/docs/grid-functionalities/Header-Menu-&-Header-Buttons.md +0 -125
- package/docs/grid-functionalities/Resize-by-Cell-Content.md +0 -138
- package/docs/grid-functionalities/Row-Selection.md +0 -247
- package/docs/grid-functionalities/Row-based-edit.md +0 -71
- package/docs/grid-functionalities/add-update-highlight.md +0 -258
- package/docs/grid-functionalities/column-row-spanning.md +0 -74
- package/docs/grid-functionalities/dynamic-item-metadata.md +0 -124
- package/docs/grid-functionalities/excel-copy-buffer.md +0 -145
- package/docs/grid-functionalities/frozen-columns-rows.md +0 -164
- package/docs/grid-functionalities/grouping-and-aggregators.md +0 -269
- package/docs/grid-functionalities/header-footer-slots.md +0 -22
- package/docs/grid-functionalities/infinite-scroll.md +0 -150
- package/docs/grid-functionalities/providing-grid-data.md +0 -61
- package/docs/grid-functionalities/row-detail.md +0 -530
- package/docs/grid-functionalities/tree-data-grid.md +0 -391
- package/docs/localization/Localization---Component-Sample.md +0 -87
- package/docs/localization/Localization-with-Custom-Locales.md +0 -66
- package/docs/localization/Localization-with-ngx-translate.md +0 -148
- package/docs/migrations/migration-to-2.x.md +0 -304
- package/docs/migrations/migration-to-3.x.md +0 -295
- package/docs/migrations/migration-to-4.x.md +0 -83
- package/docs/migrations/migration-to-5.x.md +0 -160
- package/docs/migrations/migration-to-6.x.md +0 -128
- package/docs/migrations/migration-to-7.x.md +0 -294
- package/docs/migrations/migration-to-8.x.md +0 -316
- package/docs/migrations/migration-to-9.x.md +0 -219
- package/docs/slick-grid-dataview-objects/slickgrid-dataview-objects.md +0 -79
- package/docs/styling/dark-mode.md +0 -100
- package/docs/styling/styling.md +0 -250
- package/docs/testing/testing-patterns.md +0 -73
- package/eslint.config.mjs +0 -60
- package/ng-package.json +0 -10
- package/src/assets/angular-logo.png +0 -0
- package/src/assets/angular-logo2.png +0 -0
- package/src/assets/data/collection_100_numbers.json +0 -12
- package/src/assets/data/collection_500_numbers.json +0 -52
- package/src/assets/data/countries.json +0 -245
- package/src/assets/data/country_names.json +0 -245
- package/src/assets/data/customers_100.json +0 -102
- package/src/assets/data/users.csv +0 -5
- package/src/assets/i18n/en.json +0 -102
- package/src/assets/i18n/fr.json +0 -103
- package/src/demos/app-routing.module.ts +0 -108
- package/src/demos/app.component.html +0 -187
- package/src/demos/app.component.scss +0 -79
- package/src/demos/app.component.ts +0 -11
- package/src/demos/app.module.ts +0 -196
- package/src/demos/environments/environment.dev.ts +0 -3
- package/src/demos/environments/environment.prod.ts +0 -3
- package/src/demos/environments/environment.ts +0 -8
- package/src/demos/examples/custom-angularComponentEditor.ts +0 -187
- package/src/demos/examples/custom-angularComponentFilter.ts +0 -123
- package/src/demos/examples/custom-buttonFormatter.component.ts +0 -13
- package/src/demos/examples/custom-inputEditor.ts +0 -132
- package/src/demos/examples/custom-inputFilter.ts +0 -134
- package/src/demos/examples/custom-titleFormatter.component.ts +0 -9
- package/src/demos/examples/data/collection_100_numbers.json +0 -12
- package/src/demos/examples/data/collection_500_numbers.json +0 -52
- package/src/demos/examples/data/countries.json +0 -245
- package/src/demos/examples/data/country_names.json +0 -245
- package/src/demos/examples/data/customers_100.json +0 -102
- package/src/demos/examples/data/users.csv +0 -5
- package/src/demos/examples/editor-ng-select.component.ts +0 -38
- package/src/demos/examples/example01.component.html +0 -48
- package/src/demos/examples/example01.component.ts +0 -109
- package/src/demos/examples/example02.component.html +0 -45
- package/src/demos/examples/example02.component.ts +0 -218
- package/src/demos/examples/example03.component.html +0 -118
- package/src/demos/examples/example03.component.ts +0 -694
- package/src/demos/examples/example04.component.html +0 -87
- package/src/demos/examples/example04.component.ts +0 -326
- package/src/demos/examples/example05.component.html +0 -151
- package/src/demos/examples/example05.component.ts +0 -474
- package/src/demos/examples/example06.component.html +0 -163
- package/src/demos/examples/example06.component.ts +0 -446
- package/src/demos/examples/example07.component.html +0 -56
- package/src/demos/examples/example07.component.scss +0 -10
- package/src/demos/examples/example07.component.ts +0 -216
- package/src/demos/examples/example08.component.html +0 -51
- package/src/demos/examples/example08.component.scss +0 -23
- package/src/demos/examples/example08.component.ts +0 -195
- package/src/demos/examples/example09.component.html +0 -55
- package/src/demos/examples/example09.component.scss +0 -22
- package/src/demos/examples/example09.component.ts +0 -302
- package/src/demos/examples/example10.component.html +0 -103
- package/src/demos/examples/example10.component.ts +0 -309
- package/src/demos/examples/example11.component.html +0 -91
- package/src/demos/examples/example11.component.ts +0 -276
- package/src/demos/examples/example12.component.html +0 -98
- package/src/demos/examples/example12.component.ts +0 -317
- package/src/demos/examples/example13.component.html +0 -96
- package/src/demos/examples/example13.component.ts +0 -370
- package/src/demos/examples/example14.component.html +0 -50
- package/src/demos/examples/example14.component.scss +0 -11
- package/src/demos/examples/example14.component.ts +0 -156
- package/src/demos/examples/example15.component.html +0 -56
- package/src/demos/examples/example15.component.ts +0 -304
- package/src/demos/examples/example16.component.html +0 -77
- package/src/demos/examples/example16.component.ts +0 -277
- package/src/demos/examples/example17.component.html +0 -50
- package/src/demos/examples/example17.component.ts +0 -109
- package/src/demos/examples/example18.component.html +0 -132
- package/src/demos/examples/example18.component.ts +0 -445
- package/src/demos/examples/example19-rowdetail.component.html +0 -40
- package/src/demos/examples/example19-rowdetail.component.ts +0 -54
- package/src/demos/examples/example19.component.html +0 -79
- package/src/demos/examples/example19.component.ts +0 -316
- package/src/demos/examples/example20.component.html +0 -76
- package/src/demos/examples/example20.component.scss +0 -11
- package/src/demos/examples/example20.component.ts +0 -341
- package/src/demos/examples/example21.component.html +0 -86
- package/src/demos/examples/example21.component.scss +0 -16
- package/src/demos/examples/example21.component.ts +0 -140
- package/src/demos/examples/example22.component.html +0 -41
- package/src/demos/examples/example22.component.ts +0 -117
- package/src/demos/examples/example23.component.html +0 -111
- package/src/demos/examples/example23.component.ts +0 -323
- package/src/demos/examples/example24.component.html +0 -120
- package/src/demos/examples/example24.component.scss +0 -62
- package/src/demos/examples/example24.component.ts +0 -641
- package/src/demos/examples/example25.component.html +0 -60
- package/src/demos/examples/example25.component.scss +0 -8
- package/src/demos/examples/example25.component.ts +0 -255
- package/src/demos/examples/example26.component.html +0 -98
- package/src/demos/examples/example26.component.scss +0 -42
- package/src/demos/examples/example26.component.ts +0 -383
- package/src/demos/examples/example27.component.html +0 -138
- package/src/demos/examples/example27.component.scss +0 -10
- package/src/demos/examples/example27.component.ts +0 -369
- package/src/demos/examples/example28.component.html +0 -143
- package/src/demos/examples/example28.component.scss +0 -54
- package/src/demos/examples/example28.component.ts +0 -453
- package/src/demos/examples/example29.component.html +0 -30
- package/src/demos/examples/example29.component.ts +0 -70
- package/src/demos/examples/example30.component.html +0 -116
- package/src/demos/examples/example30.component.scss +0 -20
- package/src/demos/examples/example30.component.ts +0 -1070
- package/src/demos/examples/example32.component.html +0 -77
- package/src/demos/examples/example32.component.scss +0 -8
- package/src/demos/examples/example32.component.ts +0 -905
- package/src/demos/examples/example33.component.html +0 -50
- package/src/demos/examples/example33.component.scss +0 -46
- package/src/demos/examples/example33.component.ts +0 -571
- package/src/demos/examples/example34.component.html +0 -82
- package/src/demos/examples/example34.component.scss +0 -77
- package/src/demos/examples/example34.component.ts +0 -434
- package/src/demos/examples/example35.component.html +0 -77
- package/src/demos/examples/example35.component.scss +0 -18
- package/src/demos/examples/example35.component.ts +0 -264
- package/src/demos/examples/example36.component.html +0 -56
- package/src/demos/examples/example36.component.scss +0 -26
- package/src/demos/examples/example36.component.ts +0 -504
- package/src/demos/examples/example37.component.html +0 -30
- package/src/demos/examples/example37.component.ts +0 -123
- package/src/demos/examples/example38.component.html +0 -104
- package/src/demos/examples/example38.component.scss +0 -8
- package/src/demos/examples/example38.component.ts +0 -420
- package/src/demos/examples/example39.component.html +0 -112
- package/src/demos/examples/example39.component.scss +0 -8
- package/src/demos/examples/example39.component.ts +0 -371
- package/src/demos/examples/example40.component.html +0 -76
- package/src/demos/examples/example40.component.ts +0 -226
- package/src/demos/examples/example41.component.html +0 -50
- package/src/demos/examples/example41.component.scss +0 -42
- package/src/demos/examples/example41.component.ts +0 -229
- package/src/demos/examples/example42.component.html +0 -47
- package/src/demos/examples/example42.component.ts +0 -203
- package/src/demos/examples/example43.component.html +0 -94
- package/src/demos/examples/example43.component.scss +0 -30
- package/src/demos/examples/example43.component.ts +0 -449
- package/src/demos/examples/example44.component.html +0 -78
- package/src/demos/examples/example44.component.scss +0 -50
- package/src/demos/examples/example44.component.ts +0 -375
- package/src/demos/examples/example45-detail.component.html +0 -15
- package/src/demos/examples/example45-detail.component.ts +0 -97
- package/src/demos/examples/example45.component.html +0 -110
- package/src/demos/examples/example45.component.scss +0 -50
- package/src/demos/examples/example45.component.ts +0 -243
- package/src/demos/examples/filter-ng-select.component.ts +0 -33
- package/src/demos/examples/grid-custom-pager.component.html +0 -60
- package/src/demos/examples/grid-custom-pager.component.scss +0 -57
- package/src/demos/examples/grid-custom-pager.component.ts +0 -107
- package/src/demos/examples/grid-remote.component.html +0 -44
- package/src/demos/examples/grid-remote.component.ts +0 -164
- package/src/demos/examples/home.component.html +0 -39
- package/src/demos/examples/home.component.ts +0 -10
- package/src/demos/examples/jsonp.ts +0 -89
- package/src/demos/examples/rowdetail-preload.component.ts +0 -10
- package/src/demos/examples/swt-common-grid-pagination.component.ts +0 -160
- package/src/demos/examples/swt-common-grid-test.component.html +0 -37
- package/src/demos/examples/swt-common-grid-test.component.ts +0 -214
- package/src/demos/examples/swt-common-grid.component.ts +0 -436
- package/src/demos/examples/swt-logger.service.ts +0 -173
- package/src/demos/examples/utilities.ts +0 -9
- package/src/favicon.ico +0 -0
- package/src/index.html +0 -17
- package/src/library/components/__tests__/angular-slickgrid.component.spec.ts +0 -2638
- package/src/library/components/angular-slickgrid.component.html +0 -5
- package/src/library/components/angular-slickgrid.component.ts +0 -1662
- package/src/library/constants.ts +0 -105
- package/src/library/extensions/__tests__/slickRowDetailView.spec.ts +0 -751
- package/src/library/extensions/index.ts +0 -1
- package/src/library/extensions/slickRowDetailView.ts +0 -395
- package/src/library/global-grid-options.ts +0 -273
- package/src/library/index.ts +0 -11
- package/src/library/models/angularComponentOutput.interface.ts +0 -6
- package/src/library/models/angularGridInstance.interface.ts +0 -76
- package/src/library/models/externalTestingDependencies.interface.ts +0 -37
- package/src/library/models/gridOption.interface.ts +0 -15
- package/src/library/models/index.ts +0 -5
- package/src/library/models/rowDetailView.interface.ts +0 -16
- package/src/library/modules/angular-slickgrid.module.spec.ts +0 -25
- package/src/library/modules/angular-slickgrid.module.ts +0 -27
- package/src/library/services/__tests__/angularUtilService.spec.ts +0 -156
- package/src/library/services/__tests__/container.service.spec.ts +0 -25
- package/src/library/services/__tests__/translater.service.spec.ts +0 -43
- package/src/library/services/__tests__/utilities.spec.ts +0 -22
- package/src/library/services/angularUtil.service.ts +0 -120
- package/src/library/services/container.service.ts +0 -26
- package/src/library/services/index.ts +0 -4
- package/src/library/services/translater.service.ts +0 -38
- package/src/library/services/utilities.ts +0 -19
- package/src/library/slickgrid-config.ts +0 -10
- package/src/main.ts +0 -13
- package/src/public_api.ts +0 -1
- package/src/styles.scss +0 -178
- package/test/cypress/e2e/example01.cy.ts +0 -367
- package/test/cypress/e2e/example02.cy.ts +0 -60
- package/test/cypress/e2e/example03.cy.ts +0 -268
- package/test/cypress/e2e/example04.cy.ts +0 -254
- package/test/cypress/e2e/example05.cy.ts +0 -804
- package/test/cypress/e2e/example06.cy.ts +0 -890
- package/test/cypress/e2e/example07.cy.ts +0 -384
- package/test/cypress/e2e/example08.cy.ts +0 -190
- package/test/cypress/e2e/example09.cy.ts +0 -392
- package/test/cypress/e2e/example10.cy.ts +0 -650
- package/test/cypress/e2e/example11.cy.ts +0 -86
- package/test/cypress/e2e/example12.cy.ts +0 -269
- package/test/cypress/e2e/example13.cy.ts +0 -246
- package/test/cypress/e2e/example14.cy.ts +0 -122
- package/test/cypress/e2e/example15.cy.ts +0 -598
- package/test/cypress/e2e/example16.cy.ts +0 -427
- package/test/cypress/e2e/example17.cy.ts +0 -83
- package/test/cypress/e2e/example18.cy.ts +0 -431
- package/test/cypress/e2e/example19.cy.ts +0 -263
- package/test/cypress/e2e/example20.cy.ts +0 -264
- package/test/cypress/e2e/example21.cy.ts +0 -77
- package/test/cypress/e2e/example22.cy.ts +0 -94
- package/test/cypress/e2e/example23.cy.ts +0 -259
- package/test/cypress/e2e/example24.cy.ts +0 -707
- package/test/cypress/e2e/example25.cy.ts +0 -193
- package/test/cypress/e2e/example26.cy.ts +0 -111
- package/test/cypress/e2e/example27.cy.ts +0 -261
- package/test/cypress/e2e/example28.cy.ts +0 -740
- package/test/cypress/e2e/example29.cy.ts +0 -30
- package/test/cypress/e2e/example30.cy.ts +0 -757
- package/test/cypress/e2e/example31.cy.ts +0 -69
- package/test/cypress/e2e/example32.cy.ts +0 -272
- package/test/cypress/e2e/example33.cy.ts +0 -278
- package/test/cypress/e2e/example34.cy.ts +0 -84
- package/test/cypress/e2e/example35.cy.ts +0 -178
- package/test/cypress/e2e/example36.cy.ts +0 -219
- package/test/cypress/e2e/example37.cy.ts +0 -52
- package/test/cypress/e2e/example38.cy.ts +0 -160
- package/test/cypress/e2e/example39.cy.ts +0 -150
- package/test/cypress/e2e/example40.cy.ts +0 -126
- package/test/cypress/e2e/example41.cy.ts +0 -90
- package/test/cypress/e2e/example42.cy.ts +0 -82
- package/test/cypress/e2e/example43.cy.ts +0 -482
- package/test/cypress/e2e/example44.cy.ts +0 -458
- package/test/cypress/e2e/example45.cy.ts +0 -455
- package/test/cypress/e2e/home.cy.ts +0 -7
- package/test/cypress/fixtures/example.json +0 -5
- package/test/cypress/plugins/index.ts +0 -17
- package/test/cypress/plugins/utilities.ts +0 -28
- package/test/cypress/support/commands.ts +0 -88
- package/test/cypress/support/common.ts +0 -47
- package/test/cypress/support/drag.ts +0 -101
- package/test/cypress/support/index.ts +0 -20
- package/test/cypress/tsconfig.json +0 -9
- package/test/cypress.config.ts +0 -34
- package/test/mockSlickEvent.ts +0 -77
- package/test/rxjsResourceStub.ts +0 -69
- package/test/test-setup.ts +0 -6
- package/test/translateServiceStub.ts +0 -230
- package/test/translaterServiceStub.ts +0 -239
- package/test/tsconfig.json +0 -17
- package/test/vitest-global-mocks.ts +0 -41
- package/test/vitest-global-setup.ts +0 -3
- package/test/vitest-pretest.ts +0 -5
- package/tsconfig.app.json +0 -14
- package/tsconfig.json +0 -31
- package/tsconfig.spec.json +0 -11
- package/types/sortablejs.d.ts +0 -4
- package/vite.config.mts +0 -51
- /package/{dist/fesm2022 → fesm2022}/angular-slickgrid.mjs.map +0 -0
- /package/{dist/i18n → i18n}/en.json +0 -0
- /package/{dist/i18n → i18n}/fr.json +0 -0
- /package/{dist/index.d.ts → index.d.ts} +0 -0
- /package/{dist/library → library}/components/angular-slickgrid.component.d.ts +0 -0
- /package/{dist/library → library}/constants.d.ts +0 -0
- /package/{dist/library → library}/extensions/index.d.ts +0 -0
- /package/{dist/library → library}/extensions/slickRowDetailView.d.ts +0 -0
- /package/{dist/library → library}/global-grid-options.d.ts +0 -0
- /package/{dist/library → library}/index.d.ts +0 -0
- /package/{dist/library → library}/models/angularComponentOutput.interface.d.ts +0 -0
- /package/{dist/library → library}/models/angularGridInstance.interface.d.ts +0 -0
- /package/{dist/library → library}/models/externalTestingDependencies.interface.d.ts +0 -0
- /package/{dist/library → library}/models/gridOption.interface.d.ts +0 -0
- /package/{dist/library → library}/models/index.d.ts +0 -0
- /package/{dist/library → library}/models/rowDetailView.interface.d.ts +0 -0
- /package/{dist/library → library}/modules/angular-slickgrid.module.d.ts +0 -0
- /package/{dist/library → library}/services/angularUtil.service.d.ts +0 -0
- /package/{dist/library → library}/services/container.service.d.ts +0 -0
- /package/{dist/library → library}/services/index.d.ts +0 -0
- /package/{dist/library → library}/services/translater.service.d.ts +0 -0
- /package/{dist/library → library}/services/utilities.d.ts +0 -0
- /package/{dist/library → library}/slickgrid-config.d.ts +0 -0
- /package/{dist/public_api.d.ts → public_api.d.ts} +0 -0
|
@@ -1,276 +0,0 @@
|
|
|
1
|
-
##### index
|
|
2
|
-
- [Extra Query Arguments](#extra-query-arguments)
|
|
3
|
-
- [Changing/Updating Options Dynamically](#changingupdating-options-dynamically)
|
|
4
|
-
- [GraphQL without Pagination](#graphql-without-pagination)
|
|
5
|
-
- [GraphQL Server Definitions](#graphql-server-definitions)
|
|
6
|
-
- [Pagination](graphql/GraphQL-Pagination.md)
|
|
7
|
-
- [Sorting](graphql/GraphQL-Sorting.md)
|
|
8
|
-
- [Filtering](graphql/GraphQL-Filtering.md)
|
|
9
|
-
- [Infinite Scroll](../grid-functionalities/infinite-scroll.md#infinite-scroll-with-backend-services)
|
|
10
|
-
|
|
11
|
-
### Description
|
|
12
|
-
GraphQL Backend Service (for Pagination purposes) to get data from a backend server with the help of GraphQL.
|
|
13
|
-
|
|
14
|
-
### Demo
|
|
15
|
-
[Demo Page](https://ghiscoding.github.io/Angular-Slickgrid/#/gridgraphql) / [Demo Component](https://github.com/ghiscoding/slickgrid-universal/blob/master/frameworks/angular-slickgrid/src/demos/examples/grid-graphql.component.ts)
|
|
16
|
-
|
|
17
|
-
### Note
|
|
18
|
-
You can use it when you need to support **Pagination** (though you could disable Pagination if you wish), that is when your dataset is rather large and has typically more than 5k rows, with a GraphQL endpoint. If your dataset is small (less than 5k rows), then you might be better off with [regular grid](https://ghiscoding.github.io/Angular-Slickgrid/#/basic) with the "dataset.bind" property. SlickGrid can easily handle million of rows using a DataView object, but personally when the dataset is known to be large, I usually use a backend service (OData or GraphQL) and when it's small I go with a [regular grid](https://ghiscoding.github.io/Angular-Slickgrid/#/basic).
|
|
19
|
-
|
|
20
|
-
## Implementation
|
|
21
|
-
To connect a backend service into `Slickgrid-Universal`, you simply need to modify your `gridOptions` and add a declaration of `backendServiceApi`. See below for the signature and an example further down below.
|
|
22
|
-
|
|
23
|
-
### TypeScript Signature
|
|
24
|
-
```ts
|
|
25
|
-
backendServiceApi: {
|
|
26
|
-
// On init (or on page load), what action to perform?
|
|
27
|
-
onInit?: (query: string) => Promise<any>;
|
|
28
|
-
|
|
29
|
-
// Before executing the query, what action to perform? For example, start a spinner
|
|
30
|
-
preProcess?: () => void;
|
|
31
|
-
|
|
32
|
-
// On Processing, we get the query back from the service, and we need to provide a Promise. For example: this.http.get(myGraphqlUrl)
|
|
33
|
-
process: (query: string) => Promise<any>;
|
|
34
|
-
|
|
35
|
-
// After executing the query, what action to perform? For example, stop the spinner
|
|
36
|
-
postProcess: (response: any) => void;
|
|
37
|
-
|
|
38
|
-
// Backend Service instance (could be OData or GraphQL Service)
|
|
39
|
-
service: BackendService;
|
|
40
|
-
|
|
41
|
-
// Throttle the amount of requests sent to the backend. Default to 500ms
|
|
42
|
-
filterTypingDebounce?: number;
|
|
43
|
-
}
|
|
44
|
-
```
|
|
45
|
-
As you can see, you mainly need to define which service to use (GridODataService or GraphQLService) and finally add the `process` and `postProcess` callback, while all the rest are totally optional.
|
|
46
|
-
|
|
47
|
-
### Typescript GraphQL Service Options
|
|
48
|
-
You can also pass certain options to the `backendServiceApi` through the `options` property. The list of options is the following
|
|
49
|
-
|
|
50
|
-
```typescript
|
|
51
|
-
export interface GraphqlServiceOption extends BackendServiceOption {
|
|
52
|
-
/**
|
|
53
|
-
* When using Translation, we probably want to add locale in the query for the filterBy/orderBy to work
|
|
54
|
-
* ex.: users(first: 10, offset: 0, locale: "en-CA", filterBy: [{field: name, operator: EQ, value:"John"}]) {
|
|
55
|
-
*/
|
|
56
|
-
addLocaleIntoQuery?: boolean;
|
|
57
|
-
|
|
58
|
-
/** Array of column ids that are included in the column definitions */
|
|
59
|
-
columnIds?: string[];
|
|
60
|
-
|
|
61
|
-
/** What is the dataset, this is required for the GraphQL query to be built */
|
|
62
|
-
datasetName?: string;
|
|
63
|
-
|
|
64
|
-
/** Used for defining the operation name when building the GraphQL query */
|
|
65
|
-
operationName?: string;
|
|
66
|
-
|
|
67
|
-
/** Use Pagination Cursor in the GraphQL Server. Note: previously named `isWithCursor */
|
|
68
|
-
useCursor?: boolean;
|
|
69
|
-
|
|
70
|
-
/** What are the pagination options? ex.: (first, last, offset) */
|
|
71
|
-
paginationOptions?: GraphqlPaginationOption | GraphqlCursorPaginationOption;
|
|
72
|
-
|
|
73
|
-
/** array of Filtering Options, ex.: { field: name, operator: EQ, value: "John" } */
|
|
74
|
-
filteringOptions?: GraphqlFilteringOption[];
|
|
75
|
-
|
|
76
|
-
/** array of Filtering Options, ex.: { field: name, direction: DESC } */
|
|
77
|
-
sortingOptions?: GraphqlSortingOption[];
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* Do we want to keep double quotes on field arguments of filterBy/sortBy (field: "name" instead of field: name)
|
|
81
|
-
* ex.: { field: "name", operator: EQ, value: "John" }
|
|
82
|
-
*/
|
|
83
|
-
keepArgumentFieldDoubleQuotes?: boolean;
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* When false, searchTerms may be manipulated to be functional with certain filters eg: string only filters.
|
|
87
|
-
* When true, JSON.stringify is used on the searchTerms and used in the query "as-is". It is then the responsibility of the developer to sanitise the `searchTerms` property if necessary.
|
|
88
|
-
*/
|
|
89
|
-
useVerbatimSearchTerms?: boolean;
|
|
90
|
-
}
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
#### Grid Definition & call of `backendServiceApi`
|
|
94
|
-
##### Notes
|
|
95
|
-
- Pagination is optional and if not defined, it will use what is set in the [Slickgrid-Universal - Global Options](https://github.com/ghiscoding/slickgrid-universal/blob/master/packages/common/src/global-grid-options.ts)
|
|
96
|
-
- `onInit` is optional and is there to initialize the grid with data on first page load (typically the same call as `process`)
|
|
97
|
-
- you could load the grid yourself outside of the `gridOptions` which is why it's optional
|
|
98
|
-
- `filterTypingDebounce` is a timer (in milliseconds) that waits for user input pause before querying the backend server
|
|
99
|
-
- this is meant to throttle the amount of requests sent to the backend (we don't really want to query every keystroke)
|
|
100
|
-
- 700ms is the default when not provided
|
|
101
|
-
|
|
102
|
-
##### Code
|
|
103
|
-
```ts
|
|
104
|
-
import { Component, Injectable, OnInit } from '@angular/core';
|
|
105
|
-
import { Column, GridOption } from 'angular-slickgrid';
|
|
106
|
-
import { GraphqlService, GraphqlPaginatedResult, GraphqlServiceApi, } from '@slickgrid-universal/graphql';
|
|
107
|
-
|
|
108
|
-
@Injectable()
|
|
109
|
-
|
|
110
|
-
export class MyComponent implements OnInit {
|
|
111
|
-
columnDefinitions: Column[];
|
|
112
|
-
gridOptions: GridOption;
|
|
113
|
-
|
|
114
|
-
constructor(private http: HttpClient) { }
|
|
115
|
-
|
|
116
|
-
ngOnInit(): void {
|
|
117
|
-
this.columnDefinitions = [
|
|
118
|
-
// your column definitions
|
|
119
|
-
];
|
|
120
|
-
|
|
121
|
-
this.gridOptions = {
|
|
122
|
-
enableFiltering: true,
|
|
123
|
-
enablePagination: true,
|
|
124
|
-
pagination: {
|
|
125
|
-
pageSizes: [10, 15, 20, 25, 30, 40, 50, 75, 100],
|
|
126
|
-
pageSize: defaultPageSize,
|
|
127
|
-
totalItems: 0
|
|
128
|
-
},
|
|
129
|
-
backendServiceApi: {
|
|
130
|
-
service: new GraphqlService(),
|
|
131
|
-
|
|
132
|
-
// add some options to the backend service to work
|
|
133
|
-
// shown below is the minimum setup for the service to work correctly
|
|
134
|
-
options: {
|
|
135
|
-
datasetName: 'users',
|
|
136
|
-
paginationOptions: {
|
|
137
|
-
first: 25,
|
|
138
|
-
offset: 0
|
|
139
|
-
}
|
|
140
|
-
},
|
|
141
|
-
|
|
142
|
-
// define all the on Event callbacks
|
|
143
|
-
preProcess: () => this.displaySpinner(true),
|
|
144
|
-
process: (query) => this.getAllCustomers(query),
|
|
145
|
-
postProcess: (response) => this.displaySpinner(false)
|
|
146
|
-
}
|
|
147
|
-
};
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
// Web API call
|
|
151
|
-
getAllCustomers(graphqlQuery) {
|
|
152
|
-
return this.http.post('/api/customers', { query: graphqlQuery });
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
```
|
|
156
|
-
|
|
157
|
-
### Extra Query Arguments
|
|
158
|
-
You can pass extra query arguments to the GraphQL query via the `extraQueryArguments` property defined in the `backendServiceApi.options`. For example let say you have a list of users and your GraphQL query accepts an optional `userId`, you can write it in code this way:
|
|
159
|
-
```ts
|
|
160
|
-
this.gridOptions = {
|
|
161
|
-
backendServiceApi: {
|
|
162
|
-
service: new GraphqlService(),
|
|
163
|
-
|
|
164
|
-
// add some options to the backend service to work
|
|
165
|
-
options: {
|
|
166
|
-
executeProcessCommandOnInit: false, // true by default, which load the data on page load
|
|
167
|
-
datasetName: 'users',
|
|
168
|
-
paginationOptions: {
|
|
169
|
-
first: 25,
|
|
170
|
-
offset: 0
|
|
171
|
-
},
|
|
172
|
-
extraQueryArguments: [{
|
|
173
|
-
field: 'userId',
|
|
174
|
-
value: 567
|
|
175
|
-
}]
|
|
176
|
-
},
|
|
177
|
-
|
|
178
|
-
// define all the on Event callbacks
|
|
179
|
-
preProcess: () => this.displaySpinner(true),
|
|
180
|
-
process: (query) => this.getCustomerApiCall(query),
|
|
181
|
-
postProcess: (response) => this.displaySpinner(false)
|
|
182
|
-
}
|
|
183
|
-
};
|
|
184
|
-
```
|
|
185
|
-
|
|
186
|
-
The GraphQL query built with these options will be
|
|
187
|
-
```ts
|
|
188
|
-
// extraQueryArguments will change the userId with
|
|
189
|
-
{
|
|
190
|
-
users(first: 20, offset: 0, userId: 567) {
|
|
191
|
-
totalCount,
|
|
192
|
-
nodes {
|
|
193
|
-
id,
|
|
194
|
-
name,
|
|
195
|
-
company
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
```
|
|
200
|
-
|
|
201
|
-
### Changing/Updating Options Dynamically
|
|
202
|
-
You might want to change certain options dynamically, for example passing new set of values to `extraQueryArguments`. For that you will have to first keep a reference to your `GraphqlService` instance and then you can call the `updateOptions` method.
|
|
203
|
-
|
|
204
|
-
##### Code Example
|
|
205
|
-
```ts
|
|
206
|
-
export class MyComponent implements OnInit {
|
|
207
|
-
graphqlService: GraphqlService;
|
|
208
|
-
columnDefinitions: Column[];
|
|
209
|
-
gridOptions: GridOption;
|
|
210
|
-
|
|
211
|
-
constructor() {
|
|
212
|
-
this.graphqlService = GraphqlService();
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
angularGridReady(angularGrid: AngularGridInstance) {
|
|
216
|
-
this.angularGrid = angularGrid;
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
ngOnInit(): void {
|
|
220
|
-
this.columnDefinitions = [
|
|
221
|
-
// ...
|
|
222
|
-
];
|
|
223
|
-
|
|
224
|
-
this.gridOptions = {
|
|
225
|
-
backendServiceApi: {
|
|
226
|
-
service: this.graphqlService,
|
|
227
|
-
// ...
|
|
228
|
-
}
|
|
229
|
-
};
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
changeQueryArguments() {
|
|
234
|
-
// update any Backend Service Options you want
|
|
235
|
-
this.graphqlService.updateOptions({
|
|
236
|
-
extraQueryArguments: [{
|
|
237
|
-
field: 'userId',
|
|
238
|
-
value: 567
|
|
239
|
-
}]
|
|
240
|
-
});
|
|
241
|
-
|
|
242
|
-
// then make sure to refresh the dataset
|
|
243
|
-
this.angularGrid.pluginService.refreshBackendDataset();
|
|
244
|
-
}
|
|
245
|
-
```
|
|
246
|
-
|
|
247
|
-
### GraphQL without Pagination
|
|
248
|
-
By default, the Pagination is enabled and will produce a GraphQL query which includes page related information but you could also use the GraphQL Service without Pagination if you wish by disabling the flag `enablePagination: false` in the Grid Options. However please note that the GraphQL Query will be totally different since it won't include any page related information.
|
|
249
|
-
|
|
250
|
-
#### Code Example
|
|
251
|
-
```ts
|
|
252
|
-
this.gridOptions = {
|
|
253
|
-
enablePagination: false,
|
|
254
|
-
backendServiceApi: {
|
|
255
|
-
service: this.graphqlService,
|
|
256
|
-
// ...
|
|
257
|
-
}
|
|
258
|
-
};
|
|
259
|
-
```
|
|
260
|
-
|
|
261
|
-
#### Query Change Example
|
|
262
|
-
If we take for example a GrahQL Query that includes Pagination versus without Pagination, you will see a much simpler query string. Also, note that the filtering and sorting won't be affected, they will remain as query input.
|
|
263
|
-
|
|
264
|
-
##### with Pagination
|
|
265
|
-
1. `query{ users(first:20, offset:40){ totalCount, nodes{ id, field1, field2 }}}`
|
|
266
|
-
2. `query{ users(first:20, offset:40, filterBy: [{ field: field1, value: 'test', operator: StartsWith }]){ totalCount, nodes{ id, field1, field2 }}}`
|
|
267
|
-
|
|
268
|
-
##### without Pagination
|
|
269
|
-
1. `query{ users{ id, field1, field2 }}`
|
|
270
|
-
2. `query{ users(filterBy: [{ field: field1, value: 'test', operator: StartsWith }]){ id, field1, field2 }}`
|
|
271
|
-
|
|
272
|
-
## GraphQL Server Definitions
|
|
273
|
-
For the implementation of all 3 actions (filtering, sorting, pagination) with your GraphQL Server, please refer to the sections below to configure your GraphQL Schema accordingly.
|
|
274
|
-
- [Pagination](graphql/GraphQL-Pagination.md)
|
|
275
|
-
- [Sorting](graphql/GraphQL-Sorting.md)
|
|
276
|
-
- [Filtering](graphql/GraphQL-Filtering.md)
|
|
@@ -1,245 +0,0 @@
|
|
|
1
|
-
##### index
|
|
2
|
-
- [TypeScript signature](#typescript-signature)
|
|
3
|
-
- [Usage](#grid-definition--call-of-backendserviceapi)
|
|
4
|
-
- [Passing Extra Arguments](#passing-extra-arguments-to-the-query)
|
|
5
|
-
- [OData options](#odata-options)
|
|
6
|
-
- [Override the filter query](#override-the-filter-query)
|
|
7
|
-
- [Infinite Scroll](../grid-functionalities/infinite-scroll.md#infinite-scroll-with-backend-services)
|
|
8
|
-
|
|
9
|
-
### Description
|
|
10
|
-
OData Backend Service (for Pagination purposes) to get data from a backend server with the help of OData.
|
|
11
|
-
|
|
12
|
-
### Demo
|
|
13
|
-
[Demo Page](https://ghiscoding.github.io/Angular-Slickgrid/#/odata) / [Demo Component](https://github.com/ghiscoding/slickgrid-universal/blob/master/frameworks/angular-slickgrid/src/demos/examples/grid-odata.component.ts)
|
|
14
|
-
|
|
15
|
-
### Note
|
|
16
|
-
Use it when you need to support **Pagination** (that is when your dataset is rather large, more than 5k rows) with a OData endpoint. If your dataset is small (less than 5k rows), then go with a [regular grid](https://ghiscoding.github.io/Angular-Slickgrid/#/basic) with the `[dataset]` binding property. SlickGrid can easily handle million of rows using a DataView object, but personally when the dataset is known to be large, I usually use a backend service (OData or GraphQL) and when it's small I go with a [regular grid](https://ghiscoding.github.io/Angular-Slickgrid/#/basic).
|
|
17
|
-
|
|
18
|
-
## Implementation
|
|
19
|
-
To connect a backend service into `Slickgrid-Universal`, you simply need to modify your `gridOptions` and add a declaration of `backendServiceApi` and pass it the `service`. See below for the signature and an example further down below.
|
|
20
|
-
|
|
21
|
-
### IMPORTANT NOTE
|
|
22
|
-
All the code below assumes that your Backend Server (probably in C#) will return the data into an `items` property. You could return the array directly **but it is strongly discouraged to do that** because that will conflict with the `metrics` that you will see in the code below. The best approach is to return your data into a property, like `items` or any property name you wish to use, on your backend server side. Your result should have this kind of structure
|
|
23
|
-
```ts
|
|
24
|
-
{
|
|
25
|
-
items: [ /* your data */ ]
|
|
26
|
-
}
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
### TypeScript Signature
|
|
30
|
-
```typescript
|
|
31
|
-
backendServiceApi: {
|
|
32
|
-
// Backend Service instance (could be OData or GraphQL Service)
|
|
33
|
-
service: BackendService;
|
|
34
|
-
|
|
35
|
-
// add any options you might want to provide to the backend service
|
|
36
|
-
options: OdataOption | GraphqlServiceOption;
|
|
37
|
-
|
|
38
|
-
// On init (or on page load), what action to perform?
|
|
39
|
-
onInit?: (query: string) => Promise<any>;
|
|
40
|
-
|
|
41
|
-
// Before executing the query, what action to perform? For example, start a spinner
|
|
42
|
-
preProcess?: () => void;
|
|
43
|
-
|
|
44
|
-
// On Processing, we get the query back from the service, and we need to provide a Promise. For example: this.http.get(myGraphqlUrl)
|
|
45
|
-
process: (query: string) => Promise<any>;
|
|
46
|
-
|
|
47
|
-
// After executing the query, what action to perform? For example, stop the spinner
|
|
48
|
-
postProcess: (response: any) => void;
|
|
49
|
-
|
|
50
|
-
// Throttle the amount of requests sent to the backend. Default to 500ms
|
|
51
|
-
filterTypingDebounce?: number;
|
|
52
|
-
}
|
|
53
|
-
```
|
|
54
|
-
As you can see, you mainly need to define which service to use (GridODataService or GraphQLService) and finally add the `process` and `postProcess` callback.
|
|
55
|
-
|
|
56
|
-
#### Grid Definition & call of `backendServiceApi`
|
|
57
|
-
##### Notes
|
|
58
|
-
- Pagination is optional and if not defined, it will use what is set in the [Slickgrid-Universal - Global Options](https://github.com/ghiscoding/slickgrid-universal/blob/master/packages/common/src/global-grid-options.ts)
|
|
59
|
-
- `onInit` is optional and is there to initialize (pre-populate) the grid with data on first page load (typically the same call as `process`)
|
|
60
|
-
- you could load the grid yourself outside of the `gridOptions` which is why it's optional
|
|
61
|
-
- `filterTypingDebounce` is a timer (in milliseconds) that waits for user input pause before querying the backend server
|
|
62
|
-
- this is meant to throttle the amount of requests sent to the backend (we don't really want to query every keystroke)
|
|
63
|
-
- 700ms is the default when not provided
|
|
64
|
-
|
|
65
|
-
##### Code
|
|
66
|
-
```ts
|
|
67
|
-
import { Component, Injectable, OnInit } from '@angular/core';
|
|
68
|
-
import { Column, GridOption } from 'angular-slickgrid';
|
|
69
|
-
import { GridOdataService, OdataServiceApi, OdataOption } from '@slickgrid-universal/odata';
|
|
70
|
-
|
|
71
|
-
@Injectable()
|
|
72
|
-
export class MyComponent implements OnInit {
|
|
73
|
-
columnDefinitions: Column[];
|
|
74
|
-
gridOptions: GridOption;
|
|
75
|
-
dataset = [];
|
|
76
|
-
|
|
77
|
-
constructor(private http: HttpClient) {}
|
|
78
|
-
|
|
79
|
-
ngOnInit() {
|
|
80
|
-
this.definedGrid();
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
defineGrid() {
|
|
84
|
-
this.columnDefinitions = [
|
|
85
|
-
// your column definitions
|
|
86
|
-
];
|
|
87
|
-
|
|
88
|
-
this.gridOptions = {
|
|
89
|
-
enableFiltering: true,
|
|
90
|
-
enablePagination: true,
|
|
91
|
-
pagination: {
|
|
92
|
-
pageSizes: [10, 15, 20, 25, 30, 40, 50, 75, 100],
|
|
93
|
-
pageSize: defaultPageSize,
|
|
94
|
-
totalItems: 0
|
|
95
|
-
},
|
|
96
|
-
backendServiceApi: {
|
|
97
|
-
service: new GridOdataService(),
|
|
98
|
-
// define all the on Event callbacks
|
|
99
|
-
options: {
|
|
100
|
-
caseType: CaseType.pascalCase,
|
|
101
|
-
top: defaultPageSize
|
|
102
|
-
} as OdataOption,
|
|
103
|
-
preProcess: () => this.displaySpinner(true),
|
|
104
|
-
process: (query) => this.getCustomerApiCall(query),
|
|
105
|
-
postProcess: (response) => {
|
|
106
|
-
this.displaySpinner(false);
|
|
107
|
-
this.getCustomerCallback(response);
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
};
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
// Web API call
|
|
114
|
-
getCustomerApiCall(odataQuery) {
|
|
115
|
-
return this.http.get(`/api/getCustomers?${odataQuery}`);
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
getCustomerCallback(response) {
|
|
119
|
-
// totalItems property needs to be filled for pagination to work correctly
|
|
120
|
-
// however we need to force the Framework to do a dirty check, doing a clone object will do just that
|
|
121
|
-
let countPropName = 'totalRecordCount'; // you can use "totalRecordCount" or any name or "odata.count" when "enableCount" is set
|
|
122
|
-
if (this.isCountEnabled) {
|
|
123
|
-
countPropName = (this.odataVersion === 4) ? '@odata.count' : 'odata.count';
|
|
124
|
-
}
|
|
125
|
-
if (this.metrics) {
|
|
126
|
-
this.metrics.totalItemCount = data[countPropName];
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
// once pagination totalItems is filled, we can update the dataset
|
|
130
|
-
this.paginationOptions = { ...this.gridOptions.pagination, totalItems: totalItemCount } as Pagination;
|
|
131
|
-
this.dataset = data.items as Customer[];
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
```
|
|
135
|
-
|
|
136
|
-
### Passing Extra Arguments to the Query
|
|
137
|
-
You might need to pass extra arguments to your OData query, for example passing a `userId`, you can do that simply by modifying the query you sent to your `process` callback method. For example
|
|
138
|
-
```ts
|
|
139
|
-
// Web API call
|
|
140
|
-
getCustomerApiCall(odataQuery) { with Fetch Client
|
|
141
|
-
const finalQuery = `${odataQuery}$filter=(userId eq 12345)`;
|
|
142
|
-
return this.http.get(`/api/getCustomers?${finalQuery}`);
|
|
143
|
-
}
|
|
144
|
-
```
|
|
145
|
-
|
|
146
|
-
## OData options
|
|
147
|
-
|
|
148
|
-
All options can be found here: [Slickgrid-Universal - OData Options](https://github.com/ghiscoding/slickgrid-universal/blob/master/packages/odata/src/interfaces/odataOption.interface.ts)
|
|
149
|
-
|
|
150
|
-
Some are described in more detail below.
|
|
151
|
-
|
|
152
|
-
### OData version
|
|
153
|
-
|
|
154
|
-
By default the OData version is set to 2 because it was implemented with that version. If you wish to use version 4, then just change the `version: 4`, there are subtle differences.
|
|
155
|
-
|
|
156
|
-
```ts
|
|
157
|
-
this.gridOptions = {
|
|
158
|
-
backendServiceApi: {
|
|
159
|
-
service: new GridOdataService(),
|
|
160
|
-
options: {
|
|
161
|
-
enableCount: true, // add the count in the OData query, which will return a property named "odata.count" (v2) or "@odata.count" (v4)
|
|
162
|
-
version: 4 // defaults to 2, the query string is slightly different between OData 2 and 4
|
|
163
|
-
} as OdataOption,
|
|
164
|
-
process: (query) => this.getCustomerApiCall(query),
|
|
165
|
-
postProcess: (response) => {
|
|
166
|
-
this.metrics = response.metrics;
|
|
167
|
-
this.displaySpinner(false);
|
|
168
|
-
this.getCustomerCallback(response);
|
|
169
|
-
}
|
|
170
|
-
} as OdataServiceApi
|
|
171
|
-
};
|
|
172
|
-
```
|
|
173
|
-
|
|
174
|
-
### Query total items count
|
|
175
|
-
|
|
176
|
-
The total items count can be queried from the backend by:
|
|
177
|
-
```ts
|
|
178
|
-
const oDataOptions: OdataOption = {
|
|
179
|
-
enableCount: true;
|
|
180
|
-
}
|
|
181
|
-
```
|
|
182
|
-
|
|
183
|
-
When enabled that will add `$inlinecount=allpages` (v2/v3) or `$count=true` (v4) to the query. And the count from the backend's response is extracted and `pagination.totalItems` is updated with that count. The property in the response that is used depends on the oData version specified: `d.__count` for v2, `__count` for v3 and `@odata.count` for v4. If needed a custom extractor function can be set through `oDataOptions.countExtractor`.
|
|
184
|
-
|
|
185
|
-
### Query only the grid column's fields
|
|
186
|
-
|
|
187
|
-
Query only the grid column's fields from the backend by:
|
|
188
|
-
```ts
|
|
189
|
-
const oDataOptions: OdataOption = {
|
|
190
|
-
enableSelect: true;
|
|
191
|
-
}
|
|
192
|
-
```
|
|
193
|
-
|
|
194
|
-
For example `columns: [{ id: 'col1', field: 'field1' }, { id: 'col2', field: 'field2' }]` results in the query: `?$select=id,field1,field2`.
|
|
195
|
-
|
|
196
|
-
A property `id` is always selected from the backend because the grid requires it. This property can be changed by setting `gridOptions.datasetIdPropertyName`.
|
|
197
|
-
|
|
198
|
-
### Query related resources / expand navigation properties
|
|
199
|
-
|
|
200
|
-
Specify that related resources (navigation properties) should be retrieved from the backend:
|
|
201
|
-
```ts
|
|
202
|
-
const oDataOptions: OdataOption = {
|
|
203
|
-
enableExpand: true;
|
|
204
|
-
}
|
|
205
|
-
```
|
|
206
|
-
|
|
207
|
-
A navigation property is identified as a field having `/` in it's name. For example `columns: [{ id: 'col1', field: 'nav1/field1' }, { id: 'col2', field: 'nav2/field1' }]` results in the query `?$expand=nav1,nav2`
|
|
208
|
-
|
|
209
|
-
Often `enableSelect` and `enableExpand` are used in conjunction. And with oData v4 then also navigation properties are selected from the backend. For example `columns: [{ id: 'col1', field: 'nav1/field1' }, { id: 'col2', field: 'nav2/field1' }]` results in the query `?$select=id,$expand=nav1($select=field1),nav2($select=field2)`
|
|
210
|
-
|
|
211
|
-
```ts
|
|
212
|
-
const oDataOptions: OdataOption = {
|
|
213
|
-
enableSelect: true;
|
|
214
|
-
enableExpand: true;
|
|
215
|
-
version: 4
|
|
216
|
-
}
|
|
217
|
-
```
|
|
218
|
-
|
|
219
|
-
Navigations within navigations are also supported. For example `columns: [{ id: 'col1', field: 'nav1/subnav1/field1' }]`.
|
|
220
|
-
|
|
221
|
-
The dataset from the backend is automatically extracted and navigation fields are flattened so the grid can display them and sort/filter just work. The exact property that is used as the dataset depends on the oData version: `d.results` for v2, `results` for v3 and `value` for v4. If needed a custom extractor function can be set through `oDataOptions.datasetExtractor`.
|
|
222
|
-
For example if the backend responds with `{ value: [{ id: 1, nav1: { field1: 'x' }, { nav2: { field2: 'y' } } ] }` this will be flattened to `{ value: [{ id: 1, 'nav1/field1': 'x', 'nav2/field2': 'y' } ] }`.
|
|
223
|
-
|
|
224
|
-
### Override the filter query
|
|
225
|
-
|
|
226
|
-
Column filters may have a `Custom` operator, that acts as a placeholder for you to define your own logic. To do so, the easiest way is to provide the `filterQueryOverride` callback in the OdataOptions. This method will be called with `BackendServiceFilterQueryOverrideArgs` to let you decide dynamically on how the filter should be assembled.
|
|
227
|
-
|
|
228
|
-
E.g. you could listen for a specific column and the active OperatorType.custom in order to switch the filter to a matchesPattern SQL LIKE search:
|
|
229
|
-
|
|
230
|
-
```ts
|
|
231
|
-
backendServiceApi: {
|
|
232
|
-
options: {
|
|
233
|
-
filterQueryOverride: ({ fieldName, columnDef, columnFilterOperator, searchValues }) => {
|
|
234
|
-
if (columnFilterOperator === OperatorType.custom && columnDef?.id === 'name') {
|
|
235
|
-
let matchesSearch = searchValues[0].replace(/\*/g, '.*');
|
|
236
|
-
matchesSearch = matchesSearch.slice(0, 1) + '%5E' + matchesSearch.slice(1);
|
|
237
|
-
matchesSearch = matchesSearch.slice(0, -1) + '$\'';
|
|
238
|
-
|
|
239
|
-
return `matchesPattern(${fieldName}, ${matchesSearch})`;
|
|
240
|
-
}
|
|
241
|
-
},
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
```
|
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
##### index
|
|
2
|
-
- [filterBy](#filterby)
|
|
3
|
-
- [Complex Objects](#complex-objects)
|
|
4
|
-
- [Extra Query Arguments](#extra-query-arguments)
|
|
5
|
-
- [Override the filter query](#override-the-filter-query)
|
|
6
|
-
|
|
7
|
-
### Introduction
|
|
8
|
-
The implementation of a GraphQL Service requires a certain structure to follow for `Slickgrid-Universal` to work correctly (it will fail if your GraphQL Schema is any different than what is shown below).
|
|
9
|
-
|
|
10
|
-
### Implementation
|
|
11
|
-
For the implementation in your code, refer to the [GraphQL Service](../GraphQL.md) section.
|
|
12
|
-
|
|
13
|
-
### filterBy
|
|
14
|
-
The filtering uses `filterBy` with a structure which we think is flexible enough. The query will have a `filterBy` argument with an array of filter properties:
|
|
15
|
-
- `filterBy`: array of filter object(s) (see below)
|
|
16
|
-
- `field`: field name to filter
|
|
17
|
-
- `value`: search filter value
|
|
18
|
-
- `operator`: a GraphQL enum (server side) that can have 1 of these choices:
|
|
19
|
-
- `LT`, `LE`, `GT`, `GE`, `NE`, `EQ`, `Contains`, `Not_Contains`, `StartsWith`, `EndsWith`, `IN`, `NIN`
|
|
20
|
-
- `Contains` is the default and will be used (by the grid) when operator is not provided
|
|
21
|
-
- `IN` and `NIN` (alias to `NOT_IN`) are mainly used for multi-select filtering
|
|
22
|
-
|
|
23
|
-
**Note:** the `filterBy` order is following the order of how the filter objects were entered in the array.
|
|
24
|
-
|
|
25
|
-
For example, a filter that would search for a firstName that starts with "John"
|
|
26
|
-
- matches: "John", "Johnny", ...
|
|
27
|
-
```typescript
|
|
28
|
-
users (first: 20, offset: 10, filterBy: [{field: firstName, operator: StartsWith, value: 'John'}]) {
|
|
29
|
-
totalCount
|
|
30
|
-
nodes {
|
|
31
|
-
name
|
|
32
|
-
firstName
|
|
33
|
-
lastName
|
|
34
|
-
gender
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
### Complex Objects
|
|
40
|
-
Dealing with complex objects are a little bit more involving. Because of some limitation with our [GraphQL for .Net](https://github.com/graphql-dotnet/graphql-dotnet) implementation, we decided to leave `field` as regular strings and keep the dot notation within the string. For that behavior to work, a new `keepArgumentFieldDoubleQuotes` property was added that can be passed to the GraphQL `initOptions()` function. For example, given a complex object field (defined in the Column Definition) that is `field: "billing.street"` will give this GraphQL query (if you have `keepArgumentFieldDoubleQuotes` set to True).
|
|
41
|
-
|
|
42
|
-
##### Grid Definition example
|
|
43
|
-
```ts
|
|
44
|
-
import { Component, OnInit } from '@angular/core';
|
|
45
|
-
import { Column, GridOption } from 'angular-slickgrid';
|
|
46
|
-
|
|
47
|
-
@Component({
|
|
48
|
-
templateUrl: './grid-basic.component.html'
|
|
49
|
-
})
|
|
50
|
-
export class GridBasicComponent implements OnInit {
|
|
51
|
-
columnDefinitions: Column[];
|
|
52
|
-
gridOptions: GridOption;
|
|
53
|
-
dataset: any[];
|
|
54
|
-
|
|
55
|
-
ngOnInit(): void {
|
|
56
|
-
this.columnDefinitions = [
|
|
57
|
-
{ id: 'name', name: 'Name', field: 'name', filterable: true, sortable: true },
|
|
58
|
-
{ id: 'company', name: 'Company', field: 'company', filterable: true },
|
|
59
|
-
{ id: 'billingStreet', name: 'Billing Address Street', field: 'billing.address.street', filterable: true, sortable: true },
|
|
60
|
-
{ id: 'billingZip', name: 'Billing Address Zip', field: 'billing.address.zip', filterable: true, sortable: true },
|
|
61
|
-
];
|
|
62
|
-
|
|
63
|
-
this.gridOptions = {
|
|
64
|
-
backendServiceApi: {
|
|
65
|
-
service: new GraphqlService(),
|
|
66
|
-
process: (query) => this.userService.getAll<Customer[]>(query),
|
|
67
|
-
options: {
|
|
68
|
-
datasetName: 'customers'
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
##### GraphQL Query
|
|
77
|
-
```typescript
|
|
78
|
-
// the orderBy/filterBy fields will keep the dot notation while nodes are exploded
|
|
79
|
-
{
|
|
80
|
-
users(first: 20, offset: 0, filterBy: [{field: "billing.address.street", operator: EQ, value: "123 Queens Street"}]) {
|
|
81
|
-
totalCount,
|
|
82
|
-
nodes {
|
|
83
|
-
name,
|
|
84
|
-
company,
|
|
85
|
-
billing {
|
|
86
|
-
address {
|
|
87
|
-
street,
|
|
88
|
-
zip
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
From the previous example, you can see that the `orderBy` keeps the (.) dot notation, while the `nodes` is exploded as it should `billing { street }}`. So keep this in mind while building your backend GraphQL service.
|
|
97
|
-
|
|
98
|
-
### Extra Query Arguments
|
|
99
|
-
If you want to pass extra arguments outside of the `filterBy` argument, that will be used for the life of the grid. You can do so by using the `extraQueryArguments` which accept an array of field/value. For example, let say you want to load a grid of items that belongs to a particular user (with a `userId`). You can pass the `extraQueryArguments` to the `backendServiceApi` `options` property, like so
|
|
100
|
-
|
|
101
|
-
##### Component
|
|
102
|
-
```typescript
|
|
103
|
-
this.gridOptions = {
|
|
104
|
-
backendServiceApi: {
|
|
105
|
-
service: new GraphqlService(),
|
|
106
|
-
process: (query) => this.userService.getAll<User[]>(query),
|
|
107
|
-
options: {
|
|
108
|
-
datasetName: 'users',
|
|
109
|
-
extraQueryArguments: [{
|
|
110
|
-
field: 'userId',
|
|
111
|
-
value: 123
|
|
112
|
-
}]
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
};
|
|
116
|
-
```
|
|
117
|
-
|
|
118
|
-
##### GraphQL Query
|
|
119
|
-
```typescript
|
|
120
|
-
// the orderBy/filterBy fields will keep the dot notation while nodes are exploded
|
|
121
|
-
{
|
|
122
|
-
users(first: 20, offset: 0, userId: 123) {
|
|
123
|
-
totalCount,
|
|
124
|
-
nodes {
|
|
125
|
-
name,
|
|
126
|
-
company,
|
|
127
|
-
billing {
|
|
128
|
-
address {
|
|
129
|
-
street,
|
|
130
|
-
zip
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
```
|
|
137
|
-
|
|
138
|
-
### Override the filter query
|
|
139
|
-
|
|
140
|
-
Column filters may have a `Custom` Operator, that acts as a placeholder for you to define your own logic. To do so, the easiest way is to provide the `filterQueryOverride` callback in the GraphQL Options. This method will be called with `BackendServiceFilterQueryOverrideArgs` to let you decide dynamically on how the filter should be assembled.
|
|
141
|
-
|
|
142
|
-
E.g. you could listen for a specific column and the active `OperatorType.custom` in order to switch the filter to an SQL LIKE search in GraphQL:
|
|
143
|
-
|
|
144
|
-
> **Note** technically speaking GraphQL isn't a database query language like SQL, it's an application query language. Depending on your configuration, your GraphQL Server might already support regex querying (e.g. Hasura [_regex](https://hasura.io/docs/latest/queries/postgres/filters/text-search-operators/#_regex)) or you could add your own implementation (e.g. see this SO: https://stackoverflow.com/a/37981802/1212166). Just make sure that whatever custom operator that you want to use, is already included in your GraphQL Schema.
|
|
145
|
-
```ts
|
|
146
|
-
backendServiceApi: {
|
|
147
|
-
options: {
|
|
148
|
-
filterQueryOverride: ({ fieldName, columnDef, columnFilterOperator, searchValues }) => {
|
|
149
|
-
if (columnFilterOperator === OperatorType.custom && columnDef?.id === 'name') {
|
|
150
|
-
// the `operator` is a string, make sure to implement this new operator in your GraphQL Schema
|
|
151
|
-
return { field: fieldName, operator: 'Like', value: searchValues[0] };
|
|
152
|
-
}
|
|
153
|
-
},
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
```
|