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,474 +0,0 @@
|
|
|
1
|
-
import { GridOdataService, OdataServiceApi, OdataOption } from '@slickgrid-universal/odata';
|
|
2
|
-
import { ChangeDetectorRef, Component, OnInit } from '@angular/core';
|
|
3
|
-
import { HttpClient } from '@angular/common/http';
|
|
4
|
-
import { AngularGridInstance, Column, Filters, GridOption, GridStateChange, Metrics, OperatorType, Pagination } from '../../library';
|
|
5
|
-
|
|
6
|
-
const defaultPageSize = 20;
|
|
7
|
-
const sampleDataRoot = 'assets/data';
|
|
8
|
-
const CARET_HTML_ESCAPED = '%5E';
|
|
9
|
-
const PERCENT_HTML_ESCAPED = '%25';
|
|
10
|
-
|
|
11
|
-
@Component({
|
|
12
|
-
templateUrl: './example05.component.html',
|
|
13
|
-
standalone: false,
|
|
14
|
-
})
|
|
15
|
-
export class Example5Component implements OnInit {
|
|
16
|
-
angularGrid!: AngularGridInstance;
|
|
17
|
-
columnDefinitions!: Column[];
|
|
18
|
-
gridOptions!: GridOption;
|
|
19
|
-
dataset = [];
|
|
20
|
-
metrics!: Metrics;
|
|
21
|
-
paginationOptions!: Pagination;
|
|
22
|
-
|
|
23
|
-
isCountEnabled = true;
|
|
24
|
-
isSelectEnabled = false;
|
|
25
|
-
isExpandEnabled = false;
|
|
26
|
-
odataVersion = 2;
|
|
27
|
-
odataQuery = '';
|
|
28
|
-
processing = true;
|
|
29
|
-
errorStatus = '';
|
|
30
|
-
isPageErrorTest = false;
|
|
31
|
-
status = { text: 'processing...', class: 'alert alert-danger' };
|
|
32
|
-
|
|
33
|
-
constructor(
|
|
34
|
-
private readonly cd: ChangeDetectorRef,
|
|
35
|
-
private http: HttpClient
|
|
36
|
-
) {}
|
|
37
|
-
|
|
38
|
-
angularGridReady(angularGrid: AngularGridInstance) {
|
|
39
|
-
this.angularGrid = angularGrid;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
ngOnInit(): void {
|
|
43
|
-
this.columnDefinitions = [
|
|
44
|
-
{
|
|
45
|
-
id: 'name',
|
|
46
|
-
name: 'Name',
|
|
47
|
-
field: 'name',
|
|
48
|
-
sortable: true,
|
|
49
|
-
filterable: true,
|
|
50
|
-
filter: {
|
|
51
|
-
model: Filters.compoundInput,
|
|
52
|
-
compoundOperatorList: [
|
|
53
|
-
{ operator: '', desc: 'Contains' },
|
|
54
|
-
{ operator: '<>', desc: 'Not Contains' },
|
|
55
|
-
{ operator: '=', desc: 'Equals' },
|
|
56
|
-
{ operator: '!=', desc: 'Not equal to' },
|
|
57
|
-
{ operator: 'a*', desc: 'Starts With' },
|
|
58
|
-
{ operator: 'Custom', desc: 'SQL Like' },
|
|
59
|
-
],
|
|
60
|
-
},
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
id: 'gender',
|
|
64
|
-
name: 'Gender',
|
|
65
|
-
field: 'gender',
|
|
66
|
-
filterable: true,
|
|
67
|
-
sortable: true,
|
|
68
|
-
filter: {
|
|
69
|
-
model: Filters.singleSelect,
|
|
70
|
-
collection: [
|
|
71
|
-
{ value: '', label: '' },
|
|
72
|
-
{ value: 'male', label: 'male' },
|
|
73
|
-
{ value: 'female', label: 'female' },
|
|
74
|
-
],
|
|
75
|
-
},
|
|
76
|
-
},
|
|
77
|
-
{ id: 'company', name: 'Company', field: 'company', filterable: true, sortable: true },
|
|
78
|
-
{ id: 'category_name', name: 'Category', field: 'category/name', filterable: true, sortable: true },
|
|
79
|
-
];
|
|
80
|
-
|
|
81
|
-
this.gridOptions = {
|
|
82
|
-
enableAutoResize: true,
|
|
83
|
-
autoResize: {
|
|
84
|
-
container: '#demo-container',
|
|
85
|
-
rightPadding: 10,
|
|
86
|
-
},
|
|
87
|
-
checkboxSelector: {
|
|
88
|
-
// you can toggle these 2 properties to show the "select all" checkbox in different location
|
|
89
|
-
hideInFilterHeaderRow: false,
|
|
90
|
-
hideInColumnTitleRow: true,
|
|
91
|
-
},
|
|
92
|
-
compoundOperatorAltTexts: {
|
|
93
|
-
// where '=' is any of the `OperatorString` type shown above
|
|
94
|
-
text: { Custom: { operatorAlt: '%%', descAlt: 'SQL Like' } },
|
|
95
|
-
},
|
|
96
|
-
enableCellNavigation: true,
|
|
97
|
-
enableFiltering: true,
|
|
98
|
-
enableCheckboxSelector: true,
|
|
99
|
-
enableRowSelection: true,
|
|
100
|
-
enablePagination: true, // you could optionally disable the Pagination
|
|
101
|
-
pagination: {
|
|
102
|
-
pageSizes: [10, 20, 50, 100, 500, 50000],
|
|
103
|
-
pageSize: defaultPageSize,
|
|
104
|
-
totalItems: 0,
|
|
105
|
-
},
|
|
106
|
-
presets: {
|
|
107
|
-
// you can also type operator as string, e.g.: operator: 'EQ'
|
|
108
|
-
filters: [{ columnId: 'gender', searchTerms: ['male'], operator: OperatorType.equal }],
|
|
109
|
-
sorters: [
|
|
110
|
-
// direction can be written as 'asc' (uppercase or lowercase) and/or use the SortDirection type
|
|
111
|
-
{ columnId: 'name', direction: 'asc' },
|
|
112
|
-
],
|
|
113
|
-
pagination: { pageNumber: 2, pageSize: defaultPageSize },
|
|
114
|
-
},
|
|
115
|
-
backendServiceApi: {
|
|
116
|
-
service: new GridOdataService(),
|
|
117
|
-
options: {
|
|
118
|
-
enableCount: this.isCountEnabled, // add the count in the OData query, which will return a property named "__count" (v2) or "@odata.count" (v4)
|
|
119
|
-
enableSelect: this.isSelectEnabled,
|
|
120
|
-
enableExpand: this.isExpandEnabled,
|
|
121
|
-
filterQueryOverride: ({ fieldName, columnDef, columnFilterOperator, searchValues }) => {
|
|
122
|
-
if (columnFilterOperator === OperatorType.custom && columnDef?.id === 'name') {
|
|
123
|
-
let matchesSearch = searchValues[0].replace(/\*/g, '.*');
|
|
124
|
-
matchesSearch = matchesSearch.slice(0, 1) + CARET_HTML_ESCAPED + matchesSearch.slice(1);
|
|
125
|
-
matchesSearch = matchesSearch.slice(0, -1) + "$'";
|
|
126
|
-
|
|
127
|
-
return `matchesPattern(${fieldName}, ${matchesSearch})`;
|
|
128
|
-
}
|
|
129
|
-
return;
|
|
130
|
-
},
|
|
131
|
-
version: this.odataVersion, // defaults to 2, the query string is slightly different between OData 2 and 4
|
|
132
|
-
},
|
|
133
|
-
onError: (error: Error) => {
|
|
134
|
-
this.errorStatus = error.message;
|
|
135
|
-
this.displaySpinner(false, true);
|
|
136
|
-
},
|
|
137
|
-
preProcess: () => {
|
|
138
|
-
this.errorStatus = '';
|
|
139
|
-
this.displaySpinner(true);
|
|
140
|
-
},
|
|
141
|
-
process: (query) => this.getCustomerApiCall(query),
|
|
142
|
-
postProcess: (response) => {
|
|
143
|
-
this.metrics = response.metrics;
|
|
144
|
-
this.displaySpinner(false);
|
|
145
|
-
this.getCustomerCallback(response);
|
|
146
|
-
this.cd.detectChanges();
|
|
147
|
-
},
|
|
148
|
-
} as OdataServiceApi,
|
|
149
|
-
};
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
displaySpinner(isProcessing: boolean, isError?: boolean) {
|
|
153
|
-
this.processing = isProcessing;
|
|
154
|
-
if (isError) {
|
|
155
|
-
this.status = { text: 'ERROR!!!', class: 'alert alert-danger' };
|
|
156
|
-
} else {
|
|
157
|
-
this.status = isProcessing ? { text: 'loading', class: 'alert alert-warning' } : { text: 'finished', class: 'alert alert-success' };
|
|
158
|
-
}
|
|
159
|
-
this.cd.detectChanges();
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
getCustomerCallback(data: any) {
|
|
163
|
-
// totalItems property needs to be filled for pagination to work correctly
|
|
164
|
-
// however we need to force Angular to do a dirty check, doing a clone object will do just that
|
|
165
|
-
let totalItemCount: number = data['totalRecordCount']; // you can use "totalRecordCount" or any name or "odata.count" when "enableCount" is set
|
|
166
|
-
if (this.isCountEnabled) {
|
|
167
|
-
totalItemCount = this.odataVersion === 4 ? data['@odata.count'] : data['d']['__count'];
|
|
168
|
-
}
|
|
169
|
-
if (this.metrics) {
|
|
170
|
-
this.metrics.totalItemCount = totalItemCount;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
// once pagination totalItems is filled, we can update the dataset
|
|
174
|
-
this.paginationOptions = { ...this.gridOptions.pagination, totalItems: totalItemCount } as Pagination;
|
|
175
|
-
this.dataset = this.odataVersion === 4 ? data.value : data.d.results;
|
|
176
|
-
this.odataQuery = data['query'];
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
getCustomerApiCall(query: string) {
|
|
180
|
-
// in your case, you will call your WebAPI function (wich needs to return a Promise)
|
|
181
|
-
// for the demo purpose, we will call a mock WebAPI function
|
|
182
|
-
return this.getCustomerDataApiMock(query);
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
goToFirstPage() {
|
|
186
|
-
this.angularGrid.paginationService!.goToFirstPage();
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
goToLastPage() {
|
|
190
|
-
this.angularGrid.paginationService!.goToLastPage();
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
setFiltersDynamically() {
|
|
194
|
-
// we can Set Filters Dynamically (or different filters) afterward through the FilterService
|
|
195
|
-
this.angularGrid.filterService.updateFilters([
|
|
196
|
-
// { columnId: 'gender', searchTerms: ['male'], operator: OperatorType.equal },
|
|
197
|
-
{ columnId: 'name', searchTerms: ['A'], operator: 'a*' },
|
|
198
|
-
]);
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
setSortingDynamically() {
|
|
202
|
-
this.angularGrid.sortService.updateSorting([{ columnId: 'name', direction: 'DESC' }]);
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
/** This function is only here to mock a WebAPI call (since we are using a JSON file for the demo)
|
|
206
|
-
* in your case the getCustomer() should be a WebAPI function returning a Promise
|
|
207
|
-
*/
|
|
208
|
-
getCustomerDataApiMock(query: string): Promise<any> {
|
|
209
|
-
// the mock is returning a Promise, just like a WebAPI typically does
|
|
210
|
-
return new Promise((resolve) => {
|
|
211
|
-
const queryParams = query.toLowerCase().split('&');
|
|
212
|
-
let top: number;
|
|
213
|
-
let skip = 0;
|
|
214
|
-
let orderBy = '';
|
|
215
|
-
let countTotalItems = 100;
|
|
216
|
-
const columnFilters = {};
|
|
217
|
-
|
|
218
|
-
if (this.isPageErrorTest) {
|
|
219
|
-
this.isPageErrorTest = false;
|
|
220
|
-
throw new Error('Server timed out trying to retrieve data for the last page');
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
for (const param of queryParams) {
|
|
224
|
-
if (param.includes('$top=')) {
|
|
225
|
-
top = +param.substring('$top='.length);
|
|
226
|
-
if (top === 50000) {
|
|
227
|
-
throw new Error('Server timed out retrieving 50,000 rows');
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
if (param.includes('$skip=')) {
|
|
231
|
-
skip = +param.substring('$skip='.length);
|
|
232
|
-
}
|
|
233
|
-
if (param.includes('$orderby=')) {
|
|
234
|
-
orderBy = param.substring('$orderby='.length);
|
|
235
|
-
}
|
|
236
|
-
if (param.includes('$filter=')) {
|
|
237
|
-
const filterBy = param.substring('$filter='.length).replace('%20', ' ');
|
|
238
|
-
if (filterBy.includes('matchespattern')) {
|
|
239
|
-
const regex = new RegExp(`matchespattern\\(([a-zA-Z]+),\\s'${CARET_HTML_ESCAPED}(.*?)'\\)`, 'i');
|
|
240
|
-
const filterMatch = filterBy.match(regex) || [];
|
|
241
|
-
const fieldName = filterMatch[1].trim();
|
|
242
|
-
(columnFilters as any)[fieldName] = { type: 'matchespattern', term: '^' + filterMatch[2].trim() };
|
|
243
|
-
}
|
|
244
|
-
if (filterBy.includes('contains')) {
|
|
245
|
-
const filterMatch = filterBy.match(/contains\(([a-zA-Z/]+),\s?'(.*?)'/);
|
|
246
|
-
const fieldName = filterMatch![1].trim();
|
|
247
|
-
(columnFilters as any)[fieldName] = { type: 'substring', term: filterMatch![2].trim() };
|
|
248
|
-
}
|
|
249
|
-
if (filterBy.includes('substringof')) {
|
|
250
|
-
const filterMatch = filterBy.match(/substringof\('(.*?)',\s([a-zA-Z/]+)/);
|
|
251
|
-
const fieldName = filterMatch![2].trim();
|
|
252
|
-
(columnFilters as any)[fieldName] = { type: 'substring', term: filterMatch![1].trim() };
|
|
253
|
-
}
|
|
254
|
-
for (const operator of ['eq', 'ne', 'le', 'lt', 'gt', 'ge']) {
|
|
255
|
-
if (filterBy.includes(operator)) {
|
|
256
|
-
const re = new RegExp(`([a-zA-Z ]*) ${operator} '(.*?)'`);
|
|
257
|
-
const filterMatch = re.exec(filterBy);
|
|
258
|
-
if (Array.isArray(filterMatch)) {
|
|
259
|
-
const fieldName = filterMatch[1].trim();
|
|
260
|
-
(columnFilters as any)[fieldName] = { type: operator, term: filterMatch[2].trim() };
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
if (filterBy.includes('startswith') && filterBy.includes('endswith')) {
|
|
265
|
-
const filterStartMatch = filterBy.match(/startswith\(([a-zA-Z ]*),\s?'(.*?)'/) || [];
|
|
266
|
-
const filterEndMatch = filterBy.match(/endswith\(([a-zA-Z ]*),\s?'(.*?)'/) || [];
|
|
267
|
-
const fieldName = filterStartMatch[1].trim();
|
|
268
|
-
(columnFilters as any)[fieldName] = { type: 'starts+ends', term: [filterStartMatch[2].trim(), filterEndMatch[2].trim()] };
|
|
269
|
-
} else if (filterBy.includes('startswith')) {
|
|
270
|
-
const filterMatch = filterBy.match(/startswith\(([a-zA-Z ]*),\s?'(.*?)'/);
|
|
271
|
-
const fieldName = filterMatch![1].trim();
|
|
272
|
-
(columnFilters as any)[fieldName] = { type: 'starts', term: filterMatch![2].trim() };
|
|
273
|
-
} else if (filterBy.includes('endswith')) {
|
|
274
|
-
const filterMatch = filterBy.match(/endswith\(([a-zA-Z ]*),\s?'(.*?)'/);
|
|
275
|
-
const fieldName = filterMatch![1].trim();
|
|
276
|
-
(columnFilters as any)[fieldName] = { type: 'ends', term: filterMatch![2].trim() };
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
// simulate a backend error when trying to sort on the "Company" field
|
|
280
|
-
if (filterBy.includes('company')) {
|
|
281
|
-
throw new Error('Server could not filter using the field "Company"');
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
// simulate a backend error when trying to sort on the "Company" field
|
|
287
|
-
if (orderBy.includes('company')) {
|
|
288
|
-
throw new Error('Server could not sort using the field "Company"');
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
this.http.get(`${sampleDataRoot}/customers_100.json`).subscribe((response) => {
|
|
292
|
-
let data = response as any[];
|
|
293
|
-
|
|
294
|
-
// Sort the data
|
|
295
|
-
if (orderBy?.length > 0) {
|
|
296
|
-
const orderByClauses = orderBy.split(',');
|
|
297
|
-
for (const orderByClause of orderByClauses) {
|
|
298
|
-
const orderByParts = orderByClause.split(' ');
|
|
299
|
-
const orderByField = orderByParts[0];
|
|
300
|
-
|
|
301
|
-
let selector = (obj: any): string => obj;
|
|
302
|
-
for (const orderByFieldPart of orderByField.split('/')) {
|
|
303
|
-
const prevSelector = selector;
|
|
304
|
-
selector = (obj: any) => {
|
|
305
|
-
return prevSelector(obj)[orderByFieldPart as any];
|
|
306
|
-
};
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
const sort = orderByParts[1] ?? 'asc';
|
|
310
|
-
switch (sort.toLocaleLowerCase()) {
|
|
311
|
-
case 'asc':
|
|
312
|
-
data = data.sort((a, b) => selector(a).localeCompare(selector(b)));
|
|
313
|
-
break;
|
|
314
|
-
case 'desc':
|
|
315
|
-
data = data.sort((a, b) => selector(b).localeCompare(selector(a)));
|
|
316
|
-
break;
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
// Read the result field from the JSON response.
|
|
322
|
-
let firstRow = skip;
|
|
323
|
-
let filteredData = data;
|
|
324
|
-
if (columnFilters) {
|
|
325
|
-
for (const columnId in columnFilters) {
|
|
326
|
-
if (columnId in columnFilters) {
|
|
327
|
-
filteredData = filteredData.filter((column) => {
|
|
328
|
-
const filterType = (columnFilters as any)[columnId].type;
|
|
329
|
-
const searchTerm = (columnFilters as any)[columnId].term;
|
|
330
|
-
let colId = columnId;
|
|
331
|
-
if (columnId?.indexOf(' ') !== -1) {
|
|
332
|
-
const splitIds = columnId.split(' ');
|
|
333
|
-
colId = splitIds[splitIds.length - 1];
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
let filterTerm;
|
|
337
|
-
let col = column;
|
|
338
|
-
for (const part of colId.split('/')) {
|
|
339
|
-
filterTerm = (col as any)[part];
|
|
340
|
-
col = filterTerm;
|
|
341
|
-
}
|
|
342
|
-
|
|
343
|
-
if (filterTerm) {
|
|
344
|
-
const [term1, term2] = Array.isArray(searchTerm) ? searchTerm : [searchTerm];
|
|
345
|
-
|
|
346
|
-
switch (filterType) {
|
|
347
|
-
case 'eq':
|
|
348
|
-
return filterTerm.toLowerCase() === term1;
|
|
349
|
-
case 'ne':
|
|
350
|
-
return filterTerm.toLowerCase() !== term1;
|
|
351
|
-
case 'le':
|
|
352
|
-
return filterTerm.toLowerCase() <= term1;
|
|
353
|
-
case 'lt':
|
|
354
|
-
return filterTerm.toLowerCase() < term1;
|
|
355
|
-
case 'gt':
|
|
356
|
-
return filterTerm.toLowerCase() > term1;
|
|
357
|
-
case 'ge':
|
|
358
|
-
return filterTerm.toLowerCase() >= term1;
|
|
359
|
-
case 'ends':
|
|
360
|
-
return filterTerm.toLowerCase().endsWith(term1);
|
|
361
|
-
case 'starts':
|
|
362
|
-
return filterTerm.toLowerCase().startsWith(term1);
|
|
363
|
-
case 'starts+ends':
|
|
364
|
-
return filterTerm.toLowerCase().startsWith(term1) && filterTerm.toLowerCase().endsWith(term2);
|
|
365
|
-
case 'substring':
|
|
366
|
-
return filterTerm.toLowerCase().includes(term1);
|
|
367
|
-
case 'matchespattern':
|
|
368
|
-
return new RegExp((term1 as string).replaceAll(PERCENT_HTML_ESCAPED, '.*'), 'i').test(filterTerm);
|
|
369
|
-
}
|
|
370
|
-
}
|
|
371
|
-
});
|
|
372
|
-
}
|
|
373
|
-
}
|
|
374
|
-
countTotalItems = filteredData.length;
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
// make sure page skip is not out of boundaries, if so reset to first page & remove skip from query
|
|
378
|
-
if (firstRow > filteredData.length) {
|
|
379
|
-
query = query.replace(`$skip=${firstRow}`, '');
|
|
380
|
-
firstRow = 0;
|
|
381
|
-
}
|
|
382
|
-
const updatedData = filteredData.slice(firstRow, firstRow + top!);
|
|
383
|
-
|
|
384
|
-
setTimeout(() => {
|
|
385
|
-
const backendResult: any = { query };
|
|
386
|
-
if (!this.isCountEnabled) {
|
|
387
|
-
backendResult['totalRecordCount'] = countTotalItems;
|
|
388
|
-
}
|
|
389
|
-
|
|
390
|
-
if (this.odataVersion === 4) {
|
|
391
|
-
backendResult['value'] = updatedData;
|
|
392
|
-
if (this.isCountEnabled) {
|
|
393
|
-
backendResult['@odata.count'] = countTotalItems;
|
|
394
|
-
}
|
|
395
|
-
} else {
|
|
396
|
-
backendResult['d'] = { results: updatedData };
|
|
397
|
-
if (this.isCountEnabled) {
|
|
398
|
-
backendResult['d']['__count'] = countTotalItems;
|
|
399
|
-
}
|
|
400
|
-
}
|
|
401
|
-
|
|
402
|
-
// console.log('Backend Result', backendResult);
|
|
403
|
-
resolve(backendResult);
|
|
404
|
-
}, 100);
|
|
405
|
-
});
|
|
406
|
-
});
|
|
407
|
-
}
|
|
408
|
-
|
|
409
|
-
/** Dispatched event of a Grid State Changed event */
|
|
410
|
-
gridStateChanged(gridStateChanges: GridStateChange) {
|
|
411
|
-
// console.log('Client sample, Grid State changed:: ', gridStateChanges);
|
|
412
|
-
console.log('Client sample, Grid State changed:: ', gridStateChanges.change);
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
throwPageChangeError() {
|
|
416
|
-
this.isPageErrorTest = true;
|
|
417
|
-
this.angularGrid?.paginationService?.goToLastPage();
|
|
418
|
-
}
|
|
419
|
-
|
|
420
|
-
// YOU CAN CHOOSE TO PREVENT EVENT FROM BUBBLING IN THE FOLLOWING 3x EVENTS
|
|
421
|
-
// note however that internally the cancelling the search is more of a rollback
|
|
422
|
-
handleOnBeforeSort(_e: Event) {
|
|
423
|
-
// e.preventDefault();
|
|
424
|
-
// return false;
|
|
425
|
-
return true;
|
|
426
|
-
}
|
|
427
|
-
|
|
428
|
-
handleOnBeforeSearchChange(_e: Event) {
|
|
429
|
-
// e.preventDefault();
|
|
430
|
-
// return false;
|
|
431
|
-
return true;
|
|
432
|
-
}
|
|
433
|
-
|
|
434
|
-
handleOnBeforePaginationChange(_e: Event) {
|
|
435
|
-
// e.preventDefault();
|
|
436
|
-
// return false;
|
|
437
|
-
return true;
|
|
438
|
-
}
|
|
439
|
-
|
|
440
|
-
// THE FOLLOWING METHODS ARE ONLY FOR DEMO PURPOSES DO NOT USE THIS CODE
|
|
441
|
-
// ---
|
|
442
|
-
|
|
443
|
-
changeCountEnableFlag() {
|
|
444
|
-
this.isCountEnabled = !this.isCountEnabled;
|
|
445
|
-
this.resetOptions({ enableCount: this.isCountEnabled });
|
|
446
|
-
return true;
|
|
447
|
-
}
|
|
448
|
-
|
|
449
|
-
changeEnableSelectFlag() {
|
|
450
|
-
this.isSelectEnabled = !this.isSelectEnabled;
|
|
451
|
-
this.resetOptions({ enableSelect: this.isSelectEnabled });
|
|
452
|
-
return true;
|
|
453
|
-
}
|
|
454
|
-
|
|
455
|
-
changeEnableExpandFlag() {
|
|
456
|
-
this.isExpandEnabled = !this.isExpandEnabled;
|
|
457
|
-
this.resetOptions({ enableExpand: this.isExpandEnabled });
|
|
458
|
-
return true;
|
|
459
|
-
}
|
|
460
|
-
|
|
461
|
-
setOdataVersion(version: number) {
|
|
462
|
-
this.odataVersion = version;
|
|
463
|
-
this.resetOptions({ version: this.odataVersion });
|
|
464
|
-
return true;
|
|
465
|
-
}
|
|
466
|
-
|
|
467
|
-
private resetOptions(options: Partial<OdataOption>) {
|
|
468
|
-
this.displaySpinner(true);
|
|
469
|
-
const odataService = this.gridOptions.backendServiceApi!.service as GridOdataService;
|
|
470
|
-
odataService.updateOptions(options);
|
|
471
|
-
odataService.clearFilters();
|
|
472
|
-
this.angularGrid?.filterService.clearFilters();
|
|
473
|
-
}
|
|
474
|
-
}
|
|
@@ -1,163 +0,0 @@
|
|
|
1
|
-
<div id="demo-container" class="container-fluid">
|
|
2
|
-
<h2>
|
|
3
|
-
Example 6: Grid connected to Backend Server with GraphQL
|
|
4
|
-
<span class="float-end">
|
|
5
|
-
<a
|
|
6
|
-
style="font-size: 18px"
|
|
7
|
-
target="_blank"
|
|
8
|
-
href="https://github.com/ghiscoding/slickgrid-universal/blob/master/frameworks/angular-slickgrid/src/demos/examples/grid-graphql.component.ts"
|
|
9
|
-
>
|
|
10
|
-
<span class="mdi mdi-link-variant"></span> code
|
|
11
|
-
</a>
|
|
12
|
-
</span>
|
|
13
|
-
</h2>
|
|
14
|
-
<div class="subtitle">
|
|
15
|
-
Sorting/Paging connected to a Backend GraphQL Service (<a
|
|
16
|
-
href="https://ghiscoding.gitbook.io/angular-slickgrid/backend-services/graphql"
|
|
17
|
-
target="_blank"
|
|
18
|
-
>Wiki docs</a
|
|
19
|
-
>).
|
|
20
|
-
<br />
|
|
21
|
-
<ul class="small">
|
|
22
|
-
<li><span class="red">(*) NO DATA SHOWING</span> - just change Filters & Pages and look at the "GraphQL Query" changing :)</li>
|
|
23
|
-
<li>This example also demos the Grid State feature, open the console log to see the changes</li>
|
|
24
|
-
<li>String column also support operator (>, >=, <, <=, <>, !=, =, ==, *)</li>
|
|
25
|
-
<ul>
|
|
26
|
-
<li>The (*) can be used as startsWith (ex.: "abc*" => startsWith "abc") / endsWith (ex.: "*xyz" => endsWith "xyz")</li>
|
|
27
|
-
<li>The other operators can be used on column type number for example: ">=100" (bigger or equal than 100)</li>
|
|
28
|
-
</ul>
|
|
29
|
-
<li>
|
|
30
|
-
You can also preload a grid with certain "presets" like Filters / Sorters / Pagination
|
|
31
|
-
<a href="https://ghiscoding.gitbook.io/angular-slickgrid/grid-functionalities/grid-state-and-preset" target="_blank"
|
|
32
|
-
>Wiki - Grid Preset</a
|
|
33
|
-
>
|
|
34
|
-
</li>
|
|
35
|
-
<li>
|
|
36
|
-
Also note that the column Name has a filter with a custom %% operator that behaves like an SQL LIKE operator supporting % wildcards.
|
|
37
|
-
</li>
|
|
38
|
-
<li>
|
|
39
|
-
Depending on your configuration, your GraphQL Server might already support regex querying (e.g. Hasura
|
|
40
|
-
<a href="https://hasura.io/docs/latest/queries/postgres/filters/text-search-operators/#_regex" target="_blank">_regex</a>) or you
|
|
41
|
-
could add your own implementation (e.g. see this SO <a href="https://stackoverflow.com/a/37981802/1212166">Question</a>).
|
|
42
|
-
</li>
|
|
43
|
-
</ul>
|
|
44
|
-
</div>
|
|
45
|
-
|
|
46
|
-
<div class="row">
|
|
47
|
-
<div class="col-sm-5">
|
|
48
|
-
<div [class]="status.class" role="alert" data-test="status">
|
|
49
|
-
<strong>Status: </strong> {{ status.text }}
|
|
50
|
-
<span [hidden]="!processing">
|
|
51
|
-
<i class="mdi mdi-sync mdi-spin-1s"></i>
|
|
52
|
-
</span>
|
|
53
|
-
</div>
|
|
54
|
-
|
|
55
|
-
<div class="row">
|
|
56
|
-
<div class="col-md-12">
|
|
57
|
-
<button
|
|
58
|
-
class="btn btn-outline-secondary btn-sm btn-icon"
|
|
59
|
-
data-test="clear-filters-sorting"
|
|
60
|
-
(click)="clearAllFiltersAndSorts()"
|
|
61
|
-
title="Clear all Filters & Sorts"
|
|
62
|
-
>
|
|
63
|
-
<i class="mdi mdi-filter-remove-outline"></i>
|
|
64
|
-
Clear all Filter & Sorts
|
|
65
|
-
</button>
|
|
66
|
-
<button class="btn btn-outline-secondary btn-sm btn-icon" data-test="set-dynamic-filter" (click)="setFiltersDynamically()">
|
|
67
|
-
Set Filters Dynamically
|
|
68
|
-
</button>
|
|
69
|
-
<button class="btn btn-outline-secondary btn-sm btn-icon" data-test="set-dynamic-sorting" (click)="setSortingDynamically()">
|
|
70
|
-
Set Sorting Dynamically
|
|
71
|
-
</button>
|
|
72
|
-
<button class="btn btn-outline-secondary btn-sm btn-icon" data-test="reset-presets" (click)="resetToOriginalPresets()">
|
|
73
|
-
Reset Original Presets
|
|
74
|
-
</button>
|
|
75
|
-
<label for="serverdelay" class="ml-4">Server Delay: </label>
|
|
76
|
-
<input
|
|
77
|
-
id="serverdelay"
|
|
78
|
-
type="number"
|
|
79
|
-
data-test="server-delay"
|
|
80
|
-
style="width: 55px"
|
|
81
|
-
[(ngModel)]="serverWaitDelay"
|
|
82
|
-
title="input a fake timer delay to simulate slow server response"
|
|
83
|
-
/>
|
|
84
|
-
</div>
|
|
85
|
-
</div>
|
|
86
|
-
<div class="row mt-1">
|
|
87
|
-
<div class="col-md-12">
|
|
88
|
-
<button class="btn btn-outline-secondary btn-sm btn-icon" data-test="language-button" (click)="switchLanguage()">
|
|
89
|
-
<i class="mdi mdi-translate"></i>
|
|
90
|
-
Switch Language
|
|
91
|
-
</button>
|
|
92
|
-
<strong>Locale:</strong>
|
|
93
|
-
<span style="font-style: italic" data-test="selected-locale">
|
|
94
|
-
{{ selectedLanguage + '.json' }}
|
|
95
|
-
</span>
|
|
96
|
-
</div>
|
|
97
|
-
|
|
98
|
-
<span style="margin-left: 10px">
|
|
99
|
-
<label class="radio-inline control-label" for="radioOffset">
|
|
100
|
-
<input
|
|
101
|
-
type="radio"
|
|
102
|
-
name="inlineRadioOptions"
|
|
103
|
-
data-test="offset"
|
|
104
|
-
id="radioOffset"
|
|
105
|
-
checked
|
|
106
|
-
[value]="false"
|
|
107
|
-
(change)="setIsWithCursor(false)"
|
|
108
|
-
/>
|
|
109
|
-
Offset
|
|
110
|
-
</label>
|
|
111
|
-
<label class="radio-inline control-label" for="radioCursor">
|
|
112
|
-
<input
|
|
113
|
-
type="radio"
|
|
114
|
-
name="inlineRadioOptions"
|
|
115
|
-
data-test="cursor"
|
|
116
|
-
id="radioCursor"
|
|
117
|
-
[value]="true"
|
|
118
|
-
(change)="setIsWithCursor(true)"
|
|
119
|
-
/>
|
|
120
|
-
Cursor
|
|
121
|
-
</label>
|
|
122
|
-
</span>
|
|
123
|
-
</div>
|
|
124
|
-
<br />
|
|
125
|
-
<div *ngIf="metrics" style="margin: 10px 0px">
|
|
126
|
-
<b>Metrics:</b> {{ metrics.endTime | date: "yyyy-MM-dd hh:mm aaaaa'm'" }} | {{ metrics.executionTime }}ms |
|
|
127
|
-
{{ metrics.totalItemCount }} items
|
|
128
|
-
</div>
|
|
129
|
-
<div class="row mb-2">
|
|
130
|
-
<div class="col-md-12">
|
|
131
|
-
<label>Programmatically go to first/last page:</label>
|
|
132
|
-
<div class="btn-group" role="group">
|
|
133
|
-
<button class="btn btn-outline-secondary btn-xs btn-icon px-2" data-test="goto-first-page" (click)="goToFirstPage()">
|
|
134
|
-
<i class="mdi mdi-page-first"></i>
|
|
135
|
-
</button>
|
|
136
|
-
<button class="btn btn-outline-secondary btn-xs btn-icon px-2" data-test="goto-last-page" (click)="goToLastPage()">
|
|
137
|
-
<i class="mdi mdi-page-last"></i>
|
|
138
|
-
</button>
|
|
139
|
-
</div>
|
|
140
|
-
</div>
|
|
141
|
-
</div>
|
|
142
|
-
</div>
|
|
143
|
-
|
|
144
|
-
<div class="col-sm-7">
|
|
145
|
-
<div class="alert alert-info" data-test="alert-graphql-query">
|
|
146
|
-
<strong>GraphQL Query:</strong>
|
|
147
|
-
<div [innerHTML]="graphqlQuery" data-test="graphql-query-result"></div>
|
|
148
|
-
</div>
|
|
149
|
-
</div>
|
|
150
|
-
</div>
|
|
151
|
-
|
|
152
|
-
<hr />
|
|
153
|
-
<angular-slickgrid
|
|
154
|
-
gridId="grid6"
|
|
155
|
-
[columns]="columnDefinitions"
|
|
156
|
-
[options]="gridOptions"
|
|
157
|
-
[dataset]="dataset"
|
|
158
|
-
(onAngularGridCreated)="angularGridReady($event.detail)"
|
|
159
|
-
(onGridStateChanged)="gridStateChanged($event.detail)"
|
|
160
|
-
(onBeforeGridDestroy)="saveCurrentGridState()"
|
|
161
|
-
>
|
|
162
|
-
</angular-slickgrid>
|
|
163
|
-
</div>
|