@zextras/carbonio-shell-ui 8.0.3-devel.1727780601712 → 8.0.3-devel.1727958799084
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/lib/boot/app/app-direct-exports.d.ts +5 -4
- package/lib/boot/app/app-direct-exports.js +2 -6
- package/lib/boot/app/app-direct-exports.js.map +1 -1
- package/lib/shell/creation-button.d.ts +18 -0
- package/lib/shell/creation-button.js +83 -0
- package/lib/shell/creation-button.js.map +1 -0
- package/lib/store/integrations/getters.d.ts +2 -4
- package/lib/store/integrations/getters.js +3 -13
- package/lib/store/integrations/getters.js.map +1 -1
- package/lib/store/integrations/hooks.d.ts +2 -4
- package/lib/store/integrations/hooks.js +3 -13
- package/lib/store/integrations/hooks.js.map +1 -1
- package/lib/store/integrations/store.d.ts +4 -5
- package/lib/store/integrations/store.js.map +1 -1
- package/lib/store/integrations/utils.d.ts +1 -1
- package/lib/store/integrations/utils.js +3 -3
- package/lib/store/integrations/utils.js.map +1 -1
- package/lib/types/integrations/index.d.ts +6 -8
- package/package.json +1 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
export { useAction, useActions,
|
|
2
|
-
export { getAction, getActions,
|
|
1
|
+
export { useAction, useActions, useIntegratedComponent, useIntegratedFunction } from '../../store/integrations/hooks';
|
|
2
|
+
export { getAction, getActions, getIntegratedComponent, getIntegratedFunction } from '../../store/integrations/getters';
|
|
3
3
|
export declare const registerFunctions: (...items: {
|
|
4
4
|
id: string;
|
|
5
5
|
fn: import("../../utils/typeUtils").AnyFunction;
|
|
6
|
-
}[]) => void, removeFunctions: (...ids: string[]) => void, registerActions: (...items: {
|
|
6
|
+
}[]) => void, removeFunctions: (...ids: string[]) => void, registerActions: <TAction extends import("../../lib").Action = import("../../lib").Action>(...items: {
|
|
7
7
|
id: string;
|
|
8
|
-
action:
|
|
8
|
+
action: import("../../types/integrations").ActionFactory<unknown, TAction>;
|
|
9
9
|
type: string;
|
|
10
10
|
}[]) => void, removeActions: (...ids: string[]) => void, removeComponents: (...ids: string[]) => void;
|
|
11
11
|
export { getUserAccount, getUserAccounts, getUserSetting, getUserSettings, useUserAccount, useUserAccounts, useUserSetting, useUserSettings, useUserRight, useUserRights, getUserRight, getUserRights, useAuthenticated, updateSettings, updateAccount } from '../../store/account';
|
|
@@ -21,3 +21,4 @@ export { useLocalStorage } from '../../shell/hooks/useLocalStorage';
|
|
|
21
21
|
export declare const updatePrimaryBadge: (badge: Partial<import("../../lib").BadgeInfo>, id: string) => void, setRouteVisibility: (id: string, visible: boolean) => void, removeRoute: (id: string) => void, removeBoardView: (id: string) => void, removeSettingsView: (id: string) => void, removeSearchView: (id: string) => void, removeUtilityView: (id: string) => void, removePrimaryAccessoryView: (id: string) => void, removeSecondaryAccessoryView: (id: string) => void;
|
|
22
22
|
export { useIsCarbonioCE } from '../../store/login/hooks';
|
|
23
23
|
export { useTracker } from '../posthog';
|
|
24
|
+
export type { NewAction } from '../../shell/creation-button';
|
|
@@ -6,22 +6,18 @@
|
|
|
6
6
|
*/
|
|
7
7
|
var _a, _b;
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.useSearchFolders = exports.useSearchFolder = exports.getRoots = exports.useRoots = exports.getRoot = exports.useRoot = exports.useFolders = exports.useFolder = exports.getFolders = exports.getFolder = exports.useRefresh = exports.useNotify = exports.renameTag = exports.deleteTag = exports.createTag = exports.changeTagColor = exports.useTags = exports.getTags = exports.updateAccount = exports.updateSettings = exports.useAuthenticated = exports.getUserRights = exports.getUserRight = exports.useUserRights = exports.useUserRight = exports.useUserSettings = exports.useUserSetting = exports.useUserAccounts = exports.useUserAccount = exports.getUserSettings = exports.getUserSetting = exports.getUserAccounts = exports.getUserAccount = exports.removeComponents = exports.removeActions = exports.registerActions = exports.removeFunctions = exports.registerFunctions = exports.getIntegratedFunction = exports.getIntegratedComponent = exports.
|
|
10
|
-
exports.useTracker = exports.useIsCarbonioCE = exports.removeSecondaryAccessoryView = exports.removePrimaryAccessoryView = exports.removeUtilityView = exports.removeSearchView = exports.removeSettingsView = exports.removeBoardView = exports.removeRoute = exports.setRouteVisibility = exports.updatePrimaryBadge = exports.useLocalStorage = exports.runSearch = exports.getNotificationManager = exports.pushHistory = exports.goBackHistory = exports.replaceHistory = exports.useCurrentRoute = exports.getCurrentRoute = exports.useReplaceHistoryCallback = exports.useGoBackHistoryCallback = exports.usePushHistoryCallback = exports.useBoardHooks = exports.setCurrentBoard = exports.reopenBoards = exports.minimizeBoards = exports.useBoard = exports.useBoardById = exports.useBoardContextById = exports.getBoardContextById = exports.getBoardById = exports.updateBoardContext = exports.updateBoard = exports.closeBoard = exports.getRootByUser = exports.useRootByUser =
|
|
9
|
+
exports.useFoldersAccordionByView = exports.useFoldersByView = exports.getSearchFolders = exports.getSearchFolder = exports.useSearchFolders = exports.useSearchFolder = exports.getRoots = exports.useRoots = exports.getRoot = exports.useRoot = exports.useFolders = exports.useFolder = exports.getFolders = exports.getFolder = exports.useRefresh = exports.useNotify = exports.renameTag = exports.deleteTag = exports.createTag = exports.changeTagColor = exports.useTags = exports.getTags = exports.updateAccount = exports.updateSettings = exports.useAuthenticated = exports.getUserRights = exports.getUserRight = exports.useUserRights = exports.useUserRight = exports.useUserSettings = exports.useUserSetting = exports.useUserAccounts = exports.useUserAccount = exports.getUserSettings = exports.getUserSetting = exports.getUserAccounts = exports.getUserAccount = exports.removeComponents = exports.removeActions = exports.registerActions = exports.removeFunctions = exports.registerFunctions = exports.getIntegratedFunction = exports.getIntegratedComponent = exports.getActions = exports.getAction = exports.useIntegratedFunction = exports.useIntegratedComponent = exports.useActions = exports.useAction = void 0;
|
|
10
|
+
exports.useTracker = exports.useIsCarbonioCE = exports.removeSecondaryAccessoryView = exports.removePrimaryAccessoryView = exports.removeUtilityView = exports.removeSearchView = exports.removeSettingsView = exports.removeBoardView = exports.removeRoute = exports.setRouteVisibility = exports.updatePrimaryBadge = exports.useLocalStorage = exports.runSearch = exports.getNotificationManager = exports.pushHistory = exports.goBackHistory = exports.replaceHistory = exports.useCurrentRoute = exports.getCurrentRoute = exports.useReplaceHistoryCallback = exports.useGoBackHistoryCallback = exports.usePushHistoryCallback = exports.useBoardHooks = exports.setCurrentBoard = exports.reopenBoards = exports.minimizeBoards = exports.useBoard = exports.useBoardById = exports.useBoardContextById = exports.getBoardContextById = exports.getBoardById = exports.updateBoardContext = exports.updateBoard = exports.closeBoard = exports.getRootByUser = exports.useRootByUser = void 0;
|
|
11
11
|
const app_1 = require("../../store/app");
|
|
12
12
|
const store_1 = require("../../store/integrations/store");
|
|
13
13
|
var hooks_1 = require("../../store/integrations/hooks");
|
|
14
14
|
Object.defineProperty(exports, "useAction", { enumerable: true, get: function () { return hooks_1.useAction; } });
|
|
15
15
|
Object.defineProperty(exports, "useActions", { enumerable: true, get: function () { return hooks_1.useActions; } });
|
|
16
|
-
Object.defineProperty(exports, "useActionsFactory", { enumerable: true, get: function () { return hooks_1.useActionsFactory; } });
|
|
17
|
-
Object.defineProperty(exports, "useActionFactory", { enumerable: true, get: function () { return hooks_1.useActionFactory; } });
|
|
18
16
|
Object.defineProperty(exports, "useIntegratedComponent", { enumerable: true, get: function () { return hooks_1.useIntegratedComponent; } });
|
|
19
17
|
Object.defineProperty(exports, "useIntegratedFunction", { enumerable: true, get: function () { return hooks_1.useIntegratedFunction; } });
|
|
20
18
|
var getters_1 = require("../../store/integrations/getters");
|
|
21
19
|
Object.defineProperty(exports, "getAction", { enumerable: true, get: function () { return getters_1.getAction; } });
|
|
22
20
|
Object.defineProperty(exports, "getActions", { enumerable: true, get: function () { return getters_1.getActions; } });
|
|
23
|
-
Object.defineProperty(exports, "getActionsFactory", { enumerable: true, get: function () { return getters_1.getActionsFactory; } });
|
|
24
|
-
Object.defineProperty(exports, "getActionFactory", { enumerable: true, get: function () { return getters_1.getActionFactory; } });
|
|
25
21
|
Object.defineProperty(exports, "getIntegratedComponent", { enumerable: true, get: function () { return getters_1.getIntegratedComponent; } });
|
|
26
22
|
Object.defineProperty(exports, "getIntegratedFunction", { enumerable: true, get: function () { return getters_1.getIntegratedFunction; } });
|
|
27
23
|
_a = store_1.useIntegrationsStore.getState(), exports.registerFunctions = _a.registerFunctions, exports.removeFunctions = _a.removeFunctions, exports.registerActions = _a.registerActions, exports.removeActions = _a.removeActions, exports.removeComponents = _a.removeComponents;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-direct-exports.js","sourceRoot":"","sources":["../../../src/boot/app/app-direct-exports.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;AAEH,yCAA8C;AAC9C,0DAAsE;AAEtE,
|
|
1
|
+
{"version":3,"file":"app-direct-exports.js","sourceRoot":"","sources":["../../../src/boot/app/app-direct-exports.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;AAEH,yCAA8C;AAC9C,0DAAsE;AAEtE,wDAKwC;AAJvC,kGAAA,SAAS,OAAA;AACT,mGAAA,UAAU,OAAA;AACV,+GAAA,sBAAsB,OAAA;AACtB,8GAAA,qBAAqB,OAAA;AAGtB,4DAK0C;AAJzC,oGAAA,SAAS,OAAA;AACT,qGAAA,UAAU,OAAA;AACV,iHAAA,sBAAsB,OAAA;AACtB,gHAAA,qBAAqB,OAAA;AAGT,KAMT,4BAAoB,CAAC,QAAQ,EAAE,EALlC,yBAAiB,yBACjB,uBAAe,uBACf,uBAAe,uBACf,qBAAa,qBACb,wBAAgB,uBACmB;AAEpC,+CAgB6B;AAf5B,yGAAA,cAAc,OAAA;AACd,0GAAA,eAAe,OAAA;AACf,yGAAA,cAAc,OAAA;AACd,0GAAA,eAAe,OAAA;AACf,yGAAA,cAAc,OAAA;AACd,0GAAA,eAAe,OAAA;AACf,yGAAA,cAAc,OAAA;AACd,0GAAA,eAAe,OAAA;AACf,uGAAA,YAAY,OAAA;AACZ,wGAAA,aAAa,OAAA;AACb,uGAAA,YAAY,OAAA;AACZ,wGAAA,aAAa,OAAA;AACb,2GAAA,gBAAgB,OAAA;AA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AAA;AACb,oGAAA,WAAW,OAAA;AAGZ,8EAAgF;AAAvE,6HAAA,sBAAsB,OAAA;AAE/B,sDAAoD;AAA3C,uGAAA,SAAS,OAAA;AAElB,qEAAoE;AAA3D,kHAAA,eAAe,OAAA;AAEX,KAUT,iBAAW,CAAC,QAAQ,EAAE,EATzB,0BAAkB,0BAClB,0BAAkB,0BAClB,mBAAW,mBACX,uBAAe,uBACf,0BAAkB,0BAClB,wBAAgB,wBAChB,yBAAiB,yBACjB,kCAA0B,kCAC1B,oCAA4B,mCACF;AAE3B,iDAA0D;AAAjD,wGAAA,eAAe,OAAA;AAExB,sCAAwC;AAA/B,qGAAA,UAAU,OAAA"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { FC } from 'react';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { type DropdownItem } from '@zextras/carbonio-design-system';
|
|
4
|
+
import type { Location } from 'history';
|
|
5
|
+
import type { AppRoute } from '../types/apps';
|
|
6
|
+
import type { Action } from '../types/integrations';
|
|
7
|
+
export interface NewAction extends Action, Omit<DropdownItem, 'label' | 'onClick'> {
|
|
8
|
+
execute: NonNullable<DropdownItem['onClick']>;
|
|
9
|
+
group?: string;
|
|
10
|
+
primary?: boolean;
|
|
11
|
+
}
|
|
12
|
+
interface CreationButtonProps {
|
|
13
|
+
activeRoute: AppRoute;
|
|
14
|
+
location: Location;
|
|
15
|
+
}
|
|
16
|
+
export declare const CreationButtonComponent: ({ activeRoute, location }: CreationButtonProps) => React.JSX.Element;
|
|
17
|
+
export declare const CreationButton: FC;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* SPDX-FileCopyrightText: 2022 Zextras <https://www.zextras.com>
|
|
4
|
+
*
|
|
5
|
+
* SPDX-License-Identifier: AGPL-3.0-only
|
|
6
|
+
*/
|
|
7
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
8
|
+
if (k2 === undefined) k2 = k;
|
|
9
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
10
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
11
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
12
|
+
}
|
|
13
|
+
Object.defineProperty(o, k2, desc);
|
|
14
|
+
}) : (function(o, m, k, k2) {
|
|
15
|
+
if (k2 === undefined) k2 = k;
|
|
16
|
+
o[k2] = m[k];
|
|
17
|
+
}));
|
|
18
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
19
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
20
|
+
}) : function(o, v) {
|
|
21
|
+
o["default"] = v;
|
|
22
|
+
});
|
|
23
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
24
|
+
if (mod && mod.__esModule) return mod;
|
|
25
|
+
var result = {};
|
|
26
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
27
|
+
__setModuleDefault(result, mod);
|
|
28
|
+
return result;
|
|
29
|
+
};
|
|
30
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
31
|
+
exports.CreationButton = exports.CreationButtonComponent = void 0;
|
|
32
|
+
const react_1 = __importStar(require("react"));
|
|
33
|
+
const carbonio_design_system_1 = require("@zextras/carbonio-design-system");
|
|
34
|
+
const lodash_1 = require("lodash");
|
|
35
|
+
const react_router_dom_1 = require("react-router-dom");
|
|
36
|
+
const constants_1 = require("../constants");
|
|
37
|
+
const hooks_1 = require("../history/hooks");
|
|
38
|
+
const app_1 = require("../store/app");
|
|
39
|
+
const hooks_2 = require("../store/i18n/hooks");
|
|
40
|
+
const hooks_3 = require("../store/integrations/hooks");
|
|
41
|
+
const CreationButtonComponent = ({ activeRoute, location }) => {
|
|
42
|
+
const t = (0, hooks_2.getT)();
|
|
43
|
+
const actions = (0, hooks_3.useActions)({ activeRoute, location }, constants_1.ACTION_TYPES.NEW);
|
|
44
|
+
const actionsDropdownItems = (0, react_1.useMemo)(() => actions.map(({ execute, ...rest }) => ({ onClick: execute, ...rest })), [actions]);
|
|
45
|
+
const [open, setOpen] = (0, react_1.useState)(false);
|
|
46
|
+
const primaryAction = (0, react_1.useMemo)(() => (0, lodash_1.find)(actionsDropdownItems, (action) => (action.group === activeRoute?.id || action.group === activeRoute?.app) &&
|
|
47
|
+
action.primary === true), [actionsDropdownItems, activeRoute?.app, activeRoute?.id]);
|
|
48
|
+
const apps = (0, app_1.useAppList)();
|
|
49
|
+
const actionsDropdownItemsByGroup = (0, react_1.useMemo)(() => (0, lodash_1.groupBy)(actionsDropdownItems, (actionsDropdownItem) => actionsDropdownItem.group), [actionsDropdownItems]);
|
|
50
|
+
const secondaryActions = (0, react_1.useMemo)(() => [
|
|
51
|
+
...(actionsDropdownItemsByGroup[activeRoute?.app ?? ''] ?? []),
|
|
52
|
+
...(0, lodash_1.reduce)(apps, (acc, app, i) => {
|
|
53
|
+
if (app.name !== activeRoute?.app && actionsDropdownItemsByGroup[app.name]?.length > 0) {
|
|
54
|
+
acc.push({ type: 'divider', id: `divider-${i}` }, ...actionsDropdownItemsByGroup[app.name]);
|
|
55
|
+
}
|
|
56
|
+
return acc;
|
|
57
|
+
}, [])
|
|
58
|
+
], [activeRoute?.app, apps, actionsDropdownItemsByGroup]);
|
|
59
|
+
const onClose = (0, react_1.useCallback)(() => {
|
|
60
|
+
setOpen(false);
|
|
61
|
+
}, []);
|
|
62
|
+
const onOpen = (0, react_1.useCallback)(() => {
|
|
63
|
+
setOpen(true);
|
|
64
|
+
}, []);
|
|
65
|
+
return primaryAction ? (react_1.default.createElement(carbonio_design_system_1.Container, { minWidth: "80px" },
|
|
66
|
+
react_1.default.createElement(carbonio_design_system_1.MultiButton, { "data-testid": "NewItemButton", size: "extralarge", background: 'primary', label: t('new', 'New'), onClick: primaryAction.onClick, items: secondaryActions, disabledPrimary: !primaryAction || primaryAction?.disabled, disabledSecondary: !secondaryActions?.length }))) : (react_1.default.createElement(carbonio_design_system_1.Dropdown, { items: secondaryActions, onClose: onClose, onOpen: onOpen },
|
|
67
|
+
react_1.default.createElement(carbonio_design_system_1.Button, { "data-testid": "NewItemButton", size: "extralarge", backgroundColor: "primary", label: t('new', 'New'), icon: open ? 'ChevronUp' : 'ChevronDown', onClick: lodash_1.noop })));
|
|
68
|
+
};
|
|
69
|
+
exports.CreationButtonComponent = CreationButtonComponent;
|
|
70
|
+
const MemoCreationButton = react_1.default.memo(exports.CreationButtonComponent);
|
|
71
|
+
const CreationButton = () => {
|
|
72
|
+
const locationFull = (0, react_router_dom_1.useLocation)();
|
|
73
|
+
const activeRoute = (0, hooks_1.useCurrentRoute)();
|
|
74
|
+
const truncateLocation = (location) => ({
|
|
75
|
+
...location,
|
|
76
|
+
pathname: location?.pathname?.split('/').slice(0, 2).join('/'),
|
|
77
|
+
key: ''
|
|
78
|
+
});
|
|
79
|
+
const location = (0, react_1.useMemo)(() => truncateLocation(locationFull), [locationFull]);
|
|
80
|
+
return react_1.default.createElement(MemoCreationButton, { activeRoute: activeRoute, location: location });
|
|
81
|
+
};
|
|
82
|
+
exports.CreationButton = CreationButton;
|
|
83
|
+
//# sourceMappingURL=creation-button.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"creation-button.js","sourceRoot":"","sources":["../../src/shell/creation-button.tsx"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;;;;;;;;;;;;AAGH,+CAA8D;AAE9D,4EAMyC;AAEzC,mCAAqD;AACrD,uDAA+C;AAE/C,4CAA4C;AAC5C,4CAAmD;AACnD,sCAA0C;AAC1C,+CAA2C;AAC3C,uDAAyD;AAelD,MAAM,uBAAuB,GAAG,CAAC,EACvC,WAAW,EACX,QAAQ,EACa,EAAqB,EAAE;IAC5C,MAAM,CAAC,GAAG,IAAA,YAAI,GAAE,CAAC;IAC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EAAE,MAAM,EAAE,MAAM;QAClE,8BAAC,+BAAM,mBACM,eAAe,EAC3B,IAAI,EAAC,YAAY,EACjB,eAAe,EAAC,SAAS,EACzB,KAAK,EAAE,CAAC,CAAC,KAAK,EAAE,KAAK,CAAC,EACtB,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,aAAa,EACxC,OAAO,EAAE,aAAI,GACZ,CACQ,CACX,CAAC;AACH,CAAC,CAAC;AAjFW,QAAA,uBAAuB,2BAiFlC;AAEF,MAAM,kBAAkB,GAAG,eAAK,CAAC,IAAI,CAAC,+BAAuB,CAAC,CAAC;AAExD,MAAM,cAAc,GAAO,GAAG,EAAE;IACtC,MAAM,YAAY,GAAG,IAAA,8BAAW,GAAc,CAAC;IAC/C,MAAM,WAAW,GAAG,IAAA,uBAAe,GAAc,CAAC;IAElD,MAAM,gBAAgB,GAAG,CAAC,QAAkB,EAAY,EAAE,CAAC,CAAC;QAC3D,GAAG,QAAQ;QACX,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;QAC9D,GAAG,EAAE,EAAE;KACP,CAAC,CAAC;IAEH,MAAM,QAAQ,GAAG,IAAA,eAAO,EAAC,GAAG,EAAE,CAAC,gBAAgB,CAAC,YAAY,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC;IAC/E,OAAO,8BAAC,kBAAkB,IAAC,WAAW,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,GAAI,CAAC;AAC7E,CAAC,CAAC;AAZW,QAAA,cAAc,kBAYzB"}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
|
-
import type { Action
|
|
2
|
+
import type { Action } from '../../types/integrations';
|
|
3
3
|
import type { AnyFunction } from '../../utils/typeUtils';
|
|
4
4
|
export declare const getIntegratedFunction: (id: string) => [AnyFunction, boolean];
|
|
5
5
|
export declare const getIntegratedComponent: (id: string) => [React.FunctionComponent<Record<string, unknown>>, boolean];
|
|
6
|
-
export declare const getActions: <
|
|
7
|
-
export declare const getActionsFactory: (type: string) => <T>(target: T) => Array<Action>;
|
|
6
|
+
export declare const getActions: <TContext, TAction extends Action = Action>(context: TContext, type: string) => TAction[];
|
|
8
7
|
export declare const getAction: <T>(type: string, id: string, target?: T | undefined) => [Action | undefined, boolean];
|
|
9
|
-
export declare const getActionFactory: <T>(type: string, id: string) => [ActionFactory<T> | undefined, boolean];
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
6
6
|
*/
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.
|
|
8
|
+
exports.getAction = exports.getActions = exports.getIntegratedComponent = exports.getIntegratedFunction = void 0;
|
|
9
9
|
const store_1 = require("./store");
|
|
10
10
|
const utils_1 = require("./utils");
|
|
11
11
|
const getIntegratedFunction = (id) => {
|
|
@@ -18,24 +18,14 @@ const getIntegratedComponent = (id) => {
|
|
|
18
18
|
return (0, utils_1.buildIntegrationComponent)(integration);
|
|
19
19
|
};
|
|
20
20
|
exports.getIntegratedComponent = getIntegratedComponent;
|
|
21
|
-
const getActions = (
|
|
21
|
+
const getActions = (context, type) => {
|
|
22
22
|
const factories = store_1.useIntegrationsStore.getState().actions[type];
|
|
23
|
-
return (0, utils_1.buildIntegrationActions)(factories,
|
|
23
|
+
return (0, utils_1.buildIntegrationActions)(factories, context);
|
|
24
24
|
};
|
|
25
25
|
exports.getActions = getActions;
|
|
26
|
-
const getActionsFactory = (type) => {
|
|
27
|
-
const factories = store_1.useIntegrationsStore.getState().actions[type];
|
|
28
|
-
return (target) => (0, utils_1.buildIntegrationActions)(factories, target);
|
|
29
|
-
};
|
|
30
|
-
exports.getActionsFactory = getActionsFactory;
|
|
31
26
|
const getAction = (type, id, target) => {
|
|
32
27
|
const factory = store_1.useIntegrationsStore.getState().actions[type]?.[id];
|
|
33
28
|
return (0, utils_1.buildIntegrationAction)(factory, target);
|
|
34
29
|
};
|
|
35
30
|
exports.getAction = getAction;
|
|
36
|
-
const getActionFactory = (type, id) => {
|
|
37
|
-
const factory = store_1.useIntegrationsStore.getState().actions[type]?.[id];
|
|
38
|
-
return [factory, !!factory];
|
|
39
|
-
};
|
|
40
|
-
exports.getActionFactory = getActionFactory;
|
|
41
31
|
//# sourceMappingURL=getters.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getters.js","sourceRoot":"","sources":["../../../src/store/integrations/getters.tsx"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAIH,mCAA+C;AAC/C,mCAIiB;AAIV,MAAM,qBAAqB,GAAG,CAAC,EAAU,EAA0B,EAAE;IAC3E,MAAM,WAAW,GAAG,4BAAoB,CAAC,QAAQ,EAAE,CAAC,SAAS,EAAE,CAAC,EAAE,CAAC,CAAC;IACpE,OAAO,WAAW,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,GAAS,EAAE,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;AAC3E,CAAC,CAAC;AAHW,QAAA,qBAAqB,yBAGhC;AAEK,MAAM,sBAAsB,GAAG,CACrC,EAAU,EACoD,EAAE;IAChE,MAAM,WAAW,GAAG,4BAAoB,CAAC,QAAQ,EAAE,CAAC,UAAU,EAAE,CAAC,EAAE,CAAC,CAAC;IACrE,OAAO,IAAA,iCAAyB,EAAC,WAAW,CAAC,CAAC;AAC/C,CAAC,CAAC;AALW,QAAA,sBAAsB,0BAKjC;AAEK,MAAM,UAAU,GAAG,
|
|
1
|
+
{"version":3,"file":"getters.js","sourceRoot":"","sources":["../../../src/store/integrations/getters.tsx"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAIH,mCAA+C;AAC/C,mCAIiB;AAIV,MAAM,qBAAqB,GAAG,CAAC,EAAU,EAA0B,EAAE;IAC3E,MAAM,WAAW,GAAG,4BAAoB,CAAC,QAAQ,EAAE,CAAC,SAAS,EAAE,CAAC,EAAE,CAAC,CAAC;IACpE,OAAO,WAAW,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,GAAS,EAAE,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;AAC3E,CAAC,CAAC;AAHW,QAAA,qBAAqB,yBAGhC;AAEK,MAAM,sBAAsB,GAAG,CACrC,EAAU,EACoD,EAAE;IAChE,MAAM,WAAW,GAAG,4BAAoB,CAAC,QAAQ,EAAE,CAAC,UAAU,EAAE,CAAC,EAAE,CAAC,CAAC;IACrE,OAAO,IAAA,iCAAyB,EAAC,WAAW,CAAC,CAAC;AAC/C,CAAC,CAAC;AALW,QAAA,sBAAsB,0BAKjC;AAEK,MAAM,UAAU,GAAG,CACzB,OAAiB,EACjB,IAAY,EACK,EAAE;IACnB,MAAM,SAAS,GAAG,4BAAoB,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAChE,OAAO,IAAA,+BAAuB,EAAC,SAAS,EAAE,OAAO,CAAC,CAAC;AACpD,CAAC,CAAC;AANW,QAAA,UAAU,cAMrB;AAEK,MAAM,SAAS,GAAG,CACxB,IAAY,EACZ,EAAU,EACV,MAAU,EACsB,EAAE;IAClC,MAAM,OAAO,GAAG,4BAAoB,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;IACpE,OAAO,IAAA,8BAAsB,EAAC,OAAO,EAAE,MAAM,CAAC,CAAC;AAChD,CAAC,CAAC;AAPW,QAAA,SAAS,aAOpB"}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
|
-
import type { Action
|
|
2
|
+
import type { Action } from '../../types/integrations';
|
|
3
3
|
import type { AnyFunction } from '../../utils/typeUtils';
|
|
4
4
|
export declare const useIntegratedFunction: (id: string) => [AnyFunction, boolean];
|
|
5
5
|
export declare const useIntegratedComponent: (id: string) => [React.FunctionComponent<Record<string, unknown>>, boolean];
|
|
6
|
-
export declare const useActions: <
|
|
7
|
-
export declare const useActionsFactory: (type: string) => <T>(target: T) => Array<Action>;
|
|
6
|
+
export declare const useActions: <TContext, TAction extends Action = Action>(context: TContext, type: string) => TAction[];
|
|
8
7
|
export declare const useAction: <T>(type: string, id: string, target?: T | undefined) => [Action | undefined, boolean];
|
|
9
|
-
export declare const useActionFactory: <T>(type: string, id: string) => [ActionFactory<T> | undefined, boolean];
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
6
6
|
*/
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.
|
|
8
|
+
exports.useAction = exports.useActions = exports.useIntegratedComponent = exports.useIntegratedFunction = void 0;
|
|
9
9
|
const react_1 = require("react");
|
|
10
10
|
const store_1 = require("./store");
|
|
11
11
|
const utils_1 = require("./utils");
|
|
@@ -19,24 +19,14 @@ const useIntegratedComponent = (id) => {
|
|
|
19
19
|
return (0, react_1.useMemo)(() => (0, utils_1.buildIntegrationComponent)(integration), [integration]);
|
|
20
20
|
};
|
|
21
21
|
exports.useIntegratedComponent = useIntegratedComponent;
|
|
22
|
-
const useActions = (
|
|
22
|
+
const useActions = (context, type) => {
|
|
23
23
|
const factories = (0, store_1.useIntegrationsStore)((s) => s.actions[type]);
|
|
24
|
-
return (0, react_1.useMemo)(() => (0, utils_1.buildIntegrationActions)(factories,
|
|
24
|
+
return (0, react_1.useMemo)(() => (0, utils_1.buildIntegrationActions)(factories, context), [factories, context]);
|
|
25
25
|
};
|
|
26
26
|
exports.useActions = useActions;
|
|
27
|
-
const useActionsFactory = (type) => {
|
|
28
|
-
const factories = (0, store_1.useIntegrationsStore)((s) => s.actions[type]);
|
|
29
|
-
return (0, react_1.useCallback)((target) => (0, utils_1.buildIntegrationActions)(factories, target), [factories]);
|
|
30
|
-
};
|
|
31
|
-
exports.useActionsFactory = useActionsFactory;
|
|
32
27
|
const useAction = (type, id, target) => {
|
|
33
28
|
const factory = (0, store_1.useIntegrationsStore)((s) => s.actions[type][id]);
|
|
34
29
|
return (0, react_1.useMemo)(() => (0, utils_1.buildIntegrationAction)(factory, target), [factory, target]);
|
|
35
30
|
};
|
|
36
31
|
exports.useAction = useAction;
|
|
37
|
-
const useActionFactory = (type, id) => {
|
|
38
|
-
const factory = (0, store_1.useIntegrationsStore)((s) => s.actions[type][id]);
|
|
39
|
-
return [factory, !!factory];
|
|
40
|
-
};
|
|
41
|
-
exports.useActionFactory = useActionFactory;
|
|
42
32
|
//# sourceMappingURL=hooks.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.js","sourceRoot":"","sources":["../../../src/store/integrations/hooks.tsx"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAGH,
|
|
1
|
+
{"version":3,"file":"hooks.js","sourceRoot":"","sources":["../../../src/store/integrations/hooks.tsx"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAGH,iCAAgC;AAEhC,mCAA+C;AAC/C,mCAKiB;AAIV,MAAM,qBAAqB,GAAG,CAAC,EAAU,EAA0B,EAAE;IAC3E,MAAM,WAAW,GAAG,IAAA,4BAAoB,EAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IACnE,OAAO,IAAA,gCAAwB,EAAC,WAAW,CAAC,CAAC;AAC9C,CAAC,CAAC;AAHW,QAAA,qBAAqB,yBAGhC;AAEK,MAAM,sBAAsB,GAAG,CACrC,EAAU,EACoD,EAAE;IAChE,MAAM,WAAW,GAAG,IAAA,4BAAoB,EAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IACpE,OAAO,IAAA,eAAO,EAAC,GAAG,EAAE,CAAC,IAAA,iCAAyB,EAAC,WAAW,CAAC,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC;AAC7E,CAAC,CAAC;AALW,QAAA,sBAAsB,0BAKjC;AAEK,MAAM,UAAU,GAAG,CACzB,OAAiB,EACjB,IAAY,EACK,EAAE;IACnB,MAAM,SAAS,GAAG,IAAA,4BAAoB,EAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;IAC/D,OAAO,IAAA,eAAO,EAAC,GAAG,EAAE,CAAC,IAAA,+BAAuB,EAAC,SAAS,EAAE,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC;AACzF,CAAC,CAAC;AANW,QAAA,UAAU,cAMrB;AAEK,MAAM,SAAS,GAAG,CACxB,IAAY,EACZ,EAAU,EACV,MAAU,EACsB,EAAE;IAClC,MAAM,OAAO,GAAG,IAAA,4BAAoB,EAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACjE,OAAO,IAAA,eAAO,EAAC,GAAG,EAAE,CAAC,IAAA,8BAAsB,EAAC,OAAO,EAAE,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC;AAClF,CAAC,CAAC;AAPW,QAAA,SAAS,aAOpB"}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import type { ComponentType } from 'react';
|
|
2
|
-
import type { ActionFactory } from '../../types/integrations';
|
|
2
|
+
import type { Action, ActionFactory } from '../../types/integrations';
|
|
3
3
|
import type { AnyFunction } from '../../utils/typeUtils';
|
|
4
|
-
type Action<TTarget = unknown> = ActionFactory<TTarget>;
|
|
5
4
|
type Component<TProps extends Record<string, unknown> = Record<string, unknown>> = ComponentType<TProps>;
|
|
6
5
|
export type IntegrationsState = {
|
|
7
6
|
actions: {
|
|
8
7
|
[type: string]: {
|
|
9
|
-
[id: string]:
|
|
8
|
+
[id: string]: ActionFactory<unknown>;
|
|
10
9
|
};
|
|
11
10
|
};
|
|
12
11
|
components: {
|
|
@@ -21,9 +20,9 @@ export type IntegrationsState = {
|
|
|
21
20
|
};
|
|
22
21
|
export type IntegrationActions = {
|
|
23
22
|
removeActions: (...ids: Array<string>) => void;
|
|
24
|
-
registerActions: (...items: Array<{
|
|
23
|
+
registerActions: <TAction extends Action = Action>(...items: Array<{
|
|
25
24
|
id: string;
|
|
26
|
-
action:
|
|
25
|
+
action: ActionFactory<unknown, TAction>;
|
|
27
26
|
type: string;
|
|
28
27
|
}>) => void;
|
|
29
28
|
removeComponents: (...ids: Array<string>) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store.js","sourceRoot":"","sources":["../../../src/store/integrations/store.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;AAIH,iCAAgC;AAChC,mCAAiD;AACjD,qCAAiC;AAEjC,0DAAkC;AAClC,+CAA+C;
|
|
1
|
+
{"version":3,"file":"store.js","sourceRoot":"","sources":["../../../src/store/integrations/store.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;AAIH,iCAAgC;AAChC,mCAAiD;AACjD,qCAAiC;AAEjC,0DAAkC;AAClC,+CAA+C;AA4B/C,MAAM,YAAY,GAAsB;IACvC,OAAO,EAAE,EAAE;IACX,UAAU,EAAE;QACX,QAAQ,EAAE;YACT,IAAI,EAAE,kBAAQ;YACd,GAAG,EAAE,wBAAY;SACjB;KACD;IACD,SAAS,EAAE,EAAE;CACb,CAAC;AACF,mHAAmH;AACtG,QAAA,oBAAoB,GAAG,IAAA,gBAAM,GAA0C,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;IAC9F,GAAG,YAAY;IACf,eAAe,EAAE,CAAC,GAAG,KAAK,EAAQ,EAAE,CACnC,GAAG,CACF,IAAA,eAAO,EAAoB,CAAC,KAAK,EA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gBAAO,EAAC,aAAa,EAAE,CAAC,aAAa,EAAE,eAAe,EAAE,EAAE;gBACzD,IAAI,IAAA,iBAAQ,EAAC,GAAG,EAAE,eAAe,CAAC,EAAE,CAAC;oBACpC,OAAO,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,eAAe,CAAC,CAAC;gBAC7C,CAAC;YACF,CAAC,CAAC,CAAC;QACJ,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC,CACF;IACF,gBAAgB,EAAE,CAAC,GAAG,GAAG,EAAQ,EAAE,CAClC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QACX,GAAG,CAAC;QACJ,UAAU,EAAE,IAAA,aAAI,EAAC,CAAC,CAAC,UAAU,EAAE,GAAG,CAAC;KACnC,CAAC,CAAC;IACJ,eAAe,EAAE,CAAC,GAAG,GAAG,EAAQ,EAAE,CACjC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QACX,GAAG,CAAC;QACJ,SAAS,EAAE,IAAA,aAAI,EAAC,CAAC,CAAC,SAAS,EAAE,GAAG,CAAC;KACjC,CAAC,CAAC;CACJ,CAAC,CAAC,CAAC"}
|
|
@@ -4,5 +4,5 @@ import type { Action } from '../../types/integrations';
|
|
|
4
4
|
import type { AnyFunction } from '../../utils/typeUtils';
|
|
5
5
|
export declare function buildIntegrationComponent(integration: IntegrationsState['components'][string]): [React.FunctionComponent<Record<string, unknown>>, boolean];
|
|
6
6
|
export declare function buildIntegrationFunction(integration: IntegrationsState['functions'][string]): [AnyFunction, boolean];
|
|
7
|
-
export declare function buildIntegrationActions(integration: IntegrationsState['actions'][string],
|
|
7
|
+
export declare function buildIntegrationActions<TAction extends Action>(integration: IntegrationsState['actions'][string], context: unknown): Array<TAction>;
|
|
8
8
|
export declare function buildIntegrationAction(integration: IntegrationsState['actions'][string][string], target: unknown): [Action | undefined, boolean];
|
|
@@ -25,10 +25,10 @@ function buildIntegrationFunction(integration) {
|
|
|
25
25
|
return integration ? [integration, true] : [() => undefined, false];
|
|
26
26
|
}
|
|
27
27
|
exports.buildIntegrationFunction = buildIntegrationFunction;
|
|
28
|
-
function buildIntegrationActions(integration,
|
|
29
|
-
return (0, lodash_1.compact)((0, lodash_1.map)(integration, (
|
|
28
|
+
function buildIntegrationActions(integration, context) {
|
|
29
|
+
return (0, lodash_1.compact)((0, lodash_1.map)(integration, (actionFactory) => {
|
|
30
30
|
try {
|
|
31
|
-
return
|
|
31
|
+
return actionFactory(context);
|
|
32
32
|
}
|
|
33
33
|
catch (e) {
|
|
34
34
|
// eslint-disable-next-line no-console
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/store/integrations/utils.tsx"],"names":[],"mappings":";;;;;;AAAA;;;;GAIG;AACH,kDAA0B;AAE1B,mCAAsC;AAGtC,+FAAqE;AAIrE,SAAgB,yBAAyB,CACxC,WAAoD;IAEpD,IAAI,WAAW,EAAE,CAAC;QACjB,MAAM,oBAAoB,GAAG,CAAC,KAA8B,EAAqB,EAAE,CAAC,CACnF,8BAAC,8BAAkB,IAAC,GAAG,EAAE,WAAW,CAAC,GAAG;YACvC,8BAAC,WAAW,CAAC,IAAI,OAAK,KAAK,GAAI,CACX,CACrB,CAAC;QACF,OAAO,CAAC,oBAAoB,EAAE,IAAI,CAAC,CAAC;IACrC,CAAC;IACD,OAAO,CAAC,GAAS,EAAE,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;AAClC,CAAC;AAZD,8DAYC;AAED,SAAgB,wBAAwB,CACvC,WAAmD;IAEnD,OAAO,WAAW,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,GAAS,EAAE,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;AAC3E,CAAC;AAJD,4DAIC;AAED,SAAgB,uBAAuB,CACtC,WAAiD,EACjD,
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","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ACtC,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACZ,OAAO,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;IAC3B,CAAC;AACF,CAAC;AATD,wDASC"}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
};
|
|
8
|
-
export type ActionFactory<T> = (target: T) => Action;
|
|
1
|
+
export interface Action {
|
|
2
|
+
label: string;
|
|
3
|
+
icon?: string;
|
|
4
|
+
execute(...args: unknown[]): unknown;
|
|
5
|
+
}
|
|
6
|
+
export type ActionFactory<TContext, TAction extends Action = Action> = (context: TContext) => TAction;
|