synapse-react-client 4.0.22 → 4.0.23
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/dist/SWC.index.js +1 -1
- package/dist/assets/icons/GeneticsIcon.d.ts +3 -0
- package/dist/assets/icons/GeneticsIcon.d.ts.map +1 -0
- package/dist/assets/icons/GeneticsIcon.js +14 -0
- package/dist/assets/icons/GeneticsIcon.js.map +1 -0
- package/dist/components/EntityCitation/EntityCitation.d.ts.map +1 -1
- package/dist/components/EntityCitation/EntityCitation.js +23 -8
- package/dist/components/EntityCitation/EntityCitation.js.map +1 -1
- package/dist/components/GenericCard/DuoTermTags/DuoTermTags.d.ts +18 -0
- package/dist/components/GenericCard/DuoTermTags/DuoTermTags.d.ts.map +1 -0
- package/dist/components/GenericCard/DuoTermTags/DuoTermTags.js +112 -0
- package/dist/components/GenericCard/DuoTermTags/DuoTermTags.js.map +1 -0
- package/dist/components/GenericCard/DuoTermTags/duoTerms.d.ts +31 -0
- package/dist/components/GenericCard/DuoTermTags/duoTerms.d.ts.map +1 -0
- package/dist/components/GenericCard/DuoTermTags/duoTerms.js +198 -0
- package/dist/components/GenericCard/DuoTermTags/duoTerms.js.map +1 -0
- package/dist/components/GenericCard/SynapseCardLabel.d.ts.map +1 -1
- package/dist/components/GenericCard/SynapseCardLabel.js +4 -8
- package/dist/components/GenericCard/SynapseCardLabel.js.map +1 -1
- package/dist/components/GenericCard/TableRowGenericCard.d.ts +6 -0
- package/dist/components/GenericCard/TableRowGenericCard.d.ts.map +1 -1
- package/dist/components/GenericCard/TableRowGenericCard.js +168 -153
- package/dist/components/GenericCard/TableRowGenericCard.js.map +1 -1
- package/dist/components/IconSvg/IconSvg.d.ts +1 -1
- package/dist/components/IconSvg/IconSvg.d.ts.map +1 -1
- package/dist/components/IconSvg/IconSvg.js +19 -18
- package/dist/components/IconSvg/IconSvg.js.map +1 -1
- package/dist/components/QueryVisualizationWrapper/QueryVisualizationContext.d.ts +21 -0
- package/dist/components/QueryVisualizationWrapper/QueryVisualizationContext.d.ts.map +1 -1
- package/dist/components/QueryVisualizationWrapper/QueryVisualizationContext.js.map +1 -1
- package/dist/components/QueryVisualizationWrapper/QueryVisualizationWrapper.d.ts +10 -0
- package/dist/components/QueryVisualizationWrapper/QueryVisualizationWrapper.d.ts.map +1 -1
- package/dist/components/QueryVisualizationWrapper/QueryVisualizationWrapper.js +65 -59
- package/dist/components/QueryVisualizationWrapper/QueryVisualizationWrapper.js.map +1 -1
- package/dist/components/QueryWrapperPlotNav/QueryWrapperPlotNav.d.ts +1 -1
- package/dist/components/QueryWrapperPlotNav/QueryWrapperPlotNav.d.ts.map +1 -1
- package/dist/components/QueryWrapperPlotNav/QueryWrapperPlotNav.js +2 -0
- package/dist/components/QueryWrapperPlotNav/QueryWrapperPlotNav.js.map +1 -1
- package/dist/components/SearchQueryWrapper/SearchQueryUseQueryOptions.d.ts +33 -6
- package/dist/components/SearchQueryWrapper/SearchQueryUseQueryOptions.d.ts.map +1 -1
- package/dist/components/SearchQueryWrapper/SearchQueryUseQueryOptions.js +93 -55
- package/dist/components/SearchQueryWrapper/SearchQueryUseQueryOptions.js.map +1 -1
- package/dist/components/SearchQueryWrapper/SearchQueryWrapper.d.ts +3 -0
- package/dist/components/SearchQueryWrapper/SearchQueryWrapper.d.ts.map +1 -1
- package/dist/components/SearchQueryWrapper/SearchQueryWrapper.js +39 -37
- package/dist/components/SearchQueryWrapper/SearchQueryWrapper.js.map +1 -1
- package/dist/components/SearchQueryWrapperPlotNav/SearchQueryWrapperPlotNav.d.ts +3 -1
- package/dist/components/SearchQueryWrapperPlotNav/SearchQueryWrapperPlotNav.d.ts.map +1 -1
- package/dist/components/SearchQueryWrapperPlotNav/SearchQueryWrapperPlotNav.js +4 -0
- package/dist/components/SearchQueryWrapperPlotNav/SearchQueryWrapperPlotNav.js.map +1 -1
- package/dist/components/entity/page/action_menu/EntityActionMenu.d.ts +5 -2
- package/dist/components/entity/page/action_menu/EntityActionMenu.d.ts.map +1 -1
- package/dist/components/entity/page/action_menu/EntityActionMenu.js +68 -51
- package/dist/components/entity/page/action_menu/EntityActionMenu.js.map +1 -1
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/menu/ComplexMenu.d.ts +8 -1
- package/dist/components/menu/ComplexMenu.d.ts.map +1 -1
- package/dist/components/menu/ComplexMenu.js +50 -20
- package/dist/components/menu/ComplexMenu.js.map +1 -1
- package/dist/components/widgets/facet-nav/FacetValueChip.d.ts +25 -0
- package/dist/components/widgets/facet-nav/FacetValueChip.d.ts.map +1 -0
- package/dist/components/widgets/facet-nav/FacetValueChip.js +40 -0
- package/dist/components/widgets/facet-nav/FacetValueChip.js.map +1 -0
- package/dist/components/widgets/facet-nav/SelectionCriteriaPill.d.ts +10 -5
- package/dist/components/widgets/facet-nav/SelectionCriteriaPill.d.ts.map +1 -1
- package/dist/components/widgets/facet-nav/SelectionCriteriaPill.js +10 -17
- package/dist/components/widgets/facet-nav/SelectionCriteriaPill.js.map +1 -1
- package/dist/components/widgets/facet-nav/SelectionCriteriaPills.d.ts.map +1 -1
- package/dist/components/widgets/facet-nav/SelectionCriteriaPills.js +11 -10
- package/dist/components/widgets/facet-nav/SelectionCriteriaPills.js.map +1 -1
- package/dist/components/widgets/query-filter/EnumFacetFilter/EnumFacetFilter.d.ts.map +1 -1
- package/dist/components/widgets/query-filter/EnumFacetFilter/EnumFacetFilter.js +70 -54
- package/dist/components/widgets/query-filter/EnumFacetFilter/EnumFacetFilter.js.map +1 -1
- package/dist/components/widgets/query-filter/EnumFacetFilter/EnumFacetFilterOption.d.ts +2 -1
- package/dist/components/widgets/query-filter/EnumFacetFilter/EnumFacetFilterOption.d.ts.map +1 -1
- package/dist/components/widgets/query-filter/EnumFacetFilter/EnumFacetFilterOption.js +17 -1
- package/dist/components/widgets/query-filter/EnumFacetFilter/EnumFacetFilterOption.js.map +1 -1
- package/dist/components/widgets/query-filter/EnumFacetFilter/EnumFacetFilterUI.d.ts +2 -0
- package/dist/components/widgets/query-filter/EnumFacetFilter/EnumFacetFilterUI.d.ts.map +1 -1
- package/dist/components/widgets/query-filter/EnumFacetFilter/EnumFacetFilterUI.js +7 -7
- package/dist/components/widgets/query-filter/EnumFacetFilter/EnumFacetFilterUI.js.map +1 -1
- package/dist/features/curator/dashboard/components/CurationTaskCard.d.ts.map +1 -1
- package/dist/features/curator/dashboard/components/CurationTaskCard.js +99 -45
- package/dist/features/curator/dashboard/components/CurationTaskCard.js.map +1 -1
- package/dist/features/entity/metadata-task/components/CreateOrUpdateCurationTaskDialog.d.ts.map +1 -1
- package/dist/features/entity/metadata-task/components/CreateOrUpdateCurationTaskDialog.js +174 -149
- package/dist/features/entity/metadata-task/components/CreateOrUpdateCurationTaskDialog.js.map +1 -1
- package/dist/features/entity/metadata-task/utils/constants.d.ts +6 -0
- package/dist/features/entity/metadata-task/utils/constants.d.ts.map +1 -1
- package/dist/features/entity/metadata-task/utils/constants.js +19 -2
- package/dist/features/entity/metadata-task/utils/constants.js.map +1 -1
- package/dist/style/components/_total-query-results.scss +10 -34
- package/dist/style/main.css +1 -1
- package/dist/synapse-queries/curation/task/useCurationTask.d.ts.map +1 -1
- package/dist/synapse-queries/curation/task/useCurationTask.js +1 -1
- package/dist/synapse-queries/curation/task/useCurationTask.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +4 -4
|
@@ -24,13 +24,15 @@ type SearchQueryWrapperPlotNavOwnProps = {
|
|
|
24
24
|
initialLimit?: number;
|
|
25
25
|
hideTopLevelControls?: boolean;
|
|
26
26
|
};
|
|
27
|
-
export type SearchQueryWrapperPlotNavProps = SearchQueryWrapperPlotNavOwnProps & PlotsContainerProps & Pick<QueryVisualizationWrapperProps, 'defaultShowPlots' | 'visibleColumnCount' | 'hiddenColumns' | 'columnAliases' | 'rgbIndex' | 'showLastUpdatedOn' | 'noContentPlaceholderType' | 'unitDescription' | 'helpConfiguration' | 'hideCopyToClipboard' | 'hideVisualizationsControl' | 'lockTextMatchesQueryFilterPill' | 'hideSearchBarControl' | 'defaultShowSearchBar'> & Pick<TopLevelControlsProps, 'name' | 'hideQueryCount'> & {
|
|
27
|
+
export type SearchQueryWrapperPlotNavProps = SearchQueryWrapperPlotNavOwnProps & PlotsContainerProps & Pick<QueryVisualizationWrapperProps, 'defaultShowPlots' | 'visibleColumnCount' | 'hiddenColumns' | 'columnAliases' | 'renderFacetValue' | 'rgbIndex' | 'showLastUpdatedOn' | 'noContentPlaceholderType' | 'unitDescription' | 'helpConfiguration' | 'hideCopyToClipboard' | 'hideVisualizationsControl' | 'lockTextMatchesQueryFilterPill' | 'hideSearchBarControl' | 'defaultShowSearchBar'> & Pick<TopLevelControlsProps, 'name' | 'hideQueryCount'> & {
|
|
28
28
|
/** Optional initial query parameters. Only selectedFacets, additionalFilters, limit, and offset are used. */
|
|
29
29
|
initQueryRequest?: SearchQueryWrapperProps['initQueryRequest'];
|
|
30
30
|
/** Called when the query result bundle changes (e.g. to report result counts to a parent). */
|
|
31
31
|
onQueryResultBundleChange?: SearchQueryWrapperProps['onQueryResultBundleChange'];
|
|
32
32
|
/** Whether the URL should update when the query is modified (deep linking). */
|
|
33
33
|
shouldDeepLink?: SearchQueryWrapperProps['shouldDeepLink'];
|
|
34
|
+
/** OpenSearch query strategy and field-boost configuration. Forwarded to SearchQueryWrapper. */
|
|
35
|
+
searchQueryConfig?: SearchQueryWrapperProps['searchQueryConfig'];
|
|
34
36
|
};
|
|
35
37
|
/**
|
|
36
38
|
* Type guard that identifies a SearchQueryWrapperPlotNavProps from the union
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchQueryWrapperPlotNav.d.ts","sourceRoot":"","sources":["../../../src/components/SearchQueryWrapperPlotNav/SearchQueryWrapperPlotNav.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAA;AACtE,OAAO,EAEL,8BAA8B,EAC/B,M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8F;IAC9F,yBAAyB,CAAC,EAAE,uBAAuB,CAAC,2BAA2B,CAAC,CAAA;IAChF,+EAA+E;IAC/E,cAAc,CAAC,EAAE,uBAAuB,CAAC,gBAAgB,CAAC,CAAA;
|
|
1
|
+
{"version":3,"file":"SearchQueryWrapperPlotNav.d.ts","sourceRoot":"","sources":["../../../src/components/SearchQueryWrapperPlotNav/SearchQueryWrapperPlotNav.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAA;AACtE,OAAO,EAEL,8BAA8B,EAC/B,MAAM,8BAA8B,CAAA;AAErC,OAAO,EAAE,yBAAyB,EAAE,MAAM,iBAAiB,CAAA;AAC3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,mDAAmD,CAAA;AACzF,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAA;AACzE,OAAO,EAAE,wBAAwB,EAAE,MAAM,6CAA6C,CAAA;AACtF,OAAO,EAEL,uBAAuB,EACxB,MAAM,0CAA0C,CAAA;AAIjD,KAAK,iCAAiC,GAAG;IACvC,iDAAiD;IACjD,aAAa,EAAE,MAAM,CAAA;IACrB;;;;OAIG;IACH,qBAAqB,CAAC,EAAE,MAAM,CAAA;IAC9B,2HAA2H;IAC3H,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,kBAAkB,CAAC,EAAE,yBAAyB,CAAA;IAC9C,iBAAiB,CAAC,EAAE,iBAAiB,CAAA;IACrC,YAAY,CAAC,EAAE,MAAM,EAAE,CAAA;IACvB,eAAe,CAAC,EAAE,wBAAwB,CAAC,iBAAiB,CAAC,CAAA;IAC7D,4BAA4B,CAAC,EAAE,wBAAwB,CAAC,8BAA8B,CAAC,CAAA;IACvF,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,oBAAoB,CAAC,EAAE,OAAO,CAAA;CAI/B,CAAA;AAED,MAAM,MAAM,8BAA8B,GAAG,iCAAiC,GAC5E,mBAAmB,GACnB,IAAI,CACF,8BAA8B,EAC5B,kBAAkB,GAClB,oBAAoB,GACpB,eAAe,GACf,eAAe,GACf,kBAAkB,GAClB,UAAU,GACV,mBAAmB,GACnB,0BAA0B,GAC1B,iBAAiB,GACjB,mBAAmB,GACnB,qBAAqB,GACrB,2BAA2B,GAC3B,gCAAgC,GAChC,sBAAsB,GACtB,sBAAsB,CACzB,GACD,IAAI,CAAC,qBAAqB,EAAE,MAAM,GAAG,gBAAgB,CAAC,GAAG;IACvD,6GAA6G;IAC7G,gBAAgB,CAAC,EAAE,uBAAuB,CAAC,kBAAkB,CAAC,CAAA;IAC9D,8FAA8F;IAC9F,yBAAyB,CAAC,EAAE,uBAAuB,CAAC,2BAA2B,CAAC,CAAA;IAChF,+EAA+E;IAC/E,cAAc,CAAC,EAAE,uBAAuB,CAAC,gBAAgB,CAAC,CAAA;IAC1D,gGAAgG;IAChG,iBAAiB,CAAC,EAAE,uBAAuB,CAAC,mBAAmB,CAAC,CAAA;CACjE,CAAA;AAEH;;;;;;;;;GASG;AACH,wBAAgB,gCAAgC,CAAC,MAAM,EAAE;IACvD,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,GAAG,CAAC,EAAE,OAAO,CAAA;CACd,GAAG,MAAM,IAAI,8BAA8B,CAE3C;AAED;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,yBAAyB,CAC/C,KAAK,EAAE,8BAA8B,2CA4GtC"}
|
|
@@ -19,6 +19,7 @@ function d(u) {
|
|
|
19
19
|
query: {
|
|
20
20
|
selectedFacets: h?.query?.selectedFacets,
|
|
21
21
|
additionalFilters: h?.query?.additionalFilters,
|
|
22
|
+
sort: h?.query?.sort,
|
|
22
23
|
limit: h?.query?.limit ?? 25,
|
|
23
24
|
offset: h?.query?.offset ?? 0
|
|
24
25
|
}
|
|
@@ -29,12 +30,15 @@ function d(u) {
|
|
|
29
30
|
isInfinite: f,
|
|
30
31
|
onQueryResultBundleChange: g,
|
|
31
32
|
shouldDeepLink: y,
|
|
33
|
+
searchQueryConfig: u.searchQueryConfig,
|
|
32
34
|
children: /* @__PURE__ */ c(o, {
|
|
33
35
|
fallback: /* @__PURE__ */ c(n, {}),
|
|
34
36
|
children: /* @__PURE__ */ c(t, {
|
|
35
37
|
unitDescription: p,
|
|
36
38
|
rgbIndex: u.rgbIndex,
|
|
37
39
|
columnAliases: u.columnAliases,
|
|
40
|
+
renderFacetValue: u.renderFacetValue,
|
|
41
|
+
dataUseModifiersColumnName: u.cardConfiguration?.genericCardSchema?.dataUseModifiersColumnName,
|
|
38
42
|
helpConfiguration: m,
|
|
39
43
|
visibleColumnCount: u.visibleColumnCount,
|
|
40
44
|
hiddenColumns: u.hiddenColumns,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchQueryWrapperPlotNav.js","names":[],"sources":["../../../src/components/SearchQueryWrapperPlotNav/SearchQueryWrapperPlotNav.tsx"],"sourcesContent":["import { NoContentPlaceholderType } from '@/components/SynapseTable/NoContentPlaceholderType'\nimport { DEFAULT_PAGE_SIZE } from '@/utils/SynapseConstants'\nimport { Suspense, useRef } from 'react'\nimport { useDeepCompareMemoize } from 'use-deep-compare-effect'\nimport { CardConfiguration } from '../CardContainer/CardConfiguration'\nimport {\n QueryVisualizationWrapper,\n QueryVisualizationWrapperProps,\n} from '../QueryVisualizationWrapper'\nimport QueryWrapperLoadingScreen from '../QueryWrapper/QueryWrapperLoadingScreen'\nimport { SynapseTableConfiguration } from '../SynapseTable'\nimport { TopLevelControlsProps } from '../SynapseTable/TopLevelControls/TopLevelControls'\nimport { PlotsContainerProps } from '../widgets/facet-nav/PlotsContainer'\nimport { FacetFilterControlsProps } from '../widgets/query-filter/FacetFilterControls'\nimport {\n SearchQueryWrapper,\n SearchQueryWrapperProps,\n} from '../SearchQueryWrapper/SearchQueryWrapper'\nimport { QueryWrapperPlotNavContents } from '../QueryWrapperPlotNav/QueryWrapperPlotNav'\nimport { useGetSuggestionsForSearchIndex } from '../SearchQueryWrapper/SearchQueryUseQueryOptions'\n\ntype SearchQueryWrapperPlotNavOwnProps = {\n /** The ID of the SearchIndex entity to query. */\n searchIndexId: string\n /**\n * The name of the field to use for autocomplete suggestions.\n * When provided, the search bar will show a dropdown of suggestions as the user types,\n * populated by querying the search index with this field restricted via POST /search/autocomplete.\n */\n autocompleteFieldName?: string\n /** Whether the displayed results should be paginated or infinite. Default for cards is true, default for table is false */\n isInfinite?: boolean\n tableConfiguration?: SynapseTableConfiguration\n cardConfiguration?: CardConfiguration\n facetsToPlot?: string[]\n availableFacets?: FacetFilterControlsProps['availableFacets']\n initialExpandedFacetControls?: FacetFilterControlsProps['initialExpandedFacetControls']\n initialLimit?: number\n hideTopLevelControls?: boolean\n // Note: hideDownload, hideSqlEditorControl are intentionally\n // excluded — they are hardcoded to true because these controls are not applicable to the\n // SearchQueryServicesApi (no file download, no SQL editing).\n}\n\nexport type SearchQueryWrapperPlotNavProps = SearchQueryWrapperPlotNavOwnProps &\n PlotsContainerProps &\n Pick<\n QueryVisualizationWrapperProps,\n | 'defaultShowPlots'\n | 'visibleColumnCount'\n | 'hiddenColumns'\n | 'columnAliases'\n | 'rgbIndex'\n | 'showLastUpdatedOn'\n | 'noContentPlaceholderType'\n | 'unitDescription'\n | 'helpConfiguration'\n | 'hideCopyToClipboard'\n | 'hideVisualizationsControl'\n | 'lockTextMatchesQueryFilterPill'\n | 'hideSearchBarControl'\n | 'defaultShowSearchBar'\n > &\n Pick<TopLevelControlsProps, 'name' | 'hideQueryCount'> & {\n /** Optional initial query parameters. Only selectedFacets, additionalFilters, limit, and offset are used. */\n initQueryRequest?: SearchQueryWrapperProps['initQueryRequest']\n /** Called when the query result bundle changes (e.g. to report result counts to a parent). */\n onQueryResultBundleChange?: SearchQueryWrapperProps['onQueryResultBundleChange']\n /** Whether the URL should update when the query is modified (deep linking). */\n shouldDeepLink?: SearchQueryWrapperProps['shouldDeepLink']\n }\n\n/**\n * Type guard that identifies a SearchQueryWrapperPlotNavProps from the union\n * `QueryWrapperPlotNavProps | SearchQueryWrapperPlotNavProps`.\n *\n * Two conditions are checked to be robust against future API changes:\n * 1. The config has `searchIndexId` (present only on SearchQueryWrapperPlotNavProps).\n * 2. The config does NOT have `sql` (always present on QueryWrapperPlotNavProps via\n * QueryOrDeprecatedSearchParams), so that if QueryWrapperPlotNavProps ever gains a\n * `searchIndexId` field the guard remains correct.\n */\nexport function isSearchQueryWrapperPlotNavProps(config: {\n searchIndexId?: unknown\n sql?: unknown\n}): config is SearchQueryWrapperPlotNavProps {\n return 'searchIndexId' in config && !('sql' in config)\n}\n\n/**\n * A component similar to QueryWrapperPlotNav that sources its data from the SearchQueryServicesApi\n * rather than the standard Synapse Table Services. Facets, table/card rendering, and plots are\n * all reused from the existing component library.\n */\nexport default function SearchQueryWrapperPlotNav(\n props: SearchQueryWrapperPlotNavProps,\n) {\n const {\n tableConfiguration,\n isInfinite = !tableConfiguration,\n unitDescription,\n helpConfiguration,\n initQueryRequest: initQueryRequestFromProps,\n onQueryResultBundleChange,\n searchIndexId,\n autocompleteFieldName,\n shouldDeepLink,\n } = props\n\n const getSuggestions = useGetSuggestionsForSearchIndex(\n searchIndexId,\n autocompleteFieldName,\n )\n\n const initQueryRequest: SearchQueryWrapperProps['initQueryRequest'] =\n useDeepCompareMemoize({\n partMask: initQueryRequestFromProps?.partMask ?? 0,\n query: {\n selectedFacets: initQueryRequestFromProps?.query?.selectedFacets,\n additionalFilters: initQueryRequestFromProps?.query?.additionalFilters,\n limit: initQueryRequestFromProps?.query?.limit ?? DEFAULT_PAGE_SIZE,\n offset: initQueryRequestFromProps?.query?.offset ?? 0,\n },\n })\n\n // Remount SearchQueryWrapper when initQueryRequest content changes.\n // useDeepCompareMemoize returns the same reference when content is equal, so reference\n // comparison is sufficient here. A counter is used rather than JSON.stringify to avoid\n // serializing the object on every render.\n const mountKeyRef = useRef(0)\n const prevInitQueryRef = useRef(initQueryRequest)\n if (prevInitQueryRef.current !== initQueryRequest) {\n mountKeyRef.current += 1\n prevInitQueryRef.current = initQueryRequest\n }\n\n return (\n <SearchQueryWrapper\n key={mountKeyRef.current}\n searchIndexId={searchIndexId}\n initQueryRequest={initQueryRequest}\n isInfinite={isInfinite}\n onQueryResultBundleChange={onQueryResultBundleChange}\n shouldDeepLink={shouldDeepLink}\n >\n <Suspense fallback={<QueryWrapperLoadingScreen />}>\n <QueryVisualizationWrapper\n unitDescription={unitDescription}\n rgbIndex={props.rgbIndex}\n columnAliases={props.columnAliases}\n helpConfiguration={helpConfiguration}\n visibleColumnCount={props.visibleColumnCount}\n hiddenColumns={props.hiddenColumns}\n defaultShowPlots={props.defaultShowPlots}\n hideCopyToClipboard={props.hideCopyToClipboard}\n hideSearchBarControl={props.hideSearchBarControl ?? false}\n lockTextMatchesQueryFilterPill={props.lockTextMatchesQueryFilterPill}\n defaultShowSearchBar={props.defaultShowSearchBar ?? true}\n showLastUpdatedOn={props.showLastUpdatedOn}\n noContentPlaceholderType={\n props.noContentPlaceholderType ??\n NoContentPlaceholderType.INTERACTIVE\n }\n >\n <QueryWrapperPlotNavContents\n tableConfiguration={tableConfiguration}\n name={props.name}\n cardConfiguration={props.cardConfiguration}\n facetsToPlot={props.facetsToPlot}\n availableFacets={props.availableFacets}\n initialExpandedFacetControls={props.initialExpandedFacetControls}\n hideDownload={true}\n hideQueryCount={props.hideQueryCount ?? false}\n hideSqlEditorControl={true}\n hideVisualizationsControl={props.hideVisualizationsControl}\n initialLimit={props.initialLimit}\n initialPlotTypeByFacetColumnName={\n props.initialPlotTypeByFacetColumnName\n }\n hideTopLevelControls={props.hideTopLevelControls}\n isFullTextSearchEnabled={true}\n searchConfiguration={{\n ftsConfig: {\n textMatchesMode: 'NATURAL_LANGUAGE',\n minSearchQueryLength: 1,\n replaceExistingFilter: true,\n getSuggestions: autocompleteFieldName\n ? getSuggestions\n : undefined,\n },\n }}\n />\n </QueryVisualizationWrapper>\n </Suspense>\n </SearchQueryWrapper>\n )\n}\n"],"mappings":";;;;;;;;;;;;AAkFA,SAAgB,EAAiC,GAG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AgB,IACZ,IACA,KAAA;KACN,EACF;IACD,CAAA;GACwB,CAAA;EACnB,CAAA;CACQ,GAxDb,EAAY,OAwDC;AAExB"}
|
|
1
|
+
{"version":3,"file":"SearchQueryWrapperPlotNav.js","names":[],"sources":["../../../src/components/SearchQueryWrapperPlotNav/SearchQueryWrapperPlotNav.tsx"],"sourcesContent":["import { NoContentPlaceholderType } from '@/components/SynapseTable/NoContentPlaceholderType'\nimport { DEFAULT_PAGE_SIZE } from '@/utils/SynapseConstants'\nimport { Suspense, useRef } from 'react'\nimport { useDeepCompareMemoize } from 'use-deep-compare-effect'\nimport { CardConfiguration } from '../CardContainer/CardConfiguration'\nimport {\n QueryVisualizationWrapper,\n QueryVisualizationWrapperProps,\n} from '../QueryVisualizationWrapper'\nimport QueryWrapperLoadingScreen from '../QueryWrapper/QueryWrapperLoadingScreen'\nimport { SynapseTableConfiguration } from '../SynapseTable'\nimport { TopLevelControlsProps } from '../SynapseTable/TopLevelControls/TopLevelControls'\nimport { PlotsContainerProps } from '../widgets/facet-nav/PlotsContainer'\nimport { FacetFilterControlsProps } from '../widgets/query-filter/FacetFilterControls'\nimport {\n SearchQueryWrapper,\n SearchQueryWrapperProps,\n} from '../SearchQueryWrapper/SearchQueryWrapper'\nimport { QueryWrapperPlotNavContents } from '../QueryWrapperPlotNav/QueryWrapperPlotNav'\nimport { useGetSuggestionsForSearchIndex } from '../SearchQueryWrapper/SearchQueryUseQueryOptions'\n\ntype SearchQueryWrapperPlotNavOwnProps = {\n /** The ID of the SearchIndex entity to query. */\n searchIndexId: string\n /**\n * The name of the field to use for autocomplete suggestions.\n * When provided, the search bar will show a dropdown of suggestions as the user types,\n * populated by querying the search index with this field restricted via POST /search/autocomplete.\n */\n autocompleteFieldName?: string\n /** Whether the displayed results should be paginated or infinite. Default for cards is true, default for table is false */\n isInfinite?: boolean\n tableConfiguration?: SynapseTableConfiguration\n cardConfiguration?: CardConfiguration\n facetsToPlot?: string[]\n availableFacets?: FacetFilterControlsProps['availableFacets']\n initialExpandedFacetControls?: FacetFilterControlsProps['initialExpandedFacetControls']\n initialLimit?: number\n hideTopLevelControls?: boolean\n // Note: hideDownload, hideSqlEditorControl are intentionally\n // excluded — they are hardcoded to true because these controls are not applicable to the\n // SearchQueryServicesApi (no file download, no SQL editing).\n}\n\nexport type SearchQueryWrapperPlotNavProps = SearchQueryWrapperPlotNavOwnProps &\n PlotsContainerProps &\n Pick<\n QueryVisualizationWrapperProps,\n | 'defaultShowPlots'\n | 'visibleColumnCount'\n | 'hiddenColumns'\n | 'columnAliases'\n | 'renderFacetValue'\n | 'rgbIndex'\n | 'showLastUpdatedOn'\n | 'noContentPlaceholderType'\n | 'unitDescription'\n | 'helpConfiguration'\n | 'hideCopyToClipboard'\n | 'hideVisualizationsControl'\n | 'lockTextMatchesQueryFilterPill'\n | 'hideSearchBarControl'\n | 'defaultShowSearchBar'\n > &\n Pick<TopLevelControlsProps, 'name' | 'hideQueryCount'> & {\n /** Optional initial query parameters. Only selectedFacets, additionalFilters, limit, and offset are used. */\n initQueryRequest?: SearchQueryWrapperProps['initQueryRequest']\n /** Called when the query result bundle changes (e.g. to report result counts to a parent). */\n onQueryResultBundleChange?: SearchQueryWrapperProps['onQueryResultBundleChange']\n /** Whether the URL should update when the query is modified (deep linking). */\n shouldDeepLink?: SearchQueryWrapperProps['shouldDeepLink']\n /** OpenSearch query strategy and field-boost configuration. Forwarded to SearchQueryWrapper. */\n searchQueryConfig?: SearchQueryWrapperProps['searchQueryConfig']\n }\n\n/**\n * Type guard that identifies a SearchQueryWrapperPlotNavProps from the union\n * `QueryWrapperPlotNavProps | SearchQueryWrapperPlotNavProps`.\n *\n * Two conditions are checked to be robust against future API changes:\n * 1. The config has `searchIndexId` (present only on SearchQueryWrapperPlotNavProps).\n * 2. The config does NOT have `sql` (always present on QueryWrapperPlotNavProps via\n * QueryOrDeprecatedSearchParams), so that if QueryWrapperPlotNavProps ever gains a\n * `searchIndexId` field the guard remains correct.\n */\nexport function isSearchQueryWrapperPlotNavProps(config: {\n searchIndexId?: unknown\n sql?: unknown\n}): config is SearchQueryWrapperPlotNavProps {\n return 'searchIndexId' in config && !('sql' in config)\n}\n\n/**\n * A component similar to QueryWrapperPlotNav that sources its data from the SearchQueryServicesApi\n * rather than the standard Synapse Table Services. Facets, table/card rendering, and plots are\n * all reused from the existing component library.\n */\nexport default function SearchQueryWrapperPlotNav(\n props: SearchQueryWrapperPlotNavProps,\n) {\n const {\n tableConfiguration,\n isInfinite = !tableConfiguration,\n unitDescription,\n helpConfiguration,\n initQueryRequest: initQueryRequestFromProps,\n onQueryResultBundleChange,\n searchIndexId,\n autocompleteFieldName,\n shouldDeepLink,\n } = props\n\n const getSuggestions = useGetSuggestionsForSearchIndex(\n searchIndexId,\n autocompleteFieldName,\n )\n\n const initQueryRequest: SearchQueryWrapperProps['initQueryRequest'] =\n useDeepCompareMemoize({\n partMask: initQueryRequestFromProps?.partMask ?? 0,\n query: {\n selectedFacets: initQueryRequestFromProps?.query?.selectedFacets,\n additionalFilters: initQueryRequestFromProps?.query?.additionalFilters,\n sort: initQueryRequestFromProps?.query?.sort,\n limit: initQueryRequestFromProps?.query?.limit ?? DEFAULT_PAGE_SIZE,\n offset: initQueryRequestFromProps?.query?.offset ?? 0,\n },\n })\n\n // Remount SearchQueryWrapper when initQueryRequest content changes.\n // useDeepCompareMemoize returns the same reference when content is equal, so reference\n // comparison is sufficient here. A counter is used rather than JSON.stringify to avoid\n // serializing the object on every render.\n const mountKeyRef = useRef(0)\n const prevInitQueryRef = useRef(initQueryRequest)\n if (prevInitQueryRef.current !== initQueryRequest) {\n mountKeyRef.current += 1\n prevInitQueryRef.current = initQueryRequest\n }\n\n return (\n <SearchQueryWrapper\n key={mountKeyRef.current}\n searchIndexId={searchIndexId}\n initQueryRequest={initQueryRequest}\n isInfinite={isInfinite}\n onQueryResultBundleChange={onQueryResultBundleChange}\n shouldDeepLink={shouldDeepLink}\n searchQueryConfig={props.searchQueryConfig}\n >\n <Suspense fallback={<QueryWrapperLoadingScreen />}>\n <QueryVisualizationWrapper\n unitDescription={unitDescription}\n rgbIndex={props.rgbIndex}\n columnAliases={props.columnAliases}\n renderFacetValue={props.renderFacetValue}\n dataUseModifiersColumnName={\n props.cardConfiguration?.genericCardSchema\n ?.dataUseModifiersColumnName\n }\n helpConfiguration={helpConfiguration}\n visibleColumnCount={props.visibleColumnCount}\n hiddenColumns={props.hiddenColumns}\n defaultShowPlots={props.defaultShowPlots}\n hideCopyToClipboard={props.hideCopyToClipboard}\n hideSearchBarControl={props.hideSearchBarControl ?? false}\n lockTextMatchesQueryFilterPill={props.lockTextMatchesQueryFilterPill}\n defaultShowSearchBar={props.defaultShowSearchBar ?? true}\n showLastUpdatedOn={props.showLastUpdatedOn}\n noContentPlaceholderType={\n props.noContentPlaceholderType ??\n NoContentPlaceholderType.INTERACTIVE\n }\n >\n <QueryWrapperPlotNavContents\n tableConfiguration={tableConfiguration}\n name={props.name}\n cardConfiguration={props.cardConfiguration}\n facetsToPlot={props.facetsToPlot}\n availableFacets={props.availableFacets}\n initialExpandedFacetControls={props.initialExpandedFacetControls}\n hideDownload={true}\n hideQueryCount={props.hideQueryCount ?? false}\n hideSqlEditorControl={true}\n hideVisualizationsControl={props.hideVisualizationsControl}\n initialLimit={props.initialLimit}\n initialPlotTypeByFacetColumnName={\n props.initialPlotTypeByFacetColumnName\n }\n hideTopLevelControls={props.hideTopLevelControls}\n isFullTextSearchEnabled={true}\n searchConfiguration={{\n ftsConfig: {\n textMatchesMode: 'NATURAL_LANGUAGE',\n minSearchQueryLength: 1,\n replaceExistingFilter: true,\n getSuggestions: autocompleteFieldName\n ? getSuggestions\n : undefined,\n },\n }}\n />\n </QueryVisualizationWrapper>\n </Suspense>\n </SearchQueryWrapper>\n )\n}\n"],"mappings":";;;;;;;;;;;;AAqFA,SAAgB,EAAiC,GAGJ;CAC3C,OAAO,mBAAmB,KAAU,EAAE,SAAS;AACjD;AAOA,SAAwB,EACtB,GACA;CACA,IAAM,EAC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AuB;MACvB,gBAAgB,IACZ,IACA,KAAA;KACN,EACF;IACD,CAAA;GACwB,CAAA;EACnB,CAAA;CACQ,GA9Db,EAAY,OA8DC;AAExB"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { SxProps } from '@mui/material';
|
|
1
|
+
import { ButtonProps, SxProps, Theme } from '@mui/material';
|
|
2
2
|
import { IconName } from '../../../IconSvg/IconSvg';
|
|
3
3
|
import { DropdownMenuItem } from '../../../menu/DropdownMenu';
|
|
4
4
|
import { MouseEvent } from 'react';
|
|
5
|
+
import { SystemStyleObject } from '@mui/system';
|
|
5
6
|
type EntityActionMenuDropdownMenuType = 'DOWNLOAD' | 'PRIMARY';
|
|
6
7
|
type EntityActionMenuDropdownMenuConfiguration = {
|
|
7
8
|
visible: boolean;
|
|
@@ -23,6 +24,7 @@ export type ActionViewProps = {
|
|
|
23
24
|
icon?: IconName;
|
|
24
25
|
textSx?: SxProps;
|
|
25
26
|
iconSx?: SxProps;
|
|
27
|
+
variant?: ButtonProps['variant'];
|
|
26
28
|
};
|
|
27
29
|
export type EntityActionMenuLayout = {
|
|
28
30
|
buttonActions: ActionViewProps[];
|
|
@@ -30,7 +32,8 @@ export type EntityActionMenuLayout = {
|
|
|
30
32
|
primaryMenuActions: ActionViewProps[][];
|
|
31
33
|
primaryMenuText: string;
|
|
32
34
|
primaryMenuEndIcon: IconName;
|
|
33
|
-
|
|
35
|
+
primaryMenuEndIconSx?: SxProps;
|
|
36
|
+
menuButtonSx?: SystemStyleObject<Theme>;
|
|
34
37
|
};
|
|
35
38
|
export type EntityActionMenuProps = {
|
|
36
39
|
actionConfiguration: ActionConfigurationMap;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityActionMenu.d.ts","sourceRoot":"","sources":["../../../../../src/components/entity/page/action_menu/EntityActionMenu.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"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ED,MAAM,MAAM,sBAAsB,GAAG;IACnC,aAAa,EAAE,eAAe,EAAE,CAAA;IAChC,mBAAmB,EAAE,eAAe,EAAE,EAAE,CAAA;IACxC,kBAAkB,EAAE,eAAe,EAAE,EAAE,CAAA;IACvC,eAAe,EAAE,MAAM,CAAA;IACvB,kBAAkB,EAAE,QAAQ,CAAA;IAC5B,oBAAoB,CAAC,EAAE,OAAO,CAAA;IAC9B,YAAY,CAAC,EAAE,iBAAiB,CAAC,KAAK,CAAC,CAAA;CACxC,CAAA;AAED,MAAM,MAAM,qBAAqB,GAAG;IAElC,mBAAmB,EAAE,sBAAsB,CAAA;IAE3C,iBAAiB,EAAE,oBAAoB,CAAA;IAEvC,MAAM,EAAE,sBAAsB,CAAA;CAC/B,CAAA;AAMD,iBAAS,kBAAkB,CACzB,mBAAmB,EAAE,sBAAsB,EAC3C,MAAM,EAAE,sBAAsB,GAC7B,sBAAsB,CAmBxB;AAED;;;;;GAKG;AACH,iBAAS,4BAA4B,CACnC,KAAK,EAAE,eAAe,EAAE,EACxB,mBAAmB,EAAE,sBAAsB,GAC1C,gBAAgB,EAAE,CAqBpB;AAED;;;;;;GAMG;AACH,iBAAS,sBAAsB,CAC7B,WAAW,EAAE,eAAe,EAAE,EAAE,EAChC,mBAAmB,EAAE,sBAAsB,GAC1C,gBAAgB,EAAE,EAAE,CAYtB;AAED;;GAEG;AACH,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,2CA8GpE;AAED,eAAO,MAAM,yBAAyB;;;;CAIrC,CAAA"}
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import e from "../../../IconSvg/IconSvg.js";
|
|
2
2
|
import { ComplexMenu as t } from "../../../menu/ComplexMenu.js";
|
|
3
|
-
import {
|
|
3
|
+
import { Box as n } from "@mui/material";
|
|
4
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
4
5
|
//#region src/components/entity/page/action_menu/EntityActionMenu.tsx
|
|
5
|
-
function
|
|
6
|
+
function i(e, t) {
|
|
6
7
|
return Object.fromEntries(Object.entries(e).filter(([e, n]) => !n || !n.visible ? !1 : ![
|
|
7
8
|
...t.buttonActions,
|
|
8
9
|
...t.primaryMenuActions.flat(),
|
|
9
10
|
...t.downloadMenuActions.flat()
|
|
10
11
|
].some((t) => t.action === e)));
|
|
11
12
|
}
|
|
12
|
-
function
|
|
13
|
+
function a(e, t) {
|
|
13
14
|
return e.reduce((e, n) => {
|
|
14
15
|
let r = t[n.action];
|
|
15
16
|
return r && r.visible && e.push({
|
|
@@ -24,62 +25,78 @@ function i(e, t) {
|
|
|
24
25
|
}), e;
|
|
25
26
|
}, []);
|
|
26
27
|
}
|
|
27
|
-
function
|
|
28
|
+
function o(e, t) {
|
|
28
29
|
return e.reduce((e, n) => {
|
|
29
|
-
let r =
|
|
30
|
+
let r = a(n, t);
|
|
30
31
|
return r.length > 0 && e.push(r), e;
|
|
31
32
|
}, []);
|
|
32
33
|
}
|
|
33
|
-
function
|
|
34
|
-
let { actionConfiguration:
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
},
|
|
64
|
-
items: a(c.downloadMenuActions, o)
|
|
65
|
-
}, {
|
|
66
|
-
dropdownButtonText: c.primaryMenuText,
|
|
67
|
-
convertSingleItemToButton: !0,
|
|
68
|
-
renderMenuIfNoItems: !1,
|
|
69
|
-
buttonProps: { endIcon: /* @__PURE__ */ n(e, {
|
|
70
|
-
icon: c.primaryMenuEndIcon,
|
|
34
|
+
function s(a) {
|
|
35
|
+
let { actionConfiguration: s, menuConfiguration: c, layout: l } = a, u = i(s, l);
|
|
36
|
+
Object.entries(u).length > 0 && (console.warn("Actions are visible but have not been configured in the layout:", Object.entries(u).map((e) => e[0])), l.primaryMenuActions.unshift(Object.entries(u).map((e) => ({ action: e[0] }))));
|
|
37
|
+
let d = l.buttonActions.reduce((e, t) => {
|
|
38
|
+
let n = s[t.action];
|
|
39
|
+
if (n && n.visible) {
|
|
40
|
+
let r = n.onClick;
|
|
41
|
+
r == null && !n.href && (console.warn(`No handler registered for ${t.action}`), r = () => {
|
|
42
|
+
console.warn(`No handler registered for ${t.action}`);
|
|
43
|
+
}), e.push({
|
|
44
|
+
icon: t.icon,
|
|
45
|
+
onClick: r,
|
|
46
|
+
tooltipText: n.text,
|
|
47
|
+
text: n.text,
|
|
48
|
+
variant: t.variant,
|
|
49
|
+
iconSx: t.iconSx,
|
|
50
|
+
disabled: n.disabled,
|
|
51
|
+
href: n.href
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
return e;
|
|
55
|
+
}, []), f = {
|
|
56
|
+
dropdownButtonText: "Download Options",
|
|
57
|
+
convertSingleItemToButton: !0,
|
|
58
|
+
renderMenuIfNoItems: !1,
|
|
59
|
+
buttonTooltip: c.DOWNLOAD.tooltipText,
|
|
60
|
+
buttonProps: {
|
|
61
|
+
disabled: c.DOWNLOAD.disabled,
|
|
62
|
+
endIcon: /* @__PURE__ */ r(e, {
|
|
63
|
+
icon: "expandMore",
|
|
71
64
|
wrap: !1
|
|
72
|
-
})
|
|
73
|
-
|
|
74
|
-
|
|
65
|
+
})
|
|
66
|
+
},
|
|
67
|
+
items: o(l.downloadMenuActions, s)
|
|
68
|
+
}, p = {
|
|
69
|
+
dropdownButtonText: l.primaryMenuText,
|
|
70
|
+
convertSingleItemToButton: !0,
|
|
71
|
+
renderMenuIfNoItems: !1,
|
|
72
|
+
buttonProps: { endIcon: /* @__PURE__ */ r(e, {
|
|
73
|
+
icon: l.primaryMenuEndIcon,
|
|
74
|
+
wrap: !1,
|
|
75
|
+
sx: l.primaryMenuEndIconSx
|
|
76
|
+
}) },
|
|
77
|
+
items: o(l.primaryMenuActions, s)
|
|
78
|
+
};
|
|
79
|
+
return /* @__PURE__ */ r(n, {
|
|
80
|
+
sx: {
|
|
81
|
+
"& .MuiButton-root": {
|
|
82
|
+
borderRadius: "6px",
|
|
83
|
+
fontWeight: 540,
|
|
84
|
+
...l.menuButtonSx ?? {}
|
|
85
|
+
},
|
|
86
|
+
"& .MuiButton-root .MuiTypography-root": { fontWeight: 540 }
|
|
87
|
+
},
|
|
88
|
+
children: /* @__PURE__ */ r(t, {
|
|
89
|
+
iconButtons: d,
|
|
90
|
+
dropdownMenus: [p, f]
|
|
91
|
+
})
|
|
75
92
|
});
|
|
76
93
|
}
|
|
77
|
-
var
|
|
78
|
-
getUnmappedActions:
|
|
79
|
-
mapAndFilterItemsInMenuGroup:
|
|
80
|
-
mapAndFilterMenuGroups:
|
|
94
|
+
var c = {
|
|
95
|
+
getUnmappedActions: i,
|
|
96
|
+
mapAndFilterItemsInMenuGroup: a,
|
|
97
|
+
mapAndFilterMenuGroups: o
|
|
81
98
|
};
|
|
82
99
|
//#endregion
|
|
83
|
-
export {
|
|
100
|
+
export { c as EXPORTED_FOR_UNIT_TESTING, s as default };
|
|
84
101
|
|
|
85
102
|
//# sourceMappingURL=EntityActionMenu.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityActionMenu.js","names":[],"sources":["../../../../../src/components/entity/page/action_menu/EntityActionMenu.tsx"],"sourcesContent":["import { SxProps } from '@mui/material'\nimport { ComplexMenu } from '../../../menu/ComplexMenu'\nimport IconSvg, { IconName } from '../../../IconSvg/IconSvg'\nimport { DropdownMenuItem, DropdownMenuProps } from '../../../menu/DropdownMenu'\nimport { IconSvgButtonProps } from '../../../IconSvgButton'\nimport { MouseEvent } from 'react'\n\n// Represents the two types of dropdown menus that will be displayed on the entity page\ntype EntityActionMenuDropdownMenuType = 'DOWNLOAD' | 'PRIMARY'\n\ntype EntityActionMenuDropdownMenuConfiguration = {\n visible: boolean\n tooltipText?: string\n disabled?: boolean\n}\n\nexport type ActionConfiguration = {\n visible: boolean\n text: string\n disabled?: boolean\n tooltipText?: string\n onClick?: (e: MouseEvent) => void\n href?: string\n}\n\nexport type ActionConfigurationMap = Record<string, ActionConfiguration>\n\nexport type MenuConfigurationMap = Record<\n EntityActionMenuDropdownMenuType,\n EntityActionMenuDropdownMenuConfiguration\n>\n\nexport type ActionViewProps = {\n action: string\n icon?: IconName\n textSx?: SxProps\n iconSx?: SxProps\n}\n\nexport type EntityActionMenuLayout = {\n buttonActions: ActionViewProps[]\n downloadMenuActions: ActionViewProps[][]\n primaryMenuActions: ActionViewProps[][]\n primaryMenuText: string\n primaryMenuEndIcon: IconName\n menuButtonSx?: SxProps\n}\n\nexport type EntityActionMenuProps = {\n /* Maps a unique action string to a dynamic configuration for that particular action */\n actionConfiguration: ActionConfigurationMap\n /* Maps each dropdown menu to a dynamic configuration for that particular menu */\n menuConfiguration: MenuConfigurationMap\n /* Defines the layout of the actions. Typically depends on just the entity type and area. */\n layout: EntityActionMenuLayout\n}\n\n/*\n * All visible actions should be specified in the layout, but this is not guaranteed at compile time.\n * Find all visible actions in the action configuration that are not in the layout.\n */\nfunction getUnmappedActions(\n actionConfiguration: ActionConfigurationMap,\n layout: EntityActionMenuLayout,\n): ActionConfigurationMap {\n return Object.fromEntries(\n Object.entries(actionConfiguration).filter(([action, config]) => {\n // We don't care about actions that are not configured or should not be visible\n if (!config || !config.visible) {\n return false\n }\n\n const allLayoutActions: ActionViewProps[] = [\n ...layout.buttonActions,\n ...layout.primaryMenuActions.flat(),\n ...layout.downloadMenuActions.flat(),\n ]\n // Action is unmapped if it's visible and the layout doesn't have it\n return !allLayoutActions.some(\n layoutAction => layoutAction.action === action,\n )\n }),\n )\n}\n\n/**\n * Given a group of dropdown menu items and an action configuration,\n * return a list of dropdown menu items with non-visible and non-configured actions removed.\n * @param group\n * @param actionConfiguration\n */\nfunction mapAndFilterItemsInMenuGroup(\n group: ActionViewProps[],\n actionConfiguration: ActionConfigurationMap,\n): DropdownMenuItem[] {\n return group.reduce(\n (itemAcc: DropdownMenuItem[], actionViewProps: ActionViewProps) => {\n const configForAction = actionConfiguration[actionViewProps.action]\n // Only show the item if it's configured + visible\n if (configForAction && configForAction.visible) {\n itemAcc.push({\n text: configForAction.text ?? actionViewProps.action,\n onClick: configForAction.onClick,\n href: configForAction.href,\n tooltipText: configForAction.tooltipText,\n disabled: configForAction.disabled,\n icon: actionViewProps.icon,\n textSx: actionViewProps.textSx,\n iconSx: actionViewProps.iconSx,\n })\n }\n return itemAcc\n },\n [],\n )\n}\n\n/**\n * Given a list of groups of dropdown menu actions, returns a list of dropdown menu item\n * groups where non-visible actions have been removed, and groups with no visible actions\n * have been removed.\n * @param menuActions\n * @param actionConfiguration\n */\nfunction mapAndFilterMenuGroups(\n menuActions: ActionViewProps[][],\n actionConfiguration: ActionConfigurationMap,\n): DropdownMenuItem[][] {\n return menuActions.reduce(\n (groupAcc: DropdownMenuItem[][], group: ActionViewProps[]) => {\n const itemGroup = mapAndFilterItemsInMenuGroup(group, actionConfiguration)\n // Only show the group if it contains visible items\n if (itemGroup.length > 0) {\n groupAcc.push(itemGroup)\n }\n return groupAcc\n },\n [],\n )\n}\n\n/**\n * The EntityActionMenu renders a menu that displays the actions that can be invoked on an Entity page.\n */\nexport default function EntityActionMenu(props: EntityActionMenuProps) {\n const { actionConfiguration, menuConfiguration, layout } = props\n\n /*\n * All actions should be specified in the layout, but this is not guaranteed at compile time.\n * Find all visible actions in the action configuration that are not in the layout.\n */\n const unmappedActions = getUnmappedActions(actionConfiguration, layout)\n // Warn if unmapped actions were found and push them on to the layout.\n if (Object.entries(unmappedActions).length > 0) {\n console.warn(\n 'Actions are visible but have not been configured in the layout:',\n Object.entries(unmappedActions).map(entry => entry[0]),\n )\n // Modify the layout: put the unmapped actions in their own group at the top of the menu\n layout.primaryMenuActions.unshift(\n Object.entries(unmappedActions).map(\n (entry): ActionViewProps => ({\n action: entry[0],\n }),\n ),\n )\n }\n\n // Map button actions to an IconButtonConfiguration and omit non-visible actions\n const iconButtonConfigs: IconSvgButtonProps[] = layout.buttonActions.reduce(\n (acc: IconSvgButtonProps[], buttonViewProps: ActionViewProps) => {\n const configForAction = actionConfiguration[buttonViewProps.action]\n if (configForAction && configForAction.visible) {\n let onClick = configForAction.onClick\n if (onClick == null && !configForAction.href) {\n console.warn(`No handler registered for ${buttonViewProps.action}`)\n onClick = () => {\n console.warn(`No handler registered for ${buttonViewProps.action}`)\n }\n }\n acc.push({\n icon: buttonViewProps.icon as IconName,\n onClick: onClick,\n tooltipText: configForAction.text,\n disabled: configForAction.disabled,\n href: configForAction.href,\n })\n }\n return acc\n },\n [],\n )\n\n const downloadMenuConfig: DropdownMenuProps = {\n dropdownButtonText: 'Download Options',\n convertSingleItemToButton: true,\n renderMenuIfNoItems: false,\n buttonTooltip: menuConfiguration.DOWNLOAD.tooltipText,\n buttonProps: {\n disabled: menuConfiguration.DOWNLOAD.disabled,\n endIcon: <IconSvg icon={'download'} wrap={false} />,\n },\n items: mapAndFilterMenuGroups(\n layout.downloadMenuActions,\n actionConfiguration,\n ),\n }\n\n const primaryMenuConfig: DropdownMenuProps = {\n dropdownButtonText: layout.primaryMenuText,\n convertSingleItemToButton: true,\n renderMenuIfNoItems: false,\n buttonProps: {\n endIcon: <IconSvg icon={layout.primaryMenuEndIcon} wrap={false} />,\n },\n items: mapAndFilterMenuGroups(\n layout.primaryMenuActions,\n actionConfiguration,\n ),\n }\n\n return (\n <ComplexMenu\n iconButtons={iconButtonConfigs}\n dropdownMenus={[downloadMenuConfig, primaryMenuConfig]}\n />\n )\n}\n\nexport const EXPORTED_FOR_UNIT_TESTING = {\n getUnmappedActions,\n mapAndFilterItemsInMenuGroup,\n mapAndFilterMenuGroups,\n}\n"],"mappings":";;;;AA6DA,SAAS,EACP,GACA,GACwB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oB,EAAgB;GAC5D,IAAI,KAAmB,EAAgB,SAAS;IAC9C,IAAI,IAAU,EAAgB;IAO9B,AANI,KAAW,QAAQ,CAAC,EAAgB,SACtC,QAAQ,KAAK,6BAA6B,EAAgB,QAAQ,GAClE,UAAgB;KACd,QAAQ,KAAK,6BAA6B,EAAgB,QAAQ;IACpE,IAEF,EAAI,KAAK;KACP,MAAM,EAAgB;KACb;KACT,aAAa,EAAgB;KAC7B,UAAU,EAAgB;KAC1B,MAAM,EAAgB;IACxB,CAAC;GACH;GACA,OAAO;EACT,GACA,CAAC,CAiCc;EACb,eAAe,CAAC;GA9BlB,oBAAoB;GACpB,2BAA2B;GAC3B,qBAAqB;GACrB,eAAe,EAAkB,SAAS;GAC1C,aAAa;IACX,UAAU,EAAkB,SAAS;IACrC,SAAS,kBAAC,GAAD;KAAS,MAAM;KAAY,MAAM;IAAQ,CAAA;GACpD;GACA,OAAO,EACL,EAAO,qBACP,CACF;EAmBkB,GAAoB;GAftC,oBAAoB,EAAO;GAC3B,2BAA2B;GAC3B,qBAAqB;GACrB,aAAa,EACX,SAAS,kBAAC,GAAD;IAAS,MAAM,EAAO;IAAoB,MAAM;GAAQ,CAAA,EACnE;GACA,OAAO,EACL,EAAO,oBACP,CACF;EAMsC,CAAiB;CACtD,CAAA;AAEL;AAEA,IAAa,IAA4B;CACvC;CACA;CACA;AACF"}
|
|
1
|
+
{"version":3,"file":"EntityActionMenu.js","names":[],"sources":["../../../../../src/components/entity/page/action_menu/EntityActionMenu.tsx"],"sourcesContent":["import { Box, ButtonProps, SxProps, Theme } from '@mui/material'\nimport { ComplexMenu, ComplexMenuButtonProps } from '../../../menu/ComplexMenu'\nimport IconSvg, { IconName } from '../../../IconSvg/IconSvg'\nimport { DropdownMenuItem, DropdownMenuProps } from '../../../menu/DropdownMenu'\nimport { MouseEvent } from 'react'\nimport { SystemStyleObject } from '@mui/system'\n\n// Represents the two types of dropdown menus that will be displayed on the entity page\ntype EntityActionMenuDropdownMenuType = 'DOWNLOAD' | 'PRIMARY'\n\ntype EntityActionMenuDropdownMenuConfiguration = {\n visible: boolean\n tooltipText?: string\n disabled?: boolean\n}\n\nexport type ActionConfiguration = {\n visible: boolean\n text: string\n disabled?: boolean\n tooltipText?: string\n onClick?: (e: MouseEvent) => void\n href?: string\n}\n\nexport type ActionConfigurationMap = Record<string, ActionConfiguration>\n\nexport type MenuConfigurationMap = Record<\n EntityActionMenuDropdownMenuType,\n EntityActionMenuDropdownMenuConfiguration\n>\n\nexport type ActionViewProps = {\n action: string\n icon?: IconName\n textSx?: SxProps\n iconSx?: SxProps\n variant?: ButtonProps['variant']\n}\n\nexport type EntityActionMenuLayout = {\n buttonActions: ActionViewProps[]\n downloadMenuActions: ActionViewProps[][]\n primaryMenuActions: ActionViewProps[][]\n primaryMenuText: string\n primaryMenuEndIcon: IconName\n primaryMenuEndIconSx?: SxProps\n menuButtonSx?: SystemStyleObject<Theme>\n}\n\nexport type EntityActionMenuProps = {\n /* Maps a unique action string to a dynamic configuration for that particular action */\n actionConfiguration: ActionConfigurationMap\n /* Maps each dropdown menu to a dynamic configuration for that particular menu */\n menuConfiguration: MenuConfigurationMap\n /* Defines the layout of the actions. Typically depends on just the entity type and area. */\n layout: EntityActionMenuLayout\n}\n\n/*\n * All visible actions should be specified in the layout, but this is not guaranteed at compile time.\n * Find all visible actions in the action configuration that are not in the layout.\n */\nfunction getUnmappedActions(\n actionConfiguration: ActionConfigurationMap,\n layout: EntityActionMenuLayout,\n): ActionConfigurationMap {\n return Object.fromEntries(\n Object.entries(actionConfiguration).filter(([action, config]) => {\n // We don't care about actions that are not configured or should not be visible\n if (!config || !config.visible) {\n return false\n }\n\n const allLayoutActions: ActionViewProps[] = [\n ...layout.buttonActions,\n ...layout.primaryMenuActions.flat(),\n ...layout.downloadMenuActions.flat(),\n ]\n // Action is unmapped if it's visible and the layout doesn't have it\n return !allLayoutActions.some(\n layoutAction => layoutAction.action === action,\n )\n }),\n )\n}\n\n/**\n * Given a group of dropdown menu items and an action configuration,\n * return a list of dropdown menu items with non-visible and non-configured actions removed.\n * @param group\n * @param actionConfiguration\n */\nfunction mapAndFilterItemsInMenuGroup(\n group: ActionViewProps[],\n actionConfiguration: ActionConfigurationMap,\n): DropdownMenuItem[] {\n return group.reduce(\n (itemAcc: DropdownMenuItem[], actionViewProps: ActionViewProps) => {\n const configForAction = actionConfiguration[actionViewProps.action]\n // Only show the item if it's configured + visible\n if (configForAction && configForAction.visible) {\n itemAcc.push({\n text: configForAction.text ?? actionViewProps.action,\n onClick: configForAction.onClick,\n href: configForAction.href,\n tooltipText: configForAction.tooltipText,\n disabled: configForAction.disabled,\n icon: actionViewProps.icon,\n textSx: actionViewProps.textSx,\n iconSx: actionViewProps.iconSx,\n })\n }\n return itemAcc\n },\n [],\n )\n}\n\n/**\n * Given a list of groups of dropdown menu actions, returns a list of dropdown menu item\n * groups where non-visible actions have been removed, and groups with no visible actions\n * have been removed.\n * @param menuActions\n * @param actionConfiguration\n */\nfunction mapAndFilterMenuGroups(\n menuActions: ActionViewProps[][],\n actionConfiguration: ActionConfigurationMap,\n): DropdownMenuItem[][] {\n return menuActions.reduce(\n (groupAcc: DropdownMenuItem[][], group: ActionViewProps[]) => {\n const itemGroup = mapAndFilterItemsInMenuGroup(group, actionConfiguration)\n // Only show the group if it contains visible items\n if (itemGroup.length > 0) {\n groupAcc.push(itemGroup)\n }\n return groupAcc\n },\n [],\n )\n}\n\n/**\n * The EntityActionMenu renders a menu that displays the actions that can be invoked on an Entity page.\n */\nexport default function EntityActionMenu(props: EntityActionMenuProps) {\n const { actionConfiguration, menuConfiguration, layout } = props\n\n /*\n * All actions should be specified in the layout, but this is not guaranteed at compile time.\n * Find all visible actions in the action configuration that are not in the layout.\n */\n const unmappedActions = getUnmappedActions(actionConfiguration, layout)\n // Warn if unmapped actions were found and push them on to the layout.\n if (Object.entries(unmappedActions).length > 0) {\n console.warn(\n 'Actions are visible but have not been configured in the layout:',\n Object.entries(unmappedActions).map(entry => entry[0]),\n )\n // Modify the layout: put the unmapped actions in their own group at the top of the menu\n layout.primaryMenuActions.unshift(\n Object.entries(unmappedActions).map(\n (entry): ActionViewProps => ({\n action: entry[0],\n }),\n ),\n )\n }\n\n // Map button actions to a button configuration and omit non-visible actions\n const iconButtonConfigs: ComplexMenuButtonProps[] =\n layout.buttonActions.reduce(\n (acc: ComplexMenuButtonProps[], buttonViewProps: ActionViewProps) => {\n const configForAction = actionConfiguration[buttonViewProps.action]\n if (configForAction && configForAction.visible) {\n let onClick = configForAction.onClick\n if (onClick == null && !configForAction.href) {\n console.warn(`No handler registered for ${buttonViewProps.action}`)\n onClick = () => {\n console.warn(\n `No handler registered for ${buttonViewProps.action}`,\n )\n }\n }\n acc.push({\n icon: buttonViewProps.icon as IconName,\n onClick: onClick,\n tooltipText: configForAction.text,\n text: configForAction.text,\n variant: buttonViewProps.variant,\n iconSx: buttonViewProps.iconSx,\n disabled: configForAction.disabled,\n href: configForAction.href,\n })\n }\n return acc\n },\n [],\n )\n\n const downloadMenuConfig: DropdownMenuProps = {\n dropdownButtonText: 'Download Options',\n convertSingleItemToButton: true,\n renderMenuIfNoItems: false,\n buttonTooltip: menuConfiguration.DOWNLOAD.tooltipText,\n buttonProps: {\n disabled: menuConfiguration.DOWNLOAD.disabled,\n endIcon: <IconSvg icon={'expandMore'} wrap={false} />,\n },\n items: mapAndFilterMenuGroups(\n layout.downloadMenuActions,\n actionConfiguration,\n ),\n }\n\n const primaryMenuConfig: DropdownMenuProps = {\n dropdownButtonText: layout.primaryMenuText,\n convertSingleItemToButton: true,\n renderMenuIfNoItems: false,\n buttonProps: {\n endIcon: (\n <IconSvg\n icon={layout.primaryMenuEndIcon}\n wrap={false}\n sx={layout.primaryMenuEndIconSx}\n />\n ),\n },\n items: mapAndFilterMenuGroups(\n layout.primaryMenuActions,\n actionConfiguration,\n ),\n }\n\n return (\n <Box\n sx={{\n '& .MuiButton-root': {\n borderRadius: '6px',\n fontWeight: 540,\n // Optional per-layout overrides (e.g. a different border color for\n // entity pages vs the project header).\n ...(layout.menuButtonSx ?? {}),\n },\n '& .MuiButton-root .MuiTypography-root': {\n fontWeight: 540,\n },\n }}\n >\n <ComplexMenu\n iconButtons={iconButtonConfigs}\n dropdownMenus={[primaryMenuConfig, downloadMenuConfig]}\n />\n </Box>\n )\n}\n\nexport const EXPORTED_FOR_UNIT_TESTING = {\n getUnmappedActions,\n mapAndFilterItemsInMenuGroup,\n mapAndFilterMenuGroups,\n}\n"],"mappings":";;;;;AA+DA,SAAS,EACP,GACA,GACwB;CACxB,OAAO,OAAO,YACZ,OAAO,QAAQ,CAAmB,EAAE,QAAQ,CAAC,GAAQ,OAE/C,CAAC,KAAU,CAAC,EAAO,UACd,KASF,CAAC;EALN,GAAG,EAAO;EACV,GAAG,EAAO,mBAAmB,KAAK;EAClC,GAAG,EAAO,oBAAoB,KAAK;CAG7B,EAAiB,MACvB,MAAgB,EAAa,WAAW,CAC1C,CACD,CACH;AACF;AAQA,SAAS,EACP,GACA,GACoB;CACpB,OAAO,EAAM,QACV,GAA6B,MAAqC;EACjE,IAAM,IAAkB,EAAoB,EAAgB;EAc5D,OAZI,KAAmB,EAAgB,WACrC,EAAQ,KAAK;GACX,MAAM,EAAgB,QAAQ,EAAgB;GAC9C,SAAS,EAAgB;GACzB,MAAM,EAAgB;GACtB,aAAa,EAAgB;GAC7B,UAAU,EAAgB;GAC1B,MAAM,EAAgB;GACtB,QAAQ,EAAgB;GACxB,QAAQ,EAAgB;EAC1B,CAAC,GAEI;CACT,GACA,CAAC,CACH;AACF;AASA,SAAS,EACP,GACA,GACsB;CACtB,OAAO,EAAY,QAChB,GAAgC,MAA6B;EAC5D,IAAM,IAAY,EAA6B,GAAO,CAAmB;EAKzE,OAHI,EAAU,SAAS,KACrB,EAAS,KAAK,CAAS,GAElB;CACT,GACA,CAAC,CACH;AACF;AAKA,SAAwB,EAAiB,GAA8B;CACrE,IAAM,EAAE,wBAAqB,sBAAmB,cAAW,GAMrD,IAAkB,EAAmB,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GZ,GAAI,EAAO,gBAAgB,CAAC;GAC9B;GACA,yCAAyC,EACvC,YAAY,IACd;EACF;YAEA,kBAAC,GAAD;GACE,aAAa;GACb,eAAe,CAAC,GAAmB,CAAkB;EACtD,CAAA;CACE,CAAA;AAET;AAEA,IAAa,IAA4B;CACvC;CACA;CACA;AACF"}
|
|
@@ -61,6 +61,7 @@ export * from './QueryWrapper';
|
|
|
61
61
|
export * from './QueryWrapperPlotNav';
|
|
62
62
|
export { SearchQueryWrapper } from './SearchQueryWrapper/SearchQueryWrapper';
|
|
63
63
|
export type { SearchQueryWrapperProps } from './SearchQueryWrapper/SearchQueryWrapper';
|
|
64
|
+
export type { SearchQueryConfig, SearchQueryStrategy, } from './SearchQueryWrapper/SearchQueryUseQueryOptions';
|
|
64
65
|
export { default as SearchQueryWrapperPlotNav, isSearchQueryWrapperPlotNavProps, } from './SearchQueryWrapperPlotNav/SearchQueryWrapperPlotNav';
|
|
65
66
|
export type { SearchQueryWrapperPlotNavProps } from './SearchQueryWrapperPlotNav/SearchQueryWrapperPlotNav';
|
|
66
67
|
export * from './RegisterPageLogoutPrompt';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,EAAE,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AAC/D,OAAO,kBAAkB,MAAM,mCAAmC,CAAA;AAElE;;;GAGG;AAEH,cAAc,mBAAmB,CAAA;AACjC,cAAc,sBAAsB,CAAA;AACpC,cAAc,kBAAkB,CAAA;AAChC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,sBAAsB,CAAA;AACpC,cAAc,qBAAqB,CAAA;AACnC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,qBAAqB,CAAA;AACnC,cAAc,uBAAuB,CAAA;AACrC,cAAc,yBAAyB,CAAA;AACvC,cAAc,uBAAuB,CAAA;AACrC,cAAc,kBAAkB,CAAA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CAAA;AAC7B,cAAc,yBAAyB,CAAA;AACvC,cAAc,kBAAkB,CAAA;AAChC,cAAc,sBAAsB,CAAA;AACpC,cAAc,aAAa,CAAA;AAC3B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,YAAY,CAAA;AAC1B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,mBAAmB,CAAA;AACjC,cAAc,oBAAoB,CAAA;AAClC,cAAc,qBAAqB,CAAA;AACnC,cAAc,wCAAwC,CAAA;AACtD,cAAc,eAAe,CAAA;AAC7B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,uBAAuB,CAAA;AACrC,cAAc,wBAAwB,CAAA;AACtC,cAAc,0BAA0B,CAAA;AACxC,cAAc,0BAA0B,CAAA;AACxC,cAAc,2BAA2B,CAAA;AACzC,cAAc,oBAAoB,CAAA;AAClC,cAAc,wBAAwB,CAAA;AACtC,cAAc,0BAA0B,CAAA;AACxC,cAAc,cAAc,CAAA;AAC5B,cAAc,mBAAmB,CAAA;AACjC,cAAc,uBAAuB,CAAA;AACrC,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAA;AAGnE,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,+BAA+B,CAAA;AACtE,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,CAAA;AACtC,OAAO,EAAE,kBAAkB,EAAE,CAAA"}
|
|
@@ -1,7 +1,14 @@
|
|
|
1
|
+
import { ButtonProps, SxProps } from '@mui/material';
|
|
1
2
|
import { DropdownMenuProps } from './DropdownMenu';
|
|
2
3
|
import { IconSvgButtonProps } from '../IconSvgButton';
|
|
4
|
+
export type ComplexMenuButtonProps = Omit<IconSvgButtonProps, 'icon'> & {
|
|
5
|
+
icon?: IconSvgButtonProps['icon'];
|
|
6
|
+
variant?: ButtonProps['variant'];
|
|
7
|
+
text?: string;
|
|
8
|
+
iconSx?: SxProps;
|
|
9
|
+
};
|
|
3
10
|
export type ComplexMenuProps = {
|
|
4
|
-
iconButtons?:
|
|
11
|
+
iconButtons?: ComplexMenuButtonProps[];
|
|
5
12
|
dropdownMenus?: DropdownMenuProps[];
|
|
6
13
|
};
|
|
7
14
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ComplexMenu.d.ts","sourceRoot":"","sources":["../../../src/components/menu/ComplexMenu.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ComplexMenu.d.ts","sourceRoot":"","sources":["../../../src/components/menu/ComplexMenu.tsx"],"names":[],"mappings":"AAAA,OAAO,EAGL,WAAW,EACX,OAAO,EAIR,MAAM,eAAe,CAAA;AACtB,OAAO,EAAgB,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAChE,OAAO,EAAiB,kBAAkB,EAAE,MAAM,kBAAkB,CAAA;AAGpE,MAAM,MAAM,sBAAsB,GAAG,IAAI,CAAC,kBAAkB,EAAE,MAAM,CAAC,GAAG;IACtE,IAAI,CAAC,EAAE,kBAAkB,CAAC,MAAM,CAAC,CAAA;IACjC,OAAO,CAAC,EAAE,WAAW,CAAC,SAAS,CAAC,CAAA;IAChC,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB,CAAA;AAED,MAAM,MAAM,gBAAgB,GAAG;IAK7B,WAAW,CAAC,EAAE,sBAAsB,EAAE,CAAA;IAMtC,aAAa,CAAC,EAAE,iBAAiB,EAAE,CAAA;CACpC,CAAA;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,2CAyGlD"}
|
|
@@ -16,29 +16,59 @@ function u(u) {
|
|
|
16
16
|
paddingTop: "10px"
|
|
17
17
|
}
|
|
18
18
|
}),
|
|
19
|
-
children: [d.map((n) =>
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
19
|
+
children: [d.map((n) => {
|
|
20
|
+
if (n.variant != null) {
|
|
21
|
+
let t = n.text ?? n.tooltipText;
|
|
22
|
+
return /* @__PURE__ */ c(r, {
|
|
23
|
+
sx: (e) => ({ [e.breakpoints.down("sm")]: {
|
|
24
|
+
width: "100%",
|
|
25
|
+
".MuiButton-root": { width: "100%" }
|
|
26
|
+
} }),
|
|
27
|
+
children: /* @__PURE__ */ c(i, {
|
|
28
|
+
variant: n.variant,
|
|
29
|
+
startIcon: n.icon ? /* @__PURE__ */ c(e, {
|
|
30
|
+
icon: n.icon,
|
|
31
|
+
wrap: !1,
|
|
32
|
+
fontSize: "inherit",
|
|
33
|
+
sx: n.iconSx
|
|
34
|
+
}) : void 0,
|
|
35
|
+
onClick: n.onClick,
|
|
36
|
+
href: n.href,
|
|
37
|
+
disabled: n.disabled,
|
|
38
|
+
children: /* @__PURE__ */ c(a, {
|
|
39
|
+
variant: "buttonLink",
|
|
40
|
+
children: t
|
|
41
|
+
})
|
|
42
|
+
})
|
|
43
|
+
}, t);
|
|
44
|
+
}
|
|
45
|
+
return p && n.tooltipText ? /* @__PURE__ */ c(r, {
|
|
32
46
|
sx: {
|
|
33
|
-
|
|
34
|
-
|
|
47
|
+
width: "100%",
|
|
48
|
+
textAlign: "center"
|
|
35
49
|
},
|
|
36
|
-
children: /* @__PURE__ */ c(
|
|
37
|
-
variant: "
|
|
38
|
-
|
|
50
|
+
children: /* @__PURE__ */ c(i, {
|
|
51
|
+
variant: "text",
|
|
52
|
+
startIcon: /* @__PURE__ */ c(e, {
|
|
53
|
+
icon: n.icon,
|
|
54
|
+
wrap: !1,
|
|
55
|
+
fontSize: "inherit"
|
|
56
|
+
}, n.tooltipText),
|
|
57
|
+
onClick: n.onClick,
|
|
58
|
+
sx: {
|
|
59
|
+
padding: "6px 12px",
|
|
60
|
+
minWidth: "unset"
|
|
61
|
+
},
|
|
62
|
+
children: /* @__PURE__ */ c(a, {
|
|
63
|
+
variant: "buttonLink",
|
|
64
|
+
children: n.tooltipText
|
|
65
|
+
})
|
|
39
66
|
})
|
|
40
|
-
})
|
|
41
|
-
|
|
67
|
+
}) : /* @__PURE__ */ c(t, {
|
|
68
|
+
...n,
|
|
69
|
+
icon: n.icon
|
|
70
|
+
}, n.tooltipText);
|
|
71
|
+
}), f.map((e, t) => e.items && e.items.length > 0 && /* @__PURE__ */ c(r, {
|
|
42
72
|
sx: (e) => ({ [e.breakpoints.down("sm")]: {
|
|
43
73
|
width: "100%",
|
|
44
74
|
".MuiButton-root": { width: "100%" }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ComplexMenu.js","names":[],"sources":["../../../src/components/menu/ComplexMenu.tsx"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"ComplexMenu.js","names":[],"sources":["../../../src/components/menu/ComplexMenu.tsx"],"sourcesContent":["import {\n Box,\n Button,\n ButtonProps,\n SxProps,\n Typography,\n useMediaQuery,\n useTheme,\n} from '@mui/material'\nimport { DropdownMenu, DropdownMenuProps } from './DropdownMenu'\nimport { IconSvgButton, IconSvgButtonProps } from '../IconSvgButton'\nimport IconSvg from '../IconSvg'\n\nexport type ComplexMenuButtonProps = Omit<IconSvgButtonProps, 'icon'> & {\n icon?: IconSvgButtonProps['icon']\n variant?: ButtonProps['variant']\n text?: string\n iconSx?: SxProps\n}\n\nexport type ComplexMenuProps = {\n /*\n * Configuration for buttons. Each entry corresponds to one button.\n * See the ComplexMenuButtonProps type for more info.\n */\n iconButtons?: ComplexMenuButtonProps[]\n /*\n * Configuration for DropdownMenus. Each entry corresponds to one dropdown menu button, which\n * itself can contain multiple groups of items.\n * See the DropdownMenuProps type for more info.\n */\n dropdownMenus?: DropdownMenuProps[]\n}\n\n/**\n * The ComplexMenu component allows you to create a generic menu with\n * icon buttons and multiple dropdown menus that contain groups of items.\n */\nexport function ComplexMenu(props: ComplexMenuProps) {\n const { iconButtons = [], dropdownMenus = [] } = props\n const theme = useTheme()\n const isSmallScreen = useMediaQuery(theme.breakpoints.down('sm'))\n\n return (\n <Box\n sx={theme => ({\n display: 'flex',\n alignItems: 'center',\n gap: '10px',\n [theme.breakpoints.down('sm')]: {\n flexDirection: 'column',\n paddingTop: '10px',\n },\n })}\n >\n {iconButtons.map(iconButton => {\n if (iconButton.variant != null) {\n const label = iconButton.text ?? iconButton.tooltipText\n return (\n <Box\n key={label}\n sx={theme => ({\n [theme.breakpoints.down('sm')]: {\n width: '100%',\n '.MuiButton-root': { width: '100%' },\n },\n })}\n >\n <Button\n variant={iconButton.variant}\n startIcon={\n iconButton.icon ? (\n <IconSvg\n icon={iconButton.icon}\n wrap={false}\n fontSize={'inherit'}\n sx={iconButton.iconSx}\n />\n ) : undefined\n }\n onClick={iconButton.onClick}\n href={iconButton.href}\n disabled={iconButton.disabled}\n >\n <Typography variant=\"buttonLink\">{label}</Typography>\n </Button>\n </Box>\n )\n }\n return isSmallScreen && iconButton.tooltipText ? (\n <Box\n sx={{\n width: '100%',\n textAlign: 'center',\n }}\n >\n <Button\n variant=\"text\"\n startIcon={\n <IconSvg\n key={iconButton.tooltipText}\n icon={iconButton.icon!}\n wrap={false}\n fontSize={'inherit'}\n />\n }\n onClick={iconButton.onClick}\n sx={{\n padding: '6px 12px',\n minWidth: 'unset',\n }}\n >\n <Typography variant=\"buttonLink\">\n {iconButton.tooltipText}\n </Typography>\n </Button>\n </Box>\n ) : (\n <IconSvgButton\n key={iconButton.tooltipText}\n {...iconButton}\n icon={iconButton.icon!}\n />\n )\n })}\n {dropdownMenus.map(\n (menuProps, index) =>\n menuProps.items &&\n menuProps.items.length > 0 && (\n <Box\n sx={theme => ({\n [theme.breakpoints.down('sm')]: {\n width: '100%',\n '.MuiButton-root': { width: '100%' },\n },\n })}\n >\n <DropdownMenu key={index} {...menuProps} />\n </Box>\n ),\n )}\n </Box>\n )\n}\n"],"mappings":";;;;;;AAsCA,SAAgB,EAAY,GAAyB;C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,MACV,EAAU,SACV,EAAU,MAAM,SAAS,KACvB,kBAAC,GAAD;GACE,KAAI,OAAU,GACX,EAAM,YAAY,KAAK,IAAI,IAAI;IAC9B,OAAO;IACP,mBAAmB,EAAE,OAAO,OAAO;GACrC,EACF;aAEA,kBAAC,GAAD,EAA0B,GAAI,EAAY,GAAvB,CAAuB;EACvC,CAAA,CAEX,CACG;;AAET"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { TooltipProps } from '@mui/material';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
export type FacetValueChipProps = {
|
|
4
|
+
/** The chip label. */
|
|
5
|
+
label: ReactNode;
|
|
6
|
+
/** Optional leading icon. */
|
|
7
|
+
icon?: ReactNode;
|
|
8
|
+
/** Optional tooltip content. When set, the chip is wrapped in a Tooltip. */
|
|
9
|
+
tooltipTitle?: ReactNode;
|
|
10
|
+
/** Tooltip placement. @default 'top' */
|
|
11
|
+
placement?: TooltipProps['placement'];
|
|
12
|
+
/** When provided, the chip shows a delete/remove button that calls this. */
|
|
13
|
+
onDelete?: () => void;
|
|
14
|
+
/** Cap the width and truncate long labels with an ellipsis (full text in tooltip). */
|
|
15
|
+
truncate?: boolean;
|
|
16
|
+
className?: string;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* The shared chip used to render a facet value (or DUO term) consistently
|
|
20
|
+
* wherever it appears: in the facet sidebar, as an active-filter pill, and on
|
|
21
|
+
* cards. Owning the icon, tooltip, and delete affordance in one place keeps the
|
|
22
|
+
* styling identical across those contexts.
|
|
23
|
+
*/
|
|
24
|
+
export default function FacetValueChip(props: FacetValueChipProps): import("react/jsx-runtime").JSX.Element;
|
|
25
|
+
//# sourceMappingURL=FacetValueChip.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FacetValueChip.d.ts","sourceRoot":"","sources":["../../../../src/components/widgets/facet-nav/FacetValueChip.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAgB,SAAS,EAAE,MAAM,OAAO,CAAA;AAE/C,MAAM,MAAM,mBAAmB,GAAG;IAChC,sBAAsB;IACtB,KAAK,EAAE,SAAS,CAAA;IAChB,6BAA6B;IAC7B,IAAI,CAAC,EAAE,SAAS,CAAA;IAChB,4EAA4E;IAC5E,YAAY,CAAC,EAAE,SAAS,CAAA;IACxB,wCAAwC;IACxC,SAAS,CAAC,EAAE,YAAY,CAAC,WAAW,CAAC,CAAA;IACrC,4EAA4E;IAC5E,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAA;IACrB,sFAAsF;IACtF,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAAA;AAgBD;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,KAAK,EAAE,mBAAmB,2CA+BhE"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Chip as e, Tooltip as t } from "@mui/material";
|
|
2
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
3
|
+
//#region src/components/widgets/facet-nav/FacetValueChip.tsx
|
|
4
|
+
var r = 220, i = {
|
|
5
|
+
bgcolor: "var(--synapse-secondary-action-color-alpha-10)",
|
|
6
|
+
color: "var(--synapse-text-color-dark)",
|
|
7
|
+
minWidth: 0,
|
|
8
|
+
"&:hover": { bgcolor: "var(--synapse-secondary-action-color-alpha-20)" },
|
|
9
|
+
"& .MuiChip-icon": { color: "inherit" },
|
|
10
|
+
"& .MuiChip-deleteIcon": {
|
|
11
|
+
color: "inherit",
|
|
12
|
+
opacity: .7
|
|
13
|
+
},
|
|
14
|
+
"& .MuiChip-deleteIcon:hover": {
|
|
15
|
+
color: "inherit",
|
|
16
|
+
opacity: 1
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
function a(a) {
|
|
20
|
+
let { label: o, icon: s, tooltipTitle: c, placement: l = "top", onDelete: u, truncate: d, className: f } = a, p = /* @__PURE__ */ n(e, {
|
|
21
|
+
className: f,
|
|
22
|
+
size: "small",
|
|
23
|
+
icon: s,
|
|
24
|
+
label: o,
|
|
25
|
+
onDelete: u,
|
|
26
|
+
sx: {
|
|
27
|
+
...i,
|
|
28
|
+
...d ? { maxWidth: `min(${r}px, 100%)` } : {}
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
return c ? /* @__PURE__ */ n(t, {
|
|
32
|
+
title: c,
|
|
33
|
+
placement: l,
|
|
34
|
+
children: p
|
|
35
|
+
}) : p;
|
|
36
|
+
}
|
|
37
|
+
//#endregion
|
|
38
|
+
export { a as default };
|
|
39
|
+
|
|
40
|
+
//# sourceMappingURL=FacetValueChip.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FacetValueChip.js","names":[],"sources":["../../../../src/components/widgets/facet-nav/FacetValueChip.tsx"],"sourcesContent":["import { Chip, Tooltip } from '@mui/material'\nimport type { TooltipProps } from '@mui/material'\nimport { ReactElement, ReactNode } from 'react'\n\nexport type FacetValueChipProps = {\n /** The chip label. */\n label: ReactNode\n /** Optional leading icon. */\n icon?: ReactNode\n /** Optional tooltip content. When set, the chip is wrapped in a Tooltip. */\n tooltipTitle?: ReactNode\n /** Tooltip placement. @default 'top' */\n placement?: TooltipProps['placement']\n /** When provided, the chip shows a delete/remove button that calls this. */\n onDelete?: () => void\n /** Cap the width and truncate long labels with an ellipsis (full text in tooltip). */\n truncate?: boolean\n className?: string\n}\n\nconst MAX_CHIP_WIDTH = 220\n\n// One source of truth for the shape, neutral tint, icon, and delete-icon hover\n// styling shared by DUO tags, facet-value chips, and active-filter pills.\nconst chipSx = {\n bgcolor: 'var(--synapse-secondary-action-color-alpha-10)',\n color: 'var(--synapse-text-color-dark)',\n minWidth: 0,\n '&:hover': { bgcolor: 'var(--synapse-secondary-action-color-alpha-20)' },\n '& .MuiChip-icon': { color: 'inherit' },\n '& .MuiChip-deleteIcon': { color: 'inherit', opacity: 0.7 },\n '& .MuiChip-deleteIcon:hover': { color: 'inherit', opacity: 1 },\n}\n\n/**\n * The shared chip used to render a facet value (or DUO term) consistently\n * wherever it appears: in the facet sidebar, as an active-filter pill, and on\n * cards. Owning the icon, tooltip, and delete affordance in one place keeps the\n * styling identical across those contexts.\n */\nexport default function FacetValueChip(props: FacetValueChipProps) {\n const {\n label,\n icon,\n tooltipTitle,\n placement = 'top',\n onDelete,\n truncate,\n className,\n } = props\n const chip = (\n <Chip\n className={className}\n size=\"small\"\n // MUI Chip's `icon` expects a ReactElement; the public prop is ReactNode.\n icon={icon as ReactElement | undefined}\n label={label}\n onDelete={onDelete}\n sx={{\n ...chipSx,\n ...(truncate ? { maxWidth: `min(${MAX_CHIP_WIDTH}px, 100%)` } : {}),\n }}\n />\n )\n return tooltipTitle ? (\n <Tooltip title={tooltipTitle} placement={placement}>\n {chip}\n </Tooltip>\n ) : (\n chip\n )\n}\n"],"mappings":";;;AAoBA,IAAM,IAAiB,KAIjB,IAAS;CACb,SAAS;CACT,OAAO;CACP,UAAU;CACV,WAAW,EAAE,SAAS,iDAAiD;CACvE,mBAAmB,EAAE,OAAO,UAAU;CACtC,yBAAyB;EAAE,OAAO;EAAW,SAAS;CAAI;CAC1D,+BAA+B;EAAE,OAAO;EAAW,SAAS;CAAE;AAChE;AAQA,SAAwB,EAAe,GAA4B;CACjE,IAAM,EACJ,UACA,SACA,iBACA,eAAY,OACZ,aACA,aACA,iBACE,GACE,IACJ,kBAAC,GAAD;EACa;EACX,MAAK;EAEC;EACC;EACG;EACV,IAAI;GACF,GAAG;GACH,GAAI,IAAW,EAAE,UAAU,OAAO,EAAe,WAAW,IAAI,CAAC;EACnE;CACD,CAAA;CAEH,OAAO,IACL,kBAAC,GAAD;EAAS,OAAO;EAAyB;YACtC;CACM,CAAA,IAET;AAEJ"}
|
|
@@ -1,15 +1,20 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
1
2
|
export type SelectionCriteriaPillProps = {
|
|
2
3
|
readonly key: string;
|
|
3
|
-
|
|
4
|
-
readonly
|
|
4
|
+
/** The chip label (plain text, or structured content from `renderFacetValue`). */
|
|
5
|
+
readonly label: ReactNode;
|
|
6
|
+
readonly tooltipText?: ReactNode;
|
|
7
|
+
/** Optional leading icon (e.g. for a DUO term). */
|
|
8
|
+
readonly icon?: ReactNode;
|
|
5
9
|
readonly onRemoveFilter?: () => void;
|
|
6
10
|
/** When true, the pill is shown without a remove button */
|
|
7
11
|
readonly isLocked?: boolean;
|
|
8
12
|
};
|
|
9
13
|
/**
|
|
10
|
-
* Renders a pill
|
|
11
|
-
*
|
|
12
|
-
*
|
|
14
|
+
* Renders a pill/chicklet representing a Synapse Table Query filter/selection
|
|
15
|
+
* criterion. Delegates to the shared `FacetValueChip` so the chip, icon,
|
|
16
|
+
* tooltip, and remove affordance are styled identically wherever facet values
|
|
17
|
+
* appear.
|
|
13
18
|
*/
|
|
14
19
|
declare function SelectionCriteriaPill(props: SelectionCriteriaPillProps): import("react/jsx-runtime").JSX.Element;
|
|
15
20
|
export default SelectionCriteriaPill;
|