@nu-art/work-hub-frontend 0.400.8 → 0.400.14
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/_core/work-hub-item.d.ts +7 -4
- package/_core/work-hub-item.js +2 -2
- package/_module/ModuleFE_WorkHub/ModuleFE_WorkHub.d.ts +2 -0
- package/_module/ModuleFE_WorkHub/ModuleFE_WorkHub.js +5 -2
- package/_ui/Component_WorkHub_TabContent/Component_WorkHub_TabContent.js +3 -3
- package/package.json +10 -6
package/_core/work-hub-item.d.ts
CHANGED
|
@@ -3,19 +3,22 @@ import { MouseEvent, ReactNode } from 'react';
|
|
|
3
3
|
import { ModuleFE_BaseDB } from '@nu-art/thunderstorm-frontend';
|
|
4
4
|
import { WorkHubTab } from '@nu-art/work-hub-shared';
|
|
5
5
|
import { WorkHubItem_MenuSection } from '../_ui/Component_WorkHubActionMenu/types.js';
|
|
6
|
+
type MenuResolver = (tab: WorkHubTab) => (Promise<WorkHubItem_MenuSection[]> | WorkHubItem_MenuSection[]);
|
|
7
|
+
type WorkHubItemRenderer<Args extends any = void> = (workHubItem: WorkHubItem<Args>, tabId: string, args: Args) => ReactNode;
|
|
6
8
|
export declare class WorkHubItem<Args extends any = void> extends Logger {
|
|
7
9
|
readonly key: string;
|
|
8
10
|
modulesToAwait: ModuleFE_BaseDB<any>[] | undefined;
|
|
9
|
-
renderer:
|
|
11
|
+
renderer: WorkHubItemRenderer<Args>;
|
|
10
12
|
private tabTag;
|
|
11
13
|
private customMenuActionsResolver;
|
|
12
14
|
constructor(key: string);
|
|
13
|
-
setRenderer: (renderer:
|
|
15
|
+
setRenderer: (renderer: WorkHubItemRenderer<Args>) => this;
|
|
14
16
|
setTag: (tag: string) => this;
|
|
15
17
|
setModulesToAwait: (modules: ModuleFE_BaseDB<any>[]) => this;
|
|
16
|
-
setCustomMenuActionsResolver: (resolver:
|
|
18
|
+
setCustomMenuActionsResolver: (resolver: MenuResolver) => this;
|
|
17
19
|
openTab: (id: string, label: string, args: Args) => void;
|
|
18
20
|
closeTab: (tabId: string) => void;
|
|
19
|
-
openTabMenu: (e: MouseEvent<HTMLDivElement>, tab: WorkHubTab) => void
|
|
21
|
+
openTabMenu: (e: MouseEvent<HTMLDivElement>, tab: WorkHubTab) => Promise<void>;
|
|
20
22
|
updateArgs: (tabId: string, args: Partial<Args>) => void;
|
|
21
23
|
}
|
|
24
|
+
export {};
|
package/_core/work-hub-item.js
CHANGED
|
@@ -44,8 +44,8 @@ export class WorkHubItem extends Logger {
|
|
|
44
44
|
closeTab = (tabId) => {
|
|
45
45
|
ModuleFE_WorkHub.tabs.remove(tabId);
|
|
46
46
|
};
|
|
47
|
-
openTabMenu = (e, tab) => {
|
|
48
|
-
const customSections = this.customMenuActionsResolver(tab);
|
|
47
|
+
openTabMenu = async (e, tab) => {
|
|
48
|
+
const customSections = await this.customMenuActionsResolver(tab);
|
|
49
49
|
Component_WorkHubActionMenu.show(e, {
|
|
50
50
|
tabId: tab.id,
|
|
51
51
|
customSections
|
|
@@ -8,12 +8,14 @@ declare class ModuleFE_WorkHub_Class extends Module {
|
|
|
8
8
|
private readonly _workHubItemMap;
|
|
9
9
|
private readonly storage_tabs;
|
|
10
10
|
private readonly storage_tabStack;
|
|
11
|
+
private postTabAdditionCallback;
|
|
11
12
|
private tabStack;
|
|
12
13
|
tabs: ModuleFE_WorkHub_TabActions;
|
|
13
14
|
workHubItem: {
|
|
14
15
|
register: (item: WorkHubItem<any>) => void;
|
|
15
16
|
getByKey: (key: string) => WorkHubItem<any>;
|
|
16
17
|
};
|
|
18
|
+
setPostTabAdditionCallback: (callback: VoidFunction) => VoidFunction;
|
|
17
19
|
}
|
|
18
20
|
export declare const ModuleFE_WorkHub: ModuleFE_WorkHub_Class;
|
|
19
21
|
export {};
|
|
@@ -14,16 +14,17 @@ class ModuleFE_WorkHub_Class extends Module {
|
|
|
14
14
|
_workHubItemMap;
|
|
15
15
|
storage_tabs = new StorageKey('work-hub__tabs');
|
|
16
16
|
storage_tabStack = new StorageKey('work-hub__tab-stack');
|
|
17
|
+
postTabAdditionCallback = undefined;
|
|
17
18
|
//######################### Internal Methods #########################
|
|
18
19
|
tabStack = {
|
|
19
20
|
push: (tabId) => {
|
|
20
21
|
this.tabStack.pop(tabId);
|
|
21
22
|
this._tabStack.push(tabId);
|
|
22
|
-
this.storage_tabStack.set(this._tabStack);
|
|
23
|
+
this.storage_tabStack.set([...this._tabStack]);
|
|
23
24
|
},
|
|
24
25
|
pop: (tabId) => {
|
|
25
26
|
removeItemFromArray(this._tabStack, tabId);
|
|
26
|
-
this.storage_tabStack.set(this._tabStack);
|
|
27
|
+
this.storage_tabStack.set([...this._tabStack]);
|
|
27
28
|
},
|
|
28
29
|
};
|
|
29
30
|
//######################### Public Methods #########################
|
|
@@ -45,6 +46,7 @@ class ModuleFE_WorkHub_Class extends Module {
|
|
|
45
46
|
if (setAsSelected)
|
|
46
47
|
this.tabStack.push(tab.id);
|
|
47
48
|
dispatch_OnWorkHubTabsUpdated.dispatchUI();
|
|
49
|
+
this.postTabAdditionCallback?.();
|
|
48
50
|
}
|
|
49
51
|
},
|
|
50
52
|
remove: (tabId) => {
|
|
@@ -81,5 +83,6 @@ class ModuleFE_WorkHub_Class extends Module {
|
|
|
81
83
|
return this._workHubItemMap[key];
|
|
82
84
|
}
|
|
83
85
|
};
|
|
86
|
+
setPostTabAdditionCallback = (callback) => this.postTabAdditionCallback = callback;
|
|
84
87
|
}
|
|
85
88
|
export const ModuleFE_WorkHub = new ModuleFE_WorkHub_Class();
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { createRef, useEffect } from 'react';
|
|
3
3
|
import { ModuleFE_WorkHub } from '../../_module/index.js';
|
|
4
4
|
import './Component_WorkHub_TabContent.scss';
|
|
5
|
-
import { AwaitModules } from '@nu-art/thunderstorm-frontend';
|
|
5
|
+
import { AwaitModules, TS_ErrorBoundary } from '@nu-art/thunderstorm-frontend';
|
|
6
6
|
export const Component_WorkHub_TabContent = (props) => {
|
|
7
7
|
const item = ModuleFE_WorkHub.workHubItem.getByKey(props.tab.itemKey);
|
|
8
8
|
const ref = createRef();
|
|
@@ -10,6 +10,6 @@ export const Component_WorkHub_TabContent = (props) => {
|
|
|
10
10
|
ref.current?.focus();
|
|
11
11
|
});
|
|
12
12
|
if (item.modulesToAwait?.length)
|
|
13
|
-
return _jsx("div", { className: 'c__work-hub-tab-content', ref: ref, tabIndex: 0, children: _jsx(AwaitModules, { modules: item.modulesToAwait, children: item.renderer(item, props.tab.renderArgs) }) });
|
|
14
|
-
return _jsx("div", { className: 'c__work-hub-tab-content', ref: ref, tabIndex: 0, children: item.renderer(item, props.tab.renderArgs) });
|
|
13
|
+
return _jsx("div", { className: 'c__work-hub-tab-content', ref: ref, tabIndex: 0, children: _jsx(AwaitModules, { modules: item.modulesToAwait, children: _jsx(TS_ErrorBoundary, { children: item.renderer(item, props.tab.id, props.tab.renderArgs) }) }) });
|
|
14
|
+
return _jsx("div", { className: 'c__work-hub-tab-content', ref: ref, tabIndex: 0, children: _jsx(TS_ErrorBoundary, { children: item.renderer(item, props.tab.id, props.tab.renderArgs) }) });
|
|
15
15
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nu-art/work-hub-frontend",
|
|
3
|
-
"version": "0.400.
|
|
3
|
+
"version": "0.400.14",
|
|
4
4
|
"description": "TS WorkHub Frontend",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"TacB0sS",
|
|
@@ -21,11 +21,11 @@
|
|
|
21
21
|
"linkDirectory": true
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@nu-art/work-hub-shared": "0.400.
|
|
25
|
-
"@nu-art/ts-common": "0.400.
|
|
26
|
-
"@nu-art/ts-styles": "0.400.
|
|
27
|
-
"@nu-art/thunderstorm-shared": "0.400.
|
|
28
|
-
"@nu-art/thunderstorm-frontend": "0.400.
|
|
24
|
+
"@nu-art/work-hub-shared": "0.400.14",
|
|
25
|
+
"@nu-art/ts-common": "0.400.14",
|
|
26
|
+
"@nu-art/ts-styles": "0.400.14",
|
|
27
|
+
"@nu-art/thunderstorm-shared": "0.400.14",
|
|
28
|
+
"@nu-art/thunderstorm-frontend": "0.400.14",
|
|
29
29
|
"react": "^18.0.0"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
@@ -43,6 +43,10 @@
|
|
|
43
43
|
"./ui": {
|
|
44
44
|
"types": "./_ui/index.d.ts",
|
|
45
45
|
"import": "./_ui/index.js"
|
|
46
|
+
},
|
|
47
|
+
"./modules": {
|
|
48
|
+
"types": "./_module/ModuleFE_WorkHub/ModuleFE_WorkHub.d.ts",
|
|
49
|
+
"import": "./_module/ModuleFE_WorkHub/ModuleFE_WorkHub.js"
|
|
46
50
|
}
|
|
47
51
|
}
|
|
48
52
|
}
|