@dotglitch/ngx-common 1.0.37 → 1.0.39
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/components/menu/menu.component.d.ts +3 -1
- package/directives/menu.directive.d.ts +1 -1
- package/esm2020/components/menu/menu.component.mjs +31 -12
- package/esm2020/components/tooltip/tooltip.component.mjs +4 -3
- package/esm2020/directives/menu.directive.mjs +2 -1
- package/esm2020/directives/tooltip.directive.mjs +2 -1
- package/esm2020/services/theme.service.mjs +2 -3
- package/esm2020/types/menu.mjs +1 -1
- package/fesm2015/dotglitch-ngx-common.mjs +48 -27
- package/fesm2015/dotglitch-ngx-common.mjs.map +1 -1
- package/fesm2020/dotglitch-ngx-common.mjs +36 -15
- package/fesm2020/dotglitch-ngx-common.mjs.map +1 -1
- package/package.json +1 -1
- package/types/menu.d.ts +16 -11
package/package.json
CHANGED
package/types/menu.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export type MenuOptions = Partial<PopupOptions & {
|
|
|
7
7
|
*/
|
|
8
8
|
trigger: MenuTrigger | MenuTrigger[];
|
|
9
9
|
}>;
|
|
10
|
-
type BaseMenuItem<T = any> = {
|
|
10
|
+
type BaseMenuItem<T = any, Q = object | number | string | boolean | bigint | symbol | undefined> = {
|
|
11
11
|
/**
|
|
12
12
|
* Label for the menu-item
|
|
13
13
|
*/
|
|
@@ -16,13 +16,13 @@ type BaseMenuItem<T = any> = {
|
|
|
16
16
|
* Custom angular template to use for the label
|
|
17
17
|
* Alternatively accepts a lambda function
|
|
18
18
|
*/
|
|
19
|
-
labelTemplate?: TemplateRef<any> | ((data: T) => string);
|
|
19
|
+
labelTemplate?: TemplateRef<any> | ((data: T, context: Q) => string);
|
|
20
20
|
/**
|
|
21
21
|
* Callback method that is called when a user activates
|
|
22
22
|
* a context-menu item.
|
|
23
23
|
* Use the `contextMenuData` decorator for passing data.
|
|
24
24
|
*/
|
|
25
|
-
action?: (data: T) => any;
|
|
25
|
+
action?: (data: T, context: Q) => any;
|
|
26
26
|
/**
|
|
27
27
|
* Instead of an action, this item can be a hyperlink pointing to this URL
|
|
28
28
|
* www.example.com/foo/bar.zip
|
|
@@ -37,17 +37,17 @@ type BaseMenuItem<T = any> = {
|
|
|
37
37
|
* Custom template function for resolving a link when the context menu
|
|
38
38
|
* is opened
|
|
39
39
|
*/
|
|
40
|
-
linkTemplate?: ((data: T) => string);
|
|
40
|
+
linkTemplate?: ((data: T, context: Q) => string);
|
|
41
41
|
/**
|
|
42
42
|
* Callback method that is called upon a context menu activation
|
|
43
43
|
* that when it returns true, will show the item as disabled.
|
|
44
44
|
*/
|
|
45
|
-
isDisabled?: (data: T) => boolean;
|
|
45
|
+
isDisabled?: (data: T, context: Q) => boolean;
|
|
46
46
|
/**
|
|
47
47
|
* Callback method that is called upon a context menu activation
|
|
48
48
|
* that when returning false, will hide the menu item.
|
|
49
49
|
*/
|
|
50
|
-
isVisible?: (data: T) => boolean;
|
|
50
|
+
isVisible?: (data: T, context: Q) => boolean;
|
|
51
51
|
/**
|
|
52
52
|
* If a shortcut is set, the text-label.
|
|
53
53
|
*/
|
|
@@ -68,27 +68,32 @@ type BaseMenuItem<T = any> = {
|
|
|
68
68
|
/**
|
|
69
69
|
* Optional child menu
|
|
70
70
|
*/
|
|
71
|
-
children?: MenuItem<T>[];
|
|
71
|
+
children?: MenuItem<T>[] | ((data: T, context: Q) => MenuItem<T>[]) | ((data: T, context: Q) => Promise<MenuItem<T>[]>);
|
|
72
72
|
/**
|
|
73
73
|
* Optional resolver that dynamically loads the contents
|
|
74
74
|
* for the menu item.
|
|
75
75
|
* Can be used to dynamically determine the submenu contents
|
|
76
76
|
*/
|
|
77
|
-
childrenResolver?: (data: T) => Promise<MenuItem<T>[]>;
|
|
77
|
+
childrenResolver?: (data: T, context: Q) => Promise<MenuItem<T>[]>;
|
|
78
78
|
/**
|
|
79
|
-
* If `
|
|
79
|
+
* If `children` is a method or `childrenResolver` is provided
|
|
80
|
+
* disable caching of
|
|
80
81
|
* the resolved children.
|
|
81
82
|
*/
|
|
82
83
|
cacheResolvedChildren?: boolean;
|
|
83
84
|
/**
|
|
84
85
|
* Instead of an array of children, render a template
|
|
85
86
|
*/
|
|
86
|
-
childTemplate?: TemplateRef<
|
|
87
|
+
childTemplate?: TemplateRef<any> | Type<any>;
|
|
88
|
+
/**
|
|
89
|
+
* Optional `context` that can be passed from the menu
|
|
90
|
+
*/
|
|
91
|
+
context?: ((data: T) => Promise<Q>) | ((data: T) => Q) | Q;
|
|
87
92
|
/**
|
|
88
93
|
* This item is a separator.
|
|
89
94
|
* Can be used with label to make a label separator.
|
|
90
95
|
*/
|
|
91
96
|
separator?: boolean;
|
|
92
97
|
};
|
|
93
|
-
export type MenuItem<T = any> = BaseMenuItem<T> | "separator";
|
|
98
|
+
export type MenuItem<T = any, Q = any> = BaseMenuItem<T, Q> | "separator";
|
|
94
99
|
export {};
|