@nu-art/work-hub-frontend 0.401.8 → 0.401.9
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/_module/ModuleFE_WorkHub/ModuleFE_WorkHub.d.ts +3 -0
- package/_module/ModuleFE_WorkHub/ModuleFE_WorkHub.js +10 -1
- package/_ui/Component_WorkHubActionMenu/Component_WorkHubActionMenu.d.ts +2 -1
- package/_ui/Component_WorkHubActionMenu/Component_WorkHubActionMenu.js +14 -2
- package/_ui/Component_WorkHubActionMenu/types.d.ts +3 -1
- package/package.json +8 -6
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { Module } from '@nu-art/ts-common';
|
|
2
|
+
import { PermissionKeys_WorkHubUI } from '@nu-art/work-hub-shared';
|
|
2
3
|
import { ModuleFE_WorkHub_GroupActions, ModuleFE_WorkHub_TabActions } from './types.js';
|
|
3
4
|
import { WorkHubItem } from '../../_core/work-hub-item.js';
|
|
5
|
+
import { ModuleFE_PermissionMapper } from '@nu-art/permissions-frontend';
|
|
4
6
|
declare class ModuleFE_WorkHub_Class extends Module {
|
|
7
|
+
readonly permissions: ModuleFE_PermissionMapper<typeof PermissionKeys_WorkHubUI>;
|
|
5
8
|
constructor();
|
|
6
9
|
private readonly _tabs;
|
|
7
10
|
private readonly _tabStack;
|
|
@@ -1,14 +1,23 @@
|
|
|
1
1
|
import { BadImplementationException, filterInstances, lastElement, mergeObject, Module, removeFromArrayByIndex, removeItemFromArray } from '@nu-art/ts-common';
|
|
2
|
-
import { isWorkHubTab, isWorkHubTabGroup } from '@nu-art/work-hub-shared';
|
|
2
|
+
import { isWorkHubTab, isWorkHubTabGroup, PermissionKeys_WorkHubUI } from '@nu-art/work-hub-shared';
|
|
3
3
|
import { dispatch_OnWorkHubTabSelected, dispatch_OnWorkHubTabsUpdated } from '../../dispatchers.js';
|
|
4
4
|
import { StorageKey } from '@nu-art/thunderstorm-frontend';
|
|
5
5
|
import { workHubTabGroupColors } from '../../_ui/Component_WorkHub_Header/renderers/Component_WorkHub_TabGroup/consts.js';
|
|
6
|
+
import { PermissionKey_FE } from '@nu-art/permissions-frontend';
|
|
6
7
|
class ModuleFE_WorkHub_Class extends Module {
|
|
8
|
+
permissions;
|
|
7
9
|
constructor() {
|
|
8
10
|
super();
|
|
9
11
|
this._tabs = this.storage_tabs.get([]);
|
|
10
12
|
this._tabStack = this.storage_tabStack.get([]);
|
|
11
13
|
this._workHubItemMap = {};
|
|
14
|
+
this.permissions = PermissionKey_FE.generatePermissionKeysByLevels(PermissionKeys_WorkHubUI);
|
|
15
|
+
if (this._tabs.length && !this._tabStack.length) {
|
|
16
|
+
let firstTab = this._tabs[0];
|
|
17
|
+
if (isWorkHubTabGroup(firstTab))
|
|
18
|
+
firstTab = firstTab.tabs[0];
|
|
19
|
+
this._tabStack.push(firstTab.id);
|
|
20
|
+
}
|
|
12
21
|
}
|
|
13
22
|
//######################### Class Properties #########################
|
|
14
23
|
_tabs;
|
|
@@ -11,7 +11,8 @@ export declare class Component_WorkHubActionMenu extends ComponentSync<Props> {
|
|
|
11
11
|
private generateGeneralSection;
|
|
12
12
|
private getSections;
|
|
13
13
|
private closeMenu;
|
|
14
|
-
|
|
14
|
+
private hasVisibleActions;
|
|
15
|
+
render(): (import("react/jsx-runtime").JSX.Element | undefined)[];
|
|
15
16
|
private render_Section;
|
|
16
17
|
private render_Action;
|
|
17
18
|
private render_ActionButton;
|
|
@@ -4,7 +4,7 @@ import { _className, Button, ComponentSync, LL_H_C, LL_V_L, ModuleFE_MouseIntera
|
|
|
4
4
|
import { ModuleFE_WorkHub } from '../../_module/index.js';
|
|
5
5
|
import './Component_WorkHubActionMenu.scss';
|
|
6
6
|
import { TS_Icons } from '@nu-art/ts-styles';
|
|
7
|
-
import { generateHex } from '@nu-art/ts-common';
|
|
7
|
+
import { exists, generateHex, resolveContent } from '@nu-art/ts-common';
|
|
8
8
|
import { isWorkHubTabGroup } from '@nu-art/work-hub-shared';
|
|
9
9
|
export class Component_WorkHubActionMenu extends ComponentSync {
|
|
10
10
|
// ######################## Static ########################
|
|
@@ -54,21 +54,33 @@ export class Component_WorkHubActionMenu extends ComponentSync {
|
|
|
54
54
|
closeMenu = () => {
|
|
55
55
|
ModuleFE_MouseInteractivity.hide(mouseInteractivity_PopUp);
|
|
56
56
|
};
|
|
57
|
+
hasVisibleActions = (item) => {
|
|
58
|
+
if ('actions' in item)
|
|
59
|
+
return item.actions.some(this.hasVisibleActions);
|
|
60
|
+
if (exists(item.visible))
|
|
61
|
+
return item.visible;
|
|
62
|
+
return item.innerActions?.length ? item.innerActions.some(this.hasVisibleActions) : true;
|
|
63
|
+
};
|
|
57
64
|
// ######################## Render ########################
|
|
58
65
|
render() {
|
|
59
66
|
const sections = this.getSections();
|
|
60
67
|
return sections.map(this.render_Section);
|
|
61
68
|
}
|
|
62
69
|
render_Section = (section, index) => {
|
|
70
|
+
if (!this.hasVisibleActions(section))
|
|
71
|
+
return;
|
|
63
72
|
return _jsxs(LL_V_L, { className: 'action-menu__section', children: [!!section.label?.length && _jsx("div", { className: 'action-menu__section-label', children: section.label }), section.actions.map(this.render_Action)] }, index);
|
|
64
73
|
};
|
|
65
74
|
render_Action = (action, index) => {
|
|
75
|
+
if (!this.hasVisibleActions(action))
|
|
76
|
+
return;
|
|
66
77
|
if (action.action)
|
|
67
78
|
return this.render_ActionButton(action, index);
|
|
68
79
|
return this.render_ActionWithInner(action, index);
|
|
69
80
|
};
|
|
70
81
|
render_ActionButton = (action, index) => {
|
|
71
|
-
|
|
82
|
+
const disabled = resolveContent(action.disabled);
|
|
83
|
+
return _jsxs(Fragment, { children: [_jsx(Button, { variant: 'work-hub-menu-action', disabled: disabled, onClick: async () => {
|
|
72
84
|
await action.action();
|
|
73
85
|
this.closeMenu();
|
|
74
86
|
}, children: action.label }), action.separatorAfter && _jsx("div", { className: 'action-menu__separator' })] }, index);
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { ResolvableContent } from "@nu-art/ts-common";
|
|
1
2
|
export type WorkHubItem_MenuAction = {
|
|
2
3
|
label: string;
|
|
3
4
|
action?: () => (Promise<void> | void);
|
|
4
|
-
|
|
5
|
+
visible?: ResolvableContent<boolean>;
|
|
6
|
+
disabled?: ResolvableContent<boolean>;
|
|
5
7
|
separatorAfter?: boolean;
|
|
6
8
|
innerActions?: WorkHubItem_MenuAction[];
|
|
7
9
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nu-art/work-hub-frontend",
|
|
3
|
-
"version": "0.401.
|
|
3
|
+
"version": "0.401.9",
|
|
4
4
|
"description": "TS WorkHub Frontend",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"TacB0sS",
|
|
@@ -21,11 +21,13 @@
|
|
|
21
21
|
"linkDirectory": true
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@nu-art/work-hub-shared": "0.401.
|
|
25
|
-
"@nu-art/ts-common": "0.401.
|
|
26
|
-
"@nu-art/ts-styles": "0.401.
|
|
27
|
-
"@nu-art/thunderstorm-shared": "0.401.
|
|
28
|
-
"@nu-art/thunderstorm-frontend": "0.401.
|
|
24
|
+
"@nu-art/work-hub-shared": "0.401.9",
|
|
25
|
+
"@nu-art/ts-common": "0.401.9",
|
|
26
|
+
"@nu-art/ts-styles": "0.401.9",
|
|
27
|
+
"@nu-art/thunderstorm-shared": "0.401.9",
|
|
28
|
+
"@nu-art/thunderstorm-frontend": "0.401.9",
|
|
29
|
+
"@nu-art/permissions-frontend": "0.401.9",
|
|
30
|
+
"@nu-art/permissions-shared": "0.401.9",
|
|
29
31
|
"react": "^18.0.0"
|
|
30
32
|
},
|
|
31
33
|
"devDependencies": {
|