@wltech/hooks
Advanced tools
Comparing version 0.0.9 to 0.0.10
# @wltech/mobile-hooks | ||
## 0.0.10 | ||
### Patch Changes | ||
- 修改资料的 hooks | ||
## 0.0.9 | ||
@@ -4,0 +10,0 @@ |
{ | ||
"name": "@wltech/hooks", | ||
"version": "0.0.9", | ||
"version": "0.0.10", | ||
"private": false, | ||
@@ -5,0 +5,0 @@ "description": "", |
type TMaterialMultipleChooseParams = { | ||
isSelectAll: boolean; | ||
isWeb302: boolean; | ||
@@ -11,5 +12,6 @@ isSingle: boolean; | ||
type TOperationType = "send" | "copy" | "bindCode" | "move" | "edit" | "delete"; | ||
type TMaterialMultipleChooseReturn = { | ||
type: string; | ||
iconType: string; | ||
type: TOperationType; | ||
title: string; | ||
@@ -37,2 +39,5 @@ visible: boolean; | ||
展示操作项:复制链接、发送、悬浮窗 | ||
全选状态 | ||
管理员展示操作项:悬浮窗 | ||
非管理员展示操作项:悬浮窗,选择分组,删除 | ||
*/ | ||
@@ -42,12 +47,11 @@ export const useMaterialMultipleChoose = ( | ||
): TMaterialMultipleChooseReturn[] => { | ||
console.log(params); | ||
const { isUserOrCorp, isEditable, isManager, isSingle, isWeb302 } = params; | ||
const { isUserOrCorp, isEditable, isManager, isSingle, isWeb302, isSelectAll } = params; | ||
const isUser = isUserOrCorp === "user"; | ||
const isCorp = isUserOrCorp === "corp"; | ||
const isTopAuth = isManager; | ||
const commonAuth = (isUser && isTopAuth) || isEditable; | ||
return [ | ||
let list = [ | ||
{ | ||
id: "1", | ||
type: "send", | ||
iconType: "shareLine", | ||
title: "发送", | ||
@@ -59,3 +63,2 @@ visible: isSingle, | ||
type: "copy", | ||
iconType: "link", | ||
title: "复制链接", | ||
@@ -67,3 +70,2 @@ visible: isSingle, | ||
type: "bindCode", | ||
iconType: "qrCodeFill", | ||
title: "悬浮窗", | ||
@@ -75,3 +77,2 @@ visible: ((isSingle && !isEditable) || !isSingle) && !isWeb302, | ||
type: "move", | ||
iconType: "folderShared", | ||
title: "选择分组", | ||
@@ -83,3 +84,2 @@ visible: commonAuth, | ||
type: "edit", | ||
iconType: "edit", | ||
title: "编辑", | ||
@@ -91,3 +91,2 @@ visible: isSingle && commonAuth, | ||
type: "delete", | ||
iconType: "trash", | ||
title: "删除", | ||
@@ -97,2 +96,26 @@ visible: commonAuth, | ||
]; | ||
/** | ||
* 企业库全选状态 | ||
管理员展示操作项:悬浮窗,选择分组,删除 | ||
非管理员展示操作项:悬浮窗 | ||
*/ | ||
if (isSelectAll && isCorp) { | ||
const showTypeList: TOperationType[] = isManager | ||
? ["bindCode", "move", "delete"] | ||
: ["bindCode"]; | ||
list = list.reduce((acc, item) => { | ||
if (showTypeList.includes(item.type as TOperationType)) { | ||
acc.push({ | ||
id: item.id, | ||
type: item.type as TOperationType, | ||
title: item.title, | ||
visible: true, | ||
}); | ||
} | ||
return acc; | ||
}, [] as TMaterialMultipleChooseReturn[]); | ||
} | ||
return list as TMaterialMultipleChooseReturn[]; | ||
}; | ||
@@ -117,3 +140,3 @@ | ||
*/ | ||
export const useMaterialSingleChoose = ( | ||
export const useGetMaterialMoreOptions = ( | ||
params: TMaterialSingleChooseParams | ||
@@ -120,0 +143,0 @@ ): TMaterialSingleChooseReturn[] => { |
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
10709
342