@backstage/plugin-catalog-react 1.16.1-next.1 → 1.17.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/CHANGELOG.md +136 -0
- package/dist/alpha/blueprints/CatalogFilterBlueprint.esm.js +17 -0
- package/dist/alpha/blueprints/CatalogFilterBlueprint.esm.js.map +1 -0
- package/dist/alpha/blueprints/EntityContentLayoutBlueprint.esm.js.map +1 -1
- package/dist/alpha/blueprints/EntityContextMenuItemBlueprint.esm.js +40 -0
- package/dist/alpha/blueprints/EntityContextMenuItemBlueprint.esm.js.map +1 -0
- package/dist/alpha/blueprints/extensionData.esm.js +1 -0
- package/dist/alpha/blueprints/extensionData.esm.js.map +1 -1
- package/dist/alpha/converters/convertLegacyEntityCardExtension.esm.js +4 -2
- package/dist/alpha/converters/convertLegacyEntityCardExtension.esm.js.map +1 -1
- package/dist/alpha/converters/convertLegacyEntityContentExtension.esm.js +4 -2
- package/dist/alpha/converters/convertLegacyEntityContentExtension.esm.js.map +1 -1
- package/dist/alpha.d.ts +56 -11
- package/dist/alpha.esm.js +2 -0
- package/dist/alpha.esm.js.map +1 -1
- package/dist/components/CatalogAutocomplete/CatalogAutocomplete.esm.js +15 -12
- package/dist/components/CatalogAutocomplete/CatalogAutocomplete.esm.js.map +1 -1
- package/dist/components/CatalogFilterLayout/CatalogFilterLayout.esm.js +37 -30
- package/dist/components/CatalogFilterLayout/CatalogFilterLayout.esm.js.map +1 -1
- package/dist/components/DefaultFilters/DefaultFilters.esm.js +16 -7
- package/dist/components/DefaultFilters/DefaultFilters.esm.js.map +1 -1
- package/dist/components/EntityAutocompletePicker/EntityAutocompletePicker.esm.js +5 -4
- package/dist/components/EntityAutocompletePicker/EntityAutocompletePicker.esm.js.map +1 -1
- package/dist/components/EntityAutocompletePicker/EntityAutocompletePickerOption.esm.js +7 -6
- package/dist/components/EntityAutocompletePicker/EntityAutocompletePickerOption.esm.js.map +1 -1
- package/dist/components/EntityDisplayName/EntityDisplayName.esm.js +7 -4
- package/dist/components/EntityDisplayName/EntityDisplayName.esm.js.map +1 -1
- package/dist/components/EntityKindPicker/EntityKindPicker.esm.js +4 -3
- package/dist/components/EntityKindPicker/EntityKindPicker.esm.js.map +1 -1
- package/dist/components/EntityLifecyclePicker/EntityLifecyclePicker.esm.js +2 -2
- package/dist/components/EntityLifecyclePicker/EntityLifecyclePicker.esm.js.map +1 -1
- package/dist/components/EntityNamespacePicker/EntityNamespacePicker.esm.js +2 -2
- package/dist/components/EntityNamespacePicker/EntityNamespacePicker.esm.js.map +1 -1
- package/dist/components/EntityOwnerPicker/EntityOwnerPicker.esm.js +15 -10
- package/dist/components/EntityOwnerPicker/EntityOwnerPicker.esm.js.map +1 -1
- package/dist/components/EntityPeekAheadPopover/CardActionComponents/EmailCardAction.esm.js +5 -5
- package/dist/components/EntityPeekAheadPopover/CardActionComponents/EmailCardAction.esm.js.map +1 -1
- package/dist/components/EntityPeekAheadPopover/CardActionComponents/EntityCardActions.esm.js +5 -5
- package/dist/components/EntityPeekAheadPopover/CardActionComponents/EntityCardActions.esm.js.map +1 -1
- package/dist/components/EntityPeekAheadPopover/CardActionComponents/GroupCardActions.esm.js +2 -2
- package/dist/components/EntityPeekAheadPopover/CardActionComponents/GroupCardActions.esm.js.map +1 -1
- package/dist/components/EntityPeekAheadPopover/CardActionComponents/UserCardActions.esm.js +2 -2
- package/dist/components/EntityPeekAheadPopover/CardActionComponents/UserCardActions.esm.js.map +1 -1
- package/dist/components/EntityPeekAheadPopover/EntityPeekAheadPopover.esm.js +60 -35
- package/dist/components/EntityPeekAheadPopover/EntityPeekAheadPopover.esm.js.map +1 -1
- package/dist/components/EntityProcessingStatusPicker/EntityProcessingStatusPicker.esm.js +8 -7
- package/dist/components/EntityProcessingStatusPicker/EntityProcessingStatusPicker.esm.js.map +1 -1
- package/dist/components/EntityRefLink/EntityRefLink.esm.js +6 -29
- package/dist/components/EntityRefLink/EntityRefLink.esm.js.map +1 -1
- package/dist/components/EntityRefLink/EntityRefLinks.esm.js +8 -4
- package/dist/components/EntityRefLink/EntityRefLinks.esm.js.map +1 -1
- package/dist/components/EntitySearchBar/EntitySearchBar.esm.js +10 -9
- package/dist/components/EntitySearchBar/EntitySearchBar.esm.js.map +1 -1
- package/dist/components/EntityTable/EntityTable.esm.js +3 -3
- package/dist/components/EntityTable/EntityTable.esm.js.map +1 -1
- package/dist/components/EntityTable/columns.esm.js +4 -4
- package/dist/components/EntityTable/columns.esm.js.map +1 -1
- package/dist/components/EntityTagPicker/EntityTagPicker.esm.js +2 -2
- package/dist/components/EntityTagPicker/EntityTagPicker.esm.js.map +1 -1
- package/dist/components/EntityTypePicker/EntityTypePicker.esm.js +4 -3
- package/dist/components/EntityTypePicker/EntityTypePicker.esm.js.map +1 -1
- package/dist/components/FavoriteEntity/FavoriteEntity.esm.js +2 -2
- package/dist/components/FavoriteEntity/FavoriteEntity.esm.js.map +1 -1
- package/dist/components/InspectEntityDialog/InspectEntityDialog.esm.js +36 -26
- package/dist/components/InspectEntityDialog/InspectEntityDialog.esm.js.map +1 -1
- package/dist/components/InspectEntityDialog/components/AncestryPage.esm.js +67 -52
- package/dist/components/InspectEntityDialog/components/AncestryPage.esm.js.map +1 -1
- package/dist/components/InspectEntityDialog/components/ColocatedPage.esm.js +32 -21
- package/dist/components/InspectEntityDialog/components/ColocatedPage.esm.js.map +1 -1
- package/dist/components/InspectEntityDialog/components/EntityKindIcon.esm.js +2 -2
- package/dist/components/InspectEntityDialog/components/EntityKindIcon.esm.js.map +1 -1
- package/dist/components/InspectEntityDialog/components/JsonPage.esm.js +13 -9
- package/dist/components/InspectEntityDialog/components/JsonPage.esm.js.map +1 -1
- package/dist/components/InspectEntityDialog/components/OverviewPage.esm.js +76 -34
- package/dist/components/InspectEntityDialog/components/OverviewPage.esm.js.map +1 -1
- package/dist/components/InspectEntityDialog/components/YamlPage.esm.js +13 -9
- package/dist/components/InspectEntityDialog/components/YamlPage.esm.js.map +1 -1
- package/dist/components/InspectEntityDialog/components/common.esm.js +21 -12
- package/dist/components/InspectEntityDialog/components/common.esm.js.map +1 -1
- package/dist/components/MissingAnnotationEmptyState/MissingAnnotationEmptyState.esm.js +39 -13
- package/dist/components/MissingAnnotationEmptyState/MissingAnnotationEmptyState.esm.js.map +1 -1
- package/dist/components/UnregisterEntityDialog/UnregisterEntityDialog.esm.js +106 -70
- package/dist/components/UnregisterEntityDialog/UnregisterEntityDialog.esm.js.map +1 -1
- package/dist/components/UserListPicker/UserListPicker.esm.js +36 -27
- package/dist/components/UserListPicker/UserListPicker.esm.js.map +1 -1
- package/dist/deprecated.esm.js +3 -2
- package/dist/deprecated.esm.js.map +1 -1
- package/dist/hooks/useEntity.esm.js +7 -7
- package/dist/hooks/useEntity.esm.js.map +1 -1
- package/dist/hooks/useEntityContextMenu.esm.js +18 -0
- package/dist/hooks/useEntityContextMenu.esm.js.map +1 -0
- package/dist/hooks/useEntityListProvider.esm.js +3 -2
- package/dist/hooks/useEntityListProvider.esm.js.map +1 -1
- package/dist/index.d.ts +43 -34
- package/dist/routes.esm.js +30 -5
- package/dist/routes.esm.js.map +1 -1
- package/dist/testUtils/MockEntityListContextProvider.esm.js +3 -2
- package/dist/testUtils/MockEntityListContextProvider.esm.js.map +1 -1
- package/dist/testUtils.d.ts +3 -2
- package/package.json +23 -23
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,141 @@
|
|
|
1
1
|
# @backstage/plugin-catalog-react
|
|
2
2
|
|
|
3
|
+
## 1.17.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 0f37fa8: `entityRouteParams` now also accepts entity refs, and can help with encoding the resulting parameters.
|
|
8
|
+
- 61d350f: **BREAKING ALPHA**: `CatalogFilterBlueprint`, used in the new frontend system, is now exported under plugin-catalog-react instead of plugin-catalog.
|
|
9
|
+
|
|
10
|
+
```diff
|
|
11
|
+
+ import { CatalogFilterBlueprint } from '@backstage/plugin-catalog-react/alpha';
|
|
12
|
+
- import { CatalogFilterBlueprint } from '@backstage/plugin-catalog/alpha';
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
- 09afd67: Adds `EntityContextMenuItemBlueprint` to enable extending the entity page's context menu with user defined items.
|
|
16
|
+
|
|
17
|
+
For example:
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
import { EntityContextMenuItemBlueprint } from '@backstage/plugin-catalog-react/alpha';
|
|
21
|
+
|
|
22
|
+
const myCustomHref = EntityContextMenuItemBlueprint.make({
|
|
23
|
+
name: 'test-href',
|
|
24
|
+
params: {
|
|
25
|
+
icon: <span>Example Icon</span>,
|
|
26
|
+
useProps: () => ({
|
|
27
|
+
title: 'Example Href',
|
|
28
|
+
href: '/example-path',
|
|
29
|
+
disabled: false,
|
|
30
|
+
component: 'a',
|
|
31
|
+
}),
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
const myCustomOnClick = EntityContextMenuItemBlueprint.make({
|
|
36
|
+
name: 'test-click',
|
|
37
|
+
params: {
|
|
38
|
+
icon: <span>Test Icon</span>,
|
|
39
|
+
useProps: () => ({
|
|
40
|
+
title: 'Example onClick',
|
|
41
|
+
onClick: () => window.alert('Hello world!'),
|
|
42
|
+
disabled: false,
|
|
43
|
+
}),
|
|
44
|
+
},
|
|
45
|
+
});
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### Patch Changes
|
|
49
|
+
|
|
50
|
+
- a47fd39: Removes instances of default React imports, a necessary update for the upcoming React 19 migration.
|
|
51
|
+
|
|
52
|
+
<https://legacy.reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html>
|
|
53
|
+
|
|
54
|
+
- 3f7e4f1: Added a new `overview` entity content group for the new frontend system.
|
|
55
|
+
- 186d016: Add `operation` to alpha `defaultEntityContentGroups`.
|
|
56
|
+
- 221ddba: Fix offset pagination to reset when updating filters in `useEntityList`
|
|
57
|
+
- Updated dependencies
|
|
58
|
+
- @backstage/frontend-plugin-api@0.10.1
|
|
59
|
+
- @backstage/frontend-test-utils@0.3.1
|
|
60
|
+
- @backstage/integration-react@1.2.6
|
|
61
|
+
- @backstage/core-compat-api@0.4.1
|
|
62
|
+
- @backstage/core-components@0.17.1
|
|
63
|
+
- @backstage/core-plugin-api@1.10.6
|
|
64
|
+
- @backstage/plugin-permission-react@0.4.33
|
|
65
|
+
- @backstage/catalog-client@1.9.1
|
|
66
|
+
- @backstage/catalog-model@1.7.3
|
|
67
|
+
- @backstage/errors@1.2.7
|
|
68
|
+
- @backstage/types@1.2.1
|
|
69
|
+
- @backstage/version-bridge@1.0.11
|
|
70
|
+
- @backstage/plugin-catalog-common@1.1.3
|
|
71
|
+
- @backstage/plugin-permission-common@0.8.4
|
|
72
|
+
|
|
73
|
+
## 1.17.0-next.2
|
|
74
|
+
|
|
75
|
+
### Minor Changes
|
|
76
|
+
|
|
77
|
+
- 61d350f: **BREAKING ALPHA**: `CatalogFilterBlueprint`, used in the new frontend system, is now exported under plugin-catalog-react instead of plugin-catalog.
|
|
78
|
+
|
|
79
|
+
```diff
|
|
80
|
+
+ import { CatalogFilterBlueprint } from '@backstage/plugin-catalog-react/alpha';
|
|
81
|
+
- import { CatalogFilterBlueprint } from '@backstage/plugin-catalog/alpha';
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
- 09afd67: Adds `EntityContextMenuItemBlueprint` to enable extending the entity page's context menu with user defined items.
|
|
85
|
+
|
|
86
|
+
For example:
|
|
87
|
+
|
|
88
|
+
```ts
|
|
89
|
+
import { EntityContextMenuItemBlueprint } from '@backstage/plugin-catalog-react/alpha';
|
|
90
|
+
|
|
91
|
+
const myCustomHref = EntityContextMenuItemBlueprint.make({
|
|
92
|
+
name: 'test-href',
|
|
93
|
+
params: {
|
|
94
|
+
icon: <span>Example Icon</span>,
|
|
95
|
+
useProps: () => ({
|
|
96
|
+
title: 'Example Href',
|
|
97
|
+
href: '/example-path',
|
|
98
|
+
disabled: false,
|
|
99
|
+
component: 'a',
|
|
100
|
+
}),
|
|
101
|
+
},
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
const myCustomOnClick = EntityContextMenuItemBlueprint.make({
|
|
105
|
+
name: 'test-click',
|
|
106
|
+
params: {
|
|
107
|
+
icon: <span>Test Icon</span>,
|
|
108
|
+
useProps: () => ({
|
|
109
|
+
title: 'Example onClick',
|
|
110
|
+
onClick: () => window.alert('Hello world!'),
|
|
111
|
+
disabled: false,
|
|
112
|
+
}),
|
|
113
|
+
},
|
|
114
|
+
});
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### Patch Changes
|
|
118
|
+
|
|
119
|
+
- a47fd39: Removes instances of default React imports, a necessary update for the upcoming React 19 migration.
|
|
120
|
+
|
|
121
|
+
<https://legacy.reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html>
|
|
122
|
+
|
|
123
|
+
- Updated dependencies
|
|
124
|
+
- @backstage/frontend-plugin-api@0.10.1-next.1
|
|
125
|
+
- @backstage/frontend-test-utils@0.3.1-next.1
|
|
126
|
+
- @backstage/integration-react@1.2.6-next.1
|
|
127
|
+
- @backstage/core-compat-api@0.4.1-next.2
|
|
128
|
+
- @backstage/core-components@0.17.1-next.1
|
|
129
|
+
- @backstage/core-plugin-api@1.10.6-next.0
|
|
130
|
+
- @backstage/plugin-permission-react@0.4.33-next.0
|
|
131
|
+
- @backstage/catalog-client@1.9.1
|
|
132
|
+
- @backstage/catalog-model@1.7.3
|
|
133
|
+
- @backstage/errors@1.2.7
|
|
134
|
+
- @backstage/types@1.2.1
|
|
135
|
+
- @backstage/version-bridge@1.0.11
|
|
136
|
+
- @backstage/plugin-catalog-common@1.1.3
|
|
137
|
+
- @backstage/plugin-permission-common@0.8.4
|
|
138
|
+
|
|
3
139
|
## 1.16.1-next.1
|
|
4
140
|
|
|
5
141
|
### Patch Changes
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { createExtensionBlueprint, coreExtensionData, ExtensionBoundary } from '@backstage/frontend-plugin-api';
|
|
2
|
+
|
|
3
|
+
const CatalogFilterBlueprint = createExtensionBlueprint({
|
|
4
|
+
kind: "catalog-filter",
|
|
5
|
+
attachTo: { id: "page:catalog", input: "filters" },
|
|
6
|
+
output: [coreExtensionData.reactElement],
|
|
7
|
+
factory(params, { node }) {
|
|
8
|
+
return [
|
|
9
|
+
coreExtensionData.reactElement(
|
|
10
|
+
ExtensionBoundary.lazy(node, params.loader)
|
|
11
|
+
)
|
|
12
|
+
];
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
export { CatalogFilterBlueprint };
|
|
17
|
+
//# sourceMappingURL=CatalogFilterBlueprint.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CatalogFilterBlueprint.esm.js","sources":["../../../src/alpha/blueprints/CatalogFilterBlueprint.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n ExtensionBoundary,\n coreExtensionData,\n createExtensionBlueprint,\n} from '@backstage/frontend-plugin-api';\n\n/**\n * Creates Catalog Filter Extensions\n * @alpha\n */\nexport const CatalogFilterBlueprint = createExtensionBlueprint({\n kind: 'catalog-filter',\n attachTo: { id: 'page:catalog', input: 'filters' },\n output: [coreExtensionData.reactElement],\n factory(params: { loader: () => Promise<JSX.Element> }, { node }) {\n return [\n coreExtensionData.reactElement(\n ExtensionBoundary.lazy(node, params.loader),\n ),\n ];\n },\n});\n"],"names":[],"mappings":";;AA0BO,MAAM,yBAAyB,wBAAyB,CAAA;AAAA,EAC7D,IAAM,EAAA,gBAAA;AAAA,EACN,QAAU,EAAA,EAAE,EAAI,EAAA,cAAA,EAAgB,OAAO,SAAU,EAAA;AAAA,EACjD,MAAA,EAAQ,CAAC,iBAAA,CAAkB,YAAY,CAAA;AAAA,EACvC,OAAQ,CAAA,MAAA,EAAgD,EAAE,IAAA,EAAQ,EAAA;AAChE,IAAO,OAAA;AAAA,MACL,iBAAkB,CAAA,YAAA;AAAA,QAChB,iBAAkB,CAAA,IAAA,CAAK,IAAM,EAAA,MAAA,CAAO,MAAM;AAAA;AAC5C,KACF;AAAA;AAEJ,CAAC;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityContentLayoutBlueprint.esm.js","sources":["../../../src/alpha/blueprints/EntityContentLayoutBlueprint.tsx"],"sourcesContent":["/*\n * Copyright 2025 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n createExtensionDataRef,\n createExtensionBlueprint,\n ExtensionBoundary,\n} from '@backstage/frontend-plugin-api';\nimport {\n entityFilterExpressionDataRef,\n entityFilterFunctionDataRef,\n EntityCardType,\n} from './extensionData';\nimport
|
|
1
|
+
{"version":3,"file":"EntityContentLayoutBlueprint.esm.js","sources":["../../../src/alpha/blueprints/EntityContentLayoutBlueprint.tsx"],"sourcesContent":["/*\n * Copyright 2025 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n createExtensionDataRef,\n createExtensionBlueprint,\n ExtensionBoundary,\n} from '@backstage/frontend-plugin-api';\nimport {\n entityFilterExpressionDataRef,\n entityFilterFunctionDataRef,\n EntityCardType,\n} from './extensionData';\nimport { JSX } from 'react';\nimport { EntityPredicate } from '../predicates';\nimport { resolveEntityFilterData } from './resolveEntityFilterData';\nimport { createEntityPredicateSchema } from '../predicates/createEntityPredicateSchema';\nimport { Entity } from '@backstage/catalog-model';\n\n/** @alpha */\nexport interface EntityContentLayoutProps {\n cards: Array<{\n type?: EntityCardType;\n element: JSX.Element;\n }>;\n}\n\nconst entityCardLayoutComponentDataRef = createExtensionDataRef<\n (props: EntityContentLayoutProps) => React.JSX.Element\n>().with({\n id: 'catalog.entity-content-layout.component',\n});\n\n/** @alpha */\nexport const EntityContentLayoutBlueprint = createExtensionBlueprint({\n kind: 'entity-content-layout',\n attachTo: { id: 'entity-content:catalog/overview', input: 'layouts' },\n output: [\n entityFilterFunctionDataRef.optional(),\n entityFilterExpressionDataRef.optional(),\n entityCardLayoutComponentDataRef,\n ],\n dataRefs: {\n filterFunction: entityFilterFunctionDataRef,\n filterExpression: entityFilterExpressionDataRef,\n component: entityCardLayoutComponentDataRef,\n },\n config: {\n schema: {\n type: z => z.string().optional(),\n filter: z =>\n z.union([z.string(), createEntityPredicateSchema(z)]).optional(),\n },\n },\n *factory(\n {\n loader,\n filter,\n }: {\n filter?: string | EntityPredicate | ((entity: Entity) => boolean);\n loader: () => Promise<(props: EntityContentLayoutProps) => JSX.Element>;\n },\n { node, config },\n ) {\n yield* resolveEntityFilterData(filter, config, node);\n\n yield entityCardLayoutComponentDataRef(\n ExtensionBoundary.lazyComponent(node, loader),\n );\n },\n});\n"],"names":[],"mappings":";;;;;AAwCA,MAAM,gCAAA,GAAmC,sBAEvC,EAAA,CAAE,IAAK,CAAA;AAAA,EACP,EAAI,EAAA;AACN,CAAC,CAAA;AAGM,MAAM,+BAA+B,wBAAyB,CAAA;AAAA,EACnE,IAAM,EAAA,uBAAA;AAAA,EACN,QAAU,EAAA,EAAE,EAAI,EAAA,iCAAA,EAAmC,OAAO,SAAU,EAAA;AAAA,EACpE,MAAQ,EAAA;AAAA,IACN,4BAA4B,QAAS,EAAA;AAAA,IACrC,8BAA8B,QAAS,EAAA;AAAA,IACvC;AAAA,GACF;AAAA,EACA,QAAU,EAAA;AAAA,IACR,cAAgB,EAAA,2BAAA;AAAA,IAChB,gBAAkB,EAAA,6BAAA;AAAA,IAClB,SAAW,EAAA;AAAA,GACb;AAAA,EACA,MAAQ,EAAA;AAAA,IACN,MAAQ,EAAA;AAAA,MACN,IAAM,EAAA,CAAA,CAAA,KAAK,CAAE,CAAA,MAAA,GAAS,QAAS,EAAA;AAAA,MAC/B,MAAQ,EAAA,CAAA,CAAA,KACN,CAAE,CAAA,KAAA,CAAM,CAAC,CAAA,CAAE,MAAO,EAAA,EAAG,2BAA4B,CAAA,CAAC,CAAC,CAAC,EAAE,QAAS;AAAA;AACnE,GACF;AAAA,EACA,CAAC,OACC,CAAA;AAAA,IACE,MAAA;AAAA,IACA;AAAA,GAKF,EAAA,EAAE,IAAM,EAAA,MAAA,EACR,EAAA;AACA,IAAO,OAAA,uBAAA,CAAwB,MAAQ,EAAA,MAAA,EAAQ,IAAI,CAAA;AAEnD,IAAM,MAAA,gCAAA;AAAA,MACJ,iBAAA,CAAkB,aAAc,CAAA,IAAA,EAAM,MAAM;AAAA,KAC9C;AAAA;AAEJ,CAAC;;;;"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
+
import { createExtensionBlueprint, coreExtensionData, ExtensionBoundary } from '@backstage/frontend-plugin-api';
|
|
3
|
+
import MenuItem from '@material-ui/core/MenuItem';
|
|
4
|
+
import ListItemIcon from '@material-ui/core/ListItemIcon';
|
|
5
|
+
import ListItemText from '@material-ui/core/ListItemText';
|
|
6
|
+
import { useEntityContextMenu } from '../../hooks/useEntityContextMenu.esm.js';
|
|
7
|
+
|
|
8
|
+
const EntityContextMenuItemBlueprint = createExtensionBlueprint({
|
|
9
|
+
kind: "entity-context-menu-item",
|
|
10
|
+
attachTo: { id: "page:catalog/entity", input: "contextMenuItems" },
|
|
11
|
+
output: [coreExtensionData.reactElement],
|
|
12
|
+
*factory(params, { node }) {
|
|
13
|
+
const loader = async () => {
|
|
14
|
+
const Component = () => {
|
|
15
|
+
const { onMenuClose } = useEntityContextMenu();
|
|
16
|
+
const { title, ...menuItemProps } = params.useProps();
|
|
17
|
+
let handleClick = void 0;
|
|
18
|
+
if ("onClick" in menuItemProps) {
|
|
19
|
+
handleClick = () => {
|
|
20
|
+
const result = menuItemProps.onClick();
|
|
21
|
+
if (result && "then" in result) {
|
|
22
|
+
result.then(onMenuClose, onMenuClose);
|
|
23
|
+
} else {
|
|
24
|
+
onMenuClose();
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
return /* @__PURE__ */ jsxs(MenuItem, { ...menuItemProps, onClick: handleClick, children: [
|
|
29
|
+
/* @__PURE__ */ jsx(ListItemIcon, { children: params.icon }),
|
|
30
|
+
/* @__PURE__ */ jsx(ListItemText, { primary: title })
|
|
31
|
+
] });
|
|
32
|
+
};
|
|
33
|
+
return /* @__PURE__ */ jsx(Component, {});
|
|
34
|
+
};
|
|
35
|
+
yield coreExtensionData.reactElement(ExtensionBoundary.lazy(node, loader));
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
export { EntityContextMenuItemBlueprint };
|
|
40
|
+
//# sourceMappingURL=EntityContextMenuItemBlueprint.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EntityContextMenuItemBlueprint.esm.js","sources":["../../../src/alpha/blueprints/EntityContextMenuItemBlueprint.tsx"],"sourcesContent":["/*\n * Copyright 2025 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ReactNode, JSX } from 'react';\nimport {\n coreExtensionData,\n createExtensionBlueprint,\n ExtensionBoundary,\n} from '@backstage/frontend-plugin-api';\nimport MenuItem from '@material-ui/core/MenuItem';\nimport ListItemIcon from '@material-ui/core/ListItemIcon';\nimport ListItemText from '@material-ui/core/ListItemText';\nimport { useEntityContextMenu } from '../../hooks/useEntityContextMenu';\n\n/** @alpha */\nexport type UseProps = () =>\n | {\n title: ReactNode;\n href: string;\n disabled?: boolean;\n }\n | {\n title: ReactNode;\n onClick: () => void | Promise<void>;\n disabled?: boolean;\n };\n\n/** @alpha */\nexport type EntityContextMenuItemParams = {\n useProps: UseProps;\n icon: JSX.Element;\n};\n\n/** @alpha */\nexport const EntityContextMenuItemBlueprint = createExtensionBlueprint({\n kind: 'entity-context-menu-item',\n attachTo: { id: 'page:catalog/entity', input: 'contextMenuItems' },\n output: [coreExtensionData.reactElement],\n *factory(params: EntityContextMenuItemParams, { node }) {\n const loader = async () => {\n const Component = () => {\n const { onMenuClose } = useEntityContextMenu();\n const { title, ...menuItemProps } = params.useProps();\n let handleClick = undefined;\n\n if ('onClick' in menuItemProps) {\n handleClick = () => {\n const result = menuItemProps.onClick();\n if (result && 'then' in result) {\n result.then(onMenuClose, onMenuClose);\n } else {\n onMenuClose();\n }\n };\n }\n\n return (\n <MenuItem {...menuItemProps} onClick={handleClick}>\n <ListItemIcon>{params.icon}</ListItemIcon>\n <ListItemText primary={title} />\n </MenuItem>\n );\n };\n\n return <Component />;\n };\n\n yield coreExtensionData.reactElement(ExtensionBoundary.lazy(node, lo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,CAAC,CAAA;AAAA;AAE7E,CAAC;;;;"}
|
|
@@ -8,6 +8,7 @@ const entityFilterExpressionDataRef = createExtensionDataRef().with({
|
|
|
8
8
|
id: "catalog.entity-filter-expression"
|
|
9
9
|
});
|
|
10
10
|
const defaultEntityContentGroups = {
|
|
11
|
+
overview: "Overview",
|
|
11
12
|
documentation: "Documentation",
|
|
12
13
|
development: "Development",
|
|
13
14
|
deployment: "Deployment",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extensionData.esm.js","sources":["../../../src/alpha/blueprints/extensionData.tsx"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Entity } from '@backstage/catalog-model';\nimport { createExtensionDataRef } from '@backstage/frontend-plugin-api';\n\n/** @internal */\nexport const entityContentTitleDataRef = createExtensionDataRef<string>().with({\n id: 'catalog.entity-content-title',\n});\n\n/** @internal */\nexport const entityFilterFunctionDataRef = createExtensionDataRef<\n (entity: Entity) => boolean\n>().with({ id: 'catalog.entity-filter-function' });\n\n/** @internal */\nexport const entityFilterExpressionDataRef =\n createExtensionDataRef<string>().with({\n id: 'catalog.entity-filter-expression',\n });\n\n/**\n * @alpha\n * Default entity content groups.\n */\nexport const defaultEntityContentGroups = {\n documentation: 'Documentation',\n development: 'Development',\n deployment: 'Deployment',\n operation: 'Operation',\n observability: 'Observability',\n};\n\n/** @internal */\nexport const entityContentGroupDataRef = createExtensionDataRef<string>().with({\n id: 'catalog.entity-content-group',\n});\n\n/**\n * @internal\n * Available entity card types\n */\nexport const entityCardTypes = [\n 'summary',\n 'info',\n 'content',\n] as const satisfies readonly EntityCardType[];\n\n/** @alpha */\nexport type EntityCardType = 'summary' | 'info' | 'content';\n\n/** @internal */\nexport const entityCardTypeDataRef =\n createExtensionDataRef<EntityCardType>().with({\n id: 'catalog.entity-card-type',\n });\n"],"names":[],"mappings":";;AAoBa,MAAA,yBAAA,GAA4B,sBAA+B,EAAA,CAAE,IAAK,CAAA;AAAA,EAC7E,EAAI,EAAA;AACN,CAAC;AAGM,MAAM,8BAA8B,sBAEzC,EAAA,CAAE,KAAK,EAAE,EAAA,EAAI,kCAAkC;AAGpC,MAAA,6BAAA,GACX,sBAA+B,EAAA,CAAE,IAAK,CAAA;AAAA,EACpC,EAAI,EAAA;AACN,CAAC;AAMI,MAAM,0BAA6B,GAAA;AAAA,EACxC,aAAe,EAAA,eAAA;AAAA,EACf,WAAa,EAAA,aAAA;AAAA,EACb,UAAY,EAAA,YAAA;AAAA,EACZ,SAAW,EAAA,WAAA;AAAA,EACX,aAAe,EAAA;AACjB;AAGa,MAAA,yBAAA,GAA4B,sBAA+B,EAAA,CAAE,IAAK,CAAA;AAAA,EAC7E,EAAI,EAAA;AACN,CAAC;AAMM,MAAM,eAAkB,GAAA;AAAA,EAC7B,SAAA;AAAA,EACA,MAAA;AAAA,EACA;AACF;AAMa,MAAA,qBAAA,GACX,sBAAuC,EAAA,CAAE,IAAK,CAAA;AAAA,EAC5C,EAAI,EAAA;AACN,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"extensionData.esm.js","sources":["../../../src/alpha/blueprints/extensionData.tsx"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Entity } from '@backstage/catalog-model';\nimport { createExtensionDataRef } from '@backstage/frontend-plugin-api';\n\n/** @internal */\nexport const entityContentTitleDataRef = createExtensionDataRef<string>().with({\n id: 'catalog.entity-content-title',\n});\n\n/** @internal */\nexport const entityFilterFunctionDataRef = createExtensionDataRef<\n (entity: Entity) => boolean\n>().with({ id: 'catalog.entity-filter-function' });\n\n/** @internal */\nexport const entityFilterExpressionDataRef =\n createExtensionDataRef<string>().with({\n id: 'catalog.entity-filter-expression',\n });\n\n/**\n * @alpha\n * Default entity content groups.\n */\nexport const defaultEntityContentGroups = {\n overview: 'Overview',\n documentation: 'Documentation',\n development: 'Development',\n deployment: 'Deployment',\n operation: 'Operation',\n observability: 'Observability',\n};\n\n/** @internal */\nexport const entityContentGroupDataRef = createExtensionDataRef<string>().with({\n id: 'catalog.entity-content-group',\n});\n\n/**\n * @internal\n * Available entity card types\n */\nexport const entityCardTypes = [\n 'summary',\n 'info',\n 'content',\n] as const satisfies readonly EntityCardType[];\n\n/** @alpha */\nexport type EntityCardType = 'summary' | 'info' | 'content';\n\n/** @internal */\nexport const entityCardTypeDataRef =\n createExtensionDataRef<EntityCardType>().with({\n id: 'catalog.entity-card-type',\n });\n"],"names":[],"mappings":";;AAoBa,MAAA,yBAAA,GAA4B,sBAA+B,EAAA,CAAE,IAAK,CAAA;AAAA,EAC7E,EAAI,EAAA;AACN,CAAC;AAGM,MAAM,8BAA8B,sBAEzC,EAAA,CAAE,KAAK,EAAE,EAAA,EAAI,kCAAkC;AAGpC,MAAA,6BAAA,GACX,sBAA+B,EAAA,CAAE,IAAK,CAAA;AAAA,EACpC,EAAI,EAAA;AACN,CAAC;AAMI,MAAM,0BAA6B,GAAA;AAAA,EACxC,QAAU,EAAA,UAAA;AAAA,EACV,aAAe,EAAA,eAAA;AAAA,EACf,WAAa,EAAA,aAAA;AAAA,EACb,UAAY,EAAA,YAAA;AAAA,EACZ,SAAW,EAAA,WAAA;AAAA,EACX,aAAe,EAAA;AACjB;AAGa,MAAA,yBAAA,GAA4B,sBAA+B,EAAA,CAAE,IAAK,CAAA;AAAA,EAC7E,EAAI,EAAA;AACN,CAAC;AAMM,MAAM,eAAkB,GAAA;AAAA,EAC7B,SAAA;AAAA,EACA,MAAA;AAAA,EACA;AACF;AAMa,MAAA,qBAAA,GACX,sBAAuC,EAAA,CAAE,IAAK,CAAA;AAAA,EAC5C,EAAI,EAAA;AACN,CAAC;;;;"}
|
|
@@ -1,15 +1,17 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
1
2
|
import { compatWrapper } from '@backstage/core-compat-api';
|
|
2
3
|
import { getComponentData } from '@backstage/core-plugin-api';
|
|
3
|
-
import
|
|
4
|
+
import '../blueprints/CatalogFilterBlueprint.esm.js';
|
|
4
5
|
import { EntityCardBlueprint } from '../blueprints/EntityCardBlueprint.esm.js';
|
|
5
6
|
import '../blueprints/EntityContentBlueprint.esm.js';
|
|
6
7
|
import '../blueprints/EntityContentLayoutBlueprint.esm.js';
|
|
7
8
|
import '../blueprints/EntityHeaderBlueprint.esm.js';
|
|
8
9
|
import '../blueprints/extensionData.esm.js';
|
|
10
|
+
import '../blueprints/EntityContextMenuItemBlueprint.esm.js';
|
|
9
11
|
import kebabCase from 'lodash/kebabCase';
|
|
10
12
|
|
|
11
13
|
function convertLegacyEntityCardExtension(LegacyExtension, overrides) {
|
|
12
|
-
const element = /* @__PURE__ */
|
|
14
|
+
const element = /* @__PURE__ */ jsx(LegacyExtension, {});
|
|
13
15
|
const extName = getComponentData(element, "core.extensionName");
|
|
14
16
|
if (!extName) {
|
|
15
17
|
throw new Error("Extension has no name");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"convertLegacyEntityCardExtension.esm.js","sources":["../../../src/alpha/converters/convertLegacyEntityCardExtension.tsx"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { compatWrapper } from '@backstage/core-compat-api';\nimport { BackstagePlugin, getComponentData } from '@backstage/core-plugin-api';\nimport { ExtensionDefinition } from '@backstage/frontend-plugin-api';\nimport
|
|
1
|
+
{"version":3,"file":"convertLegacyEntityCardExtension.esm.js","sources":["../../../src/alpha/converters/convertLegacyEntityCardExtension.tsx"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { compatWrapper } from '@backstage/core-compat-api';\nimport { BackstagePlugin, getComponentData } from '@backstage/core-plugin-api';\nimport { ExtensionDefinition } from '@backstage/frontend-plugin-api';\nimport { ComponentType } from 'react';\nimport { EntityCardBlueprint } from '../blueprints';\nimport kebabCase from 'lodash/kebabCase';\nimport { EntityPredicate } from '../predicates';\nimport { Entity } from '@backstage/catalog-model';\n\n/** @alpha */\nexport function convertLegacyEntityCardExtension(\n LegacyExtension: ComponentType<{}>,\n overrides?: {\n name?: string;\n filter?: string | EntityPredicate | ((entity: Entity) => boolean);\n },\n): ExtensionDefinition {\n const element = <LegacyExtension />;\n\n const extName = getComponentData<string>(element, 'core.extensionName');\n if (!extName) {\n throw new Error('Extension has no name');\n }\n\n const plugin = getComponentData<BackstagePlugin>(element, 'core.plugin');\n const pluginId = plugin?.getId();\n\n const match = extName.match(/^Entity(.*)Card$/);\n const infix = match?.[1] ?? extName;\n\n let name: string | undefined = infix;\n if (\n pluginId &&\n name\n .toLocaleLowerCase('en-US')\n .startsWith(pluginId.toLocaleLowerCase('en-US'))\n ) {\n name = name.slice(pluginId.length);\n if (!name) {\n name = undefined;\n }\n }\n name = name && kebabCase(name);\n\n return EntityCardBlueprint.make({\n name: overrides?.name ?? name,\n params: {\n filter: overrides?.filter,\n loader: async () => compatWrapper(element),\n },\n });\n}\n"],"names":[],"mappings":";;;;;;;;;;;;AA0BgB,SAAA,gCAAA,CACd,iBACA,SAIqB,EAAA;AACrB,EAAM,MAAA,OAAA,uBAAW,eAAgB,EAAA,EAAA,CAAA;AAEjC,EAAM,MAAA,OAAA,GAAU,gBAAyB,CAAA,OAAA,EAAS,oBAAoB,CAAA;AACtE,EAAA,IAAI,CAAC,OAAS,EAAA;AACZ,IAAM,MAAA,IAAI,MAAM,uBAAuB,CAAA;AAAA;AAGzC,EAAM,MAAA,MAAA,GAAS,gBAAkC,CAAA,OAAA,EAAS,aAAa,CAAA;AACvE,EAAM,MAAA,QAAA,GAAW,QAAQ,KAAM,EAAA;AAE/B,EAAM,MAAA,KAAA,GAAQ,OAAQ,CAAA,KAAA,CAAM,kBAAkB,CAAA;AAC9C,EAAM,MAAA,KAAA,GAAQ,KAAQ,GAAA,CAAC,CAAK,IAAA,OAAA;AAE5B,EAAA,IAAI,IAA2B,GAAA,KAAA;AAC/B,EACE,IAAA,QAAA,IACA,IACG,CAAA,iBAAA,CAAkB,OAAO,CAAA,CACzB,WAAW,QAAS,CAAA,iBAAA,CAAkB,OAAO,CAAC,CACjD,EAAA;AACA,IAAO,IAAA,GAAA,IAAA,CAAK,KAAM,CAAA,QAAA,CAAS,MAAM,CAAA;AACjC,IAAA,IAAI,CAAC,IAAM,EAAA;AACT,MAAO,IAAA,GAAA,KAAA,CAAA;AAAA;AACT;AAEF,EAAO,IAAA,GAAA,IAAA,IAAQ,UAAU,IAAI,CAAA;AAE7B,EAAA,OAAO,oBAAoB,IAAK,CAAA;AAAA,IAC9B,IAAA,EAAM,WAAW,IAAQ,IAAA,IAAA;AAAA,IACzB,MAAQ,EAAA;AAAA,MACN,QAAQ,SAAW,EAAA,MAAA;AAAA,MACnB,MAAA,EAAQ,YAAY,aAAA,CAAc,OAAO;AAAA;AAC3C,GACD,CAAA;AACH;;;;"}
|
|
@@ -1,16 +1,18 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
1
2
|
import { convertLegacyRouteRef, compatWrapper } from '@backstage/core-compat-api';
|
|
2
3
|
import { getComponentData } from '@backstage/core-plugin-api';
|
|
3
4
|
import kebabCase from 'lodash/kebabCase';
|
|
4
5
|
import startCase from 'lodash/startCase';
|
|
5
|
-
import
|
|
6
|
+
import '../blueprints/CatalogFilterBlueprint.esm.js';
|
|
6
7
|
import '../blueprints/EntityCardBlueprint.esm.js';
|
|
7
8
|
import { EntityContentBlueprint } from '../blueprints/EntityContentBlueprint.esm.js';
|
|
8
9
|
import '../blueprints/EntityContentLayoutBlueprint.esm.js';
|
|
9
10
|
import '../blueprints/EntityHeaderBlueprint.esm.js';
|
|
10
11
|
import '../blueprints/extensionData.esm.js';
|
|
12
|
+
import '../blueprints/EntityContextMenuItemBlueprint.esm.js';
|
|
11
13
|
|
|
12
14
|
function convertLegacyEntityContentExtension(LegacyExtension, overrides) {
|
|
13
|
-
const element = /* @__PURE__ */
|
|
15
|
+
const element = /* @__PURE__ */ jsx(LegacyExtension, {});
|
|
14
16
|
const extName = getComponentData(element, "core.extensionName");
|
|
15
17
|
if (!extName) {
|
|
16
18
|
throw new Error("Extension has no name");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"convertLegacyEntityContentExtension.esm.js","sources":["../../../src/alpha/converters/convertLegacyEntityContentExtension.tsx"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n compatWrapper,\n convertLegacyRouteRef,\n} from '@backstage/core-compat-api';\nimport {\n BackstagePlugin,\n getComponentData,\n RouteRef as LegacyRouteRef,\n} from '@backstage/core-plugin-api';\nimport { ExtensionDefinition } from '@backstage/frontend-plugin-api';\nimport kebabCase from 'lodash/kebabCase';\nimport startCase from 'lodash/startCase';\nimport
|
|
1
|
+
{"version":3,"file":"convertLegacyEntityContentExtension.esm.js","sources":["../../../src/alpha/converters/convertLegacyEntityContentExtension.tsx"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n compatWrapper,\n convertLegacyRouteRef,\n} from '@backstage/core-compat-api';\nimport {\n BackstagePlugin,\n getComponentData,\n RouteRef as LegacyRouteRef,\n} from '@backstage/core-plugin-api';\nimport { ExtensionDefinition } from '@backstage/frontend-plugin-api';\nimport kebabCase from 'lodash/kebabCase';\nimport startCase from 'lodash/startCase';\nimport { ComponentType } from 'react';\nimport { EntityContentBlueprint } from '../blueprints';\nimport { EntityPredicate } from '../predicates';\nimport { Entity } from '@backstage/catalog-model';\n\n/** @alpha */\nexport function convertLegacyEntityContentExtension(\n LegacyExtension: ComponentType<{}>,\n overrides?: {\n name?: string;\n filter?: string | EntityPredicate | ((entity: Entity) => boolean);\n defaultPath?: string;\n defaultTitle?: string;\n },\n): ExtensionDefinition {\n const element = <LegacyExtension />;\n\n const extName = getComponentData<string>(element, 'core.extensionName');\n if (!extName) {\n throw new Error('Extension has no name');\n }\n\n const mountPoint = getComponentData<LegacyRouteRef>(\n element,\n 'core.mountPoint',\n );\n\n const plugin = getComponentData<BackstagePlugin>(element, 'core.plugin');\n const pluginId = plugin?.getId();\n\n const match = extName.match(/^Entity(.*)Content$/);\n const infix = match?.[1] ?? extName;\n\n let name: string | undefined = infix;\n if (\n pluginId &&\n name\n .toLocaleLowerCase('en-US')\n .startsWith(pluginId.toLocaleLowerCase('en-US'))\n ) {\n name = name.slice(pluginId.length);\n if (!name) {\n name = undefined;\n }\n }\n name = name && kebabCase(name);\n\n return EntityContentBlueprint.make({\n name: overrides?.name ?? name,\n params: {\n filter: overrides?.filter,\n defaultPath: overrides?.defaultPath ?? `/${kebabCase(infix)}`,\n defaultTitle: overrides?.defaultTitle ?? startCase(infix),\n routeRef: mountPoint && convertLegacyRouteRef(mountPoint),\n loader: async () => compatWrapper(element),\n },\n });\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;AAkCgB,SAAA,mCAAA,CACd,iBACA,SAMqB,EAAA;AACrB,EAAM,MAAA,OAAA,uBAAW,eAAgB,EAAA,EAAA,CAAA;AAEjC,EAAM,MAAA,OAAA,GAAU,gBAAyB,CAAA,OAAA,EAAS,oBAAoB,CAAA;AACtE,EAAA,IAAI,CAAC,OAAS,EAAA;AACZ,IAAM,MAAA,IAAI,MAAM,uBAAuB,CAAA;AAAA;AAGzC,EAAA,MAAM,UAAa,GAAA,gBAAA;AAAA,IACjB,OAAA;AAAA,IACA;AAAA,GACF;AAEA,EAAM,MAAA,MAAA,GAAS,gBAAkC,CAAA,OAAA,EAAS,aAAa,CAAA;AACvE,EAAM,MAAA,QAAA,GAAW,QAAQ,KAAM,EAAA;AAE/B,EAAM,MAAA,KAAA,GAAQ,OAAQ,CAAA,KAAA,CAAM,qBAAqB,CAAA;AACjD,EAAM,MAAA,KAAA,GAAQ,KAAQ,GAAA,CAAC,CAAK,IAAA,OAAA;AAE5B,EAAA,IAAI,IAA2B,GAAA,KAAA;AAC/B,EACE,IAAA,QAAA,IACA,IACG,CAAA,iBAAA,CAAkB,OAAO,CAAA,CACzB,WAAW,QAAS,CAAA,iBAAA,CAAkB,OAAO,CAAC,CACjD,EAAA;AACA,IAAO,IAAA,GAAA,IAAA,CAAK,KAAM,CAAA,QAAA,CAAS,MAAM,CAAA;AACjC,IAAA,IAAI,CAAC,IAAM,EAAA;AACT,MAAO,IAAA,GAAA,KAAA,CAAA;AAAA;AACT;AAEF,EAAO,IAAA,GAAA,IAAA,IAAQ,UAAU,IAAI,CAAA;AAE7B,EAAA,OAAO,uBAAuB,IAAK,CAAA;AAAA,IACjC,IAAA,EAAM,WAAW,IAAQ,IAAA,IAAA;AAAA,IACzB,MAAQ,EAAA;AAAA,MACN,QAAQ,SAAW,EAAA,MAAA;AAAA,MACnB,aAAa,SAAW,EAAA,WAAA,IAAe,CAAI,CAAA,EAAA,SAAA,CAAU,KAAK,CAAC,CAAA,CAAA;AAAA,MAC3D,YAAc,EAAA,SAAA,EAAW,YAAgB,IAAA,SAAA,CAAU,KAAK,CAAA;AAAA,MACxD,QAAA,EAAU,UAAc,IAAA,qBAAA,CAAsB,UAAU,CAAA;AAAA,MACxD,MAAA,EAAQ,YAAY,aAAA,CAAc,OAAO;AAAA;AAC3C,GACD,CAAA;AACH;;;;"}
|
package/dist/alpha.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as _backstage_frontend_plugin_api from '@backstage/frontend-plugin-api';
|
|
2
2
|
import { RouteRef, ExtensionDefinition } from '@backstage/frontend-plugin-api';
|
|
3
|
-
import * as
|
|
4
|
-
import
|
|
3
|
+
import * as react from 'react';
|
|
4
|
+
import { JSX as JSX$1, ReactNode, ComponentType } from 'react';
|
|
5
5
|
import { Entity } from '@backstage/catalog-model';
|
|
6
6
|
import { JsonValue } from '@backstage/types';
|
|
7
7
|
import * as _backstage_core_plugin_api_alpha from '@backstage/core-plugin-api/alpha';
|
|
@@ -18,11 +18,29 @@ import { ResourcePermission } from '@backstage/plugin-permission-common';
|
|
|
18
18
|
*/
|
|
19
19
|
declare function isOwnerOf(owner: Entity, entity: Entity): boolean;
|
|
20
20
|
|
|
21
|
+
/**
|
|
22
|
+
* Creates Catalog Filter Extensions
|
|
23
|
+
* @alpha
|
|
24
|
+
*/
|
|
25
|
+
declare const CatalogFilterBlueprint: _backstage_frontend_plugin_api.ExtensionBlueprint<{
|
|
26
|
+
kind: "catalog-filter";
|
|
27
|
+
name: undefined;
|
|
28
|
+
params: {
|
|
29
|
+
loader: () => Promise<JSX.Element>;
|
|
30
|
+
};
|
|
31
|
+
output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<react.JSX.Element, "core.reactElement", {}>;
|
|
32
|
+
inputs: {};
|
|
33
|
+
config: {};
|
|
34
|
+
configInput: {};
|
|
35
|
+
dataRefs: never;
|
|
36
|
+
}>;
|
|
37
|
+
|
|
21
38
|
/**
|
|
22
39
|
* @alpha
|
|
23
40
|
* Default entity content groups.
|
|
24
41
|
*/
|
|
25
42
|
declare const defaultEntityContentGroups: {
|
|
43
|
+
overview: string;
|
|
26
44
|
documentation: string;
|
|
27
45
|
development: string;
|
|
28
46
|
deployment: string;
|
|
@@ -75,7 +93,7 @@ declare const EntityCardBlueprint: _backstage_frontend_plugin_api.ExtensionBluep
|
|
|
75
93
|
filter?: string | EntityPredicate | ((entity: Entity) => boolean);
|
|
76
94
|
type?: EntityCardType;
|
|
77
95
|
};
|
|
78
|
-
output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<
|
|
96
|
+
output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<react.JSX.Element, "core.reactElement", {}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<(entity: Entity) => boolean, "catalog.entity-filter-function", {
|
|
79
97
|
optional: true;
|
|
80
98
|
}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string, "catalog.entity-filter-expression", {
|
|
81
99
|
optional: true;
|
|
@@ -113,7 +131,7 @@ declare const EntityContentBlueprint: _backstage_frontend_plugin_api.ExtensionBl
|
|
|
113
131
|
routeRef?: RouteRef;
|
|
114
132
|
filter?: string | EntityPredicate | ((entity: Entity) => boolean);
|
|
115
133
|
};
|
|
116
|
-
output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<
|
|
134
|
+
output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<react.JSX.Element, "core.reactElement", {}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string, "core.routing.path", {}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<RouteRef<_backstage_frontend_plugin_api.AnyRouteRefParams>, "core.routing.ref", {
|
|
117
135
|
optional: true;
|
|
118
136
|
}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string, "catalog.entity-content-title", {}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<(entity: Entity) => boolean, "catalog.entity-filter-function", {
|
|
119
137
|
optional: true;
|
|
@@ -147,7 +165,7 @@ declare const EntityContentBlueprint: _backstage_frontend_plugin_api.ExtensionBl
|
|
|
147
165
|
interface EntityContentLayoutProps {
|
|
148
166
|
cards: Array<{
|
|
149
167
|
type?: EntityCardType;
|
|
150
|
-
element:
|
|
168
|
+
element: JSX$1.Element;
|
|
151
169
|
}>;
|
|
152
170
|
}
|
|
153
171
|
/** @alpha */
|
|
@@ -156,13 +174,13 @@ declare const EntityContentLayoutBlueprint: _backstage_frontend_plugin_api.Exten
|
|
|
156
174
|
name: undefined;
|
|
157
175
|
params: {
|
|
158
176
|
filter?: string | EntityPredicate | ((entity: Entity) => boolean);
|
|
159
|
-
loader: () => Promise<(props: EntityContentLayoutProps) =>
|
|
177
|
+
loader: () => Promise<(props: EntityContentLayoutProps) => JSX$1.Element>;
|
|
160
178
|
};
|
|
161
179
|
output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<(entity: Entity) => boolean, "catalog.entity-filter-function", {
|
|
162
180
|
optional: true;
|
|
163
181
|
}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string, "catalog.entity-filter-expression", {
|
|
164
182
|
optional: true;
|
|
165
|
-
}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<(props: EntityContentLayoutProps) =>
|
|
183
|
+
}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<(props: EntityContentLayoutProps) => React.JSX.Element, "catalog.entity-content-layout.component", {}>;
|
|
166
184
|
inputs: {};
|
|
167
185
|
config: {
|
|
168
186
|
type: string | undefined;
|
|
@@ -175,7 +193,7 @@ declare const EntityContentLayoutBlueprint: _backstage_frontend_plugin_api.Exten
|
|
|
175
193
|
dataRefs: {
|
|
176
194
|
filterFunction: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<(entity: Entity) => boolean, "catalog.entity-filter-function", {}>;
|
|
177
195
|
filterExpression: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string, "catalog.entity-filter-expression", {}>;
|
|
178
|
-
component: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<(props: EntityContentLayoutProps) =>
|
|
196
|
+
component: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<(props: EntityContentLayoutProps) => React.JSX.Element, "catalog.entity-content-layout.component", {}>;
|
|
179
197
|
};
|
|
180
198
|
}>;
|
|
181
199
|
|
|
@@ -186,17 +204,44 @@ declare const EntityHeaderBlueprint: _backstage_frontend_plugin_api.ExtensionBlu
|
|
|
186
204
|
params: {
|
|
187
205
|
loader: () => Promise<JSX.Element>;
|
|
188
206
|
};
|
|
189
|
-
output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<
|
|
207
|
+
output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<react.JSX.Element, "core.reactElement", {
|
|
190
208
|
optional: true;
|
|
191
209
|
}>;
|
|
192
210
|
inputs: {};
|
|
193
211
|
config: {};
|
|
194
212
|
configInput: {};
|
|
195
213
|
dataRefs: {
|
|
196
|
-
element: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<
|
|
214
|
+
element: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<react.JSX.Element, "core.reactElement", {}>;
|
|
197
215
|
};
|
|
198
216
|
}>;
|
|
199
217
|
|
|
218
|
+
/** @alpha */
|
|
219
|
+
type UseProps = () => {
|
|
220
|
+
title: ReactNode;
|
|
221
|
+
href: string;
|
|
222
|
+
disabled?: boolean;
|
|
223
|
+
} | {
|
|
224
|
+
title: ReactNode;
|
|
225
|
+
onClick: () => void | Promise<void>;
|
|
226
|
+
disabled?: boolean;
|
|
227
|
+
};
|
|
228
|
+
/** @alpha */
|
|
229
|
+
type EntityContextMenuItemParams = {
|
|
230
|
+
useProps: UseProps;
|
|
231
|
+
icon: JSX$1.Element;
|
|
232
|
+
};
|
|
233
|
+
/** @alpha */
|
|
234
|
+
declare const EntityContextMenuItemBlueprint: _backstage_frontend_plugin_api.ExtensionBlueprint<{
|
|
235
|
+
kind: "entity-context-menu-item";
|
|
236
|
+
name: undefined;
|
|
237
|
+
params: EntityContextMenuItemParams;
|
|
238
|
+
output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<JSX$1.Element, "core.reactElement", {}>;
|
|
239
|
+
inputs: {};
|
|
240
|
+
config: {};
|
|
241
|
+
configInput: {};
|
|
242
|
+
dataRefs: never;
|
|
243
|
+
}>;
|
|
244
|
+
|
|
200
245
|
/** @alpha */
|
|
201
246
|
declare function convertLegacyEntityCardExtension(LegacyExtension: ComponentType<{}>, overrides?: {
|
|
202
247
|
name?: string;
|
|
@@ -283,4 +328,4 @@ declare function useEntityPermission(permission: ResourcePermission<'catalog-ent
|
|
|
283
328
|
error?: Error;
|
|
284
329
|
};
|
|
285
330
|
|
|
286
|
-
export { EntityCardBlueprint, type EntityCardType, EntityContentBlueprint, EntityContentLayoutBlueprint, type EntityContentLayoutProps, EntityHeaderBlueprint, type EntityPredicate, type EntityPredicateExpression, type EntityPredicatePrimitive, type EntityPredicateValue, catalogReactTranslationRef, convertLegacyEntityCardExtension, convertLegacyEntityContentExtension, defaultEntityContentGroups, entityPredicateToFilterFunction, isOwnerOf, useEntityPermission };
|
|
331
|
+
export { CatalogFilterBlueprint, EntityCardBlueprint, type EntityCardType, EntityContentBlueprint, EntityContentLayoutBlueprint, type EntityContentLayoutProps, EntityContextMenuItemBlueprint, type EntityContextMenuItemParams, EntityHeaderBlueprint, type EntityPredicate, type EntityPredicateExpression, type EntityPredicatePrimitive, type EntityPredicateValue, type UseProps, catalogReactTranslationRef, convertLegacyEntityCardExtension, convertLegacyEntityContentExtension, defaultEntityContentGroups, entityPredicateToFilterFunction, isOwnerOf, useEntityPermission };
|
package/dist/alpha.esm.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
export { CatalogFilterBlueprint } from './alpha/blueprints/CatalogFilterBlueprint.esm.js';
|
|
1
2
|
export { EntityCardBlueprint } from './alpha/blueprints/EntityCardBlueprint.esm.js';
|
|
2
3
|
export { EntityContentBlueprint } from './alpha/blueprints/EntityContentBlueprint.esm.js';
|
|
3
4
|
export { EntityContentLayoutBlueprint } from './alpha/blueprints/EntityContentLayoutBlueprint.esm.js';
|
|
4
5
|
export { EntityHeaderBlueprint } from './alpha/blueprints/EntityHeaderBlueprint.esm.js';
|
|
5
6
|
export { defaultEntityContentGroups } from './alpha/blueprints/extensionData.esm.js';
|
|
7
|
+
export { EntityContextMenuItemBlueprint } from './alpha/blueprints/EntityContextMenuItemBlueprint.esm.js';
|
|
6
8
|
export { convertLegacyEntityCardExtension } from './alpha/converters/convertLegacyEntityCardExtension.esm.js';
|
|
7
9
|
export { convertLegacyEntityContentExtension } from './alpha/converters/convertLegacyEntityContentExtension.esm.js';
|
|
8
10
|
export { entityPredicateToFilterFunction } from './alpha/predicates/entityPredicateToFilterFunction.esm.js';
|
package/dist/alpha.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alpha.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"alpha.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
1
2
|
import Box from '@material-ui/core/Box';
|
|
2
3
|
import Typography from '@material-ui/core/Typography';
|
|
3
4
|
import Paper from '@material-ui/core/Paper';
|
|
@@ -7,7 +8,7 @@ import Grow from '@material-ui/core/Grow';
|
|
|
7
8
|
import { makeStyles, withStyles, createStyles } from '@material-ui/core/styles';
|
|
8
9
|
import ExpandMoreIcon from '@material-ui/icons/ExpandMore';
|
|
9
10
|
import Autocomplete from '@material-ui/lab/Autocomplete';
|
|
10
|
-
import
|
|
11
|
+
import { useCallback } from 'react';
|
|
11
12
|
import { merge } from 'lodash';
|
|
12
13
|
import classNames from 'classnames';
|
|
13
14
|
|
|
@@ -83,36 +84,38 @@ const BootstrapAutocomplete = withStyles(
|
|
|
83
84
|
}),
|
|
84
85
|
{ name: "BackstageAutocompleteBase" }
|
|
85
86
|
)(Autocomplete);
|
|
86
|
-
const PopperComponent = (props) => /* @__PURE__ */
|
|
87
|
-
const PaperComponent = (props) => /* @__PURE__ */
|
|
87
|
+
const PopperComponent = (props) => /* @__PURE__ */ jsx(Popper, { ...props, transition: true, placement: "bottom-start", children: ({ TransitionProps }) => /* @__PURE__ */ jsx(Grow, { ...TransitionProps, style: { transformOrigin: "0 0 0" }, children: /* @__PURE__ */ jsx(Box, { children: props.children }) }) });
|
|
88
|
+
const PaperComponent = (props) => /* @__PURE__ */ jsx(Paper, { ...props, elevation: 8 });
|
|
88
89
|
function CatalogAutocomplete(props) {
|
|
89
90
|
const { label, name, LabelProps, TextFieldProps, ...rest } = props;
|
|
90
91
|
const classes = useStyles();
|
|
91
92
|
const renderInput = useCallback(
|
|
92
|
-
(params) => /* @__PURE__ */
|
|
93
|
+
(params) => /* @__PURE__ */ jsx(TextField, { ...merge(params, TextFieldProps), variant: "outlined" }),
|
|
93
94
|
[TextFieldProps]
|
|
94
95
|
);
|
|
95
|
-
const autocomplete = /* @__PURE__ */
|
|
96
|
+
const autocomplete = /* @__PURE__ */ jsx(
|
|
96
97
|
BootstrapAutocomplete,
|
|
97
98
|
{
|
|
98
99
|
size: "small",
|
|
99
100
|
...rest,
|
|
100
101
|
renderInput: rest.renderInput ?? renderInput,
|
|
101
|
-
popupIcon: /* @__PURE__ */
|
|
102
|
+
popupIcon: /* @__PURE__ */ jsx(ExpandMoreIcon, { "data-testid": `${name}-expand` }),
|
|
102
103
|
PaperComponent,
|
|
103
104
|
PopperComponent
|
|
104
105
|
}
|
|
105
106
|
);
|
|
106
|
-
return /* @__PURE__ */
|
|
107
|
+
return /* @__PURE__ */ jsx(Box, { className: classes.root, children: label ? /* @__PURE__ */ jsxs(
|
|
107
108
|
Typography,
|
|
108
109
|
{
|
|
109
110
|
...LabelProps,
|
|
110
111
|
className: classNames(classes.label, LabelProps?.className),
|
|
111
|
-
component: "label"
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
112
|
+
component: "label",
|
|
113
|
+
children: [
|
|
114
|
+
/* @__PURE__ */ jsx(Box, { component: "span", children: label }),
|
|
115
|
+
autocomplete
|
|
116
|
+
]
|
|
117
|
+
}
|
|
118
|
+
) : autocomplete });
|
|
116
119
|
}
|
|
117
120
|
|
|
118
121
|
export { CatalogAutocomplete };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CatalogAutocomplete.esm.js","sources":["../../../src/components/CatalogAutocomplete/CatalogAutocomplete.tsx"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Box from '@material-ui/core/Box';\nimport Typography, { TypographyProps } from '@material-ui/core/Typography';\nimport Paper, { PaperProps } from '@material-ui/core/Paper';\nimport Popper, { PopperProps } from '@material-ui/core/Popper';\nimport TextField, { OutlinedTextFieldProps } from '@material-ui/core/TextField';\nimport Grow from '@material-ui/core/Grow';\nimport {\n createStyles,\n makeStyles,\n Theme,\n withStyles,\n} from '@material-ui/core/styles';\nimport ExpandMoreIcon from '@material-ui/icons/ExpandMore';\nimport Autocomplete, {\n AutocompleteProps,\n AutocompleteRenderInputParams,\n} from '@material-ui/lab/Autocomplete';\nimport
|
|
1
|
+
{"version":3,"file":"CatalogAutocomplete.esm.js","sources":["../../../src/components/CatalogAutocomplete/CatalogAutocomplete.tsx"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Box from '@material-ui/core/Box';\nimport Typography, { TypographyProps } from '@material-ui/core/Typography';\nimport Paper, { PaperProps } from '@material-ui/core/Paper';\nimport Popper, { PopperProps } from '@material-ui/core/Popper';\nimport TextField, { OutlinedTextFieldProps } from '@material-ui/core/TextField';\nimport Grow from '@material-ui/core/Grow';\nimport {\n createStyles,\n makeStyles,\n Theme,\n withStyles,\n} from '@material-ui/core/styles';\nimport ExpandMoreIcon from '@material-ui/icons/ExpandMore';\nimport Autocomplete, {\n AutocompleteProps,\n AutocompleteRenderInputParams,\n} from '@material-ui/lab/Autocomplete';\nimport { ReactNode, useCallback } from 'react';\nimport { merge } from 'lodash';\nimport classNames from 'classnames';\n\nconst useStyles = makeStyles(\n theme => ({\n root: {\n margin: theme.spacing(1, 0),\n },\n label: {\n position: 'relative',\n fontWeight: 'bold',\n fontSize: theme.typography.body2.fontSize,\n fontFamily: theme.typography.fontFamily,\n color: theme.palette.text.primary,\n '& > span': {\n top: 0,\n left: 0,\n position: 'absolute',\n },\n },\n }),\n { name: 'BackstageAutocomplete' },\n);\n\nconst BootstrapAutocomplete = withStyles(\n (theme: Theme) =>\n createStyles({\n root: {},\n paper: {\n margin: 0,\n },\n hasClearIcon: {},\n hasPopupIcon: {},\n focused: {},\n inputRoot: {\n marginTop: 24,\n backgroundColor: theme.palette.background.paper,\n '$root$hasClearIcon$hasPopupIcon &': {\n paddingBlock: theme.spacing(0.75),\n paddingInlineStart: theme.spacing(0.75),\n },\n '$root$focused &': {\n outline: 'none',\n },\n '$root &:hover > fieldset': {\n borderColor: '#ced4da',\n },\n '$root$focused & > fieldset': {\n borderWidth: 1,\n borderColor: theme.palette.primary.main,\n },\n },\n popupIndicator: {\n padding: 0,\n margin: 0,\n color: '#616161',\n '&:hover': {\n backgroundColor: 'unset',\n },\n '& [class*=\"MuiTouchRipple-root\"]': {\n display: 'none',\n },\n },\n endAdornment: {\n '$root$hasClearIcon$hasPopupIcon &': {\n right: 4,\n },\n },\n input: {\n '$root$hasClearIcon$hasPopupIcon &': {\n fontSize: theme.typography.body1.fontSize,\n paddingBlock: theme.spacing(0.8125),\n },\n },\n }),\n { name: 'BackstageAutocompleteBase' },\n)(Autocomplete) as typeof Autocomplete;\n\nconst PopperComponent = (props: PopperProps) => (\n <Popper {...props} transition placement=\"bottom-start\">\n {({ TransitionProps }) => (\n <Grow {...TransitionProps} style={{ transformOrigin: '0 0 0' }}>\n <Box>{props.children as ReactNode}</Box>\n </Grow>\n )}\n </Popper>\n);\n\nconst PaperComponent = (props: PaperProps) => (\n <Paper {...props} elevation={8} />\n);\n\n/**\n * Props for {@link CatalogAutocomplete}\n *\n * @public\n */\nexport type CatalogAutocompleteProps<\n T,\n Multiple extends boolean | undefined = undefined,\n DisableClearable extends boolean | undefined = undefined,\n FreeSolo extends boolean | undefined = undefined,\n> = Omit<\n AutocompleteProps<T, Multiple, DisableClearable, FreeSolo>,\n 'PopperComponent' | 'PaperComponent' | 'popupIcon' | 'renderInput'\n> & {\n name: string;\n label?: string;\n LabelProps?: TypographyProps<'label'>;\n TextFieldProps?: Omit<OutlinedTextFieldProps, 'variant'>;\n renderInput?: AutocompleteProps<\n T,\n Multiple,\n DisableClearable,\n FreeSolo\n >['renderInput'];\n};\n\n/** @public */\nexport function CatalogAutocomplete<\n T,\n Multiple extends boolean | undefined = undefined,\n DisableClearable extends boolean | undefined = undefined,\n FreeSolo extends boolean | undefined = undefined,\n>(props: CatalogAutocompleteProps<T, Multiple, DisableClearable, FreeSolo>) {\n const { label, name, LabelProps, TextFieldProps, ...rest } = props;\n const classes = useStyles();\n const renderInput = useCallback(\n (params: AutocompleteRenderInputParams) => (\n <TextField {...merge(params, TextFieldProps)} variant=\"outlined\" />\n ),\n [TextFieldProps],\n );\n const autocomplete = (\n <BootstrapAutocomplete\n size=\"small\"\n {...rest}\n renderInput={rest.renderInput ?? renderInput}\n popupIcon={<ExpandMoreIcon data-testid={`${name}-expand`} />}\n PaperComponent={PaperComponent}\n PopperComponent={PopperComponent}\n />\n );\n\n return (\n <Box className={classes.root}>\n {label ? (\n <Typography\n {...LabelProps}\n className={classNames(classes.label, LabelProps?.className)}\n component=\"label\"\n >\n <Box component=\"span\">{label}</Box>\n {autocomplete}\n </Typography>\n ) : (\n autocomplete\n )}\n </Box>\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;AAqCA,MAAM,SAAY,GAAA,UAAA;AAAA,EAChB,CAAU,KAAA,MAAA;AAAA,IACR,IAAM,EAAA;AAAA,MACJ,MAAQ,EAAA,KAAA,CAAM,OAAQ,CAAA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