@fctc/widget-logic 1.10.1 → 2.0.1
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/dist/hooks.d.mts +12 -1
- package/dist/hooks.d.ts +12 -1
- package/dist/hooks.js +39 -0
- package/dist/hooks.mjs +38 -0
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +40 -0
- package/dist/index.mjs +40 -0
- package/dist/widget.js +38 -0
- package/dist/widget.mjs +38 -0
- package/package.json +1 -1
package/dist/hooks.d.mts
CHANGED
|
@@ -955,6 +955,17 @@ declare const AppProvider: ({ children }: {
|
|
|
955
955
|
}) => react_jsx_runtime.JSX.Element;
|
|
956
956
|
declare const useAppProvider: () => AppProviderType;
|
|
957
957
|
|
|
958
|
+
interface TActionDetailType {
|
|
959
|
+
id: number;
|
|
960
|
+
res_model: string;
|
|
961
|
+
views: any[][];
|
|
962
|
+
}
|
|
963
|
+
declare const useMenuItem: (props: any) => {
|
|
964
|
+
handleClick: () => void;
|
|
965
|
+
path: string;
|
|
966
|
+
queryActionDetail: TActionDetailType;
|
|
967
|
+
};
|
|
968
|
+
|
|
958
969
|
declare const DEFAULT_EVENTS: readonly ["mousedown", "touchstart"];
|
|
959
970
|
type EventType = (typeof DEFAULT_EVENTS)[number];
|
|
960
971
|
interface UseClickOutsideOptions {
|
|
@@ -967,4 +978,4 @@ declare const useClickOutside: ({ handler, events, nodes, refs, }: UseClickOutsi
|
|
|
967
978
|
|
|
968
979
|
declare function useDebounce<T>(value: T, delay: number): [T];
|
|
969
980
|
|
|
970
|
-
export { type ActionResultType, AppProvider, type ContextProfile, type Record, type ViewResponse, useAppProvider, useAuth, type useAuthType, useCallAction, type useCallActionType, useClickOutside, useConfig, type useConfigType, useDebounce, useDetail, useListData, type useListDataType, useMenu, type useMenuType, useProfile, useUser, type useUserType, useViewV2, type useViewV2Type };
|
|
981
|
+
export { type ActionResultType, AppProvider, type ContextProfile, type Record, type ViewResponse, useAppProvider, useAuth, type useAuthType, useCallAction, type useCallActionType, useClickOutside, useConfig, type useConfigType, useDebounce, useDetail, useListData, type useListDataType, useMenu, useMenuItem, type useMenuType, useProfile, useUser, type useUserType, useViewV2, type useViewV2Type };
|
package/dist/hooks.d.ts
CHANGED
|
@@ -955,6 +955,17 @@ declare const AppProvider: ({ children }: {
|
|
|
955
955
|
}) => react_jsx_runtime.JSX.Element;
|
|
956
956
|
declare const useAppProvider: () => AppProviderType;
|
|
957
957
|
|
|
958
|
+
interface TActionDetailType {
|
|
959
|
+
id: number;
|
|
960
|
+
res_model: string;
|
|
961
|
+
views: any[][];
|
|
962
|
+
}
|
|
963
|
+
declare const useMenuItem: (props: any) => {
|
|
964
|
+
handleClick: () => void;
|
|
965
|
+
path: string;
|
|
966
|
+
queryActionDetail: TActionDetailType;
|
|
967
|
+
};
|
|
968
|
+
|
|
958
969
|
declare const DEFAULT_EVENTS: readonly ["mousedown", "touchstart"];
|
|
959
970
|
type EventType = (typeof DEFAULT_EVENTS)[number];
|
|
960
971
|
interface UseClickOutsideOptions {
|
|
@@ -967,4 +978,4 @@ declare const useClickOutside: ({ handler, events, nodes, refs, }: UseClickOutsi
|
|
|
967
978
|
|
|
968
979
|
declare function useDebounce<T>(value: T, delay: number): [T];
|
|
969
980
|
|
|
970
|
-
export { type ActionResultType, AppProvider, type ContextProfile, type Record, type ViewResponse, useAppProvider, useAuth, type useAuthType, useCallAction, type useCallActionType, useClickOutside, useConfig, type useConfigType, useDebounce, useDetail, useListData, type useListDataType, useMenu, type useMenuType, useProfile, useUser, type useUserType, useViewV2, type useViewV2Type };
|
|
981
|
+
export { type ActionResultType, AppProvider, type ContextProfile, type Record, type ViewResponse, useAppProvider, useAuth, type useAuthType, useCallAction, type useCallActionType, useClickOutside, useConfig, type useConfigType, useDebounce, useDetail, useListData, type useListDataType, useMenu, useMenuItem, type useMenuType, useProfile, useUser, type useUserType, useViewV2, type useViewV2Type };
|
package/dist/hooks.js
CHANGED
|
@@ -31,6 +31,7 @@ __export(hooks_exports, {
|
|
|
31
31
|
useDetail: () => useDetail,
|
|
32
32
|
useListData: () => useListData,
|
|
33
33
|
useMenu: () => useMenu,
|
|
34
|
+
useMenuItem: () => useMenuItem,
|
|
34
35
|
useProfile: () => useProfile,
|
|
35
36
|
useUser: () => useUser,
|
|
36
37
|
useViewV2: () => useViewV2
|
|
@@ -815,6 +816,43 @@ __export(utils_exports, {
|
|
|
815
816
|
});
|
|
816
817
|
__reExport(utils_exports, require("@fctc/interface-logic/utils"));
|
|
817
818
|
|
|
819
|
+
// src/hooks/core/use-menu-item.tsx
|
|
820
|
+
var useMenuItem = (props) => {
|
|
821
|
+
const { menu, activeMenuId } = props;
|
|
822
|
+
const model = menu?.action?.res_model;
|
|
823
|
+
const aid = menu?.action?.id?.id;
|
|
824
|
+
const id = menu?.id;
|
|
825
|
+
const context = (0, import_environment5.getEnv)().context;
|
|
826
|
+
const queryActionDetail = (0, import_hooks9.useGetActionDetail)({
|
|
827
|
+
aid,
|
|
828
|
+
id,
|
|
829
|
+
model,
|
|
830
|
+
context,
|
|
831
|
+
enabled: true,
|
|
832
|
+
queryKey: [`action-${aid}`]
|
|
833
|
+
}).data;
|
|
834
|
+
const [path, setPath] = (0, import_react11.useState)("");
|
|
835
|
+
const handleClick = () => {
|
|
836
|
+
if (location?.pathname === "/list/menu" && activeMenuId === menu?.id) {
|
|
837
|
+
return;
|
|
838
|
+
}
|
|
839
|
+
const hasListView = queryActionDetail.views.some(
|
|
840
|
+
([id2, type]) => type === "list"
|
|
841
|
+
);
|
|
842
|
+
const viewType = hasListView ? "list" : "form";
|
|
843
|
+
const isAccountPayment = menu?.action?.res_model === "account.payment" && menu?.action?.id?.id === 1551;
|
|
844
|
+
const isConvertCurrencyMenu = menu?.action?.res_model === "currency.convert" && menu?.action?.id?.id === 1562;
|
|
845
|
+
const path2 = (0, utils_exports.formatUrlPath)({
|
|
846
|
+
viewType,
|
|
847
|
+
actionPath: isConvertCurrencyMenu ? "menu" : isAccountPayment ? "menu" : menu?.action?.path || "menu",
|
|
848
|
+
aid: menu?.action?.id?.id,
|
|
849
|
+
model: queryActionDetail.res_model
|
|
850
|
+
});
|
|
851
|
+
setPath(path2);
|
|
852
|
+
};
|
|
853
|
+
return { handleClick, path, queryActionDetail };
|
|
854
|
+
};
|
|
855
|
+
|
|
818
856
|
// src/hooks/utils/use-click-outside.ts
|
|
819
857
|
var import_react12 = require("react");
|
|
820
858
|
var DEFAULT_EVENTS = ["mousedown", "touchstart"];
|
|
@@ -875,6 +913,7 @@ __reExport(hooks_exports, require("@fctc/interface-logic/hooks"), module.exports
|
|
|
875
913
|
useDetail,
|
|
876
914
|
useListData,
|
|
877
915
|
useMenu,
|
|
916
|
+
useMenuItem,
|
|
878
917
|
useProfile,
|
|
879
918
|
useUser,
|
|
880
919
|
useViewV2,
|
package/dist/hooks.mjs
CHANGED
|
@@ -818,6 +818,43 @@ __export(utils_exports, {
|
|
|
818
818
|
__reExport(utils_exports, utils_star);
|
|
819
819
|
import * as utils_star from "@fctc/interface-logic/utils";
|
|
820
820
|
|
|
821
|
+
// src/hooks/core/use-menu-item.tsx
|
|
822
|
+
var useMenuItem = (props) => {
|
|
823
|
+
const { menu, activeMenuId } = props;
|
|
824
|
+
const model = menu?.action?.res_model;
|
|
825
|
+
const aid = menu?.action?.id?.id;
|
|
826
|
+
const id = menu?.id;
|
|
827
|
+
const context = getEnv5().context;
|
|
828
|
+
const queryActionDetail = useGetActionDetail({
|
|
829
|
+
aid,
|
|
830
|
+
id,
|
|
831
|
+
model,
|
|
832
|
+
context,
|
|
833
|
+
enabled: true,
|
|
834
|
+
queryKey: [`action-${aid}`]
|
|
835
|
+
}).data;
|
|
836
|
+
const [path, setPath] = useState5("");
|
|
837
|
+
const handleClick = () => {
|
|
838
|
+
if (location?.pathname === "/list/menu" && activeMenuId === menu?.id) {
|
|
839
|
+
return;
|
|
840
|
+
}
|
|
841
|
+
const hasListView = queryActionDetail.views.some(
|
|
842
|
+
([id2, type]) => type === "list"
|
|
843
|
+
);
|
|
844
|
+
const viewType = hasListView ? "list" : "form";
|
|
845
|
+
const isAccountPayment = menu?.action?.res_model === "account.payment" && menu?.action?.id?.id === 1551;
|
|
846
|
+
const isConvertCurrencyMenu = menu?.action?.res_model === "currency.convert" && menu?.action?.id?.id === 1562;
|
|
847
|
+
const path2 = (0, utils_exports.formatUrlPath)({
|
|
848
|
+
viewType,
|
|
849
|
+
actionPath: isConvertCurrencyMenu ? "menu" : isAccountPayment ? "menu" : menu?.action?.path || "menu",
|
|
850
|
+
aid: menu?.action?.id?.id,
|
|
851
|
+
model: queryActionDetail.res_model
|
|
852
|
+
});
|
|
853
|
+
setPath(path2);
|
|
854
|
+
};
|
|
855
|
+
return { handleClick, path, queryActionDetail };
|
|
856
|
+
};
|
|
857
|
+
|
|
821
858
|
// src/hooks/utils/use-click-outside.ts
|
|
822
859
|
import { useEffect as useEffect7, useRef as useRef2 } from "react";
|
|
823
860
|
var DEFAULT_EVENTS = ["mousedown", "touchstart"];
|
|
@@ -877,6 +914,7 @@ export {
|
|
|
877
914
|
useDetail,
|
|
878
915
|
useListData,
|
|
879
916
|
useMenu,
|
|
917
|
+
useMenuItem,
|
|
880
918
|
useProfile,
|
|
881
919
|
useUser,
|
|
882
920
|
useViewV2
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { ActionResultType, AppProvider, ContextProfile, Record, ViewResponse, useAppProvider, useAuth, useAuthType, useCallAction, useCallActionType, useClickOutside, useConfig, useConfigType, useDebounce, useDetail, useListData, useListDataType, useMenu, useMenuType, useProfile, useUser, useUserType, useViewV2, useViewV2Type } from './hooks.mjs';
|
|
1
|
+
export { ActionResultType, AppProvider, ContextProfile, Record, ViewResponse, useAppProvider, useAuth, useAuthType, useCallAction, useCallActionType, useClickOutside, useConfig, useConfigType, useDebounce, useDetail, useListData, useListDataType, useMenu, useMenuItem, useMenuType, useProfile, useUser, useUserType, useViewV2, useViewV2Type } from './hooks.mjs';
|
|
2
2
|
export * from '@fctc/interface-logic/hooks';
|
|
3
3
|
export * from '@fctc/interface-logic/configs';
|
|
4
4
|
export { CheckIcon, ChevronBottomIcon, CloseIcon, EyeIcon, FilterIcon, GroupByIcon, LoadingIcon, SearchIcon } from './icons.mjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { ActionResultType, AppProvider, ContextProfile, Record, ViewResponse, useAppProvider, useAuth, useAuthType, useCallAction, useCallActionType, useClickOutside, useConfig, useConfigType, useDebounce, useDetail, useListData, useListDataType, useMenu, useMenuType, useProfile, useUser, useUserType, useViewV2, useViewV2Type } from './hooks.js';
|
|
1
|
+
export { ActionResultType, AppProvider, ContextProfile, Record, ViewResponse, useAppProvider, useAuth, useAuthType, useCallAction, useCallActionType, useClickOutside, useConfig, useConfigType, useDebounce, useDetail, useListData, useListDataType, useMenu, useMenuItem, useMenuType, useProfile, useUser, useUserType, useViewV2, useViewV2Type } from './hooks.js';
|
|
2
2
|
export * from '@fctc/interface-logic/hooks';
|
|
3
3
|
export * from '@fctc/interface-logic/configs';
|
|
4
4
|
export { CheckIcon, ChevronBottomIcon, CloseIcon, EyeIcon, FilterIcon, GroupByIcon, LoadingIcon, SearchIcon } from './icons.js';
|
package/dist/index.js
CHANGED
|
@@ -4082,6 +4082,7 @@ __export(index_exports, {
|
|
|
4082
4082
|
useGetRowIds: () => useGetRowIds,
|
|
4083
4083
|
useListData: () => useListData,
|
|
4084
4084
|
useMenu: () => useMenu,
|
|
4085
|
+
useMenuItem: () => useMenuItem,
|
|
4085
4086
|
useProfile: () => useProfile,
|
|
4086
4087
|
useSelectionState: () => useSelectionState,
|
|
4087
4088
|
useStorageState: () => useStorageState,
|
|
@@ -4103,6 +4104,7 @@ __export(hooks_exports, {
|
|
|
4103
4104
|
useDetail: () => useDetail,
|
|
4104
4105
|
useListData: () => useListData,
|
|
4105
4106
|
useMenu: () => useMenu,
|
|
4107
|
+
useMenuItem: () => useMenuItem,
|
|
4106
4108
|
useProfile: () => useProfile,
|
|
4107
4109
|
useUser: () => useUser,
|
|
4108
4110
|
useViewV2: () => useViewV2
|
|
@@ -4886,6 +4888,43 @@ __export(utils_exports, {
|
|
|
4886
4888
|
});
|
|
4887
4889
|
__reExport(utils_exports, require("@fctc/interface-logic/utils"));
|
|
4888
4890
|
|
|
4891
|
+
// src/hooks/core/use-menu-item.tsx
|
|
4892
|
+
var useMenuItem = (props) => {
|
|
4893
|
+
const { menu, activeMenuId } = props;
|
|
4894
|
+
const model = menu?.action?.res_model;
|
|
4895
|
+
const aid = menu?.action?.id?.id;
|
|
4896
|
+
const id = menu?.id;
|
|
4897
|
+
const context = (0, import_environment5.getEnv)().context;
|
|
4898
|
+
const queryActionDetail = (0, import_hooks9.useGetActionDetail)({
|
|
4899
|
+
aid,
|
|
4900
|
+
id,
|
|
4901
|
+
model,
|
|
4902
|
+
context,
|
|
4903
|
+
enabled: true,
|
|
4904
|
+
queryKey: [`action-${aid}`]
|
|
4905
|
+
}).data;
|
|
4906
|
+
const [path, setPath] = (0, import_react11.useState)("");
|
|
4907
|
+
const handleClick = () => {
|
|
4908
|
+
if (location?.pathname === "/list/menu" && activeMenuId === menu?.id) {
|
|
4909
|
+
return;
|
|
4910
|
+
}
|
|
4911
|
+
const hasListView = queryActionDetail.views.some(
|
|
4912
|
+
([id2, type]) => type === "list"
|
|
4913
|
+
);
|
|
4914
|
+
const viewType = hasListView ? "list" : "form";
|
|
4915
|
+
const isAccountPayment = menu?.action?.res_model === "account.payment" && menu?.action?.id?.id === 1551;
|
|
4916
|
+
const isConvertCurrencyMenu = menu?.action?.res_model === "currency.convert" && menu?.action?.id?.id === 1562;
|
|
4917
|
+
const path2 = (0, utils_exports.formatUrlPath)({
|
|
4918
|
+
viewType,
|
|
4919
|
+
actionPath: isConvertCurrencyMenu ? "menu" : isAccountPayment ? "menu" : menu?.action?.path || "menu",
|
|
4920
|
+
aid: menu?.action?.id?.id,
|
|
4921
|
+
model: queryActionDetail.res_model
|
|
4922
|
+
});
|
|
4923
|
+
setPath(path2);
|
|
4924
|
+
};
|
|
4925
|
+
return { handleClick, path, queryActionDetail };
|
|
4926
|
+
};
|
|
4927
|
+
|
|
4889
4928
|
// src/hooks/utils/use-click-outside.ts
|
|
4890
4929
|
var import_react12 = require("react");
|
|
4891
4930
|
var DEFAULT_EVENTS = ["mousedown", "touchstart"];
|
|
@@ -7572,6 +7611,7 @@ __reExport(index_exports, types_exports, module.exports);
|
|
|
7572
7611
|
useGetRowIds,
|
|
7573
7612
|
useListData,
|
|
7574
7613
|
useMenu,
|
|
7614
|
+
useMenuItem,
|
|
7575
7615
|
useProfile,
|
|
7576
7616
|
useSelectionState,
|
|
7577
7617
|
useStorageState,
|
package/dist/index.mjs
CHANGED
|
@@ -4086,6 +4086,7 @@ __export(index_exports, {
|
|
|
4086
4086
|
useGetRowIds: () => useGetRowIds,
|
|
4087
4087
|
useListData: () => useListData,
|
|
4088
4088
|
useMenu: () => useMenu,
|
|
4089
|
+
useMenuItem: () => useMenuItem,
|
|
4089
4090
|
useProfile: () => useProfile,
|
|
4090
4091
|
useSelectionState: () => useSelectionState,
|
|
4091
4092
|
useStorageState: () => useStorageState,
|
|
@@ -4106,6 +4107,7 @@ __export(hooks_exports, {
|
|
|
4106
4107
|
useDetail: () => useDetail,
|
|
4107
4108
|
useListData: () => useListData,
|
|
4108
4109
|
useMenu: () => useMenu,
|
|
4110
|
+
useMenuItem: () => useMenuItem,
|
|
4109
4111
|
useProfile: () => useProfile,
|
|
4110
4112
|
useUser: () => useUser,
|
|
4111
4113
|
useViewV2: () => useViewV2
|
|
@@ -4913,6 +4915,43 @@ __export(utils_exports, {
|
|
|
4913
4915
|
__reExport(utils_exports, utils_star);
|
|
4914
4916
|
import * as utils_star from "@fctc/interface-logic/utils";
|
|
4915
4917
|
|
|
4918
|
+
// src/hooks/core/use-menu-item.tsx
|
|
4919
|
+
var useMenuItem = (props) => {
|
|
4920
|
+
const { menu, activeMenuId } = props;
|
|
4921
|
+
const model = menu?.action?.res_model;
|
|
4922
|
+
const aid = menu?.action?.id?.id;
|
|
4923
|
+
const id = menu?.id;
|
|
4924
|
+
const context = getEnv5().context;
|
|
4925
|
+
const queryActionDetail = useGetActionDetail({
|
|
4926
|
+
aid,
|
|
4927
|
+
id,
|
|
4928
|
+
model,
|
|
4929
|
+
context,
|
|
4930
|
+
enabled: true,
|
|
4931
|
+
queryKey: [`action-${aid}`]
|
|
4932
|
+
}).data;
|
|
4933
|
+
const [path, setPath] = useState5("");
|
|
4934
|
+
const handleClick = () => {
|
|
4935
|
+
if (location?.pathname === "/list/menu" && activeMenuId === menu?.id) {
|
|
4936
|
+
return;
|
|
4937
|
+
}
|
|
4938
|
+
const hasListView = queryActionDetail.views.some(
|
|
4939
|
+
([id2, type]) => type === "list"
|
|
4940
|
+
);
|
|
4941
|
+
const viewType = hasListView ? "list" : "form";
|
|
4942
|
+
const isAccountPayment = menu?.action?.res_model === "account.payment" && menu?.action?.id?.id === 1551;
|
|
4943
|
+
const isConvertCurrencyMenu = menu?.action?.res_model === "currency.convert" && menu?.action?.id?.id === 1562;
|
|
4944
|
+
const path2 = (0, utils_exports.formatUrlPath)({
|
|
4945
|
+
viewType,
|
|
4946
|
+
actionPath: isConvertCurrencyMenu ? "menu" : isAccountPayment ? "menu" : menu?.action?.path || "menu",
|
|
4947
|
+
aid: menu?.action?.id?.id,
|
|
4948
|
+
model: queryActionDetail.res_model
|
|
4949
|
+
});
|
|
4950
|
+
setPath(path2);
|
|
4951
|
+
};
|
|
4952
|
+
return { handleClick, path, queryActionDetail };
|
|
4953
|
+
};
|
|
4954
|
+
|
|
4916
4955
|
// src/hooks/utils/use-click-outside.ts
|
|
4917
4956
|
import { useEffect as useEffect7, useRef as useRef2 } from "react";
|
|
4918
4957
|
var DEFAULT_EVENTS = ["mousedown", "touchstart"];
|
|
@@ -7636,6 +7675,7 @@ export {
|
|
|
7636
7675
|
useGetRowIds,
|
|
7637
7676
|
useListData,
|
|
7638
7677
|
useMenu,
|
|
7678
|
+
useMenuItem,
|
|
7639
7679
|
useProfile,
|
|
7640
7680
|
useSelectionState,
|
|
7641
7681
|
useStorageState,
|
package/dist/widget.js
CHANGED
|
@@ -4126,6 +4126,7 @@ __export(hooks_exports, {
|
|
|
4126
4126
|
useDetail: () => useDetail,
|
|
4127
4127
|
useListData: () => useListData,
|
|
4128
4128
|
useMenu: () => useMenu,
|
|
4129
|
+
useMenuItem: () => useMenuItem,
|
|
4129
4130
|
useProfile: () => useProfile,
|
|
4130
4131
|
useUser: () => useUser,
|
|
4131
4132
|
useViewV2: () => useViewV2
|
|
@@ -4909,6 +4910,43 @@ __export(utils_exports, {
|
|
|
4909
4910
|
});
|
|
4910
4911
|
__reExport(utils_exports, require("@fctc/interface-logic/utils"));
|
|
4911
4912
|
|
|
4913
|
+
// src/hooks/core/use-menu-item.tsx
|
|
4914
|
+
var useMenuItem = (props) => {
|
|
4915
|
+
const { menu, activeMenuId } = props;
|
|
4916
|
+
const model = menu?.action?.res_model;
|
|
4917
|
+
const aid = menu?.action?.id?.id;
|
|
4918
|
+
const id = menu?.id;
|
|
4919
|
+
const context = (0, import_environment6.getEnv)().context;
|
|
4920
|
+
const queryActionDetail = (0, import_hooks10.useGetActionDetail)({
|
|
4921
|
+
aid,
|
|
4922
|
+
id,
|
|
4923
|
+
model,
|
|
4924
|
+
context,
|
|
4925
|
+
enabled: true,
|
|
4926
|
+
queryKey: [`action-${aid}`]
|
|
4927
|
+
}).data;
|
|
4928
|
+
const [path, setPath] = (0, import_react12.useState)("");
|
|
4929
|
+
const handleClick = () => {
|
|
4930
|
+
if (location?.pathname === "/list/menu" && activeMenuId === menu?.id) {
|
|
4931
|
+
return;
|
|
4932
|
+
}
|
|
4933
|
+
const hasListView = queryActionDetail.views.some(
|
|
4934
|
+
([id2, type]) => type === "list"
|
|
4935
|
+
);
|
|
4936
|
+
const viewType = hasListView ? "list" : "form";
|
|
4937
|
+
const isAccountPayment = menu?.action?.res_model === "account.payment" && menu?.action?.id?.id === 1551;
|
|
4938
|
+
const isConvertCurrencyMenu = menu?.action?.res_model === "currency.convert" && menu?.action?.id?.id === 1562;
|
|
4939
|
+
const path2 = (0, utils_exports.formatUrlPath)({
|
|
4940
|
+
viewType,
|
|
4941
|
+
actionPath: isConvertCurrencyMenu ? "menu" : isAccountPayment ? "menu" : menu?.action?.path || "menu",
|
|
4942
|
+
aid: menu?.action?.id?.id,
|
|
4943
|
+
model: queryActionDetail.res_model
|
|
4944
|
+
});
|
|
4945
|
+
setPath(path2);
|
|
4946
|
+
};
|
|
4947
|
+
return { handleClick, path, queryActionDetail };
|
|
4948
|
+
};
|
|
4949
|
+
|
|
4912
4950
|
// src/hooks/utils/use-click-outside.ts
|
|
4913
4951
|
var import_react13 = require("react");
|
|
4914
4952
|
var DEFAULT_EVENTS = ["mousedown", "touchstart"];
|
package/dist/widget.mjs
CHANGED
|
@@ -4106,6 +4106,7 @@ __export(hooks_exports, {
|
|
|
4106
4106
|
useDetail: () => useDetail,
|
|
4107
4107
|
useListData: () => useListData,
|
|
4108
4108
|
useMenu: () => useMenu,
|
|
4109
|
+
useMenuItem: () => useMenuItem,
|
|
4109
4110
|
useProfile: () => useProfile,
|
|
4110
4111
|
useUser: () => useUser,
|
|
4111
4112
|
useViewV2: () => useViewV2
|
|
@@ -4913,6 +4914,43 @@ __export(utils_exports, {
|
|
|
4913
4914
|
__reExport(utils_exports, utils_star);
|
|
4914
4915
|
import * as utils_star from "@fctc/interface-logic/utils";
|
|
4915
4916
|
|
|
4917
|
+
// src/hooks/core/use-menu-item.tsx
|
|
4918
|
+
var useMenuItem = (props) => {
|
|
4919
|
+
const { menu, activeMenuId } = props;
|
|
4920
|
+
const model = menu?.action?.res_model;
|
|
4921
|
+
const aid = menu?.action?.id?.id;
|
|
4922
|
+
const id = menu?.id;
|
|
4923
|
+
const context = getEnv6().context;
|
|
4924
|
+
const queryActionDetail = useGetActionDetail({
|
|
4925
|
+
aid,
|
|
4926
|
+
id,
|
|
4927
|
+
model,
|
|
4928
|
+
context,
|
|
4929
|
+
enabled: true,
|
|
4930
|
+
queryKey: [`action-${aid}`]
|
|
4931
|
+
}).data;
|
|
4932
|
+
const [path, setPath] = useState6("");
|
|
4933
|
+
const handleClick = () => {
|
|
4934
|
+
if (location?.pathname === "/list/menu" && activeMenuId === menu?.id) {
|
|
4935
|
+
return;
|
|
4936
|
+
}
|
|
4937
|
+
const hasListView = queryActionDetail.views.some(
|
|
4938
|
+
([id2, type]) => type === "list"
|
|
4939
|
+
);
|
|
4940
|
+
const viewType = hasListView ? "list" : "form";
|
|
4941
|
+
const isAccountPayment = menu?.action?.res_model === "account.payment" && menu?.action?.id?.id === 1551;
|
|
4942
|
+
const isConvertCurrencyMenu = menu?.action?.res_model === "currency.convert" && menu?.action?.id?.id === 1562;
|
|
4943
|
+
const path2 = (0, utils_exports.formatUrlPath)({
|
|
4944
|
+
viewType,
|
|
4945
|
+
actionPath: isConvertCurrencyMenu ? "menu" : isAccountPayment ? "menu" : menu?.action?.path || "menu",
|
|
4946
|
+
aid: menu?.action?.id?.id,
|
|
4947
|
+
model: queryActionDetail.res_model
|
|
4948
|
+
});
|
|
4949
|
+
setPath(path2);
|
|
4950
|
+
};
|
|
4951
|
+
return { handleClick, path, queryActionDetail };
|
|
4952
|
+
};
|
|
4953
|
+
|
|
4916
4954
|
// src/hooks/utils/use-click-outside.ts
|
|
4917
4955
|
import { useEffect as useEffect8, useRef as useRef3 } from "react";
|
|
4918
4956
|
var DEFAULT_EVENTS = ["mousedown", "touchstart"];
|