angular-slickgrid 8.14.0 → 9.0.0
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/.gitbook.yaml +5 -0
- package/CHANGELOG.md +1691 -0
- package/CONTRIBUTING.md +17 -0
- package/README.md +13 -50
- package/angular.json +133 -0
- package/coverage/base.css +224 -0
- package/coverage/block-navigation.js +87 -0
- package/coverage/clover.xml +1620 -0
- package/coverage/coverage-final.json +9 -0
- package/coverage/favicon.png +0 -0
- package/coverage/index.html +176 -0
- package/coverage/library/components/angular-slickgrid.component.ts.html +5074 -0
- package/coverage/library/components/index.html +116 -0
- package/coverage/library/constants.ts.html +397 -0
- package/coverage/library/extensions/index.html +116 -0
- package/coverage/library/extensions/slickRowDetailView.ts.html +1261 -0
- package/coverage/library/index.html +116 -0
- package/coverage/library/modules/angular-slickgrid.module.ts.html +166 -0
- package/coverage/library/modules/index.html +116 -0
- package/coverage/library/services/angularUtil.service.ts.html +445 -0
- package/coverage/library/services/container.service.ts.html +163 -0
- package/coverage/library/services/index.html +161 -0
- package/coverage/library/services/translater.service.ts.html +199 -0
- package/coverage/library/services/utilities.ts.html +142 -0
- package/coverage/prettify.css +1 -0
- package/coverage/prettify.js +2 -0
- package/coverage/sort-arrow-sprite.png +0 -0
- package/coverage/sorter.js +196 -0
- package/dist/LICENSE +21 -0
- package/dist/README.md +142 -0
- package/{fesm2022 → dist/fesm2022}/angular-slickgrid.mjs +175 -198
- package/dist/fesm2022/angular-slickgrid.mjs.map +1 -0
- package/{i18n → dist/i18n}/en.json +2 -1
- package/{i18n → dist/i18n}/fr.json +2 -1
- package/{app/modules/angular-slickgrid → dist/library}/components/angular-slickgrid.component.d.ts +9 -9
- package/{app/modules/angular-slickgrid → dist/library}/extensions/slickRowDetailView.d.ts +4 -4
- package/{app/modules/angular-slickgrid → dist/library}/models/angularGridInstance.interface.d.ts +0 -2
- package/dist/library/models/index.d.ts +5 -0
- package/{app/modules/angular-slickgrid → dist/library}/models/rowDetailView.interface.d.ts +1 -1
- package/{app/modules/angular-slickgrid → dist/library}/modules/angular-slickgrid.module.d.ts +1 -1
- package/dist/public_api.d.ts +1 -0
- package/docs/README.md +5 -0
- package/docs/TOC.md +105 -0
- package/docs/backend-services/Custom-Backend-Service.md +50 -0
- package/docs/backend-services/GraphQL.md +276 -0
- package/docs/backend-services/OData.md +245 -0
- package/docs/backend-services/graphql/GraphQL-Filtering.md +156 -0
- package/docs/backend-services/graphql/GraphQL-JSON-Result.md +85 -0
- package/docs/backend-services/graphql/GraphQL-Pagination.md +77 -0
- package/docs/backend-services/graphql/GraphQL-Sorting.md +78 -0
- package/docs/column-functionalities/cell-menu.md +212 -0
- package/docs/column-functionalities/editors/autocomplete-editor.md +466 -0
- package/docs/column-functionalities/editors/date-editor-flatpickr.md +71 -0
- package/docs/column-functionalities/editors/date-editor-vanilla-calendar.md +91 -0
- package/docs/column-functionalities/editors/longtext-editor-textarea.md +80 -0
- package/docs/column-functionalities/editors/select-dropdown-editor.md +227 -0
- package/docs/column-functionalities/editors.md +604 -0
- package/docs/column-functionalities/filters/autocomplete-filter.md +183 -0
- package/docs/column-functionalities/filters/compound-filters.md +234 -0
- package/docs/column-functionalities/filters/custom-filter.md +117 -0
- package/docs/column-functionalities/filters/filter-intro.md +81 -0
- package/docs/column-functionalities/filters/input-filter.md +260 -0
- package/docs/column-functionalities/filters/range-filters.md +188 -0
- package/docs/column-functionalities/filters/select-filter.md +695 -0
- package/docs/column-functionalities/filters/single-search-filter.md +77 -0
- package/docs/column-functionalities/filters/styling-filled-filters.md +45 -0
- package/docs/column-functionalities/formatters.md +325 -0
- package/docs/column-functionalities/sorting.md +200 -0
- package/docs/developer-guides/csp-compliance.md +64 -0
- package/docs/events/Available-Events.md +223 -0
- package/docs/events/Grid-&-DataView-Events.md +211 -0
- package/docs/getting-started/quick-start.md +230 -0
- package/docs/getting-started/troubleshooting.md +80 -0
- package/docs/grid-functionalities/Column-Picker.md +22 -0
- package/docs/grid-functionalities/Composite-Editor-Modal.md +627 -0
- package/docs/grid-functionalities/Context-Menu.md +226 -0
- package/docs/grid-functionalities/Custom-Footer.md +80 -0
- package/docs/grid-functionalities/Custom-Tooltip-(plugin).md +258 -0
- package/docs/grid-functionalities/Export-to-Excel.md +457 -0
- package/docs/grid-functionalities/Export-to-Text-File.md +165 -0
- package/docs/grid-functionalities/FAQ.md +53 -0
- package/docs/grid-functionalities/Global-Options.md +29 -0
- package/docs/grid-functionalities/Grid-Auto-Resize.md +218 -0
- package/docs/grid-functionalities/Grid-Menu.md +134 -0
- package/docs/grid-functionalities/Grid-State-&-Preset.md +245 -0
- package/docs/grid-functionalities/Header-Menu-&-Header-Buttons.md +125 -0
- package/docs/grid-functionalities/Resize-by-Cell-Content.md +138 -0
- package/docs/grid-functionalities/Row-Selection.md +247 -0
- package/docs/grid-functionalities/Row-based-edit.md +71 -0
- package/docs/grid-functionalities/add-update-highlight.md +258 -0
- package/docs/grid-functionalities/column-row-spanning.md +74 -0
- package/docs/grid-functionalities/dynamic-item-metadata.md +124 -0
- package/docs/grid-functionalities/excel-copy-buffer.md +145 -0
- package/docs/grid-functionalities/frozen-columns-rows.md +164 -0
- package/docs/grid-functionalities/grouping-and-aggregators.md +269 -0
- package/docs/grid-functionalities/header-footer-slots.md +22 -0
- package/docs/grid-functionalities/infinite-scroll.md +150 -0
- package/docs/grid-functionalities/providing-grid-data.md +61 -0
- package/docs/grid-functionalities/row-detail.md +530 -0
- package/docs/grid-functionalities/tree-data-grid.md +391 -0
- package/docs/localization/Localization---Component-Sample.md +87 -0
- package/docs/localization/Localization-with-Custom-Locales.md +66 -0
- package/docs/localization/Localization-with-ngx-translate.md +148 -0
- package/docs/migrations/migration-to-2.x.md +304 -0
- package/docs/migrations/migration-to-3.x.md +295 -0
- package/docs/migrations/migration-to-4.x.md +83 -0
- package/docs/migrations/migration-to-5.x.md +160 -0
- package/docs/migrations/migration-to-6.x.md +128 -0
- package/docs/migrations/migration-to-7.x.md +294 -0
- package/docs/migrations/migration-to-8.x.md +316 -0
- package/docs/migrations/migration-to-9.x.md +219 -0
- package/docs/slick-grid-dataview-objects/slickgrid-dataview-objects.md +79 -0
- package/docs/styling/dark-mode.md +100 -0
- package/docs/styling/styling.md +250 -0
- package/docs/testing/testing-patterns.md +73 -0
- package/eslint.config.mjs +60 -0
- package/ng-package.json +10 -0
- package/package.json +24 -48
- package/src/assets/angular-logo.png +0 -0
- package/src/assets/angular-logo2.png +0 -0
- package/src/assets/data/collection_100_numbers.json +12 -0
- package/src/assets/data/collection_500_numbers.json +52 -0
- package/src/assets/data/countries.json +245 -0
- package/src/assets/data/country_names.json +245 -0
- package/src/assets/data/customers_100.json +102 -0
- package/src/assets/data/users.csv +5 -0
- package/src/assets/i18n/en.json +102 -0
- package/src/assets/i18n/fr.json +103 -0
- package/src/demos/app-routing.module.ts +108 -0
- package/src/demos/app.component.html +187 -0
- package/src/demos/app.component.scss +79 -0
- package/src/demos/app.component.ts +11 -0
- package/src/demos/app.module.ts +196 -0
- package/src/demos/environments/environment.dev.ts +3 -0
- package/src/demos/environments/environment.prod.ts +3 -0
- package/src/demos/environments/environment.ts +8 -0
- package/src/demos/examples/custom-angularComponentEditor.ts +187 -0
- package/src/demos/examples/custom-angularComponentFilter.ts +123 -0
- package/src/demos/examples/custom-buttonFormatter.component.ts +13 -0
- package/src/demos/examples/custom-inputEditor.ts +132 -0
- package/src/demos/examples/custom-inputFilter.ts +134 -0
- package/src/demos/examples/custom-titleFormatter.component.ts +9 -0
- package/src/demos/examples/data/collection_100_numbers.json +12 -0
- package/src/demos/examples/data/collection_500_numbers.json +52 -0
- package/src/demos/examples/data/countries.json +245 -0
- package/src/demos/examples/data/country_names.json +245 -0
- package/src/demos/examples/data/customers_100.json +102 -0
- package/src/demos/examples/data/users.csv +5 -0
- package/src/demos/examples/editor-ng-select.component.ts +38 -0
- package/src/demos/examples/example01.component.html +48 -0
- package/src/demos/examples/example01.component.ts +109 -0
- package/src/demos/examples/example02.component.html +45 -0
- package/src/demos/examples/example02.component.ts +218 -0
- package/src/demos/examples/example03.component.html +118 -0
- package/src/demos/examples/example03.component.ts +694 -0
- package/src/demos/examples/example04.component.html +87 -0
- package/src/demos/examples/example04.component.ts +326 -0
- package/src/demos/examples/example05.component.html +151 -0
- package/src/demos/examples/example05.component.ts +474 -0
- package/src/demos/examples/example06.component.html +163 -0
- package/src/demos/examples/example06.component.ts +446 -0
- package/src/demos/examples/example07.component.html +56 -0
- package/src/demos/examples/example07.component.scss +10 -0
- package/src/demos/examples/example07.component.ts +216 -0
- package/src/demos/examples/example08.component.html +51 -0
- package/src/demos/examples/example08.component.scss +23 -0
- package/src/demos/examples/example08.component.ts +195 -0
- package/src/demos/examples/example09.component.html +55 -0
- package/src/demos/examples/example09.component.scss +22 -0
- package/src/demos/examples/example09.component.ts +302 -0
- package/src/demos/examples/example10.component.html +103 -0
- package/src/demos/examples/example10.component.ts +309 -0
- package/src/demos/examples/example11.component.html +91 -0
- package/src/demos/examples/example11.component.ts +276 -0
- package/src/demos/examples/example12.component.html +98 -0
- package/src/demos/examples/example12.component.ts +317 -0
- package/src/demos/examples/example13.component.html +96 -0
- package/src/demos/examples/example13.component.ts +370 -0
- package/src/demos/examples/example14.component.html +50 -0
- package/src/demos/examples/example14.component.scss +11 -0
- package/src/demos/examples/example14.component.ts +156 -0
- package/src/demos/examples/example15.component.html +56 -0
- package/src/demos/examples/example15.component.ts +304 -0
- package/src/demos/examples/example16.component.html +77 -0
- package/src/demos/examples/example16.component.ts +277 -0
- package/src/demos/examples/example17.component.html +50 -0
- package/src/demos/examples/example17.component.ts +109 -0
- package/src/demos/examples/example18.component.html +132 -0
- package/src/demos/examples/example18.component.ts +445 -0
- package/src/demos/examples/example19-rowdetail.component.html +40 -0
- package/src/demos/examples/example19-rowdetail.component.ts +54 -0
- package/src/demos/examples/example19.component.html +79 -0
- package/src/demos/examples/example19.component.ts +316 -0
- package/src/demos/examples/example20.component.html +76 -0
- package/src/demos/examples/example20.component.scss +11 -0
- package/src/demos/examples/example20.component.ts +341 -0
- package/src/demos/examples/example21.component.html +86 -0
- package/src/demos/examples/example21.component.scss +16 -0
- package/src/demos/examples/example21.component.ts +140 -0
- package/src/demos/examples/example22.component.html +41 -0
- package/src/demos/examples/example22.component.ts +117 -0
- package/src/demos/examples/example23.component.html +111 -0
- package/src/demos/examples/example23.component.ts +323 -0
- package/src/demos/examples/example24.component.html +120 -0
- package/src/demos/examples/example24.component.scss +62 -0
- package/src/demos/examples/example24.component.ts +641 -0
- package/src/demos/examples/example25.component.html +60 -0
- package/src/demos/examples/example25.component.scss +8 -0
- package/src/demos/examples/example25.component.ts +255 -0
- package/src/demos/examples/example26.component.html +98 -0
- package/src/demos/examples/example26.component.scss +42 -0
- package/src/demos/examples/example26.component.ts +383 -0
- package/src/demos/examples/example27.component.html +138 -0
- package/src/demos/examples/example27.component.scss +10 -0
- package/src/demos/examples/example27.component.ts +369 -0
- package/src/demos/examples/example28.component.html +143 -0
- package/src/demos/examples/example28.component.scss +54 -0
- package/src/demos/examples/example28.component.ts +453 -0
- package/src/demos/examples/example29.component.html +30 -0
- package/src/demos/examples/example29.component.ts +70 -0
- package/src/demos/examples/example30.component.html +116 -0
- package/src/demos/examples/example30.component.scss +20 -0
- package/src/demos/examples/example30.component.ts +1070 -0
- package/src/demos/examples/example32.component.html +77 -0
- package/src/demos/examples/example32.component.scss +8 -0
- package/src/demos/examples/example32.component.ts +905 -0
- package/src/demos/examples/example33.component.html +50 -0
- package/src/demos/examples/example33.component.scss +46 -0
- package/src/demos/examples/example33.component.ts +571 -0
- package/src/demos/examples/example34.component.html +82 -0
- package/src/demos/examples/example34.component.scss +77 -0
- package/src/demos/examples/example34.component.ts +434 -0
- package/src/demos/examples/example35.component.html +77 -0
- package/src/demos/examples/example35.component.scss +18 -0
- package/src/demos/examples/example35.component.ts +264 -0
- package/src/demos/examples/example36.component.html +56 -0
- package/src/demos/examples/example36.component.scss +26 -0
- package/src/demos/examples/example36.component.ts +504 -0
- package/src/demos/examples/example37.component.html +30 -0
- package/src/demos/examples/example37.component.ts +123 -0
- package/src/demos/examples/example38.component.html +104 -0
- package/src/demos/examples/example38.component.scss +8 -0
- package/src/demos/examples/example38.component.ts +420 -0
- package/src/demos/examples/example39.component.html +112 -0
- package/src/demos/examples/example39.component.scss +8 -0
- package/src/demos/examples/example39.component.ts +371 -0
- package/src/demos/examples/example40.component.html +76 -0
- package/src/demos/examples/example40.component.ts +226 -0
- package/src/demos/examples/example41.component.html +50 -0
- package/src/demos/examples/example41.component.scss +42 -0
- package/src/demos/examples/example41.component.ts +229 -0
- package/src/demos/examples/example42.component.html +47 -0
- package/src/demos/examples/example42.component.ts +203 -0
- package/src/demos/examples/example43.component.html +94 -0
- package/src/demos/examples/example43.component.scss +30 -0
- package/src/demos/examples/example43.component.ts +449 -0
- package/src/demos/examples/example44.component.html +78 -0
- package/src/demos/examples/example44.component.scss +50 -0
- package/src/demos/examples/example44.component.ts +375 -0
- package/src/demos/examples/example45-detail.component.html +15 -0
- package/src/demos/examples/example45-detail.component.ts +97 -0
- package/src/demos/examples/example45.component.html +110 -0
- package/src/demos/examples/example45.component.scss +50 -0
- package/src/demos/examples/example45.component.ts +243 -0
- package/src/demos/examples/filter-ng-select.component.ts +33 -0
- package/src/demos/examples/grid-custom-pager.component.html +60 -0
- package/src/demos/examples/grid-custom-pager.component.scss +57 -0
- package/src/demos/examples/grid-custom-pager.component.ts +107 -0
- package/src/demos/examples/grid-remote.component.html +44 -0
- package/src/demos/examples/grid-remote.component.ts +164 -0
- package/src/demos/examples/home.component.html +39 -0
- package/src/demos/examples/home.component.ts +10 -0
- package/src/demos/examples/jsonp.ts +89 -0
- package/src/demos/examples/rowdetail-preload.component.ts +10 -0
- package/src/demos/examples/swt-common-grid-pagination.component.ts +160 -0
- package/src/demos/examples/swt-common-grid-test.component.html +37 -0
- package/src/demos/examples/swt-common-grid-test.component.ts +214 -0
- package/src/demos/examples/swt-common-grid.component.ts +436 -0
- package/src/demos/examples/swt-logger.service.ts +173 -0
- package/src/demos/examples/utilities.ts +9 -0
- package/src/favicon.ico +0 -0
- package/src/index.html +17 -0
- package/src/library/components/__tests__/angular-slickgrid.component.spec.ts +2638 -0
- package/src/library/components/angular-slickgrid.component.html +5 -0
- package/src/library/components/angular-slickgrid.component.ts +1662 -0
- package/src/library/constants.ts +105 -0
- package/src/library/extensions/__tests__/slickRowDetailView.spec.ts +751 -0
- package/src/library/extensions/index.ts +1 -0
- package/src/library/extensions/slickRowDetailView.ts +395 -0
- package/src/library/global-grid-options.ts +273 -0
- package/src/library/index.ts +11 -0
- package/src/library/models/angularComponentOutput.interface.ts +6 -0
- package/src/library/models/angularGridInstance.interface.ts +76 -0
- package/src/library/models/externalTestingDependencies.interface.ts +37 -0
- package/src/library/models/gridOption.interface.ts +15 -0
- package/src/library/models/index.ts +5 -0
- package/src/library/models/rowDetailView.interface.ts +16 -0
- package/src/library/modules/angular-slickgrid.module.spec.ts +25 -0
- package/src/library/modules/angular-slickgrid.module.ts +27 -0
- package/src/library/services/__tests__/angularUtilService.spec.ts +156 -0
- package/src/library/services/__tests__/container.service.spec.ts +25 -0
- package/src/library/services/__tests__/translater.service.spec.ts +43 -0
- package/src/library/services/__tests__/utilities.spec.ts +22 -0
- package/src/library/services/angularUtil.service.ts +120 -0
- package/src/library/services/container.service.ts +26 -0
- package/src/library/services/index.ts +4 -0
- package/src/library/services/translater.service.ts +38 -0
- package/src/library/services/utilities.ts +19 -0
- package/src/library/slickgrid-config.ts +10 -0
- package/src/main.ts +13 -0
- package/src/public_api.ts +1 -0
- package/src/styles.scss +178 -0
- package/test/cypress/e2e/example01.cy.ts +367 -0
- package/test/cypress/e2e/example02.cy.ts +60 -0
- package/test/cypress/e2e/example03.cy.ts +268 -0
- package/test/cypress/e2e/example04.cy.ts +254 -0
- package/test/cypress/e2e/example05.cy.ts +804 -0
- package/test/cypress/e2e/example06.cy.ts +890 -0
- package/test/cypress/e2e/example07.cy.ts +384 -0
- package/test/cypress/e2e/example08.cy.ts +190 -0
- package/test/cypress/e2e/example09.cy.ts +392 -0
- package/test/cypress/e2e/example10.cy.ts +650 -0
- package/test/cypress/e2e/example11.cy.ts +86 -0
- package/test/cypress/e2e/example12.cy.ts +269 -0
- package/test/cypress/e2e/example13.cy.ts +246 -0
- package/test/cypress/e2e/example14.cy.ts +122 -0
- package/test/cypress/e2e/example15.cy.ts +598 -0
- package/test/cypress/e2e/example16.cy.ts +427 -0
- package/test/cypress/e2e/example17.cy.ts +83 -0
- package/test/cypress/e2e/example18.cy.ts +431 -0
- package/test/cypress/e2e/example19.cy.ts +263 -0
- package/test/cypress/e2e/example20.cy.ts +264 -0
- package/test/cypress/e2e/example21.cy.ts +77 -0
- package/test/cypress/e2e/example22.cy.ts +94 -0
- package/test/cypress/e2e/example23.cy.ts +259 -0
- package/test/cypress/e2e/example24.cy.ts +707 -0
- package/test/cypress/e2e/example25.cy.ts +193 -0
- package/test/cypress/e2e/example26.cy.ts +111 -0
- package/test/cypress/e2e/example27.cy.ts +261 -0
- package/test/cypress/e2e/example28.cy.ts +740 -0
- package/test/cypress/e2e/example29.cy.ts +30 -0
- package/test/cypress/e2e/example30.cy.ts +757 -0
- package/test/cypress/e2e/example31.cy.ts +69 -0
- package/test/cypress/e2e/example32.cy.ts +272 -0
- package/test/cypress/e2e/example33.cy.ts +278 -0
- package/test/cypress/e2e/example34.cy.ts +84 -0
- package/test/cypress/e2e/example35.cy.ts +178 -0
- package/test/cypress/e2e/example36.cy.ts +219 -0
- package/test/cypress/e2e/example37.cy.ts +52 -0
- package/test/cypress/e2e/example38.cy.ts +160 -0
- package/test/cypress/e2e/example39.cy.ts +150 -0
- package/test/cypress/e2e/example40.cy.ts +126 -0
- package/test/cypress/e2e/example41.cy.ts +90 -0
- package/test/cypress/e2e/example42.cy.ts +82 -0
- package/test/cypress/e2e/example43.cy.ts +482 -0
- package/test/cypress/e2e/example44.cy.ts +458 -0
- package/test/cypress/e2e/example45.cy.ts +455 -0
- package/test/cypress/e2e/home.cy.ts +7 -0
- package/test/cypress/fixtures/example.json +5 -0
- package/test/cypress/plugins/index.ts +17 -0
- package/test/cypress/plugins/utilities.ts +28 -0
- package/test/cypress/support/commands.ts +88 -0
- package/test/cypress/support/common.ts +47 -0
- package/test/cypress/support/drag.ts +101 -0
- package/test/cypress/support/index.ts +20 -0
- package/test/cypress/tsconfig.json +9 -0
- package/test/cypress.config.ts +34 -0
- package/test/mockSlickEvent.ts +77 -0
- package/test/rxjsResourceStub.ts +69 -0
- package/test/test-setup.ts +6 -0
- package/test/translateServiceStub.ts +230 -0
- package/test/translaterServiceStub.ts +239 -0
- package/test/tsconfig.json +17 -0
- package/test/vitest-global-mocks.ts +41 -0
- package/test/vitest-global-setup.ts +3 -0
- package/test/vitest-pretest.ts +5 -0
- package/tsconfig.app.json +14 -0
- package/tsconfig.json +31 -0
- package/tsconfig.spec.json +11 -0
- package/types/sortablejs.d.ts +4 -0
- package/vite.config.mts +51 -0
- package/app/modules/angular-slickgrid/models/index.d.ts +0 -5
- package/esm2022/angular-slickgrid.mjs +0 -5
- package/esm2022/app/modules/angular-slickgrid/components/angular-slickgrid.component.mjs +0 -1407
- package/esm2022/app/modules/angular-slickgrid/constants.mjs +0 -96
- package/esm2022/app/modules/angular-slickgrid/extensions/index.mjs +0 -2
- package/esm2022/app/modules/angular-slickgrid/extensions/slickRowDetailView.mjs +0 -301
- package/esm2022/app/modules/angular-slickgrid/global-grid-options.mjs +0 -263
- package/esm2022/app/modules/angular-slickgrid/index.mjs +0 -8
- package/esm2022/app/modules/angular-slickgrid/models/angularComponentOutput.interface.mjs +0 -2
- package/esm2022/app/modules/angular-slickgrid/models/angularGridInstance.interface.mjs +0 -2
- package/esm2022/app/modules/angular-slickgrid/models/externalTestingDependencies.interface.mjs +0 -2
- package/esm2022/app/modules/angular-slickgrid/models/gridOption.interface.mjs +0 -2
- package/esm2022/app/modules/angular-slickgrid/models/index.mjs +0 -6
- package/esm2022/app/modules/angular-slickgrid/models/rowDetailView.interface.mjs +0 -2
- package/esm2022/app/modules/angular-slickgrid/modules/angular-slickgrid.module.mjs +0 -32
- package/esm2022/app/modules/angular-slickgrid/services/angularUtil.service.mjs +0 -88
- package/esm2022/app/modules/angular-slickgrid/services/container.service.mjs +0 -27
- package/esm2022/app/modules/angular-slickgrid/services/index.mjs +0 -5
- package/esm2022/app/modules/angular-slickgrid/services/translater.service.mjs +0 -45
- package/esm2022/app/modules/angular-slickgrid/services/utilities.mjs +0 -19
- package/esm2022/app/modules/angular-slickgrid/slickgrid-config.mjs +0 -8
- package/esm2022/public_api.mjs +0 -2
- package/fesm2022/angular-slickgrid.mjs.map +0 -1
- package/public_api.d.ts +0 -1
- /package/{index.d.ts → dist/index.d.ts} +0 -0
- /package/{app/modules/angular-slickgrid → dist/library}/constants.d.ts +0 -0
- /package/{app/modules/angular-slickgrid → dist/library}/extensions/index.d.ts +0 -0
- /package/{app/modules/angular-slickgrid → dist/library}/global-grid-options.d.ts +0 -0
- /package/{app/modules/angular-slickgrid → dist/library}/index.d.ts +0 -0
- /package/{app/modules/angular-slickgrid → dist/library}/models/angularComponentOutput.interface.d.ts +0 -0
- /package/{app/modules/angular-slickgrid → dist/library}/models/externalTestingDependencies.interface.d.ts +0 -0
- /package/{app/modules/angular-slickgrid → dist/library}/models/gridOption.interface.d.ts +0 -0
- /package/{app/modules/angular-slickgrid → dist/library}/services/angularUtil.service.d.ts +0 -0
- /package/{app/modules/angular-slickgrid → dist/library}/services/container.service.d.ts +0 -0
- /package/{app/modules/angular-slickgrid → dist/library}/services/index.d.ts +0 -0
- /package/{app/modules/angular-slickgrid → dist/library}/services/translater.service.d.ts +0 -0
- /package/{app/modules/angular-slickgrid → dist/library}/services/utilities.d.ts +0 -0
- /package/{app/modules/angular-slickgrid → dist/library}/slickgrid-config.d.ts +0 -0
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
#### index
|
|
2
|
+
- [Default Usage](#default-usage)
|
|
3
|
+
- [Action Callback Methods](#action-callback-methods-preferred-approach)
|
|
4
|
+
- [Override Callback Methods](#override-callback-methods)
|
|
5
|
+
- [How to add Translations](#how-to-add-translations)
|
|
6
|
+
- [How to Disable Cell Menu](#how-to-disable-the-cell-menu)
|
|
7
|
+
- [UI Sample](#ui-sample)
|
|
8
|
+
|
|
9
|
+
### Demo
|
|
10
|
+
[Demo](https://ghiscoding.github.io/Angular-Slickgrid/#/context) / [Demo Component](https://github.com/ghiscoding/slickgrid-universal/blob/master/frameworks/angular-slickgrid/src/demos/examples/grid-contextmenu.component.ts)
|
|
11
|
+
|
|
12
|
+
### Description
|
|
13
|
+
A Cell Menu, most often used as an Action Menu and is more oriented on a row action (e.g. delete current row), it could be defined on 1 or more columns (defined in a column definition) and is triggered by a cell click or touch. The menu can show a list of Commands (to execute an action) and/or Options (to change the value of a field). Also note that the Commands list is following the same structure used in the [Context Menu](../grid-functionalities/Context-Menu.md), [Header Menu](../grid-functionalities/Header-Menu-&-Header-Buttons.md) & [Grid Menu](../grid-functionalities/Grid-Menu.md). The Cell Menu is very similar to the [Context Menu](../grid-functionalities/Context-Menu.md), both were create as SlickGrid plugins during the same period, their main difference is that they get triggered differently (cell click vs mouse right+click) and they serve different purposes. The Cell Menu is more oriented on a row action (e.g. delete current row) while the Context Menu is all about actions for the entire grid (e.g. export to Excel).
|
|
14
|
+
|
|
15
|
+
This extensions is wrapped around the new SlickGrid Plugin **SlickCellMenu**
|
|
16
|
+
|
|
17
|
+
### Default Usage
|
|
18
|
+
To use the Cell Menu, you will need to enable it in the Grid Options and also define its structure in the chose column. You can customize the menu with 2 different lists, Commands and/or Options, they can be used separately or at the same time (same as [Context Menu](../grid-functionalities/Context-Menu.md)). However please note that you will also need to use a Custom Formatter to display the Action button/text, it's easy enough as you can see below. Also note that even though the code shown below makes a separation between the Commands and Options, you can mix them in the same Cell Menu.
|
|
19
|
+
|
|
20
|
+
#### with Commands
|
|
21
|
+
```ts
|
|
22
|
+
this.columnDefinitions = [
|
|
23
|
+
{ id: 'firstName', field: 'firstName', name: 'First Name' },
|
|
24
|
+
{ id: 'lastName', field: 'lastName', name: 'Last Name' },
|
|
25
|
+
// ... more column defs
|
|
26
|
+
{
|
|
27
|
+
id: 'action', name: 'Action', field: 'action', width: 110, maxWidth: 200,
|
|
28
|
+
excludeFromExport: true, // you typically don't want this column exported
|
|
29
|
+
formatter: actionFormatter, // your Custom Formatter
|
|
30
|
+
cellMenu: {
|
|
31
|
+
commandTitle: 'Commands', // optional title
|
|
32
|
+
commandItems: [
|
|
33
|
+
// array of command item objects, you can also use the "positionOrder" that will be used to sort the items in the list
|
|
34
|
+
{
|
|
35
|
+
command: 'command1', title: 'Command 1', positionOrder: 61,
|
|
36
|
+
// you can use the "action" callback and/or use "onCommand" callback from the grid options, they both have the same arguments
|
|
37
|
+
action: (e, args) => {
|
|
38
|
+
console.log(args.dataContext, args.column); // action callback.. do something
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
{ command: 'help', title: 'HELP', iconCssClass: 'mdi mdi-help-circle', positionOrder: 62 },
|
|
42
|
+
// you can add sub-menus by adding nested `commandItems`
|
|
43
|
+
{
|
|
44
|
+
// we can also have multiple nested sub-menus
|
|
45
|
+
command: 'export', title: 'Exports', positionOrder: 99,
|
|
46
|
+
commandItems: [
|
|
47
|
+
{ command: 'exports-txt', title: 'Text (tab delimited)' },
|
|
48
|
+
{
|
|
49
|
+
command: 'sub-menu', title: 'Excel', cssClass: 'green', subMenuTitle: 'available formats', subMenuTitleCssClass: 'text-italic orange',
|
|
50
|
+
commandItems: [
|
|
51
|
+
{ command: 'exports-csv', title: 'Excel (csv)' },
|
|
52
|
+
{ command: 'exports-xlsx', title: 'Excel (xlsx)' },
|
|
53
|
+
]
|
|
54
|
+
}
|
|
55
|
+
]
|
|
56
|
+
},
|
|
57
|
+
],
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
]
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
#### with Options
|
|
64
|
+
That is when you want to define a list of Options (only 1 list) that the user can choose from and once an option is selected we would do something (for example change the value of a cell in the grid).
|
|
65
|
+
```ts
|
|
66
|
+
this.columnDefinitions = [
|
|
67
|
+
{ id: 'firstName', field: 'firstName', name: 'First Name' },
|
|
68
|
+
{ id: 'lastName', field: 'lastName', name: 'Last Name' },
|
|
69
|
+
// ... more column defs
|
|
70
|
+
{
|
|
71
|
+
id: 'action', name: 'Action', field: 'action', width: 110, maxWidth: 200,
|
|
72
|
+
excludeFromExport: true, // you typically don't want this column exported
|
|
73
|
+
formatter: actionFormatter, // your Custom Formatter
|
|
74
|
+
cellMenu: {
|
|
75
|
+
optionTitle: 'Change Effort Driven Flag', // optional, add title
|
|
76
|
+
optionItems: [
|
|
77
|
+
{ option: true, title: 'True', iconCssClass: 'mdi mdi-check-box-outline' },
|
|
78
|
+
{ option: false, title: 'False', iconCssClass: 'mdi mdi-checkbox-blank-outline' },
|
|
79
|
+
{ divider: true, command: '', positionOrder: 60 },
|
|
80
|
+
],
|
|
81
|
+
// subscribe to Context Menu onOptionSelected event (or use the "action" callback on each option)
|
|
82
|
+
action: (e, args) => {
|
|
83
|
+
console.log(args.dataContext, args.column); // action callback.. do something
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### Action Callback Methods (preferred approach)
|
|
91
|
+
There are 2 ways to execute an action after a Command is clicked (or an Option is selected), you could do it via the `action` callback or via the `onCommand` callback. You might be wondering why 2 and what's the difference? Well, the `action` would have to be defined on every single Command/Option while the `onCommand` (or `onOptionSelected`) is more of a global subscriber which gets triggered every time any of the Command/Option is clicked/selected, so for that, you would typically need to use `if/else` or a `switch/case`... hmm ok but I still don't understand when would I use the `onCommand`? Let say you combine the Cell Menu with the [Context Menu](../grid-functionalities/Context-Menu.md) and some of the commands are the same, well, in that case, it might be better to use the `onCommand` and centralize your commands in that callback, while in most other cases if you wish to do only 1 thing with a command, then using the `action` might be better. Also, note that they could also both be used if you wish.
|
|
92
|
+
|
|
93
|
+
So if you decide to use the `action` callback, then your code would look like this
|
|
94
|
+
##### with `action` callback
|
|
95
|
+
```ts
|
|
96
|
+
this.columnDefinitions = [
|
|
97
|
+
{ id: 'action', field: 'action', name: 'Action',
|
|
98
|
+
cellMenu: {
|
|
99
|
+
commandItems: [
|
|
100
|
+
{ command: 'command1', title: 'Command 1', action: (e, args) => console.log(args) },
|
|
101
|
+
{ command: 'command2', title: 'Command 2', action: (e, args) => console.log(args) }
|
|
102
|
+
// ...
|
|
103
|
+
]
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
];
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
##### with `onCommand` callback
|
|
110
|
+
The `onCommand` (or `onOptionSelected`) **must** be defined in the Grid Options
|
|
111
|
+
|
|
112
|
+
```ts
|
|
113
|
+
this.columnDefinitions = [
|
|
114
|
+
{ id: 'action', field: 'action', name: 'Action',
|
|
115
|
+
cellMenu: {
|
|
116
|
+
commandItems: [
|
|
117
|
+
{ command: 'command1', title: 'Command 1' },
|
|
118
|
+
{ command: 'command2', title: 'Command 2' }
|
|
119
|
+
// ...
|
|
120
|
+
]
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
];
|
|
124
|
+
|
|
125
|
+
this.gridOptions = {
|
|
126
|
+
enableCellMenu: true,
|
|
127
|
+
cellMenu: {
|
|
128
|
+
onCommand(e, args) => {
|
|
129
|
+
const columnDef = args.columnDef;
|
|
130
|
+
const command = args.command;
|
|
131
|
+
const dataContext = args.dataContext;
|
|
132
|
+
|
|
133
|
+
switch (command) {
|
|
134
|
+
case 'command1': alert('Command 1'); break;
|
|
135
|
+
case 'command2': alert('Command 2'); break;
|
|
136
|
+
default: break;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### Override Callback Methods
|
|
144
|
+
What if you want to dynamically disable or hide a Command/Option or even disable the entire menu in certain circumstances? For these cases, you would use the override callback methods, the method must return a `boolean`. The list of override available are the following
|
|
145
|
+
- `menuUsabilityOverride` returning false would make the Cell Menu unavailable to the user
|
|
146
|
+
- `itemVisibilityOverride` returning false would hide the item (command/option) from the list
|
|
147
|
+
- `itemUsabilityOverride` return false would disabled the item (command/option) from the list
|
|
148
|
+
- **note** there is also a `disabled` property that you could use, however it is defined at the beginning while the override is meant to be used with certain logic dynamically.
|
|
149
|
+
|
|
150
|
+
For example, say we want the Cell Menu to only be available on the first 20 rows of the grid, we could use the override this way
|
|
151
|
+
```ts
|
|
152
|
+
this.columnDefinitions = [
|
|
153
|
+
{ id: 'action', field: 'action', name: 'Action',
|
|
154
|
+
cellMenu: {
|
|
155
|
+
menuUsabilityOverride: (args) => {
|
|
156
|
+
const dataContext = args && args.dataContext;
|
|
157
|
+
return (dataContext.id < 21); // say we want to display the menu only from Task 0 to 20
|
|
158
|
+
},
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
];
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
To give another example, with Options this time, we could say that we enable the `n/a` option only when the row is Completed. So we could do it this way
|
|
165
|
+
```ts
|
|
166
|
+
this.columnDefinitions = [
|
|
167
|
+
{ id: 'action', field: 'action', name: 'Action',
|
|
168
|
+
cellMenu: {
|
|
169
|
+
optionItems: [
|
|
170
|
+
{
|
|
171
|
+
option: 0, title: 'n/a', textCssClass: 'italic',
|
|
172
|
+
// only enable this option when the task is Not Completed
|
|
173
|
+
itemUsabilityOverride: (args) => {
|
|
174
|
+
const dataContext = args && args.dataContext;
|
|
175
|
+
return !dataContext.completed;
|
|
176
|
+
},
|
|
177
|
+
{ option: 1, iconCssClass: 'mdi mdi-star-outline yellow', title: 'Low' },
|
|
178
|
+
{ option: 2, iconCssClass: 'mdi mdi-star orange', title: 'Medium' },
|
|
179
|
+
{ option: 3, iconCssClass: 'mdi mdi-star red', title: 'High' },
|
|
180
|
+
]
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
];
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
### How to add Translations?
|
|
187
|
+
It works exactly like the rest of the library when `enableTranslate` is set, all we have to do is to provide translations with the `Key` suffix, so for example without translations, we would use `title` and that would become `titleKey` with translations, that;'s easy enough. So for example, a list of Options could be defined as follow:
|
|
188
|
+
```ts
|
|
189
|
+
this.columnDefinitions = [
|
|
190
|
+
{ id: 'action', field: 'action', name: 'Action',
|
|
191
|
+
cellMenu: {
|
|
192
|
+
optionTitleKey: 'COMMANDS', // optionally pass a title to show over the Options
|
|
193
|
+
optionItems: [
|
|
194
|
+
{ option: 1, titleKey: 'LOW', iconCssClass: 'mdi mdi-star-outline yellow' },
|
|
195
|
+
{ option: 2, titleKey: 'MEDIUM', iconCssClass: 'mdi mdi-star orange' },
|
|
196
|
+
{ option: 3, titleKey: 'HIGH', iconCssClass: 'mdi mdi-star red' },
|
|
197
|
+
]
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
];
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
### How to Disable the Cell Menu?
|
|
204
|
+
You can disable the Cell Menu, by calling `enableCellMenu: false` from the Grid Options.
|
|
205
|
+
```ts
|
|
206
|
+
this.gridOptions = {
|
|
207
|
+
enableCellMenu: false
|
|
208
|
+
};
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
### UI Sample
|
|
212
|
+

|
|
@@ -0,0 +1,466 @@
|
|
|
1
|
+
#### Index
|
|
2
|
+
- [Using fixed `collection` or `collectionAsync`](#using-collection-or-collectionasync)
|
|
3
|
+
- [Editor Options (`AutocompleterOption` interface)](#editor-options-autocompleteroption-interface)
|
|
4
|
+
- [Using Remote API](#using-external-remote-api)
|
|
5
|
+
- [Basic Usage](#remote-api-basic)
|
|
6
|
+
- [Basic Usage with Object Result (**preferred way**)](#remote-api-basic-with-object-result)
|
|
7
|
+
- [with `renderItem` + custom Layout (`twoRows` or `fourCorners`)](#remote-api-renderitem-callback--custom-layout-tworows-or-fourcorners)
|
|
8
|
+
- [Custom Styling - SASS variables](https://github.com/ghiscoding/slickgrid-universal/blob/master/packages/common/src/styles/_variables.scss#L141)
|
|
9
|
+
- [Force User Input](#autocomplete---force-user-input)
|
|
10
|
+
- [How to change drop container dimensions?](#how-to-change-drop-container-dimensions)
|
|
11
|
+
- [Animated Gif Demo](#animated-gif-demo)
|
|
12
|
+
- See the [Editors - Wiki](../Editors.md) for more general info about Editors (validators, event handlers, ...)
|
|
13
|
+
|
|
14
|
+
### Demo
|
|
15
|
+
[Demo Page](https://ghiscoding.github.io/Angular-Slickgrid/#/editor) | [Demo Component](https://github.com/ghiscoding/slickgrid-universal/blob/master/frameworks/angular-slickgrid/src/demos/examples/grid-editor.component.ts)
|
|
16
|
+
|
|
17
|
+
### Introduction
|
|
18
|
+
AutoComplete is a functionality that let the user start typing characters and the autocomplete will try to give suggestions according to the characters entered. The collection can be a fixed JSON files (collection of strings or objects) or can also be an external remote resource to an external API. For a demo of what that could look like, take a look at the [animated gif demo](#animated-gif-demo) below.
|
|
19
|
+
|
|
20
|
+
We use an external lib named [Autocomplete](https://github.com/kraaden/autocomplete) (aka `autocompleter` on npm) by Kraaden.
|
|
21
|
+
|
|
22
|
+
## Using `collection` or `collectionAsync`
|
|
23
|
+
If you want to pass the entire list to the AutoComplete (like a JSON file or a Web API call), you can do so using the `collection` or the `collectionAsync` (the latter will load it asynchronously). You can also see that the Editor and Filter have almost the exact same configuration (apart from the `model` that is obviously different).
|
|
24
|
+
|
|
25
|
+
##### Component
|
|
26
|
+
```typescript
|
|
27
|
+
export class GridBasicComponent {
|
|
28
|
+
columnDefinitions: Column[];
|
|
29
|
+
gridOptions: GridOption;
|
|
30
|
+
dataset: any[];
|
|
31
|
+
|
|
32
|
+
defineGrid(): void {
|
|
33
|
+
// your columns definition
|
|
34
|
+
this.columnDefinitions = [
|
|
35
|
+
{
|
|
36
|
+
id: 'countryOfOrigin', name: 'Country of Origin', field: 'countryOfOrigin',
|
|
37
|
+
formatter: Formatters.complexObject,
|
|
38
|
+
dataKey: 'code', // our list of objects has the structure { code: 'CA', name: 'Canada' }, since we want to use the code`, we will set the dataKey to "code"
|
|
39
|
+
labelKey: 'name', // while the displayed value is "name"
|
|
40
|
+
type: 'object',
|
|
41
|
+
sorter: Sorters.objectString, // since we have set dataKey to "code" our output type will be a string, and so we can use this objectString, this sorter always requires the dataKey
|
|
42
|
+
filterable: true,
|
|
43
|
+
sortable: true,
|
|
44
|
+
minWidth: 100,
|
|
45
|
+
editor: {
|
|
46
|
+
model: Editors.autocompleter,
|
|
47
|
+
customStructure: { label: 'name', value: 'code' },
|
|
48
|
+
collectionAsync: this.http.get('assets/data/countries.json'), // this demo will load the JSON file asynchronously
|
|
49
|
+
},
|
|
50
|
+
filter: {
|
|
51
|
+
model: Filters.autocompleter,
|
|
52
|
+
customStructure: { label: 'name', value: 'code' },
|
|
53
|
+
collectionAsync: this.http.get('assets/data/countries.json'),
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
];
|
|
57
|
+
|
|
58
|
+
this.gridOptions = {
|
|
59
|
+
// your grid options config
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Collection Label Render HTML
|
|
66
|
+
By default HTML is not rendered and the `label` will simply show HTML as text. But in some cases you might want to render it, you can do so by enabling the `enableRenderHtml` flag.
|
|
67
|
+
|
|
68
|
+
**NOTE:** this is currently only used by the Editors that have a `collection` which are the `MultipleSelect` & `SingleSelect` Editors.
|
|
69
|
+
|
|
70
|
+
```typescript
|
|
71
|
+
this.columnDefinitions = [
|
|
72
|
+
{
|
|
73
|
+
id: 'effort-driven', name: 'Effort Driven', field: 'effortDriven',
|
|
74
|
+
formatter: Formatters.checkmarkMaterial,
|
|
75
|
+
type: 'boolean',
|
|
76
|
+
editor: {
|
|
77
|
+
model: Editors.autocompleter,
|
|
78
|
+
placeholder: '🔍 search city',
|
|
79
|
+
|
|
80
|
+
// example with a fixed Collection (or collectionAsync)
|
|
81
|
+
// previously known as `editorOptions` for < 9.0
|
|
82
|
+
options: {
|
|
83
|
+
showOnFocus: true, // display the list on focus of the autocomplete (without the need to type anything)
|
|
84
|
+
} as AutocompleterOption,
|
|
85
|
+
enableRenderHtml: true, // this flag only works with a fixed Collection
|
|
86
|
+
// collectionAsync: this.http.get(URL_COUNTRIES_COLLECTION),
|
|
87
|
+
collection: [
|
|
88
|
+
{ value: '', label: '' },
|
|
89
|
+
{ value: true, label: 'True', labelPrefix: `<i class="mdi mdi-plus"></i> ` },
|
|
90
|
+
{ value: false, label: 'False', labelPrefix: `<i class="mdi mdi-minus"></i> ` }
|
|
91
|
+
],
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
];
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### Editor Options (`AutocompleterOption` interface)
|
|
98
|
+
All the available options that can be provided as editor `options` to your column definitions can be found under this [AutocompleterOption interface](https://github.com/ghiscoding/slickgrid-universal/blob/master/packages/common/src/interfaces/autocompleterOption.interface.ts) and you should cast your editor `options` to that interface to make sure that you use only valid options of the autocomplete library.
|
|
99
|
+
|
|
100
|
+
```ts
|
|
101
|
+
editor: {
|
|
102
|
+
model: Editors.autocompleter,
|
|
103
|
+
// previously known as `editorOptions` for < 9.0
|
|
104
|
+
options: {
|
|
105
|
+
minLength: 3,
|
|
106
|
+
} as AutocompleterOption
|
|
107
|
+
}
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
#### Grid Option `defaultEditorOptions
|
|
111
|
+
You could also define certain options as a global level (for the entire grid or even all grids) by taking advantage of the `defaultEditorOptions` Grid Option. Note that they are set via the editor type as a key name (`autocompleter`, `date`, ...) and then the content is the same as editor `options` (also note that each key is already typed with the correct editor option interface), for example
|
|
112
|
+
|
|
113
|
+
```ts
|
|
114
|
+
this.gridOptions = {
|
|
115
|
+
defaultEditorOptions: {
|
|
116
|
+
autocompleter: { debounceWaitMs: 150 }, // typed as AutocompleterOption
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
## Using External Remote API
|
|
122
|
+
You could also use external 3rd party Web API (can be JSONP query or regular JSON). This will make a much shorter result since it will only return a small subset of what will be displayed in the AutoComplete Editor or Filter. For example, we could use GeoBytes which provide a JSONP Query API for the cities of the world, you can imagine the entire list of cities would be way too big to download locally, so this is why we use such API.
|
|
123
|
+
|
|
124
|
+
### Remote API (basic)
|
|
125
|
+
The basic functionality will use built-in 3rd party lib styling that is to display a label/value pair item result.
|
|
126
|
+
|
|
127
|
+
##### Component
|
|
128
|
+
```typescript
|
|
129
|
+
export class GridBasicComponent {
|
|
130
|
+
columnDefinitions: Column[];
|
|
131
|
+
gridOptions: GridOption;
|
|
132
|
+
dataset: any[];
|
|
133
|
+
|
|
134
|
+
defineGrid() {
|
|
135
|
+
// your columns definition
|
|
136
|
+
this.columnDefinitions = [
|
|
137
|
+
{
|
|
138
|
+
id: 'product', name: 'Product', field: 'product',
|
|
139
|
+
filterable: true,
|
|
140
|
+
minWidth: 100,
|
|
141
|
+
editor: {
|
|
142
|
+
model: Editors.autocompleter,
|
|
143
|
+
alwaysSaveOnEnterKey: true,
|
|
144
|
+
// previously known as `editorOptions` for < 9.0
|
|
145
|
+
options: {
|
|
146
|
+
showOnFocus: true,
|
|
147
|
+
minLength: 1,
|
|
148
|
+
fetch: (searchText, updateCallback) => {
|
|
149
|
+
// assuming your API call returns a label/value pair
|
|
150
|
+
yourAsyncApiCall(searchText) // typically you'll want to return no more than 10 results
|
|
151
|
+
.then(result => updateCallback((results.length > 0) ? results : [{ label: 'No match found.', value: '' }]))
|
|
152
|
+
.catch(error => console.log('Error:', error));
|
|
153
|
+
},
|
|
154
|
+
}
|
|
155
|
+
} as AutocompleterOption,
|
|
156
|
+
},
|
|
157
|
+
];
|
|
158
|
+
|
|
159
|
+
this.gridOptions = {
|
|
160
|
+
// your grid options config
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
### Remote API (basic with object result)
|
|
167
|
+
This is the preferred way of dealing with the AutoComplete, the main reason is because the AutoComplete uses an `<input/>` and that means we can only keep 1 value and if we do then we lose the text label and so using an Object Result makes more sense. Note however that you'll need a bit more code that is because we'll use the `'object'` and so we need to provide a custom `SortComparer` and also a custom `Formatters` and for them to work we also need to provide a `dataKey` (the value) and a `labelKey` (text label) as shown below.
|
|
168
|
+
```ts
|
|
169
|
+
this.columnDefinitions = [
|
|
170
|
+
{
|
|
171
|
+
id: 'product', name: 'Product', field: 'product',
|
|
172
|
+
dataKey: 'id',
|
|
173
|
+
labelKey: 'name', // (id/name) pair to override default (value/label) pair
|
|
174
|
+
editor: {
|
|
175
|
+
model: Editors.autocompleter,
|
|
176
|
+
alwaysSaveOnEnterKey: true,
|
|
177
|
+
type: 'object',
|
|
178
|
+
sortComparer: SortComparers.objectString,
|
|
179
|
+
options: {
|
|
180
|
+
showOnFocus: true,
|
|
181
|
+
minLength: 1,
|
|
182
|
+
fetch: (searchText, updateCallback) => {
|
|
183
|
+
// assuming your API call returns a label/value pair
|
|
184
|
+
yourAsyncApiCall(searchText) // typically you'll want to return no more than 10 results
|
|
185
|
+
.then(result => updateCallback((results.length > 0) ? results : [{ label: 'No match found.', value: '' }]))
|
|
186
|
+
.catch(error => console.log('Error:', error));
|
|
187
|
+
}
|
|
188
|
+
},
|
|
189
|
+
} as AutocompleterOption,
|
|
190
|
+
}
|
|
191
|
+
];
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
### Remote API with `renderItem` + custom layout (`twoRows` or `fourCorners`)
|
|
195
|
+
#### See animated gif ([twoRows](#with-tworows-custom-layout-without-optional-left-icon) or [fourCorners](#with-fourcorners-custom-layout-with-extra-optional-left-icon))
|
|
196
|
+
The lib comes with 2 built-in custom layouts, these 2 layouts also have SASS variables if anyone wants to style it differently. When using the `renderItem`, it will require the user to provide a `layout` (2 possible options `twoRows` or `fourCorners`) and also a `templateCallback` that will be executed when rendering the AutoComplete Search List Item. For example:
|
|
197
|
+
|
|
198
|
+
##### Component
|
|
199
|
+
```typescript
|
|
200
|
+
export class GridBasicComponent {
|
|
201
|
+
columnDefinitions: Column[];
|
|
202
|
+
gridOptions: GridOption;
|
|
203
|
+
dataset: any[];
|
|
204
|
+
|
|
205
|
+
defineGrid() {
|
|
206
|
+
// your columns definition
|
|
207
|
+
this.columnDefinitions = [
|
|
208
|
+
{
|
|
209
|
+
id: 'product', name: 'Product', field: 'product',
|
|
210
|
+
filterable: true,
|
|
211
|
+
minWidth: 100,
|
|
212
|
+
editor: {
|
|
213
|
+
model: Editors.autocompleter,
|
|
214
|
+
alwaysSaveOnEnterKey: true,
|
|
215
|
+
customStructure: {
|
|
216
|
+
label: 'itemName',
|
|
217
|
+
value: 'id'
|
|
218
|
+
},
|
|
219
|
+
// previously known as `editorOptions` for < 9.0
|
|
220
|
+
options: {
|
|
221
|
+
showOnFocus: true,
|
|
222
|
+
minLength: 1,
|
|
223
|
+
fetch: (searchText, updateCallback) => {
|
|
224
|
+
yourAsyncApiCall(searchText) // typically you'll want to return no more than 10 results
|
|
225
|
+
.then(result => updateCallback((results.length > 0) ? results : [{ label: 'No match found.', value: '' }]))
|
|
226
|
+
.catch(error => console.log('Error:', error));
|
|
227
|
+
}
|
|
228
|
+
},
|
|
229
|
+
renderItem: {
|
|
230
|
+
layout: 'twoRows',
|
|
231
|
+
templateCallback: (item: any) => `<div class="autocomplete-container-list">
|
|
232
|
+
<div class="autocomplete-left">
|
|
233
|
+
<span class="mdi ${item.icon} mdi-26px"></span>
|
|
234
|
+
</div>
|
|
235
|
+
<div>
|
|
236
|
+
<span class="autocomplete-top-left">
|
|
237
|
+
<span class="mdi ${item.itemTypeName === 'I' ? 'mdi-information-outline' : 'mdi-content-copy'} mdi-14px"></span>
|
|
238
|
+
${item.itemName}
|
|
239
|
+
</span>
|
|
240
|
+
<div>
|
|
241
|
+
</div>
|
|
242
|
+
<div>
|
|
243
|
+
<div class="autocomplete-bottom-left">${item.itemNameTranslated}</div>
|
|
244
|
+
</div>`,
|
|
245
|
+
},
|
|
246
|
+
} as AutocompleterOption,
|
|
247
|
+
},
|
|
248
|
+
];
|
|
249
|
+
|
|
250
|
+
this.gridOptions = {
|
|
251
|
+
// your grid options config
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
### Remote API `renderItem` callback + custom layout (`twoRows` or `fourCorners`)
|
|
258
|
+
#### See animated gif ([twoRows](#with-tworows-custom-layout-without-optional-left-icon) or [fourCorners](#with-fourcorners-custom-layout-with-extra-optional-left-icon))
|
|
259
|
+
The previous example can also be written using the `renderItem` callback and adding `classes`, this is actually what Slickgrid-Universal does internally, you can do it yourself if you wish to have more control on the render callback result.
|
|
260
|
+
|
|
261
|
+
##### Component
|
|
262
|
+
```typescript
|
|
263
|
+
export class GridBasicComponent {
|
|
264
|
+
columnDefinitions: Column[];
|
|
265
|
+
gridOptions: GridOption;
|
|
266
|
+
dataset: any[];
|
|
267
|
+
|
|
268
|
+
defineGrid() {
|
|
269
|
+
// your columns definition
|
|
270
|
+
this.columnDefinitions = [
|
|
271
|
+
{
|
|
272
|
+
id: 'product', name: 'Product', field: 'product',
|
|
273
|
+
filterable: true,
|
|
274
|
+
minWidth: 100,
|
|
275
|
+
editor: {
|
|
276
|
+
model: Editors.autocompleter,
|
|
277
|
+
alwaysSaveOnEnterKey: true,
|
|
278
|
+
customStructure: {
|
|
279
|
+
label: 'itemName',
|
|
280
|
+
value: 'id'
|
|
281
|
+
},
|
|
282
|
+
// previously known as `editorOptions` for < 9.0
|
|
283
|
+
options: {
|
|
284
|
+
showOnFocus: true,
|
|
285
|
+
minLength: 1,
|
|
286
|
+
classes: {
|
|
287
|
+
// choose a custom style layout
|
|
288
|
+
// 'ui-autocomplete': 'autocomplete-custom-two-rows',
|
|
289
|
+
'ui-autocomplete': 'autocomplete-custom-four-corners',
|
|
290
|
+
},
|
|
291
|
+
fetch: (searchText, updateCallback) => {
|
|
292
|
+
yourAsyncApiCall(searchText) // typically you'll want to return no more than 10 results
|
|
293
|
+
.then(result => updateCallback((results.length > 0) ? results : [{ label: 'No match found.', value: '' }]))
|
|
294
|
+
.catch(error => console.log('Error:', error);
|
|
295
|
+
},
|
|
296
|
+
renderItem: {
|
|
297
|
+
layout: 'twoRows',
|
|
298
|
+
templateCallback: (item: any) => `<div class="autocomplete-container-list">
|
|
299
|
+
<div class="autocomplete-left">
|
|
300
|
+
<span class="mdi ${item.icon} mdi-26px"></span>
|
|
301
|
+
</div>
|
|
302
|
+
<div>
|
|
303
|
+
<span class="autocomplete-top-left">
|
|
304
|
+
<span class="mdi ${item.itemTypeName === 'I' ? 'mdi-information-outline' : 'mdi-content-copy'} mdi-14px"></span>
|
|
305
|
+
${item.itemName}
|
|
306
|
+
</span>
|
|
307
|
+
<div>
|
|
308
|
+
</div>
|
|
309
|
+
<div>
|
|
310
|
+
<div class="autocomplete-bottom-left">${item.itemNameTranslated}</div>
|
|
311
|
+
</div>`,
|
|
312
|
+
},
|
|
313
|
+
} as AutocompleterOption,
|
|
314
|
+
callbacks: {
|
|
315
|
+
// callback on the AutoComplete on the instance
|
|
316
|
+
renderItem: {
|
|
317
|
+
templateCallback: (item: any) => {
|
|
318
|
+
return `<div class="autocomplete-container-list">
|
|
319
|
+
<div class="autocomplete-left">
|
|
320
|
+
<!--<img src="http://i.stack.imgur.com/pC1Tv.jpg" width="50" />-->
|
|
321
|
+
<span class="mdi ${item.icon} mdi-26px"></span>
|
|
322
|
+
</div>
|
|
323
|
+
<div>
|
|
324
|
+
<span class="autocomplete-top-left">
|
|
325
|
+
<span class="mdi ${item.itemTypeName === 'I' ? 'mdi-information-outline' : 'mdi-content-copy'} mdi-14px"></span>
|
|
326
|
+
${item.itemName}
|
|
327
|
+
</span>
|
|
328
|
+
<span class="autocomplete-top-right">${formatNumber(item.listPrice, 2, 2, false, '$')}</span>
|
|
329
|
+
<div>
|
|
330
|
+
</div>
|
|
331
|
+
<div>
|
|
332
|
+
<div class="autocomplete-bottom-left">${item.itemNameTranslated}</div>
|
|
333
|
+
<span class="autocomplete-bottom-right">Type: <b>${item.itemTypeName === 'I' ? 'Item' : item.itemTypeName === 'C' ? 'PdCat' : 'Cat'}</b></span>
|
|
334
|
+
</div>`;
|
|
335
|
+
}
|
|
336
|
+
},
|
|
337
|
+
},
|
|
338
|
+
}
|
|
339
|
+
];
|
|
340
|
+
|
|
341
|
+
this.gridOptions = {
|
|
342
|
+
// your grid options config
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
#### with JSONP
|
|
349
|
+
Example from an external remote API (geobytes) returning a JSONP response.
|
|
350
|
+
|
|
351
|
+
##### Component
|
|
352
|
+
```typescript
|
|
353
|
+
export class GridBasicComponent {
|
|
354
|
+
columnDefinitions: Column[];
|
|
355
|
+
gridOptions: GridOption;
|
|
356
|
+
dataset: any[];
|
|
357
|
+
|
|
358
|
+
defineGrid(): void {
|
|
359
|
+
// your columns definition
|
|
360
|
+
this.columnDefinitions = [
|
|
361
|
+
{
|
|
362
|
+
id: 'cityOfOrigin', name: 'City of Origin', field: 'cityOfOrigin',
|
|
363
|
+
filterable: true,
|
|
364
|
+
minWidth: 100,
|
|
365
|
+
editor: {
|
|
366
|
+
model: Editors.autocompleter,
|
|
367
|
+
placeholder: 'search city', // you can provide an optional placeholder to help your users
|
|
368
|
+
|
|
369
|
+
// use your own autocomplete options, instead of $.ajax, use http
|
|
370
|
+
// here we use $.ajax just because I'm not sure how to configure http with JSONP and CORS
|
|
371
|
+
options: {
|
|
372
|
+
minLength: 3, // minimum count of character that the user needs to type before it queries to the remote
|
|
373
|
+
fetch: (searchText, updateCallback) => {
|
|
374
|
+
// assuming your API call returns a label/value pair
|
|
375
|
+
yourAsyncApiCall(searchText) // typically you'll want to return no more than 10 results
|
|
376
|
+
.then(result => updateCallback((results.length > 0) ? results : [{ label: 'No match found.', value: '' }]))
|
|
377
|
+
.catch(error => console.log('Error:', error));
|
|
378
|
+
}
|
|
379
|
+
},
|
|
380
|
+
},
|
|
381
|
+
filter: {
|
|
382
|
+
model: Editors.autocompleter,
|
|
383
|
+
// placeholder: '🔍 search city', // 🔍 is a search icon, this provide an option placeholder
|
|
384
|
+
|
|
385
|
+
// use your own autocomplete options, instead of $.ajax, use http
|
|
386
|
+
// here we use $.ajax just because I'm not sure how to configure http with JSONP and CORS
|
|
387
|
+
options: {
|
|
388
|
+
minLength: 3, // minimum count of character that the user needs to type before it queries to the remote
|
|
389
|
+
fetch: (searchText, updateCallback) => {
|
|
390
|
+
// assuming your API call returns a label/value pair
|
|
391
|
+
yourAsyncApiCall(searchText) // typically you'll want to return no more than 10 results
|
|
392
|
+
.then(result => updateCallback((results.length > 0) ? results : [{ label: 'No match found.', value: '' }]))
|
|
393
|
+
.catch(error => console.log('Error:', error));
|
|
394
|
+
}
|
|
395
|
+
},
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
];
|
|
399
|
+
|
|
400
|
+
this.gridOptions = {
|
|
401
|
+
// your grid options config
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
```
|
|
406
|
+
|
|
407
|
+
## Autocomplete - force user input
|
|
408
|
+
If you want to add the autocomplete functionality but want the user to be able to input a new option, then follow the example below:
|
|
409
|
+
|
|
410
|
+
```ts
|
|
411
|
+
this.columnDefinitions = [{
|
|
412
|
+
id: 'area',
|
|
413
|
+
name: 'Area',
|
|
414
|
+
field: 'area',
|
|
415
|
+
editor: {
|
|
416
|
+
model: Editors.autocompleter,
|
|
417
|
+
options: {
|
|
418
|
+
minLength: 0,
|
|
419
|
+
forceUserInput: true,
|
|
420
|
+
fetch: (searchText, updateCallback) => {
|
|
421
|
+
updateCallback(this.areas); // add here the array
|
|
422
|
+
},
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
},
|
|
426
|
+
];
|
|
427
|
+
```
|
|
428
|
+
You can also use the `minLength` to limit the autocomplete text to `0` characters or more, the default number is `3`.
|
|
429
|
+
|
|
430
|
+
### How to change drop container dimensions?
|
|
431
|
+
You might want to change the dimensions of the drop container, this 3rd party library has a `customize` method to deal with such a thing. Slickgrid-Universal itself is removing the width using this method, you can however override this method to change the drop container dimensions
|
|
432
|
+
|
|
433
|
+
```ts
|
|
434
|
+
this.columnDefinitions = [
|
|
435
|
+
{
|
|
436
|
+
id: 'product', name: 'Product', field: 'product', filterable: true,
|
|
437
|
+
editor: {
|
|
438
|
+
model: Editors.autocompleter,
|
|
439
|
+
alwaysSaveOnEnterKey: true,
|
|
440
|
+
|
|
441
|
+
// example with a Remote API call
|
|
442
|
+
options: {
|
|
443
|
+
minLength: 1,
|
|
444
|
+
fetch: (searchTerm, callback) => {
|
|
445
|
+
// ...
|
|
446
|
+
},
|
|
447
|
+
customize: (_input, _inputRect, container) => {
|
|
448
|
+
// change drop container dimensions
|
|
449
|
+
container.style.width = '250px';
|
|
450
|
+
container.style.height = '325px';
|
|
451
|
+
},
|
|
452
|
+
} as AutocompleterOption,
|
|
453
|
+
},
|
|
454
|
+
}
|
|
455
|
+
];
|
|
456
|
+
```
|
|
457
|
+
|
|
458
|
+
## Animated Gif Demo
|
|
459
|
+
### Basic (default layout)
|
|
460
|
+

|
|
461
|
+
|
|
462
|
+
### with `twoRows` custom layout (without optional left icon)
|
|
463
|
+

|
|
464
|
+
|
|
465
|
+
### with `fourCorners` custom layout (with extra optional left icon)
|
|
466
|
+

|