@wltech/hooks
Advanced tools
Comparing version 0.0.7 to 0.0.8
# @wltech/mobile-hooks | ||
## 0.0.8 | ||
### Patch Changes | ||
- 部门库 Bug 修改 | ||
## 0.0.7 | ||
@@ -4,0 +10,0 @@ |
{ | ||
"name": "@wltech/hooks", | ||
"version": "0.0.7", | ||
"version": "0.0.8", | ||
"private": false, | ||
@@ -5,0 +5,0 @@ "description": "", |
@@ -1,2 +0,3 @@ | ||
type TMaterialOperAuthParams = { | ||
type TMaterialMultipleChooseParams = { | ||
isWeb302: boolean; | ||
isSingle: boolean; | ||
@@ -10,6 +11,3 @@ isLeader: boolean; | ||
/** | ||
* 多选物料 | ||
*/ | ||
type MaterialMultipleChooseReturn = { | ||
type TMaterialMultipleChooseReturn = { | ||
type: string; | ||
@@ -23,2 +21,3 @@ iconType: string; | ||
/** | ||
* 多选物料 | ||
* 个人库的逻辑 | ||
@@ -41,5 +40,5 @@ 多选一个 | ||
export const useMaterialMultipleChoose = ( | ||
params: TMaterialOperAuthParams | ||
): MaterialMultipleChooseReturn[] => { | ||
const { isUserOrCorp, isEditable, isManager, isSingle } = params; | ||
params: TMaterialMultipleChooseParams | ||
): TMaterialMultipleChooseReturn[] => { | ||
const { isUserOrCorp, isEditable, isManager, isSingle, isWeb302 } = params; | ||
const isUser = isUserOrCorp === "user"; | ||
@@ -68,3 +67,3 @@ const isTopAuth = isManager; | ||
title: "悬浮窗", | ||
visible: (isSingle && !isEditable) || !isSingle, | ||
visible: ((isSingle && !isEditable) || !isSingle) && !isWeb302, | ||
}, | ||
@@ -94,1 +93,79 @@ { | ||
}; | ||
type TMaterialSingleChooseParams = { | ||
hasHistory: boolean; | ||
isWeb302: boolean; | ||
isEditable: boolean; | ||
isMobileOrPC: "mobile" | "pc"; | ||
isUserOrCorp: "user" | "corp"; | ||
}; | ||
type TMaterialSingleChooseReturn = { | ||
name: string; | ||
value: string; | ||
visible: boolean; | ||
}; | ||
/** | ||
* 右键更多操作物料 | ||
*/ | ||
export const useMaterialSingleChoose = ( | ||
params: TMaterialSingleChooseParams | ||
): TMaterialSingleChooseReturn[] => { | ||
const { isUserOrCorp, isEditable, isWeb302, isMobileOrPC, hasHistory } = params; | ||
const isUser = isUserOrCorp === "user"; | ||
const isCorp = isUserOrCorp === "corp"; | ||
const isPC = isMobileOrPC === "pc"; | ||
const commonAuth = (isCorp && isEditable) || isUser; | ||
const list = [ | ||
{ | ||
name: "设置个人悬浮窗", | ||
value: "bindLiveCode", | ||
visible: isCorp && !isWeb302, //只有企业库的才可以绑定个人智能码并且非302网页 | ||
}, | ||
{ | ||
name: "复制资料链接", | ||
value: "copy", | ||
visible: true, | ||
}, | ||
{ | ||
name: "选择分组", | ||
value: "move", | ||
/** | ||
* 个人库资料 | ||
* 企业库资料并且是管理员 | ||
* pc工作台隐藏 | ||
*/ | ||
visible: commonAuth && !isPC, | ||
}, | ||
{ | ||
name: "历史版本", | ||
value: "history", | ||
/** | ||
* hasMaterialHistory接口返回true才显示 | ||
* pc工作台隐藏 | ||
*/ | ||
visible: hasHistory && !isPC && commonAuth, | ||
}, | ||
{ | ||
name: "编辑", | ||
value: "edit", | ||
/** | ||
* 个人库资料 | ||
* 企业库资料并且是管理员 | ||
* 该物料属于自己的才可以编辑 | ||
*/ | ||
visible: commonAuth, | ||
}, | ||
{ | ||
name: "删除", | ||
value: "delete", | ||
/** | ||
* 个人库资料 | ||
* 企业库资料并且是管理员 | ||
*/ | ||
visible: commonAuth, | ||
}, | ||
]; | ||
return list.filter((res) => res.visible); | ||
}; |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9788
320