@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,17 @@
|
|
|
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
|
+
* Minimum trimmed keyword length before a search fires. The search backend
|
|
9
|
+
* rejects shorter terms, so the query is gated client-side.
|
|
10
|
+
*/
|
|
11
|
+
export const MIN_QUERY_LENGTH = 3;
|
|
12
|
+
|
|
13
|
+
export const DEFAULT_PAGE_SIZE = 10;
|
|
14
|
+
export const DEFAULT_PAGE_SIZE_OPTIONS = [10, 25, 50];
|
|
15
|
+
|
|
16
|
+
/** Debounce for syncing search state to the URL. */
|
|
17
|
+
export const URL_SYNC_DEBOUNCE_MS = 300;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026, Salesforce, Inc.,
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
* For full license text, see the LICENSE.txt file
|
|
5
|
+
*/
|
|
6
|
+
import type { SearchConfig } from "./types/search-config.types";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Starter config for the shipped `/search` page: Accounts, Contacts and
|
|
10
|
+
* Opportunities in per-source mode. Edit it (or pass your own `SearchConfig`
|
|
11
|
+
* to `<app-search>`) to search other objects.
|
|
12
|
+
*/
|
|
13
|
+
export const defaultSearchConfig: SearchConfig = {
|
|
14
|
+
pagination: { mode: "per-source", pageSize: 10, pageSizeOptions: [5, 10, 20] },
|
|
15
|
+
sources: [
|
|
16
|
+
{
|
|
17
|
+
kind: "sobject",
|
|
18
|
+
key: "accounts",
|
|
19
|
+
objectName: "Account",
|
|
20
|
+
label: "Accounts",
|
|
21
|
+
labelSingular: "Account",
|
|
22
|
+
searchableFields: ["Name", "Phone", "Industry"],
|
|
23
|
+
displayFields: [
|
|
24
|
+
"Name",
|
|
25
|
+
"Industry",
|
|
26
|
+
"Type",
|
|
27
|
+
"Phone",
|
|
28
|
+
"AnnualRevenue",
|
|
29
|
+
{ name: "Owner", subfields: ["Name"] },
|
|
30
|
+
],
|
|
31
|
+
filterBy: [
|
|
32
|
+
{ field: "Industry", label: "Industry", type: "picklist" },
|
|
33
|
+
{ field: "Type", label: "Type", type: "picklist" },
|
|
34
|
+
{ field: "AnnualRevenue", label: "Annual Revenue", type: "numeric" },
|
|
35
|
+
],
|
|
36
|
+
sortBy: [
|
|
37
|
+
{ field: "Name", label: "Name" },
|
|
38
|
+
{ field: "Industry", label: "Industry" },
|
|
39
|
+
{ field: "AnnualRevenue", label: "Annual Revenue" },
|
|
40
|
+
{ field: "CreatedDate", label: "Created Date" },
|
|
41
|
+
],
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
kind: "sobject",
|
|
45
|
+
key: "contacts",
|
|
46
|
+
objectName: "Contact",
|
|
47
|
+
label: "Contacts",
|
|
48
|
+
labelSingular: "Contact",
|
|
49
|
+
searchableFields: ["Name", "Email", "Phone"],
|
|
50
|
+
displayFields: ["Name", "Title", "Email", "Phone", { name: "Account", subfields: ["Name"] }],
|
|
51
|
+
sortBy: [
|
|
52
|
+
{ field: "Name", label: "Name" },
|
|
53
|
+
{ field: "CreatedDate", label: "Created Date" },
|
|
54
|
+
],
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
kind: "sobject",
|
|
58
|
+
key: "opportunities",
|
|
59
|
+
objectName: "Opportunity",
|
|
60
|
+
label: "Opportunities",
|
|
61
|
+
labelSingular: "Opportunity",
|
|
62
|
+
searchableFields: ["Name"],
|
|
63
|
+
displayFields: [
|
|
64
|
+
"Name",
|
|
65
|
+
"StageName",
|
|
66
|
+
"Amount",
|
|
67
|
+
"CloseDate",
|
|
68
|
+
{ name: "Account", subfields: ["Name"] },
|
|
69
|
+
],
|
|
70
|
+
filterBy: [
|
|
71
|
+
{ field: "StageName", label: "Stage", type: "picklist" },
|
|
72
|
+
{ field: "Amount", label: "Amount", type: "numeric" },
|
|
73
|
+
{ field: "CloseDate", label: "Close Date", type: "daterange" },
|
|
74
|
+
],
|
|
75
|
+
sortBy: [
|
|
76
|
+
{ field: "CloseDate", label: "Close Date" },
|
|
77
|
+
{ field: "Amount", label: "Amount" },
|
|
78
|
+
{ field: "Name", label: "Name" },
|
|
79
|
+
],
|
|
80
|
+
defaultSort: { field: "CloseDate", direction: "DESC" },
|
|
81
|
+
},
|
|
82
|
+
],
|
|
83
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026, Salesforce, Inc.,
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
* For full license text, see the LICENSE.txt file
|
|
5
|
+
*/
|
|
6
|
+
import { Directive, inject, input, TemplateRef } from "@angular/core";
|
|
7
|
+
import type { SourceConfig } from "../../types/search-config.types";
|
|
8
|
+
|
|
9
|
+
/** Context handed to a result template. */
|
|
10
|
+
export interface SearchResultContext {
|
|
11
|
+
/** The raw result node (`let-node`). */
|
|
12
|
+
$implicit: unknown;
|
|
13
|
+
/** The config of the source the node came from (`let-source="source"`). */
|
|
14
|
+
source: SourceConfig;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Replaces the default row for one source. Place it inside `<app-search>`:
|
|
19
|
+
*
|
|
20
|
+
* ```html
|
|
21
|
+
* <app-search [config]="config">
|
|
22
|
+
* <ng-template appSearchResult="Property__c" let-node>
|
|
23
|
+
* <app-property-card [property]="node" />
|
|
24
|
+
* </ng-template>
|
|
25
|
+
* </app-search>
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* The attribute value is the source `key`. The star form works too:
|
|
29
|
+
* `*appSearchResult="'Property__c'; let node"`. This is the Angular
|
|
30
|
+
* counterpart of React's `renderResult[sourceKey]`.
|
|
31
|
+
*/
|
|
32
|
+
@Directive({ selector: "ng-template[appSearchResult]" })
|
|
33
|
+
export class SearchResultTemplateDirective {
|
|
34
|
+
/** The `key` of the source this template renders. */
|
|
35
|
+
readonly sourceKey = input.required<string>({ alias: "appSearchResult" });
|
|
36
|
+
readonly template = inject<TemplateRef<SearchResultContext>>(TemplateRef);
|
|
37
|
+
|
|
38
|
+
static ngTemplateContextGuard(
|
|
39
|
+
_dir: SearchResultTemplateDirective,
|
|
40
|
+
_ctx: unknown,
|
|
41
|
+
): _ctx is SearchResultContext {
|
|
42
|
+
return true;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
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 { BooleanFilterComponent } from "./boolean-filter";
|
|
10
|
+
import type { FilterValue } from "./filter-types";
|
|
11
|
+
|
|
12
|
+
describe("BooleanFilterComponent", () => {
|
|
13
|
+
function setup() {
|
|
14
|
+
const fixture = TestBed.createComponent(BooleanFilterComponent);
|
|
15
|
+
fixture.componentRef.setInput("label", "Active");
|
|
16
|
+
fixture.componentRef.setInput("trueLabel", "On");
|
|
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("offers Any / true / false with custom labels", () => {
|
|
26
|
+
expect(setup().select.options()).toEqual([
|
|
27
|
+
{ value: "", label: "Any" },
|
|
28
|
+
{ value: "true", label: "On" },
|
|
29
|
+
{ value: "false", label: "No" },
|
|
30
|
+
]);
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
it("emits true/false and clears on Any", () => {
|
|
34
|
+
const { fixture, select, emitted } = setup();
|
|
35
|
+
select.value.set("true");
|
|
36
|
+
select.value.set("false");
|
|
37
|
+
select.value.set("");
|
|
38
|
+
fixture.detectChanges();
|
|
39
|
+
expect(emitted).toEqual([{ value: "true" }, { value: "false" }, undefined]);
|
|
40
|
+
});
|
|
41
|
+
});
|
|
@@ -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 {
|
|
8
|
+
SelectComponent,
|
|
9
|
+
type AppSelectOption,
|
|
10
|
+
} from "../../../components/ui/select/select";
|
|
11
|
+
import { uniqueFilterId, type FilterValue } from "./filter-types";
|
|
12
|
+
import { FilterFieldWrapperComponent } from "./filter-field-wrapper";
|
|
13
|
+
|
|
14
|
+
/** Tri-state boolean filter: Any (clears) / true / false. Emits `value: "true" | "false"`. */
|
|
15
|
+
@Component({
|
|
16
|
+
selector: "app-boolean-filter",
|
|
17
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
18
|
+
imports: [SelectComponent, FilterFieldWrapperComponent],
|
|
19
|
+
templateUrl: "./boolean-filter.html",
|
|
20
|
+
})
|
|
21
|
+
export class BooleanFilterComponent {
|
|
22
|
+
readonly label = input.required<string>();
|
|
23
|
+
readonly value = input<FilterValue | undefined>(undefined);
|
|
24
|
+
readonly trueLabel = input("Yes");
|
|
25
|
+
readonly falseLabel = input("No");
|
|
26
|
+
readonly helpText = input<string | undefined>(undefined);
|
|
27
|
+
readonly valueChange = output<FilterValue | undefined>();
|
|
28
|
+
|
|
29
|
+
protected readonly selectId = uniqueFilterId("filter-boolean");
|
|
30
|
+
|
|
31
|
+
protected readonly options = computed<readonly AppSelectOption[]>(() => [
|
|
32
|
+
{ value: "", label: "Any" },
|
|
33
|
+
{ value: "true", label: this.trueLabel() },
|
|
34
|
+
{ value: "false", label: this.falseLabel() },
|
|
35
|
+
]);
|
|
36
|
+
|
|
37
|
+
protected readonly current = computed(() => this.value()?.value ?? "");
|
|
38
|
+
|
|
39
|
+
protected onChange(v: string): void {
|
|
40
|
+
this.valueChange.emit(v ? { value: v } : undefined);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<app-filter-field-wrapper [label]="label()" [htmlFor]="pickerId" [helpText]="helpText()">
|
|
2
|
+
<div class="flex gap-2">
|
|
3
|
+
<app-select
|
|
4
|
+
class="flex-1"
|
|
5
|
+
[label]="label() + ' comparison'"
|
|
6
|
+
[options]="operatorOptions"
|
|
7
|
+
[value]="operator()"
|
|
8
|
+
(valueChange)="onOperatorChange($event)"
|
|
9
|
+
/>
|
|
10
|
+
<app-date-picker
|
|
11
|
+
class="flex-1"
|
|
12
|
+
[label]="label()"
|
|
13
|
+
placeholder="Pick a date"
|
|
14
|
+
[readonly]="true"
|
|
15
|
+
[max]="maxDate()"
|
|
16
|
+
[value]="currentDate()"
|
|
17
|
+
(valueChange)="onDateChange($event)"
|
|
18
|
+
/>
|
|
19
|
+
</div>
|
|
20
|
+
</app-filter-field-wrapper>
|
|
@@ -0,0 +1,56 @@
|
|
|
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 { DatePickerComponent } from "../../../components/ui/date-picker/date-picker";
|
|
9
|
+
import { SelectComponent } from "../../../components/ui/select/select";
|
|
10
|
+
import { DateFilterComponent } from "./date-filter";
|
|
11
|
+
import type { FilterValue } from "./filter-types";
|
|
12
|
+
|
|
13
|
+
describe("DateFilterComponent", () => {
|
|
14
|
+
function setup(value?: FilterValue) {
|
|
15
|
+
const fixture = TestBed.createComponent(DateFilterComponent);
|
|
16
|
+
fixture.componentRef.setInput("label", "Created");
|
|
17
|
+
if (value) fixture.componentRef.setInput("value", value);
|
|
18
|
+
const emitted: (FilterValue | undefined)[] = [];
|
|
19
|
+
fixture.componentInstance.valueChange.subscribe((v) => emitted.push(v));
|
|
20
|
+
fixture.detectChanges();
|
|
21
|
+
const select = fixture.debugElement.query(By.directive(SelectComponent))
|
|
22
|
+
.componentInstance as SelectComponent;
|
|
23
|
+
const picker = fixture.debugElement.query(By.directive(DatePickerComponent))
|
|
24
|
+
.componentInstance as DatePickerComponent;
|
|
25
|
+
return { fixture, select, picker, emitted };
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
it("defaults to After and emits min", () => {
|
|
29
|
+
const { fixture, select, picker, emitted } = setup();
|
|
30
|
+
expect(select.value()).toBe("gt");
|
|
31
|
+
picker.value.set(new Date(2026, 0, 2));
|
|
32
|
+
fixture.detectChanges();
|
|
33
|
+
expect(emitted).toEqual([{ value: "gt", min: "2026-01-02" }]);
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
it("moves the date to max when switching to Before", () => {
|
|
37
|
+
const { fixture, select, emitted } = setup({ value: "gt", min: "2026-01-02" });
|
|
38
|
+
select.value.set("lt");
|
|
39
|
+
fixture.detectChanges();
|
|
40
|
+
expect(emitted).toEqual([{ value: "lt", max: "2026-01-02" }]);
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
it("does not emit on operator change without a date", () => {
|
|
44
|
+
const { fixture, select, emitted } = setup();
|
|
45
|
+
select.value.set("lt");
|
|
46
|
+
fixture.detectChanges();
|
|
47
|
+
expect(emitted).toEqual([]);
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
it("emits undefined when the date is cleared", () => {
|
|
51
|
+
const { fixture, picker, emitted } = setup({ value: "gt", min: "2026-01-02" });
|
|
52
|
+
picker.value.set(null);
|
|
53
|
+
fixture.detectChanges();
|
|
54
|
+
expect(emitted).toEqual([undefined]);
|
|
55
|
+
});
|
|
56
|
+
});
|
|
@@ -0,0 +1,78 @@
|
|
|
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 { DatePickerComponent } from "../../../components/ui/date-picker/date-picker";
|
|
8
|
+
import {
|
|
9
|
+
SelectComponent,
|
|
10
|
+
type AppSelectOption,
|
|
11
|
+
} from "../../../components/ui/select/select";
|
|
12
|
+
import { toDate, toDateString, uniqueFilterId, type FilterValue } from "./filter-types";
|
|
13
|
+
import { FilterFieldWrapperComponent } from "./filter-field-wrapper";
|
|
14
|
+
|
|
15
|
+
type DateOperator = "gt" | "lt";
|
|
16
|
+
|
|
17
|
+
const OPERATOR_OPTIONS: readonly AppSelectOption[] = [
|
|
18
|
+
{ value: "gt", label: "After" },
|
|
19
|
+
{ value: "lt", label: "Before" },
|
|
20
|
+
];
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Single-date filter: an After/Before operator plus a date picker. Emits
|
|
24
|
+
* `{ value: "gt", min }` or `{ value: "lt", max }` with `YYYY-MM-DD` dates.
|
|
25
|
+
* Used for both date and datetime fields; the caller decides the field type.
|
|
26
|
+
*/
|
|
27
|
+
@Component({
|
|
28
|
+
selector: "app-date-filter",
|
|
29
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
30
|
+
imports: [DatePickerComponent, SelectComponent, FilterFieldWrapperComponent],
|
|
31
|
+
templateUrl: "./date-filter.html",
|
|
32
|
+
})
|
|
33
|
+
export class DateFilterComponent {
|
|
34
|
+
readonly label = input.required<string>();
|
|
35
|
+
readonly value = input<FilterValue | undefined>(undefined);
|
|
36
|
+
readonly helpText = input<string | undefined>(undefined);
|
|
37
|
+
/** Cap the picker at today. */
|
|
38
|
+
readonly disableFuture = input(false);
|
|
39
|
+
readonly valueChange = output<FilterValue | undefined>();
|
|
40
|
+
|
|
41
|
+
protected readonly pickerId = uniqueFilterId("filter-date");
|
|
42
|
+
protected readonly operatorOptions = OPERATOR_OPTIONS;
|
|
43
|
+
|
|
44
|
+
protected readonly maxDate = computed<Date | null>(() =>
|
|
45
|
+
this.disableFuture() ? new Date() : null,
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
protected readonly operator = computed<DateOperator>(() => {
|
|
49
|
+
const v = this.value();
|
|
50
|
+
if (v?.value === "gt" || v?.value === "lt") return v.value;
|
|
51
|
+
if (v?.max && !v.min) return "lt";
|
|
52
|
+
return "gt";
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
protected readonly currentDate = computed<Date | null>(() => {
|
|
56
|
+
const v = this.value();
|
|
57
|
+
return toDate(v?.min ?? v?.max);
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
protected onOperatorChange(v: string): void {
|
|
61
|
+
const date = this.currentDate();
|
|
62
|
+
// Wait for a date before emitting.
|
|
63
|
+
if (date) this.emit(v === "lt" ? "lt" : "gt", date);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
protected onDateChange(date: Date | null | undefined): void {
|
|
67
|
+
if (!date || !toDateString(date)) {
|
|
68
|
+
this.valueChange.emit(undefined);
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
this.emit(this.operator(), date);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
private emit(op: DateOperator, date: Date): void {
|
|
75
|
+
const str = toDateString(date);
|
|
76
|
+
this.valueChange.emit(op === "gt" ? { value: op, min: str } : { value: op, max: str });
|
|
77
|
+
}
|
|
78
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
<app-filter-field-wrapper [label]="label()" [htmlFor]="controlId" [helpText]="helpText()">
|
|
2
|
+
<div class="flex flex-col gap-2">
|
|
3
|
+
@if (showSelector()) {
|
|
4
|
+
<app-select
|
|
5
|
+
[label]="label() + ' comparison'"
|
|
6
|
+
[options]="operatorOptions()"
|
|
7
|
+
[value]="operator()"
|
|
8
|
+
(valueChange)="onOperatorChange($event)"
|
|
9
|
+
/>
|
|
10
|
+
} @switch (operator()) { @case ('between') {
|
|
11
|
+
<app-date-range-picker
|
|
12
|
+
class="w-full"
|
|
13
|
+
[label]="label()"
|
|
14
|
+
startPlaceholder="Start"
|
|
15
|
+
endPlaceholder="End"
|
|
16
|
+
[readonly]="true"
|
|
17
|
+
[max]="maxDate()"
|
|
18
|
+
[value]="range()"
|
|
19
|
+
(valueChange)="onRangeChange($event)"
|
|
20
|
+
/>
|
|
21
|
+
} @case ('after') {
|
|
22
|
+
<app-date-picker
|
|
23
|
+
class="w-full"
|
|
24
|
+
[label]="label() + ' after'"
|
|
25
|
+
placeholder="Pick a date"
|
|
26
|
+
[readonly]="true"
|
|
27
|
+
[max]="maxDate()"
|
|
28
|
+
[value]="minDate()"
|
|
29
|
+
(valueChange)="onAfterChange($event)"
|
|
30
|
+
/>
|
|
31
|
+
} @case ('before') {
|
|
32
|
+
<app-date-picker
|
|
33
|
+
class="w-full"
|
|
34
|
+
[label]="label() + ' before'"
|
|
35
|
+
placeholder="Pick a date"
|
|
36
|
+
[readonly]="true"
|
|
37
|
+
[max]="maxDate()"
|
|
38
|
+
[value]="maxValue()"
|
|
39
|
+
(valueChange)="onBeforeChange($event)"
|
|
40
|
+
/>
|
|
41
|
+
} }
|
|
42
|
+
</div>
|
|
43
|
+
</app-filter-field-wrapper>
|
|
@@ -0,0 +1,70 @@
|
|
|
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 { DatePickerComponent } from "../../../components/ui/date-picker/date-picker";
|
|
9
|
+
import { DateRangePickerComponent } from "../../../components/ui/date-range-picker/date-range-picker";
|
|
10
|
+
import { SelectComponent } from "../../../components/ui/select/select";
|
|
11
|
+
import { DateRangeFilterComponent } from "./date-range-filter";
|
|
12
|
+
import type { DateFilterMode, FilterValue } from "./filter-types";
|
|
13
|
+
|
|
14
|
+
describe("DateRangeFilterComponent", () => {
|
|
15
|
+
function setup(mode: DateFilterMode, value?: FilterValue) {
|
|
16
|
+
const fixture = TestBed.createComponent(DateRangeFilterComponent);
|
|
17
|
+
fixture.componentRef.setInput("label", "Closed");
|
|
18
|
+
fixture.componentRef.setInput("mode", mode);
|
|
19
|
+
if (value) fixture.componentRef.setInput("value", value);
|
|
20
|
+
const emitted: (FilterValue | undefined)[] = [];
|
|
21
|
+
fixture.componentInstance.valueChange.subscribe((v) => emitted.push(v));
|
|
22
|
+
fixture.detectChanges();
|
|
23
|
+
const get = <T>(type: new (...a: never[]) => T) =>
|
|
24
|
+
fixture.debugElement.query(By.directive(type))?.componentInstance as T | undefined;
|
|
25
|
+
return { fixture, get, emitted };
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
it("range mode shows only the range picker, no selector", () => {
|
|
29
|
+
const { get } = setup("range");
|
|
30
|
+
expect(get(SelectComponent)).toBeUndefined();
|
|
31
|
+
expect(get(DateRangePickerComponent)).toBeDefined();
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
it("range mode emits both bounds", () => {
|
|
35
|
+
const { fixture, get, emitted } = setup("range");
|
|
36
|
+
get(DateRangePickerComponent)!.value.set({
|
|
37
|
+
start: new Date(2026, 0, 1),
|
|
38
|
+
end: new Date(2026, 0, 31),
|
|
39
|
+
});
|
|
40
|
+
fixture.detectChanges();
|
|
41
|
+
expect(emitted).toEqual([{ min: "2026-01-01", max: "2026-01-31" }]);
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
it("comparison mode defaults to After and emits only min", () => {
|
|
45
|
+
const { fixture, get, emitted } = setup("comparison");
|
|
46
|
+
expect(
|
|
47
|
+
get(SelectComponent)!
|
|
48
|
+
.options()
|
|
49
|
+
.map((o) => o.label),
|
|
50
|
+
).toEqual(["After", "Before"]);
|
|
51
|
+
get(DatePickerComponent)!.value.set(new Date(2026, 4, 6));
|
|
52
|
+
fixture.detectChanges();
|
|
53
|
+
expect(emitted).toEqual([{ min: "2026-05-06", max: undefined }]);
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
it("restores the Before operator from a max-only value and keeps only max on switch", () => {
|
|
57
|
+
const { fixture, get, emitted } = setup("both", { max: "2026-02-01" });
|
|
58
|
+
expect(get(SelectComponent)!.value()).toBe("before");
|
|
59
|
+
get(SelectComponent)!.value.set("between");
|
|
60
|
+
fixture.detectChanges();
|
|
61
|
+
expect(emitted).toEqual([{ min: undefined, max: "2026-02-01" }]);
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
it("emits undefined when cleared", () => {
|
|
65
|
+
const { fixture, get, emitted } = setup("comparison", { min: "2026-01-01" });
|
|
66
|
+
get(DatePickerComponent)!.value.set(null);
|
|
67
|
+
fixture.detectChanges();
|
|
68
|
+
expect(emitted).toEqual([undefined]);
|
|
69
|
+
});
|
|
70
|
+
});
|
|
@@ -0,0 +1,125 @@
|
|
|
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, signal } from "@angular/core";
|
|
7
|
+
import { DatePickerComponent } from "../../../components/ui/date-picker/date-picker";
|
|
8
|
+
import {
|
|
9
|
+
DateRange,
|
|
10
|
+
DateRangePickerComponent,
|
|
11
|
+
} from "../../../components/ui/date-range-picker/date-range-picker";
|
|
12
|
+
import {
|
|
13
|
+
SelectComponent,
|
|
14
|
+
type AppSelectOption,
|
|
15
|
+
} from "../../../components/ui/select/select";
|
|
16
|
+
import {
|
|
17
|
+
toDate,
|
|
18
|
+
toDateString,
|
|
19
|
+
uniqueFilterId,
|
|
20
|
+
type DateFilterMode,
|
|
21
|
+
type FilterValue,
|
|
22
|
+
} from "./filter-types";
|
|
23
|
+
import { FilterFieldWrapperComponent } from "./filter-field-wrapper";
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* after -> only `min` (gte), before -> only `max` (lte), between -> both.
|
|
27
|
+
*/
|
|
28
|
+
type DateOperator = "between" | "after" | "before";
|
|
29
|
+
|
|
30
|
+
const OPERATOR_LABELS: Record<DateOperator, string> = {
|
|
31
|
+
between: "Between",
|
|
32
|
+
after: "After",
|
|
33
|
+
before: "Before",
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const MODE_OPERATORS: Record<DateFilterMode, readonly DateOperator[]> = {
|
|
37
|
+
range: ["between"],
|
|
38
|
+
comparison: ["after", "before"],
|
|
39
|
+
both: ["between", "after", "before"],
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
function operatorFor(v: FilterValue | undefined): DateOperator {
|
|
43
|
+
if (v?.max && !v.min) return "before";
|
|
44
|
+
if (v?.min && !v.max) return "after";
|
|
45
|
+
return "between";
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Date constraint whose chrome follows `mode` (see {@link DateFilterMode}).
|
|
50
|
+
* Emits `{ min?, max? }` as `YYYY-MM-DD`. Used for both date and datetime
|
|
51
|
+
* fields; the caller decides the field type.
|
|
52
|
+
*/
|
|
53
|
+
@Component({
|
|
54
|
+
selector: "app-date-range-filter",
|
|
55
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
56
|
+
imports: [
|
|
57
|
+
DatePickerComponent,
|
|
58
|
+
DateRangePickerComponent,
|
|
59
|
+
SelectComponent,
|
|
60
|
+
FilterFieldWrapperComponent,
|
|
61
|
+
],
|
|
62
|
+
templateUrl: "./date-range-filter.html",
|
|
63
|
+
})
|
|
64
|
+
export class DateRangeFilterComponent {
|
|
65
|
+
readonly label = input.required<string>();
|
|
66
|
+
readonly value = input<FilterValue | undefined>(undefined);
|
|
67
|
+
readonly mode = input<DateFilterMode>("comparison");
|
|
68
|
+
readonly helpText = input<string | undefined>(undefined);
|
|
69
|
+
/** Cap the pickers at today. */
|
|
70
|
+
readonly disableFuture = input(false);
|
|
71
|
+
readonly valueChange = output<FilterValue | undefined>();
|
|
72
|
+
|
|
73
|
+
protected readonly controlId = uniqueFilterId("filter-daterange");
|
|
74
|
+
|
|
75
|
+
protected readonly operators = computed(() => MODE_OPERATORS[this.mode()]);
|
|
76
|
+
protected readonly operatorOptions = computed<readonly AppSelectOption[]>(() =>
|
|
77
|
+
this.operators().map((op) => ({ value: op, label: OPERATOR_LABELS[op] })),
|
|
78
|
+
);
|
|
79
|
+
protected readonly showSelector = computed(() => this.operators().length > 1);
|
|
80
|
+
|
|
81
|
+
// Operator is local state: it must survive the moment no date is entered
|
|
82
|
+
// (which clears the value). `null` means "derive from the bound value".
|
|
83
|
+
private readonly chosen = signal<DateOperator | null>(null);
|
|
84
|
+
protected readonly operator = computed<DateOperator>(() => {
|
|
85
|
+
const ops = this.operators();
|
|
86
|
+
const op = this.chosen() ?? operatorFor(this.value());
|
|
87
|
+
return ops.includes(op) ? op : ops[0];
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
protected readonly maxDate = computed<Date | null>(() =>
|
|
91
|
+
this.disableFuture() ? new Date() : null,
|
|
92
|
+
);
|
|
93
|
+
protected readonly minDate = computed(() => toDate(this.value()?.min));
|
|
94
|
+
protected readonly maxValue = computed(() => toDate(this.value()?.max));
|
|
95
|
+
protected readonly range = computed<DateRange<Date>>(() => ({
|
|
96
|
+
start: this.minDate(),
|
|
97
|
+
end: this.maxValue(),
|
|
98
|
+
}));
|
|
99
|
+
|
|
100
|
+
protected onOperatorChange(v: string): void {
|
|
101
|
+
const next = v as DateOperator;
|
|
102
|
+
this.chosen.set(next);
|
|
103
|
+
const cur = this.value();
|
|
104
|
+
// Keep only the bound(s) the new operator uses.
|
|
105
|
+
if (next === "after") this.emit(cur?.min, undefined);
|
|
106
|
+
else if (next === "before") this.emit(undefined, cur?.max);
|
|
107
|
+
else this.emit(cur?.min, cur?.max);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
protected onRangeChange(range: DateRange<Date> | null): void {
|
|
111
|
+
this.emit(toDateString(range?.start) || undefined, toDateString(range?.end) || undefined);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
protected onAfterChange(date: Date | null | undefined): void {
|
|
115
|
+
this.emit(toDateString(date) || undefined, undefined);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
protected onBeforeChange(date: Date | null | undefined): void {
|
|
119
|
+
this.emit(undefined, toDateString(date) || undefined);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
private emit(min: string | undefined, max: string | undefined): void {
|
|
123
|
+
this.valueChange.emit(min || max ? { min, max } : undefined);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<!-- The wrapper owns the one visible label; projected base controls keep theirs for a11y but sr-only. -->
|
|
2
|
+
<div
|
|
3
|
+
class="space-y-1 [&_app-select_label]:sr-only [&_app-date-picker_label]:sr-only [&_app-date-range-picker_label]:sr-only"
|
|
4
|
+
>
|
|
5
|
+
@if (label()) {
|
|
6
|
+
<app-label [for]="htmlFor()">{{ label() }}</app-label>
|
|
7
|
+
}
|
|
8
|
+
<ng-content />
|
|
9
|
+
<div class="min-h-4">
|
|
10
|
+
@if (error(); as err) {
|
|
11
|
+
<p [id]="errorId()" class="text-xs text-destructive" role="alert">{{ err }}</p>
|
|
12
|
+
} @else if (helpText(); as help) {
|
|
13
|
+
<p class="text-xs text-muted-foreground">{{ help }}</p>
|
|
14
|
+
}
|
|
15
|
+
</div>
|
|
16
|
+
</div>
|