@scm-manager/ui-extensions 2.44.3-20230613-120253 → 2.44.3
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/build/index.d.ts +2 -11
- package/build/index.js +7 -15
- package/build/index.mjs +7 -15
- package/package.json +2 -2
package/build/index.d.ts
CHANGED
|
@@ -59,15 +59,6 @@ declare class Binder {
|
|
|
59
59
|
* @param options object with additional settings
|
|
60
60
|
*/
|
|
61
61
|
bind<E extends ExtensionPointDefinition<string, unknown, any>>(extensionPoint: E["name"], extension: E["type"], options?: BindOptions<E["props"]>): void;
|
|
62
|
-
/**
|
|
63
|
-
* Binds an extension to the extension point.
|
|
64
|
-
*
|
|
65
|
-
* @param extensionPoint name of extension point
|
|
66
|
-
* @param extension provided extension
|
|
67
|
-
* @param predicate to decide if the extension gets rendered for the given props
|
|
68
|
-
* @param options object with additional settings
|
|
69
|
-
*/
|
|
70
|
-
bind<E extends ExtensionPointDefinition<string, unknown, any>>(extensionPoint: E["name"], extension: E["type"], predicate?: Predicate<E["props"]>, options?: BindOptions<E["props"]>): void;
|
|
71
62
|
/**
|
|
72
63
|
* Returns the first extension or null for the given extension point and its props.
|
|
73
64
|
*
|
|
@@ -283,7 +274,7 @@ declare type RepositoryOverviewTopExtensionProps = RepositoryOverviewTop["props"
|
|
|
283
274
|
declare type RepositoryOverviewTopExtension = RepositoryOverviewTop;
|
|
284
275
|
declare type RepositoryOverviewTop = RenderableExtensionPointDefinition<"repository.overview.top", {
|
|
285
276
|
page: number;
|
|
286
|
-
search
|
|
277
|
+
search: string;
|
|
287
278
|
namespace?: string;
|
|
288
279
|
}>;
|
|
289
280
|
/**
|
|
@@ -623,7 +614,7 @@ declare type BaseActionBarOverflowMenuProps = {
|
|
|
623
614
|
category: string;
|
|
624
615
|
label: string;
|
|
625
616
|
icon: string;
|
|
626
|
-
props?:
|
|
617
|
+
props?: unknown;
|
|
627
618
|
};
|
|
628
619
|
declare type ActionMenuProps = BaseActionBarOverflowMenuProps & {
|
|
629
620
|
action: (props: ContentActionExtensionProps) => void;
|
package/build/index.js
CHANGED
|
@@ -37,7 +37,7 @@ module.exports = __toCommonJS(src_exports);
|
|
|
37
37
|
|
|
38
38
|
// src/binder.ts
|
|
39
39
|
function isBindOptions(input) {
|
|
40
|
-
return typeof input !== "
|
|
40
|
+
return typeof input !== "function" && typeof input === "object";
|
|
41
41
|
}
|
|
42
42
|
var Binder = class {
|
|
43
43
|
constructor(name) {
|
|
@@ -62,7 +62,7 @@ var Binder = class {
|
|
|
62
62
|
this.name = name;
|
|
63
63
|
this.extensionPoints = {};
|
|
64
64
|
}
|
|
65
|
-
bind(extensionPoint, extension, predicateOrOptions,
|
|
65
|
+
bind(extensionPoint, extension, predicateOrOptions, extensionName) {
|
|
66
66
|
let predicate = () => true;
|
|
67
67
|
let priority = 0;
|
|
68
68
|
if (isBindOptions(predicateOrOptions)) {
|
|
@@ -70,23 +70,13 @@ var Binder = class {
|
|
|
70
70
|
predicate = predicateOrOptions.predicate;
|
|
71
71
|
}
|
|
72
72
|
if (predicateOrOptions.extensionName) {
|
|
73
|
-
|
|
73
|
+
extensionName = predicateOrOptions.extensionName;
|
|
74
74
|
}
|
|
75
75
|
if (typeof predicateOrOptions.priority === "number") {
|
|
76
76
|
priority = predicateOrOptions.priority;
|
|
77
77
|
}
|
|
78
78
|
} else if (predicateOrOptions) {
|
|
79
79
|
predicate = predicateOrOptions;
|
|
80
|
-
if (isBindOptions(extensionNameOrOptions)) {
|
|
81
|
-
if (typeof extensionNameOrOptions.priority === "number") {
|
|
82
|
-
priority = extensionNameOrOptions.priority;
|
|
83
|
-
}
|
|
84
|
-
if (extensionNameOrOptions == null ? void 0 : extensionNameOrOptions.extensionName) {
|
|
85
|
-
extensionNameOrOptions = extensionNameOrOptions.extensionName;
|
|
86
|
-
} else {
|
|
87
|
-
extensionNameOrOptions = void 0;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
80
|
}
|
|
91
81
|
if (!this.extensionPoints[extensionPoint]) {
|
|
92
82
|
this.extensionPoints[extensionPoint] = [];
|
|
@@ -94,7 +84,7 @@ var Binder = class {
|
|
|
94
84
|
const registration = {
|
|
95
85
|
predicate,
|
|
96
86
|
extension,
|
|
97
|
-
extensionName:
|
|
87
|
+
extensionName: extensionName ? extensionName : "",
|
|
98
88
|
priority
|
|
99
89
|
};
|
|
100
90
|
this.extensionPoints[extensionPoint].push(registration);
|
|
@@ -108,7 +98,9 @@ var Binder = class {
|
|
|
108
98
|
}
|
|
109
99
|
getExtensions(extensionPoint, props) {
|
|
110
100
|
let registrations = this.extensionPoints[extensionPoint] || [];
|
|
111
|
-
|
|
101
|
+
if (props) {
|
|
102
|
+
registrations = registrations.filter((reg) => reg.predicate(props));
|
|
103
|
+
}
|
|
112
104
|
registrations.sort(this.sortExtensions);
|
|
113
105
|
return registrations.map((reg) => reg.extension);
|
|
114
106
|
}
|
package/build/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// src/binder.ts
|
|
2
2
|
function isBindOptions(input) {
|
|
3
|
-
return typeof input !== "
|
|
3
|
+
return typeof input !== "function" && typeof input === "object";
|
|
4
4
|
}
|
|
5
5
|
var Binder = class {
|
|
6
6
|
constructor(name) {
|
|
@@ -25,7 +25,7 @@ var Binder = class {
|
|
|
25
25
|
this.name = name;
|
|
26
26
|
this.extensionPoints = {};
|
|
27
27
|
}
|
|
28
|
-
bind(extensionPoint, extension, predicateOrOptions,
|
|
28
|
+
bind(extensionPoint, extension, predicateOrOptions, extensionName) {
|
|
29
29
|
let predicate = () => true;
|
|
30
30
|
let priority = 0;
|
|
31
31
|
if (isBindOptions(predicateOrOptions)) {
|
|
@@ -33,23 +33,13 @@ var Binder = class {
|
|
|
33
33
|
predicate = predicateOrOptions.predicate;
|
|
34
34
|
}
|
|
35
35
|
if (predicateOrOptions.extensionName) {
|
|
36
|
-
|
|
36
|
+
extensionName = predicateOrOptions.extensionName;
|
|
37
37
|
}
|
|
38
38
|
if (typeof predicateOrOptions.priority === "number") {
|
|
39
39
|
priority = predicateOrOptions.priority;
|
|
40
40
|
}
|
|
41
41
|
} else if (predicateOrOptions) {
|
|
42
42
|
predicate = predicateOrOptions;
|
|
43
|
-
if (isBindOptions(extensionNameOrOptions)) {
|
|
44
|
-
if (typeof extensionNameOrOptions.priority === "number") {
|
|
45
|
-
priority = extensionNameOrOptions.priority;
|
|
46
|
-
}
|
|
47
|
-
if (extensionNameOrOptions == null ? void 0 : extensionNameOrOptions.extensionName) {
|
|
48
|
-
extensionNameOrOptions = extensionNameOrOptions.extensionName;
|
|
49
|
-
} else {
|
|
50
|
-
extensionNameOrOptions = void 0;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
43
|
}
|
|
54
44
|
if (!this.extensionPoints[extensionPoint]) {
|
|
55
45
|
this.extensionPoints[extensionPoint] = [];
|
|
@@ -57,7 +47,7 @@ var Binder = class {
|
|
|
57
47
|
const registration = {
|
|
58
48
|
predicate,
|
|
59
49
|
extension,
|
|
60
|
-
extensionName:
|
|
50
|
+
extensionName: extensionName ? extensionName : "",
|
|
61
51
|
priority
|
|
62
52
|
};
|
|
63
53
|
this.extensionPoints[extensionPoint].push(registration);
|
|
@@ -71,7 +61,9 @@ var Binder = class {
|
|
|
71
61
|
}
|
|
72
62
|
getExtensions(extensionPoint, props) {
|
|
73
63
|
let registrations = this.extensionPoints[extensionPoint] || [];
|
|
74
|
-
|
|
64
|
+
if (props) {
|
|
65
|
+
registrations = registrations.filter((reg) => reg.predicate(props));
|
|
66
|
+
}
|
|
75
67
|
registrations.sort(this.sortExtensions);
|
|
76
68
|
return registrations.map((reg) => reg.extension);
|
|
77
69
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scm-manager/ui-extensions",
|
|
3
|
-
"version": "2.44.3
|
|
3
|
+
"version": "2.44.3",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"private": false,
|
|
6
6
|
"author": "Sebastian Sdorra <sebastian.sdorra@cloudogu.com>",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"test": "jest"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@scm-manager/ui-types": "2.44.3
|
|
20
|
+
"@scm-manager/ui-types": "2.44.3",
|
|
21
21
|
"react": "^17.0.1"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|