@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,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026, Salesforce, Inc.,
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
* For full license text, see the LICENSE.txt file
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { getAdapter } from "../adapters/registry";
|
|
8
|
+
import type { RunSearchOutcome, SourceRequest, SourceResult } from "../types/search-result.types";
|
|
9
|
+
|
|
10
|
+
/** Minimal shape of a GraphQL error we can attribute to a source by path. */
|
|
11
|
+
export interface GraphQLErrorLike {
|
|
12
|
+
message?: string | null;
|
|
13
|
+
path?: Array<string | number> | null;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const GENERIC_SOURCE_ERROR = "Search failed for this source.";
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Attributes GraphQL errors to a source by matching the error `path` against
|
|
20
|
+
* the adapter's location for that source. When no path matches, returns a
|
|
21
|
+
* generic per-source message rather than echoing unrelated sources' errors.
|
|
22
|
+
*/
|
|
23
|
+
function attributeError(request: SourceRequest, errors: GraphQLErrorLike[]): string {
|
|
24
|
+
const prefix = getAdapter(request.source.kind).errorPath(request);
|
|
25
|
+
|
|
26
|
+
const matched = errors.filter((e) => {
|
|
27
|
+
const path = e.path;
|
|
28
|
+
if (!path || path.length < prefix.length) return false;
|
|
29
|
+
return prefix.every((segment, i) => path[i] === segment);
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
if (matched.length === 0) return GENERIC_SOURCE_ERROR;
|
|
33
|
+
|
|
34
|
+
const message = matched
|
|
35
|
+
.map((e) => e.message)
|
|
36
|
+
.filter((m): m is string => !!m)
|
|
37
|
+
.join("; ");
|
|
38
|
+
return message || GENERIC_SOURCE_ERROR;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Parses each source's subtree via its adapter. A source whose subtree is
|
|
43
|
+
* absent gets an attributed error when the response reported GraphQL errors,
|
|
44
|
+
* and is otherwise left out of both maps (an empty result, not a failure).
|
|
45
|
+
* Never throws for partial failures.
|
|
46
|
+
*/
|
|
47
|
+
export function parseSearchResponse(
|
|
48
|
+
requests: SourceRequest[],
|
|
49
|
+
root: Record<string, unknown>,
|
|
50
|
+
gqlErrors: GraphQLErrorLike[],
|
|
51
|
+
): RunSearchOutcome {
|
|
52
|
+
const results: Record<string, SourceResult> = {};
|
|
53
|
+
const errors: Record<string, string> = {};
|
|
54
|
+
|
|
55
|
+
for (const request of requests) {
|
|
56
|
+
const key = request.source.key;
|
|
57
|
+
let parsed: SourceResult | null = null;
|
|
58
|
+
try {
|
|
59
|
+
parsed = getAdapter(request.source.kind).parseResponse(root, request);
|
|
60
|
+
} catch {
|
|
61
|
+
// An adapter that throws parsing its own subtree is a per-source failure.
|
|
62
|
+
parsed = null;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
if (parsed != null) {
|
|
66
|
+
results[key] = parsed;
|
|
67
|
+
} else if (gqlErrors.length > 0) {
|
|
68
|
+
errors[key] = attributeError(request, gqlErrors);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return { results, errors };
|
|
73
|
+
}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026, Salesforce, Inc.,
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
* For full license text, see the LICENSE.txt file
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { TestBed } from "@angular/core/testing";
|
|
8
|
+
import { beforeEach, describe, expect, it, vi } from "vitest";
|
|
9
|
+
import { DataClient } from "../../../api/data-client.service";
|
|
10
|
+
import { SearchService } from "./search.service";
|
|
11
|
+
import type { SObjectSourceConfig } from "../types/search-config.types";
|
|
12
|
+
import type { SourceRequest } from "../types/search-result.types";
|
|
13
|
+
|
|
14
|
+
const accounts: SObjectSourceConfig = {
|
|
15
|
+
kind: "sobject",
|
|
16
|
+
key: "accounts",
|
|
17
|
+
label: "Accounts",
|
|
18
|
+
objectName: "Account",
|
|
19
|
+
displayFields: ["Name"],
|
|
20
|
+
searchableFields: ["Name"],
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const request: SourceRequest = {
|
|
24
|
+
source: accounts,
|
|
25
|
+
q: "acme",
|
|
26
|
+
filters: [],
|
|
27
|
+
sort: null,
|
|
28
|
+
pageSize: 10,
|
|
29
|
+
afterCursor: undefined,
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
describe("SearchService", () => {
|
|
33
|
+
let service: SearchService;
|
|
34
|
+
let execute: ReturnType<typeof vi.fn>;
|
|
35
|
+
|
|
36
|
+
beforeEach(() => {
|
|
37
|
+
execute = vi.fn();
|
|
38
|
+
TestBed.configureTestingModule({
|
|
39
|
+
providers: [{ provide: DataClient, useValue: { execute } }],
|
|
40
|
+
});
|
|
41
|
+
service = TestBed.inject(SearchService);
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
describe("runSearch", () => {
|
|
45
|
+
it("executes the combined document and parses the response", async () => {
|
|
46
|
+
execute.mockResolvedValue({
|
|
47
|
+
uiapi: {
|
|
48
|
+
query: {
|
|
49
|
+
accounts: {
|
|
50
|
+
edges: [{ node: { Id: "001" } }],
|
|
51
|
+
pageInfo: {
|
|
52
|
+
hasNextPage: true,
|
|
53
|
+
hasPreviousPage: false,
|
|
54
|
+
startCursor: "s",
|
|
55
|
+
endCursor: "e",
|
|
56
|
+
},
|
|
57
|
+
totalCount: 12,
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
const outcome = await service.runSearch([request]);
|
|
64
|
+
|
|
65
|
+
const [document, variables] = execute.mock.calls[0];
|
|
66
|
+
expect(document).toContain("accounts: Account(");
|
|
67
|
+
expect(variables).toMatchObject({ accounts_first: 10 });
|
|
68
|
+
expect(outcome.results["accounts"].nodes).toEqual([{ Id: "001" }]);
|
|
69
|
+
expect(outcome.results["accounts"].pageInfo?.endCursor).toBe("e");
|
|
70
|
+
expect(outcome.results["accounts"].totalCount).toBe(12);
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
it("rejects on a whole-request failure", async () => {
|
|
74
|
+
execute.mockRejectedValue(new Error("Network timeout"));
|
|
75
|
+
|
|
76
|
+
await expect(service.runSearch([request])).rejects.toThrow("Network timeout");
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
describe("fetchDistinctValues", () => {
|
|
81
|
+
it("extracts distinct values and prefers label over displayValue", async () => {
|
|
82
|
+
execute.mockResolvedValue({
|
|
83
|
+
uiapi: {
|
|
84
|
+
aggregate: {
|
|
85
|
+
Account: {
|
|
86
|
+
edges: [
|
|
87
|
+
{ node: { aggregate: { Industry: { value: "Tech", label: "Technology" } } } },
|
|
88
|
+
{ node: { aggregate: { Industry: { value: "Bank", displayValue: "Banking" } } } },
|
|
89
|
+
{ node: { aggregate: { Industry: { value: "Raw" } } } },
|
|
90
|
+
{ node: { aggregate: { Industry: { value: "" } } } },
|
|
91
|
+
{ node: { aggregate: { Industry: { value: null } } } },
|
|
92
|
+
],
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
const options = await service.fetchDistinctValues("Account", "Industry");
|
|
99
|
+
|
|
100
|
+
expect(execute.mock.calls[0][0]).toContain("Account(groupBy: { Industry: { group: true } })");
|
|
101
|
+
expect(options).toEqual([
|
|
102
|
+
{ value: "Tech", label: "Technology" },
|
|
103
|
+
{ value: "Bank", label: "Banking" },
|
|
104
|
+
{ value: "Raw", label: "Raw" },
|
|
105
|
+
]);
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
it("returns an empty list when the aggregate is missing", async () => {
|
|
109
|
+
execute.mockResolvedValue({ uiapi: {} });
|
|
110
|
+
|
|
111
|
+
expect(await service.fetchDistinctValues("Account", "Industry")).toEqual([]);
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
it("rejects invalid identifiers without calling the client", async () => {
|
|
115
|
+
await expect(service.fetchDistinctValues("Account", "bad field")).rejects.toThrow(
|
|
116
|
+
/Invalid fieldName/,
|
|
117
|
+
);
|
|
118
|
+
await expect(service.fetchDistinctValues("Bad-Object", "Industry")).rejects.toThrow(
|
|
119
|
+
/Invalid objectName/,
|
|
120
|
+
);
|
|
121
|
+
expect(execute).not.toHaveBeenCalled();
|
|
122
|
+
});
|
|
123
|
+
});
|
|
124
|
+
});
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026, Salesforce, Inc.,
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
* For full license text, see the LICENSE.txt file
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { Injectable, inject } from "@angular/core";
|
|
8
|
+
import { DataClient } from "../../../api/data-client.service";
|
|
9
|
+
import { buildSearchQuery } from "../query/build-search-query";
|
|
10
|
+
import type { PicklistOption } from "../types/filter.types";
|
|
11
|
+
import type { RunSearchOutcome, SourceRequest } from "../types/search-result.types";
|
|
12
|
+
import { assertValidIdentifier } from "../utils/identifier";
|
|
13
|
+
import { parseSearchResponse } from "./search-response";
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Executes multi-source search and distinct-value queries through the base
|
|
17
|
+
* `DataClient`.
|
|
18
|
+
*/
|
|
19
|
+
@Injectable({ providedIn: "root" })
|
|
20
|
+
export class SearchService {
|
|
21
|
+
private readonly dataClient = inject(DataClient);
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Runs one combined multi-source GraphQL request and parses each source via
|
|
25
|
+
* its adapter. Rejects on a whole-request failure.
|
|
26
|
+
*/
|
|
27
|
+
async runSearch(requests: SourceRequest[]): Promise<RunSearchOutcome> {
|
|
28
|
+
const { document, variables } = buildSearchQuery(requests);
|
|
29
|
+
const root = await this.dataClient.execute<Record<string, unknown>>(document, variables);
|
|
30
|
+
return parseSearchResponse(requests, root, []);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Fetches the distinct values of a picklist field through the uiapi aggregate
|
|
35
|
+
* `groupBy` query.
|
|
36
|
+
*/
|
|
37
|
+
async fetchDistinctValues(objectName: string, fieldName: string): Promise<PicklistOption[]> {
|
|
38
|
+
assertValidIdentifier(objectName, "objectName");
|
|
39
|
+
assertValidIdentifier(fieldName, "fieldName");
|
|
40
|
+
|
|
41
|
+
const document = `query DistinctValues {
|
|
42
|
+
uiapi {
|
|
43
|
+
aggregate {
|
|
44
|
+
${objectName}(groupBy: { ${fieldName}: { group: true } }) {
|
|
45
|
+
edges {
|
|
46
|
+
node {
|
|
47
|
+
aggregate @optional {
|
|
48
|
+
${fieldName} @optional {
|
|
49
|
+
value
|
|
50
|
+
displayValue
|
|
51
|
+
label
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}`;
|
|
60
|
+
|
|
61
|
+
const root = await this.dataClient.execute<Record<string, unknown>>(document);
|
|
62
|
+
|
|
63
|
+
const aggregate = (root["uiapi"] as Record<string, unknown> | undefined)?.["aggregate"] as
|
|
64
|
+
Record<string, unknown> | undefined;
|
|
65
|
+
const objectAgg = aggregate?.[objectName] as
|
|
66
|
+
{ edges?: Array<{ node?: { aggregate?: Record<string, unknown> } }> } | undefined;
|
|
67
|
+
const edges = objectAgg?.edges ?? [];
|
|
68
|
+
|
|
69
|
+
return edges
|
|
70
|
+
.map((edge) => {
|
|
71
|
+
const field = edge?.node?.aggregate?.[fieldName] as
|
|
72
|
+
| { value?: string | null; displayValue?: string | null; label?: string | null }
|
|
73
|
+
| undefined;
|
|
74
|
+
const value = field?.value;
|
|
75
|
+
if (value == null || value === "") return null;
|
|
76
|
+
return { value, label: field?.label ?? field?.displayValue ?? value };
|
|
77
|
+
})
|
|
78
|
+
.filter((opt): opt is PicklistOption => opt !== null);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
@if (chips().length > 0) {
|
|
2
|
+
<div class="flex flex-wrap gap-2" role="group" aria-label="Active filters">
|
|
3
|
+
@for (chip of chips(); track chip.field) {
|
|
4
|
+
<app-button
|
|
5
|
+
appearance="outlined"
|
|
6
|
+
size="sm"
|
|
7
|
+
iconEnd="close"
|
|
8
|
+
[ariaLabel]="'Remove filter ' + chip.label"
|
|
9
|
+
(clicked)="removeFilter.emit(chip.field)"
|
|
10
|
+
>
|
|
11
|
+
{{ chip.label }}
|
|
12
|
+
</app-button>
|
|
13
|
+
}
|
|
14
|
+
<app-button
|
|
15
|
+
appearance="destructive"
|
|
16
|
+
size="sm"
|
|
17
|
+
ariaLabel="Clear all filters"
|
|
18
|
+
(clicked)="clearAll.emit()"
|
|
19
|
+
>
|
|
20
|
+
Clear all
|
|
21
|
+
</app-button>
|
|
22
|
+
</div>
|
|
23
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
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 { ButtonComponent } from "../../../../components/ui/button/button";
|
|
9
|
+
import type { ActiveFilterValue, FilterFieldConfig } from "../../types/filter.types";
|
|
10
|
+
import { ActiveFiltersComponent, formatFilterLabel } from "./active-filters";
|
|
11
|
+
|
|
12
|
+
describe("formatFilterLabel", () => {
|
|
13
|
+
const f = (o: Partial<ActiveFilterValue>): ActiveFilterValue => ({
|
|
14
|
+
field: "X",
|
|
15
|
+
label: "X",
|
|
16
|
+
type: "text",
|
|
17
|
+
...o,
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it("formats each filter type", () => {
|
|
21
|
+
expect(formatFilterLabel(f({ value: "a" }))).toBe("X: a");
|
|
22
|
+
expect(formatFilterLabel(f({ type: "boolean", value: "true" }))).toBe("X: Yes");
|
|
23
|
+
expect(formatFilterLabel(f({ type: "numeric", min: "1", max: "5" }))).toBe("X: 1 - 5");
|
|
24
|
+
expect(formatFilterLabel(f({ type: "numeric", min: "1" }))).toBe("X: >= 1");
|
|
25
|
+
expect(formatFilterLabel(f({ type: "numeric", max: "5" }))).toBe("X: <= 5");
|
|
26
|
+
expect(formatFilterLabel(f({ type: "daterange", min: "a", max: "b" }))).toBe("X: a to b");
|
|
27
|
+
expect(formatFilterLabel(f({ type: "date", min: "a" }))).toBe("X: from a");
|
|
28
|
+
expect(formatFilterLabel(f({ type: "date", max: "b" }))).toBe("X: until b");
|
|
29
|
+
expect(formatFilterLabel(f({ type: "multipicklist", value: "a,b,c" }))).toBe("X: 3 selected");
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
it("resolves picklist values to option labels", () => {
|
|
33
|
+
const cfg: FilterFieldConfig = {
|
|
34
|
+
field: "X",
|
|
35
|
+
label: "Industry",
|
|
36
|
+
type: "picklist",
|
|
37
|
+
options: [{ value: "tech", label: "Technology" }],
|
|
38
|
+
};
|
|
39
|
+
expect(formatFilterLabel(f({ type: "picklist", value: "tech" }), cfg)).toBe(
|
|
40
|
+
"Industry: Technology",
|
|
41
|
+
);
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
describe("ActiveFiltersComponent", () => {
|
|
46
|
+
function setup(filters: ActiveFilterValue[]) {
|
|
47
|
+
const fixture = TestBed.createComponent(ActiveFiltersComponent);
|
|
48
|
+
fixture.componentRef.setInput("filters", filters);
|
|
49
|
+
const removed: string[] = [];
|
|
50
|
+
let cleared = 0;
|
|
51
|
+
fixture.componentInstance.removeFilter.subscribe((v) => removed.push(v));
|
|
52
|
+
fixture.componentInstance.clearAll.subscribe(() => cleared++);
|
|
53
|
+
fixture.detectChanges();
|
|
54
|
+
const buttons = () => fixture.debugElement.queryAll(By.directive(ButtonComponent));
|
|
55
|
+
return { fixture, buttons, removed, cleared: () => cleared };
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
it("renders nothing without filters", () => {
|
|
59
|
+
expect(setup([]).buttons()).toHaveLength(0);
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
it("emits removeFilter with the field and clearAll", () => {
|
|
63
|
+
const { buttons, removed, cleared } = setup([
|
|
64
|
+
{ field: "Name", label: "Name", type: "text", value: "a" },
|
|
65
|
+
]);
|
|
66
|
+
const all = buttons();
|
|
67
|
+
expect(all).toHaveLength(2);
|
|
68
|
+
all[0].componentInstance.clicked.emit(new MouseEvent("click"));
|
|
69
|
+
all[1].componentInstance.clicked.emit(new MouseEvent("click"));
|
|
70
|
+
expect(removed).toEqual(["Name"]);
|
|
71
|
+
expect(cleared()).toBe(1);
|
|
72
|
+
});
|
|
73
|
+
});
|
|
@@ -0,0 +1,77 @@
|
|
|
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 { ButtonComponent } from "../../../../components/ui/button/button";
|
|
8
|
+
import type { ActiveFilterValue, FilterFieldConfig } from "../../types/filter.types";
|
|
9
|
+
|
|
10
|
+
/** Maps a picklist value to its configured option label, falling back to the raw value. */
|
|
11
|
+
function optionLabel(config: FilterFieldConfig | undefined, value: string): string {
|
|
12
|
+
return config?.options?.find((o) => o.value === value)?.label ?? value;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Formats the display label for one active filter chip. Mirrors the React
|
|
17
|
+
* `formatFilterLabel`, resolving picklist values to option labels via `config`.
|
|
18
|
+
*/
|
|
19
|
+
export function formatFilterLabel(filter: ActiveFilterValue, config?: FilterFieldConfig): string {
|
|
20
|
+
const { type, value, min, max } = filter;
|
|
21
|
+
const label = config?.label ?? filter.label;
|
|
22
|
+
switch (type) {
|
|
23
|
+
case "text":
|
|
24
|
+
return `${label}: ${value}`;
|
|
25
|
+
case "picklist":
|
|
26
|
+
return `${label}: ${optionLabel(config, value ?? "")}`;
|
|
27
|
+
case "multipicklist": {
|
|
28
|
+
const values = value ? value.split(",") : [];
|
|
29
|
+
if (values.length <= 2) {
|
|
30
|
+
return `${label}: ${values.map((v) => optionLabel(config, v)).join(", ")}`;
|
|
31
|
+
}
|
|
32
|
+
return `${label}: ${values.length} selected`;
|
|
33
|
+
}
|
|
34
|
+
case "boolean":
|
|
35
|
+
return `${label}: ${value === "true" ? "Yes" : "No"}`;
|
|
36
|
+
case "numeric": {
|
|
37
|
+
if (min && max) return `${label}: ${min} - ${max}`;
|
|
38
|
+
if (min) return `${label}: >= ${min}`;
|
|
39
|
+
return `${label}: <= ${max}`;
|
|
40
|
+
}
|
|
41
|
+
case "date":
|
|
42
|
+
case "datetime":
|
|
43
|
+
case "daterange":
|
|
44
|
+
case "datetimerange": {
|
|
45
|
+
if (min && max) return `${label}: ${min} to ${max}`;
|
|
46
|
+
if (min) return `${label}: from ${min}`;
|
|
47
|
+
return `${label}: until ${max}`;
|
|
48
|
+
}
|
|
49
|
+
default:
|
|
50
|
+
return label;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* State-agnostic removable-chip strip for the active filters. Clicking a chip
|
|
56
|
+
* emits `removeFilter` with its field; `Clear all` emits `clearAll`.
|
|
57
|
+
*/
|
|
58
|
+
@Component({
|
|
59
|
+
selector: "app-active-filters",
|
|
60
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
61
|
+
imports: [ButtonComponent],
|
|
62
|
+
templateUrl: "./active-filters.html",
|
|
63
|
+
})
|
|
64
|
+
export class ActiveFiltersComponent {
|
|
65
|
+
readonly filters = input.required<ActiveFilterValue[]>();
|
|
66
|
+
readonly configs = input<FilterFieldConfig[]>([]);
|
|
67
|
+
readonly removeFilter = output<string>();
|
|
68
|
+
readonly clearAll = output<void>();
|
|
69
|
+
|
|
70
|
+
protected readonly chips = computed(() => {
|
|
71
|
+
const byField = new Map(this.configs().map((c) => [c.field, c]));
|
|
72
|
+
return this.filters().map((f) => ({
|
|
73
|
+
field: f.field,
|
|
74
|
+
label: formatFilterLabel(f, byField.get(f.field)),
|
|
75
|
+
}));
|
|
76
|
+
});
|
|
77
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
@for (field of fields(); track field.config.field) { @switch (field.kind) { @case ('text') {
|
|
2
|
+
<app-text-filter
|
|
3
|
+
[label]="field.config.label"
|
|
4
|
+
[placeholder]="field.config.placeholder"
|
|
5
|
+
[helpText]="field.config.helpText"
|
|
6
|
+
[value]="valueOf(field.config.field)"
|
|
7
|
+
(valueChange)="onChange(field.config, $event)"
|
|
8
|
+
/>
|
|
9
|
+
} @case ('picklist') {
|
|
10
|
+
<app-select-filter
|
|
11
|
+
[label]="field.config.label"
|
|
12
|
+
[options]="field.options"
|
|
13
|
+
[helpText]="field.config.helpText"
|
|
14
|
+
[value]="valueOf(field.config.field)"
|
|
15
|
+
(valueChange)="onChange(field.config, $event)"
|
|
16
|
+
/>
|
|
17
|
+
} @case ('multipicklist') {
|
|
18
|
+
<app-multi-select-filter
|
|
19
|
+
[label]="field.config.label"
|
|
20
|
+
[options]="field.options"
|
|
21
|
+
[helpText]="field.config.helpText"
|
|
22
|
+
[value]="valueOf(field.config.field)"
|
|
23
|
+
(valueChange)="onChange(field.config, $event)"
|
|
24
|
+
/>
|
|
25
|
+
} @case ('numeric') {
|
|
26
|
+
<app-numeric-range-filter
|
|
27
|
+
[label]="field.config.label"
|
|
28
|
+
[min]="field.config.min"
|
|
29
|
+
[max]="field.config.max"
|
|
30
|
+
[helpText]="field.config.helpText"
|
|
31
|
+
[value]="valueOf(field.config.field)"
|
|
32
|
+
(valueChange)="onChange(field.config, $event)"
|
|
33
|
+
/>
|
|
34
|
+
} @case ('boolean') {
|
|
35
|
+
<app-boolean-filter
|
|
36
|
+
[label]="field.config.label"
|
|
37
|
+
[helpText]="field.config.helpText"
|
|
38
|
+
[value]="valueOf(field.config.field)"
|
|
39
|
+
(valueChange)="onChange(field.config, $event)"
|
|
40
|
+
/>
|
|
41
|
+
} @case ('date') {
|
|
42
|
+
<app-date-range-filter
|
|
43
|
+
[label]="field.config.label"
|
|
44
|
+
[mode]="field.config.dateMode ?? 'comparison'"
|
|
45
|
+
[helpText]="field.config.helpText"
|
|
46
|
+
[value]="valueOf(field.config.field)"
|
|
47
|
+
(valueChange)="onChange(field.config, $event)"
|
|
48
|
+
/>
|
|
49
|
+
} } }
|
|
@@ -0,0 +1,87 @@
|
|
|
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, inject, input } from "@angular/core";
|
|
7
|
+
import { BooleanFilterComponent } from "../../filters/boolean-filter";
|
|
8
|
+
import { DateRangeFilterComponent } from "../../filters/date-range-filter";
|
|
9
|
+
import type { FilterValue } from "../../filters/filter-types";
|
|
10
|
+
import { MultiSelectFilterComponent } from "../../filters/multi-select-filter";
|
|
11
|
+
import { NumericRangeFilterComponent } from "../../filters/numeric-range-filter";
|
|
12
|
+
import { SelectFilterComponent } from "../../filters/select-filter";
|
|
13
|
+
import { TextFilterComponent } from "../../filters/text-filter";
|
|
14
|
+
import { SearchStateService } from "../../state/search-state.service";
|
|
15
|
+
import type { FilterFieldConfig, FilterFieldType, PicklistOption } from "../../types/filter.types";
|
|
16
|
+
import type { SourceConfig } from "../../types/search-config.types";
|
|
17
|
+
|
|
18
|
+
type FilterKind = "text" | "picklist" | "multipicklist" | "numeric" | "boolean" | "date";
|
|
19
|
+
|
|
20
|
+
interface FilterField {
|
|
21
|
+
config: FilterFieldConfig;
|
|
22
|
+
kind: FilterKind;
|
|
23
|
+
options: readonly PicklistOption[];
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/** The date-family types share one input; its chrome follows `dateMode`. */
|
|
27
|
+
function filterKind(type: FilterFieldType): FilterKind {
|
|
28
|
+
switch (type) {
|
|
29
|
+
case "date":
|
|
30
|
+
case "daterange":
|
|
31
|
+
case "datetime":
|
|
32
|
+
case "datetimerange":
|
|
33
|
+
return "date";
|
|
34
|
+
default:
|
|
35
|
+
return type;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* One input per `source.filterBy` entry, picked by `FilterFieldType`:
|
|
41
|
+
*
|
|
42
|
+
* - text -> text; picklist / multipicklist -> select / multi-select (inline
|
|
43
|
+
* `options`, else the distinct values fetched from the org)
|
|
44
|
+
* - numeric -> numeric range; boolean -> yes/no
|
|
45
|
+
* - date / daterange / datetime / datetimerange -> date filter whose
|
|
46
|
+
* Between / After / Before chrome follows `dateMode`
|
|
47
|
+
*
|
|
48
|
+
* Reads and writes through the surrounding {@link SearchStateService}.
|
|
49
|
+
*/
|
|
50
|
+
@Component({
|
|
51
|
+
selector: "app-default-filter-panel",
|
|
52
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
53
|
+
imports: [
|
|
54
|
+
TextFilterComponent,
|
|
55
|
+
SelectFilterComponent,
|
|
56
|
+
MultiSelectFilterComponent,
|
|
57
|
+
NumericRangeFilterComponent,
|
|
58
|
+
BooleanFilterComponent,
|
|
59
|
+
DateRangeFilterComponent,
|
|
60
|
+
],
|
|
61
|
+
host: { class: "contents" },
|
|
62
|
+
templateUrl: "./default-filter-panel.html",
|
|
63
|
+
})
|
|
64
|
+
export class DefaultFilterPanelComponent {
|
|
65
|
+
private readonly state = inject(SearchStateService);
|
|
66
|
+
|
|
67
|
+
readonly source = input.required<SourceConfig>();
|
|
68
|
+
|
|
69
|
+
protected readonly fields = computed<FilterField[]>(() => {
|
|
70
|
+
const source = this.source();
|
|
71
|
+
return (source.filterBy ?? []).map((config) => {
|
|
72
|
+
const needsOptions = config.type === "picklist" || config.type === "multipicklist";
|
|
73
|
+
const options =
|
|
74
|
+
config.options ??
|
|
75
|
+
(needsOptions ? this.state.distinctOptions(source.objectName, config.field)() : []);
|
|
76
|
+
return { config, kind: filterKind(config.type), options };
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
protected valueOf(field: string): FilterValue | undefined {
|
|
81
|
+
return this.state.filterValue(this.source().key, field);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
protected onChange(config: FilterFieldConfig, value: FilterValue | undefined): void {
|
|
85
|
+
this.state.setFilterValue(this.source().key, config, value);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
@if (hasFields()) {
|
|
2
|
+
<section class="rounded-md border p-3 space-y-3" [attr.aria-labelledby]="headingId">
|
|
3
|
+
<div class="flex items-center justify-between">
|
|
4
|
+
<h2 class="text-sm font-semibold" [id]="headingId">Filters</h2>
|
|
5
|
+
@if (hasActive()) {
|
|
6
|
+
<app-button appearance="text" size="sm" (clicked)="reset()"> Reset </app-button>
|
|
7
|
+
}
|
|
8
|
+
</div>
|
|
9
|
+
<div class="grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3">
|
|
10
|
+
<app-default-filter-panel [source]="source()" />
|
|
11
|
+
</div>
|
|
12
|
+
</section>
|
|
13
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
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, inject, input } from "@angular/core";
|
|
7
|
+
import { ButtonComponent } from "../../../../components/ui/button/button";
|
|
8
|
+
import { SearchStateService } from "../../state/search-state.service";
|
|
9
|
+
import type { SourceConfig } from "../../types/search-config.types";
|
|
10
|
+
import { DefaultFilterPanelComponent } from "./default-filter-panel";
|
|
11
|
+
|
|
12
|
+
let nextId = 0;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Bordered "Filters" box for one source: heading, a reset button that clears
|
|
16
|
+
* only that source's filters (React's `FilterResetButton`), and the default
|
|
17
|
+
* filter inputs. Renders nothing when the source declares no `filterBy`.
|
|
18
|
+
*/
|
|
19
|
+
@Component({
|
|
20
|
+
selector: "app-filter-box",
|
|
21
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
22
|
+
imports: [ButtonComponent, DefaultFilterPanelComponent],
|
|
23
|
+
templateUrl: "./filter-box.html",
|
|
24
|
+
})
|
|
25
|
+
export class FilterBoxComponent {
|
|
26
|
+
private readonly state = inject(SearchStateService);
|
|
27
|
+
|
|
28
|
+
readonly source = input.required<SourceConfig>();
|
|
29
|
+
|
|
30
|
+
protected readonly headingId = `search-filters-${nextId++}`;
|
|
31
|
+
protected readonly hasFields = computed(() => (this.source().filterBy?.length ?? 0) > 0);
|
|
32
|
+
protected readonly hasActive = computed(
|
|
33
|
+
() => (this.state.sources()[this.source().key]?.filters.length ?? 0) > 0,
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
protected reset(): void {
|
|
37
|
+
this.state.clearFilters(this.source().key);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<form role="search" (submit)="submit($event)">
|
|
2
|
+
<div class="flex gap-2">
|
|
3
|
+
<app-input
|
|
4
|
+
class="flex-1"
|
|
5
|
+
type="search"
|
|
6
|
+
icon="search"
|
|
7
|
+
[ariaLabel]="label()"
|
|
8
|
+
[ariaDescribedby]="hintId"
|
|
9
|
+
[placeholder]="placeholder()"
|
|
10
|
+
[value]="text()"
|
|
11
|
+
(valueChange)="text.set($event)"
|
|
12
|
+
/>
|
|
13
|
+
<app-button type="submit" [disabled]="!canSearch()">{{ submitLabel() }}</app-button>
|
|
14
|
+
</div>
|
|
15
|
+
<p [id]="hintId" class="sr-only">{{ hint() }}</p>
|
|
16
|
+
</form>
|