@salesforce/ui-bundle-template-feature-angular-search 0.0.0-stage → 12.14.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/LICENSE.txt +82 -0
- package/README.md +75 -2
- package/dist/.forceignore +15 -0
- package/dist/.husky/pre-commit +4 -0
- package/dist/.prettierignore +11 -0
- package/dist/.prettierrc +17 -0
- package/dist/CHANGELOG.md +5375 -0
- package/dist/README.md +83 -0
- package/dist/config/project-scratch-def.json +13 -0
- package/dist/eslint.config.js +7 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/.forceignore +15 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/.graphqlrc.yml +2 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/.postcssrc.json +5 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/.prettierignore +8 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/.prettierrc +12 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/CHANGELOG.md +4 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/README.md +85 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/angular.json +98 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/codegen.yml +95 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/components.json +6 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/e2e/app.spec.ts +15 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/esbuild/api-version.mjs +17 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/esbuild/graphql-codegen.mjs +13 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/eslint-plugin-angular-graphql.js +148 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/eslint.config.js +77 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/feature-angular-search.uibundle-meta.xml +7 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/middleware/html.mjs +3 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/middleware/proxy.mjs +12 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/package.json +69 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/playwright.config.ts +25 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/public/favicon.ico +0 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/scripts/get-graphql-schema.mjs +69 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/scripts/rewrite-e2e-assets.mjs +30 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/api/data-client.service.spec.ts +184 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/api/data-client.service.ts +74 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/app.config.ts +20 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/app.html +1 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/app.routes.ts +27 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/app.spec.ts +18 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/app.ts +15 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/components/layout/app-layout/app-layout.html +51 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/components/layout/app-layout/app-layout.spec.ts +63 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/components/layout/app-layout/app-layout.ts +27 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/components/ui/alert/alert.html +27 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/components/ui/alert/alert.ts +41 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/components/ui/button/button.html +27 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/components/ui/button/button.ts +59 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/components/ui/card/card.ts +100 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/components/ui/collapsible/collapsible.html +38 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/components/ui/collapsible/collapsible.ts +21 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/components/ui/date-picker/date-picker.html +20 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/components/ui/date-picker/date-picker.ts +49 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/components/ui/date-range-picker/date-range-picker.html +20 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/components/ui/date-range-picker/date-range-picker.ts +69 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/components/ui/dialog/dialog.html +20 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/components/ui/dialog/dialog.ts +40 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/components/ui/dropdown-menu/dropdown-menu.html +20 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/components/ui/dropdown-menu/dropdown-menu.ts +100 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/components/ui/field/field.html +15 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/components/ui/field/field.ts +28 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/components/ui/field-appearance.ts +8 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/components/ui/field-size.ts +8 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/components/ui/icon/icon.ts +118 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/components/ui/input/input.html +34 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/components/ui/input/input.ts +79 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/components/ui/label/label.ts +21 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/components/ui/paginator/paginator.html +74 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/components/ui/paginator/paginator.ts +93 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/components/ui/paginator/types.ts +13 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/components/ui/popover/popover.html +13 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/components/ui/popover/popover.ts +37 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/components/ui/select/select.html +36 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/components/ui/select/select.ts +63 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/components/ui/separator/separator.ts +31 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/components/ui/skeleton/skeleton.ts +20 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/components/ui/spinner/spinner.ts +28 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/features/search/adapters/registry.ts +28 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/features/search/adapters/sobject/index.ts +19 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/features/search/adapters/sobject/parse-response.ts +57 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/features/search/adapters/sobject/query-fragment.ts +169 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/features/search/adapters/types.ts +44 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/features/search/api/search-response.spec.ts +114 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/features/search/api/search-response.ts +73 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/features/search/api/search.service.spec.ts +124 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/features/search/api/search.service.ts +80 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/features/search/components/active-filters/active-filters.html +23 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/features/search/components/active-filters/active-filters.spec.ts +73 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/features/search/components/active-filters/active-filters.ts +77 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/features/search/components/filter-panel/default-filter-panel.html +49 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/features/search/components/filter-panel/default-filter-panel.ts +87 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/features/search/components/filter-panel/filter-box.html +13 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/features/search/components/filter-panel/filter-box.ts +39 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/features/search/components/global-search-box/global-search-box.html +16 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/features/search/components/global-search-box/global-search-box.ts +50 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/features/search/components/results/default-result-row.html +19 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/features/search/components/results/default-result-row.ts +91 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/features/search/components/results/merged-search-results.html +99 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/features/search/components/results/merged-search-results.ts +145 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/features/search/components/results/result-item.ts +53 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/features/search/components/results/search-results.html +10 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/features/search/components/results/search-results.ts +33 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/features/search/components/results/source-section.html +84 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/features/search/components/results/source-section.ts +146 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/features/search/components/scope/scope-selector.html +9 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/features/search/components/scope/scope-selector.ts +45 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/features/search/components/search/search.html +55 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/features/search/components/search/search.ts +118 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/features/search/components/search-bar/search-bar.html +10 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/features/search/components/search-bar/search-bar.spec.ts +65 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/features/search/components/search-bar/search-bar.ts +72 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/features/search/components/sort-control/sort-control.html +24 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/features/search/components/sort-control/sort-control.spec.ts +67 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/features/search/components/sort-control/sort-control.ts +59 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/features/search/constants.ts +17 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/features/search/default-search-config.ts +83 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/features/search/directives/search-result-template/search-result-template.ts +44 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/features/search/filters/boolean-filter.html +8 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/features/search/filters/boolean-filter.spec.ts +41 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/features/search/filters/boolean-filter.ts +42 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/features/search/filters/date-filter.html +20 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/features/search/filters/date-filter.spec.ts +56 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/features/search/filters/date-filter.ts +78 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/features/search/filters/date-range-filter.html +43 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/features/search/filters/date-range-filter.spec.ts +70 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/features/search/filters/date-range-filter.ts +125 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/features/search/filters/filter-field-wrapper.html +16 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/features/search/filters/filter-field-wrapper.spec.ts +28 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/features/search/filters/filter-field-wrapper.ts +24 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/features/search/filters/filter-types.spec.ts +27 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/features/search/filters/filter-types.ts +64 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/features/search/filters/multi-select-filter.html +11 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/features/search/filters/multi-select-filter.spec.ts +42 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/features/search/filters/multi-select-filter.ts +42 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/features/search/filters/numeric-range-filter.html +32 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/features/search/filters/numeric-range-filter.spec.ts +75 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/features/search/filters/numeric-range-filter.ts +117 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/features/search/filters/select-filter.html +8 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/features/search/filters/select-filter.spec.ts +43 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/features/search/filters/select-filter.ts +40 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/features/search/filters/text-filter.html +9 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/features/search/filters/text-filter.spec.ts +54 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/features/search/filters/text-filter.ts +70 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/features/search/index.ts +55 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/features/search/query/build-search-query.spec.ts +157 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/features/search/query/build-search-query.ts +95 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/features/search/state/filter-mapping.ts +48 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/features/search/state/search-state.service.spec.ts +293 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/features/search/state/search-state.service.ts +735 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/features/search/state/search-state.types.ts +48 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/features/search/types/filter.types.ts +57 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/features/search/types/index.ts +11 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/features/search/types/scope.types.ts +10 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/features/search/types/search-config.types.ts +110 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/features/search/types/search-result.types.ts +68 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/features/search/types/sort.types.ts +15 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/features/search/utils/debounce.ts +23 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/features/search/utils/field-utils.ts +20 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/features/search/utils/filter-utils.spec.ts +335 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/features/search/utils/filter-utils.ts +354 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/features/search/utils/identifier.ts +19 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/features/search/utils/merge-utils.spec.ts +199 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/features/search/utils/merge-utils.ts +177 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/features/search/utils/scope-utils.ts +19 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/features/search/utils/sort-utils.ts +32 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/features/search/utils/validate-config.spec.ts +48 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/features/search/utils/validate-config.ts +34 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/pages/home/home.html +6 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/pages/home/home.spec.ts +23 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/pages/home/home.ts +13 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/pages/not-found/not-found.html +12 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/pages/not-found/not-found.spec.ts +33 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/pages/not-found/not-found.ts +15 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/pages/search/search-page.html +5 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/pages/search/search-page.ts +19 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/alert/hlm-alert-action.ts +14 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/alert/hlm-alert-description.ts +17 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/alert/hlm-alert-title.ts +17 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/alert/hlm-alert.ts +35 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/alert/index.ts +16 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/button/hlm-button.token.ts +22 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/button/hlm-button.ts +72 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/button/index.ts +6 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/calendar/hlm-calendar-multi.ts +195 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/calendar/hlm-calendar-range.ts +194 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/calendar/hlm-calendar.ts +189 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/calendar/hlm-month-year-calendar.ts +119 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/calendar/index.ts +16 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/card/hlm-card-action.ts +12 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/card/hlm-card-avatar.ts +14 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/card/hlm-card-content.ts +12 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/card/hlm-card-description.ts +12 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/card/hlm-card-footer.ts +12 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/card/hlm-card-header.ts +15 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/card/hlm-card-title.ts +12 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/card/hlm-card.token.ts +19 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/card/hlm-card.ts +22 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/card/index.ts +28 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/collapsible/hlm-collapsible-content.ts +14 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/collapsible/hlm-collapsible-trigger.ts +9 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/collapsible/hlm-collapsible.ts +15 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/collapsible/index.ts +13 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/date-picker/hlm-date-multi-input.ts +104 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/date-picker/hlm-date-picker-anchor.ts +23 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/date-picker/hlm-date-picker-input.ts +118 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/date-picker/hlm-date-picker-multi.token.ts +109 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/date-picker/hlm-date-picker-multi.ts +220 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/date-picker/hlm-date-picker-trigger.ts +104 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/date-picker/hlm-date-picker.token.ts +69 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/date-picker/hlm-date-picker.ts +203 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/date-picker/hlm-date-range-input.ts +120 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/date-picker/hlm-date-range-picker.token.ts +86 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/date-picker/hlm-date-range-picker.ts +252 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/date-picker/hlm-month-year-input.ts +105 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/date-picker/hlm-month-year-picker.token.ts +89 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/date-picker/hlm-month-year-picker.ts +196 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/date-picker/index.ts +38 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/dialog/hlm-dialog-close.ts +9 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/dialog/hlm-dialog-content.ts +74 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/dialog/hlm-dialog-description.ts +17 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/dialog/hlm-dialog-footer.ts +15 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/dialog/hlm-dialog-header.ts +12 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/dialog/hlm-dialog-overlay.ts +27 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/dialog/hlm-dialog-portal.ts +8 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/dialog/hlm-dialog-title.ts +14 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/dialog/hlm-dialog-trigger.ts +14 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/dialog/hlm-dialog.service.ts +46 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/dialog/hlm-dialog.ts +24 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/dialog/index.ts +35 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/dropdown-menu/hlm-dropdown-menu-checkbox-indicator.ts +21 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/dropdown-menu/hlm-dropdown-menu-checkbox.ts +54 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/dropdown-menu/hlm-dropdown-menu-focus-on-hover.ts +35 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/dropdown-menu/hlm-dropdown-menu-group.ts +14 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/dropdown-menu/hlm-dropdown-menu-item-sub-indicator.ts +19 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/dropdown-menu/hlm-dropdown-menu-item.ts +42 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/dropdown-menu/hlm-dropdown-menu-label.ts +20 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/dropdown-menu/hlm-dropdown-menu-radio-indicator.ts +21 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/dropdown-menu/hlm-dropdown-menu-radio.ts +49 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/dropdown-menu/hlm-dropdown-menu-separator.ts +12 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/dropdown-menu/hlm-dropdown-menu-shortcut.ts +15 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/dropdown-menu/hlm-dropdown-menu-sub-trigger.ts +52 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/dropdown-menu/hlm-dropdown-menu-sub.ts +53 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/dropdown-menu/hlm-dropdown-menu-token.ts +26 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/dropdown-menu/hlm-dropdown-menu-trigger.ts +46 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/dropdown-menu/hlm-dropdown-menu.ts +57 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/dropdown-menu/index.ts +49 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/field/hlm-field-content.ts +12 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/field/hlm-field-description.ts +53 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/field/hlm-field-error.ts +100 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/field/hlm-field-group.ts +15 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/field/hlm-field-label.ts +17 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/field/hlm-field-legend.ts +19 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/field/hlm-field-separator.ts +24 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/field/hlm-field-set.ts +15 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/field/hlm-field-title.ts +15 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/field/hlm-field.ts +47 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/field/index.ts +34 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/input/hlm-input.ts +21 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/input/index.ts +5 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/input-group/hlm-input-group-addon.ts +40 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/input-group/hlm-input-group-button.ts +47 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/input-group/hlm-input-group-input.ts +17 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/input-group/hlm-input-group-text.ts +14 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/input-group/hlm-input-group.ts +18 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/input-group/index.ts +19 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/label/hlm-label.ts +17 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/label/index.ts +5 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/label/label.html +11 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/pagination/hlm-numbered-pagination-query-params.ts +191 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/pagination/hlm-numbered-pagination.ts +290 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/pagination/hlm-pagination-content.ts +12 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/pagination/hlm-pagination-ellipsis.ts +27 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/pagination/hlm-pagination-item.ts +7 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/pagination/hlm-pagination-link.ts +51 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/pagination/hlm-pagination-next.ts +65 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/pagination/hlm-pagination-previous.ts +65 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/pagination/hlm-pagination.ts +19 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/pagination/index.ts +31 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/popover/hlm-popover-content.ts +25 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/popover/hlm-popover-description.ts +12 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/popover/hlm-popover-header.ts +12 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/popover/hlm-popover-portal.ts +8 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/popover/hlm-popover-title.ts +12 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/popover/hlm-popover-trigger.ts +14 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/popover/hlm-popover.ts +23 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/popover/index.ts +25 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/select/hlm-select-content.ts +44 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/select/hlm-select-group.ts +14 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/select/hlm-select-item.ts +36 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/select/hlm-select-label.ts +14 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/select/hlm-select-multiple.ts +37 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/select/hlm-select-placeholder.ts +17 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/select/hlm-select-portal.ts +8 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/select/hlm-select-scroll-down.ts +22 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/select/hlm-select-scroll-up.ts +22 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/select/hlm-select-separator.ts +14 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/select/hlm-select-trigger.ts +59 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/select/hlm-select-value-template.ts +5 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/select/hlm-select-value.ts +18 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/select/hlm-select-values-content.ts +9 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/select/hlm-select-values.ts +5 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/select/hlm-select.ts +37 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/select/index.ts +52 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/separator/hlm-separator.ts +19 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/separator/index.ts +5 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/skeleton/hlm-skeleton.ts +14 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/skeleton/index.ts +5 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/spinner/hlm-spinner.ts +26 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/spinner/index.ts +5 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/utils/hlm.ts +313 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/utils/index.ts +2 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/shared/utils/provide-spartan-hlm.ts +34 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/app/utils/async-data.ts +99 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/index.html +13 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/main.ts +5 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/styles.css +139 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/src/types/sf-globals.d.ts +9 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/tsconfig.app.json +11 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/tsconfig.json +36 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/tsconfig.spec.json +10 -0
- package/dist/force-app/main/default/uiBundles/feature-angular-search/ui-bundle.json +7 -0
- package/dist/jest.config.js +6 -0
- package/dist/package-lock.json +12554 -0
- package/dist/package.json +46 -0
- package/dist/scripts/apex/hello.apex +10 -0
- package/dist/scripts/gitignore-templates.json +4 -0
- package/dist/scripts/graphql-search.sh +191 -0
- package/dist/scripts/network-senders.mjs +84 -0
- package/dist/scripts/org-setup-config-schema.mjs +132 -0
- package/dist/scripts/org-setup-dev.mjs +114 -0
- package/dist/scripts/org-setup-url.mjs +108 -0
- package/dist/scripts/org-setup-utils.mjs +569 -0
- package/dist/scripts/org-setup-xml.mjs +283 -0
- package/dist/scripts/org-setup.config.json +5 -0
- package/dist/scripts/org-setup.mjs +2545 -0
- package/dist/scripts/sf-project-setup.mjs +103 -0
- package/dist/scripts/soql/account.soql +6 -0
- package/dist/scripts/validate-org-setup-config.mjs +38 -0
- package/dist/sfdx-project.json +12 -0
- package/package.json +43 -4
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026, Salesforce, Inc.,
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
* For full license text, see the LICENSE.txt file
|
|
5
|
+
*/
|
|
6
|
+
import { TestBed } from "@angular/core/testing";
|
|
7
|
+
import { FilterFieldWrapperComponent } from "./filter-field-wrapper";
|
|
8
|
+
|
|
9
|
+
describe("FilterFieldWrapperComponent", () => {
|
|
10
|
+
function create(inputs: Record<string, unknown>) {
|
|
11
|
+
const fixture = TestBed.createComponent(FilterFieldWrapperComponent);
|
|
12
|
+
for (const [k, v] of Object.entries(inputs)) fixture.componentRef.setInput(k, v);
|
|
13
|
+
fixture.detectChanges();
|
|
14
|
+
return fixture.nativeElement as HTMLElement;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
it("renders help text", () => {
|
|
18
|
+
expect(create({ label: "Name", helpText: "Help" }).textContent).toContain("Help");
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
it("renders error as an alert with the given id and hides help text", () => {
|
|
22
|
+
const el = create({ label: "Name", helpText: "Help", error: "Bad", errorId: "e1" });
|
|
23
|
+
const alert = el.querySelector("[role=alert]");
|
|
24
|
+
expect(alert?.textContent).toContain("Bad");
|
|
25
|
+
expect(alert?.id).toBe("e1");
|
|
26
|
+
expect(el.textContent).not.toContain("Help");
|
|
27
|
+
});
|
|
28
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026, Salesforce, Inc.,
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
* For full license text, see the LICENSE.txt file
|
|
5
|
+
*/
|
|
6
|
+
import { ChangeDetectionStrategy, Component, input } from "@angular/core";
|
|
7
|
+
import { LabelComponent } from "../../../components/ui/label/label";
|
|
8
|
+
|
|
9
|
+
/** Label + control + help/error text chrome shared by every filter input. */
|
|
10
|
+
@Component({
|
|
11
|
+
selector: "app-filter-field-wrapper",
|
|
12
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
13
|
+
imports: [LabelComponent],
|
|
14
|
+
templateUrl: "./filter-field-wrapper.html",
|
|
15
|
+
})
|
|
16
|
+
export class FilterFieldWrapperComponent {
|
|
17
|
+
readonly label = input<string>("");
|
|
18
|
+
/** Id of the control the label points at. */
|
|
19
|
+
readonly htmlFor = input<string | null>(null);
|
|
20
|
+
readonly helpText = input<string | undefined>(undefined);
|
|
21
|
+
readonly error = input<string | undefined>(undefined);
|
|
22
|
+
/** Id for the error paragraph, so controls can reference it via aria-describedby. */
|
|
23
|
+
readonly errorId = input<string | null>(null);
|
|
24
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026, Salesforce, Inc.,
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
* For full license text, see the LICENSE.txt file
|
|
5
|
+
*/
|
|
6
|
+
import { toDate, toDateString, uniqueFilterId } from "./filter-types";
|
|
7
|
+
|
|
8
|
+
describe("filter-types", () => {
|
|
9
|
+
it("round-trips local dates without timezone drift", () => {
|
|
10
|
+
const d = toDate("2026-03-05");
|
|
11
|
+
expect(d?.getFullYear()).toBe(2026);
|
|
12
|
+
expect(d?.getMonth()).toBe(2);
|
|
13
|
+
expect(d?.getDate()).toBe(5);
|
|
14
|
+
expect(toDateString(d)).toBe("2026-03-05");
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
it("returns null / empty for invalid input", () => {
|
|
18
|
+
expect(toDate(undefined)).toBeNull();
|
|
19
|
+
expect(toDate("nope")).toBeNull();
|
|
20
|
+
expect(toDateString(null)).toBe("");
|
|
21
|
+
expect(toDateString(new Date(202, 0, 1))).toBe("");
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
it("generates unique ids", () => {
|
|
25
|
+
expect(uniqueFilterId("x")).not.toBe(uniqueFilterId("x"));
|
|
26
|
+
});
|
|
27
|
+
});
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026, Salesforce, Inc.,
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
* For full license text, see the LICENSE.txt file
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Value contract shared by the state-agnostic filter inputs in this folder.
|
|
9
|
+
* Each input receives the current `FilterValue` (or `undefined` when inactive)
|
|
10
|
+
* and emits the next one, `undefined` meaning "clear this filter". The
|
|
11
|
+
* integrator (SearchStateService / DefaultFilterPanel) maps this to/from the
|
|
12
|
+
* canonical search filter type.
|
|
13
|
+
*/
|
|
14
|
+
export interface FilterValue {
|
|
15
|
+
/** Scalar value: text, picklist, comma-joined multipicklist, "true"/"false". */
|
|
16
|
+
value?: string;
|
|
17
|
+
/** Lower bound (numeric / date range), as a string. */
|
|
18
|
+
min?: string;
|
|
19
|
+
/** Upper bound (numeric / date range), as a string. */
|
|
20
|
+
max?: string;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface FilterOption {
|
|
24
|
+
value: string;
|
|
25
|
+
label: string;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Which comparison chrome date filters show: `range` = Between only,
|
|
30
|
+
* `comparison` = After/Before, `both` = all three.
|
|
31
|
+
*/
|
|
32
|
+
export type DateFilterMode = "range" | "comparison" | "both";
|
|
33
|
+
|
|
34
|
+
/** Trailing debounce for free-typing inputs (text, numeric). */
|
|
35
|
+
export const FILTER_DEBOUNCE_MS = 300;
|
|
36
|
+
|
|
37
|
+
let nextId = 0;
|
|
38
|
+
/** Unique DOM id for label/control association. */
|
|
39
|
+
export function uniqueFilterId(prefix: string): string {
|
|
40
|
+
return `${prefix}-${nextId++}`;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** Parses `YYYY-MM-DD` (or any ISO date) as a local-time `Date`, or `null`. */
|
|
44
|
+
export function toDate(value: string | undefined): Date | null {
|
|
45
|
+
if (!value) return null;
|
|
46
|
+
const parts = value.split("T")[0].split("-");
|
|
47
|
+
if (parts.length === 3) {
|
|
48
|
+
const [y, m, d] = parts.map((p) => Number(p));
|
|
49
|
+
const dt = new Date(y, m - 1, d);
|
|
50
|
+
return isNaN(dt.getTime()) ? null : dt;
|
|
51
|
+
}
|
|
52
|
+
const dt = new Date(value);
|
|
53
|
+
return isNaN(dt.getTime()) ? null : dt;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/** Formats a `Date` as local `YYYY-MM-DD`; `""` for invalid/partially typed years. */
|
|
57
|
+
export function toDateString(date: Date | null | undefined): string {
|
|
58
|
+
if (!date || isNaN(date.getTime())) return "";
|
|
59
|
+
const y = date.getFullYear();
|
|
60
|
+
if (y < 1000 || y > 9999) return "";
|
|
61
|
+
const m = String(date.getMonth() + 1).padStart(2, "0");
|
|
62
|
+
const d = String(date.getDate()).padStart(2, "0");
|
|
63
|
+
return `${y}-${m}-${d}`;
|
|
64
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<app-filter-field-wrapper [label]="label()" [htmlFor]="selectId" [helpText]="helpText()">
|
|
2
|
+
<app-select
|
|
3
|
+
multiple
|
|
4
|
+
[label]="label()"
|
|
5
|
+
[size]="size()"
|
|
6
|
+
[options]="options()"
|
|
7
|
+
[placeholder]="placeholder()"
|
|
8
|
+
[values]="selected()"
|
|
9
|
+
(valuesChange)="onChange($event)"
|
|
10
|
+
/>
|
|
11
|
+
</app-filter-field-wrapper>
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026, Salesforce, Inc.,
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
* For full license text, see the LICENSE.txt file
|
|
5
|
+
*/
|
|
6
|
+
import { TestBed } from "@angular/core/testing";
|
|
7
|
+
import { By } from "@angular/platform-browser";
|
|
8
|
+
import { SelectComponent } from "../../../components/ui/select/select";
|
|
9
|
+
import { MultiSelectFilterComponent } from "./multi-select-filter";
|
|
10
|
+
import type { FilterValue } from "./filter-types";
|
|
11
|
+
|
|
12
|
+
describe("MultiSelectFilterComponent", () => {
|
|
13
|
+
function setup() {
|
|
14
|
+
const fixture = TestBed.createComponent(MultiSelectFilterComponent);
|
|
15
|
+
fixture.componentRef.setInput("label", "Industry");
|
|
16
|
+
fixture.componentRef.setInput("options", [
|
|
17
|
+
{ value: "a", label: "A" },
|
|
18
|
+
{ value: "b", label: "B" },
|
|
19
|
+
]);
|
|
20
|
+
const emitted: (FilterValue | undefined)[] = [];
|
|
21
|
+
fixture.componentInstance.valueChange.subscribe((v) => emitted.push(v));
|
|
22
|
+
fixture.detectChanges();
|
|
23
|
+
const select = fixture.debugElement.query(By.directive(SelectComponent))
|
|
24
|
+
.componentInstance as SelectComponent;
|
|
25
|
+
return { fixture, select, emitted };
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
it("parses the comma-joined value into the selection", () => {
|
|
29
|
+
const { fixture, select } = setup();
|
|
30
|
+
fixture.componentRef.setInput("value", { value: "a,b" });
|
|
31
|
+
fixture.detectChanges();
|
|
32
|
+
expect(select.values()).toEqual(["a", "b"]);
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
it("joins selections and clears when empty", () => {
|
|
36
|
+
const { fixture, select, emitted } = setup();
|
|
37
|
+
select.values.set(["a", "b"]);
|
|
38
|
+
select.values.set([]);
|
|
39
|
+
fixture.detectChanges();
|
|
40
|
+
expect(emitted).toEqual([{ value: "a,b" }, undefined]);
|
|
41
|
+
});
|
|
42
|
+
});
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026, Salesforce, Inc.,
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
* For full license text, see the LICENSE.txt file
|
|
5
|
+
*/
|
|
6
|
+
import { ChangeDetectionStrategy, Component, computed, input, output } from "@angular/core";
|
|
7
|
+
import type { AppFieldSize } from "../../../components/ui/field-size";
|
|
8
|
+
import { SelectComponent } from "../../../components/ui/select/select";
|
|
9
|
+
import { uniqueFilterId, type FilterOption, type FilterValue } from "./filter-types";
|
|
10
|
+
import { FilterFieldWrapperComponent } from "./filter-field-wrapper";
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Multi-select picklist filter. Presentation lives in `app-select multiple`;
|
|
14
|
+
* this bridges its `string[]` to the comma-joined `value` contract.
|
|
15
|
+
*/
|
|
16
|
+
@Component({
|
|
17
|
+
selector: "app-multi-select-filter",
|
|
18
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
19
|
+
imports: [SelectComponent, FilterFieldWrapperComponent],
|
|
20
|
+
templateUrl: "./multi-select-filter.html",
|
|
21
|
+
})
|
|
22
|
+
export class MultiSelectFilterComponent {
|
|
23
|
+
readonly label = input.required<string>();
|
|
24
|
+
readonly options = input<readonly FilterOption[]>([]);
|
|
25
|
+
readonly value = input<FilterValue | undefined>(undefined);
|
|
26
|
+
readonly helpText = input<string | undefined>(undefined);
|
|
27
|
+
readonly size = input<AppFieldSize>("default");
|
|
28
|
+
readonly valueChange = output<FilterValue | undefined>();
|
|
29
|
+
|
|
30
|
+
protected readonly selectId = uniqueFilterId("filter-multiselect");
|
|
31
|
+
|
|
32
|
+
protected readonly selected = computed<string[]>(() => {
|
|
33
|
+
const raw = this.value()?.value;
|
|
34
|
+
return raw ? raw.split(",").filter(Boolean) : [];
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
protected readonly placeholder = computed(() => `Select ${this.label().toLowerCase()}`);
|
|
38
|
+
|
|
39
|
+
protected onChange(next: readonly string[]): void {
|
|
40
|
+
this.valueChange.emit(next.length ? { value: next.join(",") } : undefined);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
<app-filter-field-wrapper
|
|
2
|
+
[label]="label()"
|
|
3
|
+
[helpText]="helpText()"
|
|
4
|
+
[error]="errorMessage()"
|
|
5
|
+
[errorId]="errorId"
|
|
6
|
+
>
|
|
7
|
+
<div class="flex items-center gap-2" role="group" [attr.aria-label]="label()">
|
|
8
|
+
<app-input
|
|
9
|
+
class="flex-1"
|
|
10
|
+
type="number"
|
|
11
|
+
placeholder="Min"
|
|
12
|
+
[id]="baseId + '-min'"
|
|
13
|
+
[ariaLabel]="label() + ' minimum'"
|
|
14
|
+
[ariaDescribedby]="hasError() ? errorId : ''"
|
|
15
|
+
[error]="minOutOfBounds() || inverted()"
|
|
16
|
+
[value]="draftMin()"
|
|
17
|
+
(valueChange)="onMin($event)"
|
|
18
|
+
/>
|
|
19
|
+
<span class="text-sm text-muted-foreground" aria-hidden="true">–</span>
|
|
20
|
+
<app-input
|
|
21
|
+
class="flex-1"
|
|
22
|
+
type="number"
|
|
23
|
+
placeholder="Max"
|
|
24
|
+
[id]="baseId + '-max'"
|
|
25
|
+
[ariaLabel]="label() + ' maximum'"
|
|
26
|
+
[ariaDescribedby]="hasError() ? errorId : ''"
|
|
27
|
+
[error]="maxOutOfBounds() || inverted()"
|
|
28
|
+
[value]="draftMax()"
|
|
29
|
+
(valueChange)="onMax($event)"
|
|
30
|
+
/>
|
|
31
|
+
</div>
|
|
32
|
+
</app-filter-field-wrapper>
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026, Salesforce, Inc.,
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
* For full license text, see the LICENSE.txt file
|
|
5
|
+
*/
|
|
6
|
+
import { TestBed } from "@angular/core/testing";
|
|
7
|
+
import { By } from "@angular/platform-browser";
|
|
8
|
+
import { afterEach, beforeEach, vi } from "vitest";
|
|
9
|
+
import { InputComponent } from "../../../components/ui/input/input";
|
|
10
|
+
import { NumericRangeFilterComponent } from "./numeric-range-filter";
|
|
11
|
+
import { FILTER_DEBOUNCE_MS, type FilterValue } from "./filter-types";
|
|
12
|
+
|
|
13
|
+
describe("NumericRangeFilterComponent", () => {
|
|
14
|
+
beforeEach(() => vi.useFakeTimers());
|
|
15
|
+
afterEach(() => vi.useRealTimers());
|
|
16
|
+
|
|
17
|
+
function setup(inputs: Record<string, unknown> = {}) {
|
|
18
|
+
const fixture = TestBed.createComponent(NumericRangeFilterComponent);
|
|
19
|
+
fixture.componentRef.setInput("label", "Revenue");
|
|
20
|
+
for (const [k, v] of Object.entries(inputs)) fixture.componentRef.setInput(k, v);
|
|
21
|
+
const emitted: (FilterValue | undefined)[] = [];
|
|
22
|
+
fixture.componentInstance.valueChange.subscribe((v) => emitted.push(v));
|
|
23
|
+
fixture.detectChanges();
|
|
24
|
+
const [min, max] = fixture.debugElement
|
|
25
|
+
.queryAll(By.directive(InputComponent))
|
|
26
|
+
.map((d) => d.componentInstance as InputComponent);
|
|
27
|
+
return { fixture, min, max, emitted };
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const flush = (f: { detectChanges(): void }) => {
|
|
31
|
+
f.detectChanges();
|
|
32
|
+
vi.advanceTimersByTime(FILTER_DEBOUNCE_MS);
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
it("emits a valid range after the debounce", () => {
|
|
36
|
+
const { fixture, min, max, emitted } = setup();
|
|
37
|
+
min.value.set("1");
|
|
38
|
+
max.value.set("5");
|
|
39
|
+
flush(fixture);
|
|
40
|
+
expect(emitted).toEqual([{ min: "1", max: "5" }]);
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
it("emits a single bound with the other undefined", () => {
|
|
44
|
+
const { fixture, min, emitted } = setup();
|
|
45
|
+
min.value.set("3");
|
|
46
|
+
flush(fixture);
|
|
47
|
+
expect(emitted).toEqual([{ min: "3", max: undefined }]);
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
it("does not emit an inverted range and shows an alert", () => {
|
|
51
|
+
const { fixture, min, max, emitted } = setup();
|
|
52
|
+
min.value.set("9");
|
|
53
|
+
max.value.set("2");
|
|
54
|
+
flush(fixture);
|
|
55
|
+
fixture.detectChanges();
|
|
56
|
+
expect(emitted).toEqual([]);
|
|
57
|
+
expect(fixture.nativeElement.querySelector("[role=alert]").textContent).toContain(
|
|
58
|
+
"Min must not exceed max",
|
|
59
|
+
);
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
it("does not emit out-of-bounds values", () => {
|
|
63
|
+
const { fixture, max, emitted } = setup({ min: 0, max: 10 });
|
|
64
|
+
max.value.set("11");
|
|
65
|
+
flush(fixture);
|
|
66
|
+
expect(emitted).toEqual([]);
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
it("emits undefined when both are cleared", () => {
|
|
70
|
+
const { fixture, min, emitted } = setup({ value: { min: "1" } });
|
|
71
|
+
min.value.set("");
|
|
72
|
+
flush(fixture);
|
|
73
|
+
expect(emitted).toEqual([undefined]);
|
|
74
|
+
});
|
|
75
|
+
});
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026, Salesforce, Inc.,
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
* For full license text, see the LICENSE.txt file
|
|
5
|
+
*/
|
|
6
|
+
import {
|
|
7
|
+
ChangeDetectionStrategy,
|
|
8
|
+
Component,
|
|
9
|
+
DestroyRef,
|
|
10
|
+
computed,
|
|
11
|
+
effect,
|
|
12
|
+
inject,
|
|
13
|
+
input,
|
|
14
|
+
output,
|
|
15
|
+
signal,
|
|
16
|
+
untracked,
|
|
17
|
+
} from "@angular/core";
|
|
18
|
+
import { takeUntilDestroyed } from "@angular/core/rxjs-interop";
|
|
19
|
+
import { Subject } from "rxjs";
|
|
20
|
+
import { debounceTime } from "rxjs/operators";
|
|
21
|
+
import { InputComponent } from "../../../components/ui/input/input";
|
|
22
|
+
import { FILTER_DEBOUNCE_MS, uniqueFilterId, type FilterValue } from "./filter-types";
|
|
23
|
+
import { FilterFieldWrapperComponent } from "./filter-field-wrapper";
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Paired min/max number inputs. Emits `{ min, max }` (strings) on a trailing
|
|
27
|
+
* debounce; inverted or out-of-bounds ranges show an error and are not emitted.
|
|
28
|
+
*/
|
|
29
|
+
@Component({
|
|
30
|
+
selector: "app-numeric-range-filter",
|
|
31
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
32
|
+
imports: [InputComponent, FilterFieldWrapperComponent],
|
|
33
|
+
templateUrl: "./numeric-range-filter.html",
|
|
34
|
+
})
|
|
35
|
+
export class NumericRangeFilterComponent {
|
|
36
|
+
private readonly destroyRef = inject(DestroyRef);
|
|
37
|
+
|
|
38
|
+
readonly label = input.required<string>();
|
|
39
|
+
readonly value = input<FilterValue | undefined>(undefined);
|
|
40
|
+
/** Lowest / highest value the field accepts. */
|
|
41
|
+
readonly min = input<number | undefined>(undefined);
|
|
42
|
+
readonly max = input<number | undefined>(undefined);
|
|
43
|
+
readonly helpText = input<string | undefined>(undefined);
|
|
44
|
+
readonly valueChange = output<FilterValue | undefined>();
|
|
45
|
+
|
|
46
|
+
protected readonly baseId = uniqueFilterId("filter-numeric");
|
|
47
|
+
protected readonly errorId = `${this.baseId}-error`;
|
|
48
|
+
protected readonly draftMin = signal("");
|
|
49
|
+
protected readonly draftMax = signal("");
|
|
50
|
+
private readonly commit$ = new Subject<{ min: string; max: string }>();
|
|
51
|
+
|
|
52
|
+
constructor() {
|
|
53
|
+
this.commit$
|
|
54
|
+
.pipe(debounceTime(FILTER_DEBOUNCE_MS), takeUntilDestroyed(this.destroyRef))
|
|
55
|
+
.subscribe(({ min, max }) => this.commit(min, max));
|
|
56
|
+
|
|
57
|
+
effect(() => {
|
|
58
|
+
const v = this.value();
|
|
59
|
+
const lo = v?.min ?? "";
|
|
60
|
+
const hi = v?.max ?? "";
|
|
61
|
+
untracked(() => {
|
|
62
|
+
if (lo !== this.draftMin()) this.draftMin.set(lo);
|
|
63
|
+
if (hi !== this.draftMax()) this.draftMax.set(hi);
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
private isOutOfBounds(v: string): boolean {
|
|
69
|
+
if (v === "") return false;
|
|
70
|
+
const n = Number(v);
|
|
71
|
+
const lo = this.min();
|
|
72
|
+
const hi = this.max();
|
|
73
|
+
return (lo != null && n < lo) || (hi != null && n > hi);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
protected readonly minOutOfBounds = computed(() => this.isOutOfBounds(this.draftMin()));
|
|
77
|
+
protected readonly maxOutOfBounds = computed(() => this.isOutOfBounds(this.draftMax()));
|
|
78
|
+
protected readonly inverted = computed(() => {
|
|
79
|
+
const lo = this.draftMin();
|
|
80
|
+
const hi = this.draftMax();
|
|
81
|
+
return lo !== "" && hi !== "" && Number(lo) > Number(hi);
|
|
82
|
+
});
|
|
83
|
+
protected readonly hasError = computed(
|
|
84
|
+
() => this.minOutOfBounds() || this.maxOutOfBounds() || this.inverted(),
|
|
85
|
+
);
|
|
86
|
+
|
|
87
|
+
protected readonly errorMessage = computed<string | undefined>(() => {
|
|
88
|
+
if (this.inverted()) return "Min must not exceed max";
|
|
89
|
+
if (!this.minOutOfBounds() && !this.maxOutOfBounds()) return undefined;
|
|
90
|
+
const lo = this.min();
|
|
91
|
+
const hi = this.max();
|
|
92
|
+
if (lo != null && hi != null) return `Value must be between ${lo}–${hi}`;
|
|
93
|
+
if (lo != null) return `Value must be ${lo} or more`;
|
|
94
|
+
if (hi != null) return `Value must be ${hi} or less`;
|
|
95
|
+
return undefined;
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
protected onMin(v: string): void {
|
|
99
|
+
this.draftMin.set(v);
|
|
100
|
+
this.commit$.next({ min: v, max: this.draftMax() });
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
protected onMax(v: string): void {
|
|
104
|
+
this.draftMax.set(v);
|
|
105
|
+
this.commit$.next({ min: this.draftMin(), max: v });
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
private commit(min: string, max: string): void {
|
|
109
|
+
if (!min && !max) {
|
|
110
|
+
this.valueChange.emit(undefined);
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
if (this.isOutOfBounds(min) || this.isOutOfBounds(max)) return;
|
|
114
|
+
if (min !== "" && max !== "" && Number(min) > Number(max)) return;
|
|
115
|
+
this.valueChange.emit({ min: min || undefined, max: max || undefined });
|
|
116
|
+
}
|
|
117
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026, Salesforce, Inc.,
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
* For full license text, see the LICENSE.txt file
|
|
5
|
+
*/
|
|
6
|
+
import { TestBed } from "@angular/core/testing";
|
|
7
|
+
import { By } from "@angular/platform-browser";
|
|
8
|
+
import { SelectComponent } from "../../../components/ui/select/select";
|
|
9
|
+
import { SelectFilterComponent } from "./select-filter";
|
|
10
|
+
import type { FilterValue } from "./filter-types";
|
|
11
|
+
|
|
12
|
+
describe("SelectFilterComponent", () => {
|
|
13
|
+
function setup() {
|
|
14
|
+
const fixture = TestBed.createComponent(SelectFilterComponent);
|
|
15
|
+
fixture.componentRef.setInput("label", "Type");
|
|
16
|
+
fixture.componentRef.setInput("options", [{ value: "a", label: "A" }]);
|
|
17
|
+
const emitted: (FilterValue | undefined)[] = [];
|
|
18
|
+
fixture.componentInstance.valueChange.subscribe((v) => emitted.push(v));
|
|
19
|
+
fixture.detectChanges();
|
|
20
|
+
const select = fixture.debugElement.query(By.directive(SelectComponent))
|
|
21
|
+
.componentInstance as SelectComponent;
|
|
22
|
+
return { fixture, select, emitted };
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
it("prepends an All option", () => {
|
|
26
|
+
expect(setup().select.options()[0]).toEqual({ value: "", label: "All" });
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
it("emits the chosen value, and undefined for All", () => {
|
|
30
|
+
const { fixture, select, emitted } = setup();
|
|
31
|
+
select.value.set("a");
|
|
32
|
+
select.value.set("");
|
|
33
|
+
fixture.detectChanges();
|
|
34
|
+
expect(emitted).toEqual([{ value: "a" }, undefined]);
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
it("reflects the bound value", () => {
|
|
38
|
+
const { fixture, select } = setup();
|
|
39
|
+
fixture.componentRef.setInput("value", { value: "a" });
|
|
40
|
+
fixture.detectChanges();
|
|
41
|
+
expect(select.value()).toBe("a");
|
|
42
|
+
});
|
|
43
|
+
});
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026, Salesforce, Inc.,
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
* For full license text, see the LICENSE.txt file
|
|
5
|
+
*/
|
|
6
|
+
import { ChangeDetectionStrategy, Component, computed, input, output } from "@angular/core";
|
|
7
|
+
import {
|
|
8
|
+
SelectComponent,
|
|
9
|
+
type AppSelectOption,
|
|
10
|
+
} from "../../../components/ui/select/select";
|
|
11
|
+
import { uniqueFilterId, type FilterOption, type FilterValue } from "./filter-types";
|
|
12
|
+
import { FilterFieldWrapperComponent } from "./filter-field-wrapper";
|
|
13
|
+
|
|
14
|
+
/** Single-select picklist filter with a leading "All" entry that clears it. */
|
|
15
|
+
@Component({
|
|
16
|
+
selector: "app-select-filter",
|
|
17
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
18
|
+
imports: [SelectComponent, FilterFieldWrapperComponent],
|
|
19
|
+
templateUrl: "./select-filter.html",
|
|
20
|
+
})
|
|
21
|
+
export class SelectFilterComponent {
|
|
22
|
+
readonly label = input.required<string>();
|
|
23
|
+
readonly options = input<readonly FilterOption[]>([]);
|
|
24
|
+
readonly value = input<FilterValue | undefined>(undefined);
|
|
25
|
+
readonly helpText = input<string | undefined>(undefined);
|
|
26
|
+
readonly valueChange = output<FilterValue | undefined>();
|
|
27
|
+
|
|
28
|
+
protected readonly selectId = uniqueFilterId("filter-select");
|
|
29
|
+
|
|
30
|
+
protected readonly allOptions = computed<readonly AppSelectOption[]>(() => [
|
|
31
|
+
{ value: "", label: "All" },
|
|
32
|
+
...this.options(),
|
|
33
|
+
]);
|
|
34
|
+
|
|
35
|
+
protected readonly current = computed(() => this.value()?.value ?? "");
|
|
36
|
+
|
|
37
|
+
protected onChange(v: string): void {
|
|
38
|
+
this.valueChange.emit(v ? { value: v } : undefined);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026, Salesforce, Inc.,
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
* For full license text, see the LICENSE.txt file
|
|
5
|
+
*/
|
|
6
|
+
import { TestBed } from "@angular/core/testing";
|
|
7
|
+
import { By } from "@angular/platform-browser";
|
|
8
|
+
import { afterEach, beforeEach, vi } from "vitest";
|
|
9
|
+
import { InputComponent } from "../../../components/ui/input/input";
|
|
10
|
+
import { TextFilterComponent } from "./text-filter";
|
|
11
|
+
import { FILTER_DEBOUNCE_MS, type FilterValue } from "./filter-types";
|
|
12
|
+
|
|
13
|
+
describe("TextFilterComponent", () => {
|
|
14
|
+
beforeEach(() => vi.useFakeTimers());
|
|
15
|
+
afterEach(() => vi.useRealTimers());
|
|
16
|
+
|
|
17
|
+
function setup() {
|
|
18
|
+
const fixture = TestBed.createComponent(TextFilterComponent);
|
|
19
|
+
fixture.componentRef.setInput("label", "Name");
|
|
20
|
+
const emitted: (FilterValue | undefined)[] = [];
|
|
21
|
+
fixture.componentInstance.valueChange.subscribe((v) => emitted.push(v));
|
|
22
|
+
fixture.detectChanges();
|
|
23
|
+
const input = fixture.debugElement.query(By.directive(InputComponent))
|
|
24
|
+
.componentInstance as InputComponent;
|
|
25
|
+
return { fixture, input, emitted };
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
it("debounces typing and emits the value", () => {
|
|
29
|
+
const { fixture, input, emitted } = setup();
|
|
30
|
+
input.value.set("a");
|
|
31
|
+
input.value.set("ac");
|
|
32
|
+
fixture.detectChanges();
|
|
33
|
+
vi.advanceTimersByTime(FILTER_DEBOUNCE_MS - 1);
|
|
34
|
+
expect(emitted).toEqual([]);
|
|
35
|
+
vi.advanceTimersByTime(1);
|
|
36
|
+
expect(emitted).toEqual([{ value: "ac" }]);
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
it("emits undefined when cleared", () => {
|
|
40
|
+
const { fixture, input, emitted } = setup();
|
|
41
|
+
input.value.set("x");
|
|
42
|
+
input.value.set("");
|
|
43
|
+
fixture.detectChanges();
|
|
44
|
+
vi.advanceTimersByTime(FILTER_DEBOUNCE_MS);
|
|
45
|
+
expect(emitted).toEqual([undefined]);
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
it("syncs the draft from the bound value", () => {
|
|
49
|
+
const { fixture, input } = setup();
|
|
50
|
+
fixture.componentRef.setInput("value", { value: "ext" });
|
|
51
|
+
fixture.detectChanges();
|
|
52
|
+
expect(input.value()).toBe("ext");
|
|
53
|
+
});
|
|
54
|
+
});
|