@axelor/aos-mobile-dms 9.0.13 → 9.1.0
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/components/atoms/DocumentCard/DocumentCard.js +5 -6
- package/lib/components/atoms/DocumentCard/DocumentCard.js.map +1 -1
- package/lib/components/molecules/DocumentActionCard/DocumentActionCard.d.ts +3 -5
- package/lib/components/molecules/DocumentActionCard/DocumentActionCard.js +58 -57
- package/lib/components/molecules/DocumentActionCard/DocumentActionCard.js.map +1 -1
- package/lib/components/templates/DocumentList/DocumentList.js +8 -42
- package/lib/components/templates/DocumentList/DocumentList.js.map +1 -1
- package/lib/hooks/use-dms-document-actions.d.ts +1 -0
- package/lib/hooks/use-dms-document-actions.js +130 -0
- package/lib/hooks/use-dms-document-actions.js.map +1 -0
- package/lib/hooks/use-dms-header-actions.js +2 -0
- package/lib/hooks/use-dms-header-actions.js.map +1 -1
- package/lib/i18n/en.json +1 -0
- package/lib/i18n/fr.json +1 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +7 -5
- package/lib/index.js.map +1 -1
- package/lib/models/index.d.ts +1 -0
- package/lib/models/index.js +1 -0
- package/lib/models/index.js.map +1 -1
- package/lib/models/typeObjects.d.ts +2 -0
- package/lib/models/typeObjects.js +34 -0
- package/lib/models/typeObjects.js.map +1 -0
- package/lib/providers/DocumentActionsProvider.d.ts +21 -0
- package/lib/providers/DocumentActionsProvider.js +77 -0
- package/lib/providers/DocumentActionsProvider.js.map +1 -0
- package/lib/providers/index.d.ts +1 -0
- package/lib/providers/index.js +19 -0
- package/lib/providers/index.js.map +1 -0
- package/package.json +3 -3
|
@@ -17,22 +17,21 @@
|
|
|
17
17
|
*/
|
|
18
18
|
import React, { useMemo } from 'react';
|
|
19
19
|
import { StyleSheet } from 'react-native';
|
|
20
|
-
import { formatDateTime,
|
|
20
|
+
import { formatDateTime, useFileApi, useTranslator, } from '@axelor/aos-mobile-core';
|
|
21
21
|
import { LabelText, ObjectCard, useThemeColor } from '@axelor/aos-mobile-ui';
|
|
22
22
|
import { File } from '../../../types';
|
|
23
23
|
const DocumentCard = ({ style, document, customOnPress }) => {
|
|
24
24
|
const I18n = useTranslator();
|
|
25
25
|
const Colors = useThemeColor();
|
|
26
|
-
const
|
|
26
|
+
const fileApi = useFileApi();
|
|
27
27
|
const fileColor = useMemo(() => File.getFileColor(document.metaFile?.fileName, Colors).background, [Colors, document.metaFile?.fileName]);
|
|
28
28
|
const styles = useMemo(() => getStyles(fileColor), [fileColor]);
|
|
29
29
|
const addedOn = useMemo(() => `${I18n.t('Base_AddedOn')} ${formatDateTime(document.createdOn, I18n.t('Base_DateTimeFormat'))}`, [I18n, document.createdOn]);
|
|
30
30
|
const handleOpenFile = async () => {
|
|
31
|
-
await
|
|
32
|
-
fileName: document.metaFile?.fileName,
|
|
31
|
+
await fileApi.openInExternalApp({
|
|
33
32
|
id: document.metaFile?.id,
|
|
34
|
-
|
|
35
|
-
}
|
|
33
|
+
fileName: document.metaFile?.fileName,
|
|
34
|
+
});
|
|
36
35
|
};
|
|
37
36
|
return (<ObjectCard style={[styles.card, style]} showArrow={false} onPress={customOnPress ?? handleOpenFile} upperTexts={{
|
|
38
37
|
items: [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DocumentCard.js","sourceRoot":"","sources":["../../../../src/components/atoms/DocumentCard/DocumentCard.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,EAAC,OAAO,EAAC,MAAM,OAAO,CAAC;AACrC,OAAO,EAAC,UAAU,EAAC,MAAM,cAAc,CAAC;AACxC,OAAO,EACL,cAAc,EACd,
|
|
1
|
+
{"version":3,"file":"DocumentCard.js","sourceRoot":"","sources":["../../../../src/components/atoms/DocumentCard/DocumentCard.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,EAAC,OAAO,EAAC,MA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Q,EAAE,QAAQ;SACtC,CAAC,CAAC;IACL,CAAC,CAAC;IAEF,OAAO,CACL,CAAC,UAAU,CACT,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAC5B,SAAS,CAAC,CAAC,KAAK,CAAC,CACjB,OAAO,CAAC,CAAC,aAAa,IAAI,cAAc,CAAC,CACzC,UAAU,CAAC,CAAC;YACV,KAAK,EAAE;gBACL;oBACE,eAAe,EAAE,CACf,CAAC,SAAS,CACR,QAAQ,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAC9C,KAAK,CAAC,CAAC,SAAS,CAAC,CACjB,KAAK,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CACzB,IAAI,CAAC,CAAC,EAAE,CAAC,CACT,QAAQ,CAAC,CAAC,EAAE,CAAC,CACb,WAAW,EACX,CACH;iBACF;gBACD;oBACE,QAAQ,EAAE,aAAa;oBACvB,aAAa,EAAE,QAAQ,CAAC,SAAS,EAAE,QAAQ;iBAC5C;gBACD;oBACE,QAAQ,EAAE,gBAAgB;oBAC1B,aAAa,EAAE,OAAO;iBACvB;aACF;SACF,CAAC,EACF,CACH,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,SAAS,GAAG,CAAC,WAAmB,EAAE,EAAE,CACxC,UAAU,CAAC,MAAM,CAAC;IAChB,IAAI,EAAE;QACJ,cAAc,EAAE,CAAC;QACjB,gBAAgB,EAAE,CAAC;QACnB,WAAW,EAAE,CAAC;QACd,eAAe,EAAE,CAAC;QAClB,eAAe,EAAE,WAAW;KAC7B;CACF,CAAC,CAAC;AAEL,eAAe,YAAY,CAAC"}
|
|
@@ -2,11 +2,9 @@ import React from 'react';
|
|
|
2
2
|
interface DocumentActionCardProps {
|
|
3
3
|
document: any;
|
|
4
4
|
handleRefresh?: () => void;
|
|
5
|
-
disableFavorites?: boolean;
|
|
6
|
-
disableDownload?: boolean;
|
|
7
|
-
disableEdit?: boolean;
|
|
8
|
-
disabledDelete?: boolean;
|
|
9
5
|
customOnPress?: () => void;
|
|
6
|
+
disableActions?: boolean;
|
|
7
|
+
disabledActionKeys?: string[];
|
|
10
8
|
}
|
|
11
|
-
declare const DocumentActionCard: ({ document, handleRefresh,
|
|
9
|
+
declare const DocumentActionCard: ({ document, handleRefresh, customOnPress, disableActions, disabledActionKeys, }: DocumentActionCardProps) => React.JSX.Element;
|
|
12
10
|
export default DocumentActionCard;
|
|
@@ -15,67 +15,68 @@
|
|
|
15
15
|
* You should have received a copy of the GNU Affero General Public License
|
|
16
16
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
17
|
*/
|
|
18
|
-
import React, { useCallback, useMemo } from 'react';
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
18
|
+
import React, { useCallback, useMemo, useState } from 'react';
|
|
19
|
+
import { StyleSheet } from 'react-native';
|
|
20
|
+
import { useFileApi, useTranslator } from '@axelor/aos-mobile-core';
|
|
21
|
+
import { ActionSheet } from '@axelor/aos-mobile-ui';
|
|
22
|
+
import { useDocumentActions } from '../../../providers';
|
|
22
23
|
import { DocumentCard } from '../../atoms';
|
|
23
|
-
const DocumentActionCard = ({ document, handleRefresh,
|
|
24
|
+
const DocumentActionCard = ({ document, handleRefresh, customOnPress, disableActions = false, disabledActionKeys, }) => {
|
|
24
25
|
const I18n = useTranslator();
|
|
25
|
-
const
|
|
26
|
-
const
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
26
|
+
const fileApi = useFileApi();
|
|
27
|
+
const { getLeafActions } = useDocumentActions();
|
|
28
|
+
const [isActionsVisible, setIsActionsVisible] = useState(false);
|
|
29
|
+
const handleOpenFile = useCallback(async () => {
|
|
30
|
+
await fileApi.openInExternalApp({
|
|
31
|
+
id: document.metaFile?.id,
|
|
32
|
+
fileName: document.metaFile?.fileName,
|
|
33
|
+
});
|
|
34
|
+
}, [fileApi, document]);
|
|
35
|
+
const actionList = useMemo(() => {
|
|
36
|
+
const providerActions = disableActions
|
|
37
|
+
? []
|
|
38
|
+
: (getLeafActions(document, { handleRefresh })?.filter(_action => _action.key == null || !disabledActionKeys?.includes(_action.key)) ?? []);
|
|
39
|
+
return [
|
|
39
40
|
{
|
|
40
|
-
iconName:
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
onPress: () => dispatch((isFavorite ? removeFromFavorites : addToFavorites)({
|
|
44
|
-
documentId: document.id,
|
|
45
|
-
userId: user?.id,
|
|
46
|
-
})),
|
|
47
|
-
hidden: disableFavorites || !mobileSettings?.isFavoritesManagementEnabled,
|
|
48
|
-
disabled: readonly,
|
|
41
|
+
iconName: 'eye-fill',
|
|
42
|
+
helper: I18n.t('Dms_Open'),
|
|
43
|
+
onPress: handleOpenFile,
|
|
49
44
|
},
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
<DocumentCard document={document} customOnPress={customOnPress}/>
|
|
78
|
-
</ActionCard>);
|
|
45
|
+
...providerActions,
|
|
46
|
+
];
|
|
47
|
+
}, [
|
|
48
|
+
I18n,
|
|
49
|
+
handleOpenFile,
|
|
50
|
+
disableActions,
|
|
51
|
+
disabledActionKeys,
|
|
52
|
+
getLeafActions,
|
|
53
|
+
document,
|
|
54
|
+
handleRefresh,
|
|
55
|
+
]);
|
|
56
|
+
const visibleActions = useMemo(() => actionList.filter(action => !action.hidden), [actionList]);
|
|
57
|
+
const handleCardPress = useCallback(() => {
|
|
58
|
+
if (customOnPress != null) {
|
|
59
|
+
customOnPress?.();
|
|
60
|
+
}
|
|
61
|
+
else if (visibleActions.length > 1) {
|
|
62
|
+
setIsActionsVisible(true);
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
visibleActions[0]?.onPress();
|
|
66
|
+
}
|
|
67
|
+
}, [customOnPress, visibleActions]);
|
|
68
|
+
return (<>
|
|
69
|
+
<DocumentCard style={styles.container} document={document} customOnPress={handleCardPress}/>
|
|
70
|
+
<ActionSheet visible={isActionsVisible} title={document.fileName} actionList={visibleActions} onClose={() => setIsActionsVisible(false)}/>
|
|
71
|
+
</>);
|
|
79
72
|
};
|
|
73
|
+
const styles = StyleSheet.create({
|
|
74
|
+
container: {
|
|
75
|
+
flex: 1,
|
|
76
|
+
width: '95%',
|
|
77
|
+
alignSelf: 'center',
|
|
78
|
+
marginVertical: 2,
|
|
79
|
+
},
|
|
80
|
+
});
|
|
80
81
|
export default DocumentActionCard;
|
|
81
82
|
//# sourceMappingURL=DocumentActionCard.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DocumentActionCard.js","sourceRoot":"","sources":["../../../../src/components/molecules/DocumentActionCard/DocumentActionCard.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,EAAC,WAAW,EAAE,OAAO,EAAC,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"DocumentActionCard.js","sourceRoot":"","sources":["../../../../src/components/molecules/DocumentActionCard/DocumentActionCard.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,EAAC,WAAW,EAAE,OAAO,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AAC5D,OAAO,EAAC,UAAU,EAAC,MAAM,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MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IAC/B,SAAS,EAAE;QACT,IAAI,EAAE,CAAC;QACP,KAAK,EAAE,KAAK;QACZ,SAAS,EAAE,QAAQ;QACnB,cAAc,EAAE,CAAC;KAClB;CACF,CAAC,CAAC;AAEH,eAAe,kBAAkB,CAAC"}
|
|
@@ -16,30 +16,25 @@
|
|
|
16
16
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
17
|
*/
|
|
18
18
|
import React, { useEffect, useMemo, useState } from 'react';
|
|
19
|
-
import { headerActionsProvider, SearchTreeView, useNavigation,
|
|
19
|
+
import { headerActionsProvider, SearchTreeView, useNavigation, useSelector, useTranslator, usePermitted, } from '@axelor/aos-mobile-core';
|
|
20
20
|
import { ChipSelect, Screen, useThemeColor } from '@axelor/aos-mobile-ui';
|
|
21
|
-
import {
|
|
21
|
+
import { searchDocument, searchDirectory } from '../../../features/documentSlice';
|
|
22
22
|
import { searchDocumentApi } from '../../../api';
|
|
23
23
|
import { AuthorFilter, DirectoryCard } from '../../atoms';
|
|
24
24
|
import { DocumentActionCard } from '../../molecules';
|
|
25
|
+
import { useDocumentActions } from '../../../providers';
|
|
25
26
|
import { File } from '../../../types';
|
|
26
27
|
const DocumentList = ({ defaultParent, isAttachedFilesList = false, hideActions = false, customOnPress, }) => {
|
|
27
28
|
const I18n = useTranslator();
|
|
28
29
|
const Colors = useThemeColor();
|
|
29
30
|
const navigation = useNavigation();
|
|
30
|
-
const {
|
|
31
|
-
|
|
32
|
-
});
|
|
33
|
-
const dispatch = useDispatch();
|
|
31
|
+
const { getBranchActions } = useDocumentActions();
|
|
32
|
+
const { canCreate } = usePermitted({ modelName: 'com.axelor.dms.db.DMSFile' });
|
|
34
33
|
const [author, setAuthor] = useState(null);
|
|
35
34
|
const [selectedExtensions, setSelectedExtensions] = useState([]);
|
|
36
35
|
const [parentList, setParentList] = useState([]);
|
|
37
|
-
const { loadingDocument, moreLoadingDocument, isListEndDocument, documentList, directoryList, } = useSelector(
|
|
38
|
-
const
|
|
39
|
-
const { user } = useSelector(state => state.user);
|
|
40
|
-
const sliceParentFunctionData = useMemo(() => ({
|
|
41
|
-
authorId: author?.id,
|
|
42
|
-
}), [author?.id]);
|
|
36
|
+
const { loadingDocument, moreLoadingDocument, isListEndDocument, documentList, directoryList, } = useSelector(state => state.dms_document);
|
|
37
|
+
const sliceParentFunctionData = useMemo(() => ({ authorId: author?.id }), [author?.id]);
|
|
43
38
|
const sliceFunctionData = useMemo(() => ({
|
|
44
39
|
authorId: author?.id,
|
|
45
40
|
extensions: selectedExtensions.map(_extension => _extension.key),
|
|
@@ -67,36 +62,7 @@ const DocumentList = ({ defaultParent, isAttachedFilesList = false, hideActions
|
|
|
67
62
|
authorId: author?.id,
|
|
68
63
|
extensions: selectedExtensions.map(_extension => _extension.key),
|
|
69
64
|
parentDirectoryId: branchId,
|
|
70
|
-
})} branchCondition={item => item.isDirectory} displayParentSearchValue={item => item.fileName} searchParentPlaceholder={I18n.t('Dms_ParentFolder')} searchPlaceholder={I18n.t('Base_Search')} isHideableParentSearch={false} parentFieldName="parent" renderBranch={({ item }) => <DirectoryCard directory={item}/>} getBranchActions={branch => {
|
|
71
|
-
if (hideActions) {
|
|
72
|
-
return null;
|
|
73
|
-
}
|
|
74
|
-
const isFavorite = user?.favouriteFolderSet.some(({ id }) => id === branch.item.id);
|
|
75
|
-
const sliceFunction = isFavorite
|
|
76
|
-
? removeFromFavorites
|
|
77
|
-
: addToFavorites;
|
|
78
|
-
return [
|
|
79
|
-
{
|
|
80
|
-
iconName: isFavorite ? 'star-fill' : 'star',
|
|
81
|
-
iconColor: Colors.progressColor.background,
|
|
82
|
-
helper: I18n.t('Dms_AddToFavorites'),
|
|
83
|
-
onPress: () => dispatch(sliceFunction({
|
|
84
|
-
documentId: branch.item.id,
|
|
85
|
-
userId: user?.id,
|
|
86
|
-
})),
|
|
87
|
-
hidden: !mobileSettings?.isFavoritesManagementEnabled,
|
|
88
|
-
disabled: readonly,
|
|
89
|
-
},
|
|
90
|
-
{
|
|
91
|
-
iconName: 'pencil-fill',
|
|
92
|
-
helper: I18n.t('Dms_Rename'),
|
|
93
|
-
onPress: () => navigation.navigate('DocumentFormScreen', {
|
|
94
|
-
document: branch.item,
|
|
95
|
-
}),
|
|
96
|
-
hidden: !mobileSettings?.isRenamingAllowed || readonly,
|
|
97
|
-
},
|
|
98
|
-
];
|
|
99
|
-
}} renderLeaf={({ item }) => (<DocumentActionCard document={item} handleRefresh={() => setSelectedExtensions(current => [...current])} disableFavorites={hideActions} disableDownload={hideActions} disableEdit={hideActions} disabledDelete={hideActions} customOnPress={customOnPress ? () => customOnPress(item) : undefined}/>)} headerChildren={<AuthorFilter author={author} setAuthor={setAuthor}/>} chipComponent={<ChipSelect mode="multi" selectionItems={File.getFileExtensionList(Colors)} onChangeValue={setSelectedExtensions} showClearButton/>} displayBreadcrumb defaultParent={defaultParent} manageParentFilter={!isAttachedFilesList} onParentChange={setParentList}/>
|
|
65
|
+
})} branchCondition={item => item.isDirectory} displayParentSearchValue={item => item.fileName} searchParentPlaceholder={I18n.t('Dms_ParentFolder')} searchPlaceholder={I18n.t('Base_Search')} isHideableParentSearch={false} parentFieldName="parent" renderBranch={({ item }) => <DirectoryCard directory={item}/>} getBranchActions={branch => hideActions ? [] : getBranchActions(branch)} renderLeaf={({ item }) => (<DocumentActionCard document={item} handleRefresh={() => setSelectedExtensions(current => [...current])} disableActions={hideActions} customOnPress={customOnPress ? () => customOnPress(item) : undefined}/>)} headerChildren={<AuthorFilter author={author} setAuthor={setAuthor}/>} chipComponent={<ChipSelect mode="multi" selectionItems={File.getFileExtensionList(Colors)} onChangeValue={setSelectedExtensions} showClearButton/>} displayBreadcrumb defaultParent={defaultParent} manageParentFilter={!isAttachedFilesList} onParentChange={setParentList}/>
|
|
100
66
|
</Screen>);
|
|
101
67
|
};
|
|
102
68
|
export default DocumentList;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DocumentList.js","sourceRoot":"","sources":["../../../../src/components/templates/DocumentList/DocumentList.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,EAAC,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AAC1D,OAAO,EACL,qBAAqB,EACrB,cAAc,EACd,aAAa,EACb,WAAW,EACX,
|
|
1
|
+
{"version":3,"file":"DocumentList.js","sourceRoot":"","sources":["../../../../src/components/templates/DocumentList/DocumentList.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,EAAC,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AAC1D,OAAO,EACL,qBAAqB,EACrB,cAAc,EACd,aAAa,EACb,WAAW,EACX,aAAa,EACb,YAAY,GACb,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAC,UAAU,EAAE,MAAM,EAAE,aAAa,EAAC,MAAM,uBAAuB,CAAC;AACxE,OAAO,EAAC,cAAc,EAAE,eAAe,EAAC,MAAM,iCAAiC,CAAC;AAChF,OAAO,EAAC,iBAAiB,EAAC,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAC,YAAY,EAAE,aAAa,EAAC,MAAM,aAAa,CAAC;AACxD,OAAO,EAAC,kBAAkB,EAAC,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAC,kBAAkB,EAAC,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAC,IAAI,EAAC,MAAM,gBAAgB,CAAC;AASpC,MAAM,YAAY,GAAG,CAAC,EACpB,aAAa,EACb,mBAAmB,GAAG,KAAK,EAC3B,WAAW,GAAG,KAAK,EACnB,aAAa,GACK,EAAE,EAAE;IACtB,MAAM,IAAI,GAAG,aAAa,EAAE,CAAC;IAC7B,MAAM,MAAM,GAAG,aAAa,EAAE,CAAC;IAC/B,MAAM,UAAU,GAAG,aAAa,EAAE,CAAC;IACnC,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Aa,CAAC,CAC7B,kBAAkB,CAAC,CAAC,CAAC,mBAAmB,CAAC,CACzC,cAAc,CAAC,CAAC,aAAa,CAAC,EAElC;IAAA,EAAE,MAAM,CAAC,CACV,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useDmsDocumentActions: () => void;
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Axelor Business Solutions
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2026 Axelor (<http://axelor.com>).
|
|
5
|
+
*
|
|
6
|
+
* This program is free software: you can redistribute it and/or modify
|
|
7
|
+
* it under the terms of the GNU Affero General Public License, version 3,
|
|
8
|
+
* as published by the Free Software Foundation.
|
|
9
|
+
*
|
|
10
|
+
* This program is distributed in the hope that it will be useful,
|
|
11
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
+
* GNU Affero General Public License for more details.
|
|
14
|
+
*
|
|
15
|
+
* You should have received a copy of the GNU Affero General Public License
|
|
16
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
|
+
*/
|
|
18
|
+
import { useEffect } from 'react';
|
|
19
|
+
import { useDispatch, useFileApi, useNavigation, useOnline, usePermitted, useSelector, useTranslator, useTypes, } from '@axelor/aos-mobile-core';
|
|
20
|
+
import { useThemeColor } from '@axelor/aos-mobile-ui';
|
|
21
|
+
import { addToFavorites, deleteDocument, deleteFavoriteDocument, removeFromFavorites, } from '../features/documentSlice';
|
|
22
|
+
import { documentActionsProvider } from '../providers';
|
|
23
|
+
export const useDmsDocumentActions = () => {
|
|
24
|
+
const I18n = useTranslator();
|
|
25
|
+
const Colors = useThemeColor();
|
|
26
|
+
const navigation = useNavigation();
|
|
27
|
+
const fileApi = useFileApi();
|
|
28
|
+
const dispatch = useDispatch();
|
|
29
|
+
const { DMSFile } = useTypes();
|
|
30
|
+
const { readonly, canDelete } = usePermitted({
|
|
31
|
+
modelName: 'com.axelor.dms.db.DMSFile',
|
|
32
|
+
});
|
|
33
|
+
const { isConnected } = useOnline();
|
|
34
|
+
const { mobileSettings } = useSelector(state => state.appConfig);
|
|
35
|
+
const { user } = useSelector(state => state.user);
|
|
36
|
+
useEffect(() => {
|
|
37
|
+
documentActionsProvider.registerLeafActions('dms', (item, context) => {
|
|
38
|
+
if (item?.id == null)
|
|
39
|
+
return [];
|
|
40
|
+
const isFavorite = user?.favouriteFileSet?.some(({ id }) => id === item.id);
|
|
41
|
+
return [
|
|
42
|
+
{
|
|
43
|
+
key: DMSFile?.actionKey?.Favorite,
|
|
44
|
+
iconName: isFavorite ? 'star-fill' : 'star',
|
|
45
|
+
iconColor: Colors.progressColor.background,
|
|
46
|
+
helper: I18n.t('Dms_AddToFavorites'),
|
|
47
|
+
onPress: () => dispatch((isFavorite ? removeFromFavorites : addToFavorites)({
|
|
48
|
+
documentId: item.id,
|
|
49
|
+
userId: user?.id,
|
|
50
|
+
})),
|
|
51
|
+
hidden: !isConnected || !mobileSettings?.isFavoritesManagementEnabled,
|
|
52
|
+
disabled: readonly,
|
|
53
|
+
closeAfter: false,
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
key: DMSFile?.actionKey?.Download,
|
|
57
|
+
iconName: 'download',
|
|
58
|
+
helper: I18n.t('Dms_Download'),
|
|
59
|
+
onPress: () => fileApi.saveToDevice({
|
|
60
|
+
id: item.metaFile?.id,
|
|
61
|
+
fileName: item.metaFile?.fileName,
|
|
62
|
+
}),
|
|
63
|
+
hidden: !mobileSettings?.isDownloadAllowed,
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
key: DMSFile?.actionKey?.Rename,
|
|
67
|
+
iconName: 'pencil-fill',
|
|
68
|
+
helper: I18n.t('Dms_Rename'),
|
|
69
|
+
onPress: () => navigation.navigate('DocumentFormScreen', { document: item }),
|
|
70
|
+
hidden: !isConnected || !mobileSettings?.isRenamingAllowed || readonly,
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
key: DMSFile?.actionKey?.Delete,
|
|
74
|
+
iconName: 'trash-fill',
|
|
75
|
+
iconColor: Colors.errorColor.background,
|
|
76
|
+
helper: I18n.t('Dms_Delete'),
|
|
77
|
+
onPress: () => dispatch((isFavorite ? deleteFavoriteDocument : deleteDocument)({
|
|
78
|
+
documentId: item.id,
|
|
79
|
+
userId: user?.id,
|
|
80
|
+
})).then(() => context?.handleRefresh?.()),
|
|
81
|
+
hidden: !isConnected ||
|
|
82
|
+
!canDelete ||
|
|
83
|
+
!mobileSettings?.isFileDeletionAllowed,
|
|
84
|
+
},
|
|
85
|
+
];
|
|
86
|
+
});
|
|
87
|
+
documentActionsProvider.registerBranchActions('dms', branch => {
|
|
88
|
+
const item = branch?.item;
|
|
89
|
+
if (item?.id == null)
|
|
90
|
+
return [];
|
|
91
|
+
const isFavorite = user?.favouriteFolderSet?.some(({ id }) => id === item.id);
|
|
92
|
+
return [
|
|
93
|
+
{
|
|
94
|
+
key: DMSFile?.actionKey?.Favorite,
|
|
95
|
+
iconName: isFavorite ? 'star-fill' : 'star',
|
|
96
|
+
iconColor: Colors.progressColor.background,
|
|
97
|
+
helper: I18n.t('Dms_AddToFavorites'),
|
|
98
|
+
onPress: () => dispatch((isFavorite ? removeFromFavorites : addToFavorites)({
|
|
99
|
+
documentId: item.id,
|
|
100
|
+
userId: user?.id,
|
|
101
|
+
})),
|
|
102
|
+
hidden: !isConnected || !mobileSettings?.isFavoritesManagementEnabled,
|
|
103
|
+
disabled: readonly,
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
key: DMSFile?.actionKey?.Rename,
|
|
107
|
+
iconName: 'pencil-fill',
|
|
108
|
+
helper: I18n.t('Dms_Rename'),
|
|
109
|
+
onPress: () => navigation.navigate('DocumentFormScreen', { document: item }),
|
|
110
|
+
hidden: !isConnected || !mobileSettings?.isRenamingAllowed || readonly,
|
|
111
|
+
},
|
|
112
|
+
];
|
|
113
|
+
});
|
|
114
|
+
}, [
|
|
115
|
+
Colors,
|
|
116
|
+
DMSFile?.actionKey,
|
|
117
|
+
I18n,
|
|
118
|
+
canDelete,
|
|
119
|
+
dispatch,
|
|
120
|
+
fileApi,
|
|
121
|
+
isConnected,
|
|
122
|
+
mobileSettings,
|
|
123
|
+
navigation,
|
|
124
|
+
readonly,
|
|
125
|
+
user?.favouriteFileSet,
|
|
126
|
+
user?.favouriteFolderSet,
|
|
127
|
+
user?.id,
|
|
128
|
+
]);
|
|
129
|
+
};
|
|
130
|
+
//# sourceMappingURL=use-dms-document-actions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-dms-document-actions.js","sourceRoot":"","sources":["../../src/hooks/use-dms-document-actions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAC,SAAS,EAAC,MAAM,OAAO,CAAC;AAChC,OAAO,EACL,WAAW,EACX,UAAU,EACV,aAAa,EACb,SAAS,EACT,YAAY,EACZ,WAAW,EACX,aAAa,EACb,QAAQ,GACT,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAC,aAAa,EAAC,MAAM,uBAAuB,CAAC;AACpD,OAAO,EACL,cAAc,EACd,cAAc,EACd,sBAAsB,EACtB,mBAAmB,GACpB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAC,uBAAuB,EAAC,MAAM,cAAc,CAAC;AAErD,MAAM,CAAC,MAAM,qBAAqB,GAAG,GAAG,EAAE;IACxC,MAAM,IAAI,GAAG,aAAa,EAAE,CAAC;IAC7B,MAAM,MAAM,GAAG,aAAa,EAAE,CAAC;IAC/B,MAAM,UAAU,GAAG,aAAa,EAAE,CAAC;IACnC,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;IAC7B,MAAM,QAAQ,GAAQ,WAAW,EAAE,CAAC;IACpC,MAAM,EAAC,OAAO,EAAC,GAAG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,UAAU,CAAC,QAAQ,CAAC,oBAAoB,EAAE,EAAC,QAAQ,EAAE,IAAI,EAAC,CAAC;oBAC7D,MAAM,EACJ,CAAC,WAAW,IAAI,CAAC,cAAc,EAAE,iBAAiB,IAAI,QAAQ;iBACjE;aACF,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC,EAAE;QACD,MAAM;QACN,OAAO,EAAE,SAAS;QAClB,IAAI;QACJ,SAAS;QACT,QAAQ;QACR,OAAO;QACP,WAAW;QACX,cAAc;QACd,UAAU;QACV,QAAQ;QACR,IAAI,EAAE,gBAAgB;QACtB,IAAI,EAAE,kBAAkB;QACxB,IAAI,EAAE,EAAE;KACT,CAAC,CAAC;AACL,CAAC,CAAC"}
|
|
@@ -18,8 +18,10 @@
|
|
|
18
18
|
import { useEffect } from 'react';
|
|
19
19
|
import { headerActionsProvider, useNavigation, usePermitted, useSelector, useTranslator, } from '@axelor/aos-mobile-core';
|
|
20
20
|
import { getAction } from '../utils';
|
|
21
|
+
import { useDmsDocumentActions } from './use-dms-document-actions';
|
|
21
22
|
export const useDMSHeaders = () => {
|
|
22
23
|
useAttachedFilesGenericAction();
|
|
24
|
+
useDmsDocumentActions();
|
|
23
25
|
};
|
|
24
26
|
const useAttachedFilesGenericAction = () => {
|
|
25
27
|
const I18n = useTranslator();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-dms-header-actions.js","sourceRoot":"","sources":["../../src/hooks/use-dms-header-actions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAC,SAAS,EAAC,MAAM,OAAO,CAAC;AAChC,OAAO,EACL,qBAAqB,EACrB,aAAa,EACb,YAAY,EACZ,WAAW,EACX,aAAa,GACd,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAC,SAAS,EAAC,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"use-dms-header-actions.js","sourceRoot":"","sources":["../../src/hooks/use-dms-header-actions.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AC"}
|
package/lib/i18n/en.json
CHANGED
package/lib/i18n/fr.json
CHANGED
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -20,7 +20,7 @@ import enTranslations from './i18n/en.json';
|
|
|
20
20
|
import frTranslations from './i18n/fr.json';
|
|
21
21
|
import DmsScreens from './screens';
|
|
22
22
|
import * as dmsReducers from './features';
|
|
23
|
-
import { dms_formsRegister, dms_modelAPI, dms_searchFields, dms_sortFields, } from './models';
|
|
23
|
+
import { dms_formsRegister, dms_modelAPI, dms_searchFields, dms_sortFields, dms_typeObjects, } from './models';
|
|
24
24
|
import { useDMSHeaders } from './hooks/use-dms-header-actions';
|
|
25
25
|
import { createMenusScreen } from './utils';
|
|
26
26
|
export const DmsModule = {
|
|
@@ -46,10 +46,11 @@ export const DmsModule = {
|
|
|
46
46
|
...dmsReducers,
|
|
47
47
|
},
|
|
48
48
|
models: {
|
|
49
|
-
objectFields:
|
|
50
|
-
searchFields:
|
|
51
|
-
sortFields:
|
|
52
|
-
|
|
49
|
+
objectFields: dms_modelAPI,
|
|
50
|
+
searchFields: dms_searchFields,
|
|
51
|
+
sortFields: dms_sortFields,
|
|
52
|
+
typeObjects: dms_typeObjects,
|
|
53
|
+
formsRegister: dms_formsRegister,
|
|
53
54
|
headerRegisters: useDMSHeaders,
|
|
54
55
|
},
|
|
55
56
|
moduleRegister: async (userId) => {
|
|
@@ -70,6 +71,7 @@ export const DmsModule = {
|
|
|
70
71
|
export * from './api';
|
|
71
72
|
export * from './components';
|
|
72
73
|
export * from './features/asyncFunctions-index';
|
|
74
|
+
export * from './providers';
|
|
73
75
|
export * from './screens';
|
|
74
76
|
export * from './types';
|
|
75
77
|
export * from './utils';
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAC,aAAa,EAAU,eAAe,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YAAY,EAAE,gBAAgB;QAC9B,UAAU,EAAE,cAAc;QAC1B,WAAW,EAAE,eAAe;QAC5B,aAAa,EAAE,iBAAiB;QAChC,eAAe,EAAE,aAAa;KAC/B;IACD,cAAc,EAAE,KAAK,EAAE,MAAc,EAAE,EAAE;QACvC,MAAM,IAAI,GAAG,MAAM,aAAa,CAAC,MAAM,CAAC;aACrC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;aACjC,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QAErB,MAAM,EAAC,KAAK,EAAE,OAAO,EAAC,GAAG,iBAAiB,CAAC;YACzC,kBAAkB,EAAE,IAAI,EAAE,kBAAkB;YAC5C,gBAAgB,EAAE,IAAI,EAAE,gBAAgB;SACzC,CAAC,CAAC;QAEH,eAAe,CAAC,cAAc,CAAC;YAC7B,IAAI,EAAE,mBAAmB;YACzB,KAAK;YACL,OAAO;SACR,CAAC,CAAC;IACL,CAAC;CACF,CAAC;AAEF,cAAc,OAAO,CAAC;AACtB,cAAc,cAAc,CAAC;AAC7B,cAAc,iCAAiC,CAAC;AAChD,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC"}
|
package/lib/models/index.d.ts
CHANGED
package/lib/models/index.js
CHANGED
|
@@ -19,4 +19,5 @@ export { dms_formsRegister } from './forms';
|
|
|
19
19
|
export { dms_modelAPI } from './objectFields';
|
|
20
20
|
export { dms_searchFields } from './searchFields';
|
|
21
21
|
export { dms_sortFields } from './sortFields';
|
|
22
|
+
export { dms_typeObjects } from './typeObjects';
|
|
22
23
|
//# sourceMappingURL=index.js.map
|
package/lib/models/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/models/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAC,iBAAiB,EAAC,MAAM,SAAS,CAAC;AAC1C,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAC,gBAAgB,EAAC,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAC,cAAc,EAAC,MAAM,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/models/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAC,iBAAiB,EAAC,MAAM,SAAS,CAAC;AAC1C,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAC,gBAAgB,EAAC,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAC,cAAc,EAAC,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAC,eAAe,EAAC,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Axelor Business Solutions
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2026 Axelor (<http://axelor.com>).
|
|
5
|
+
*
|
|
6
|
+
* This program is free software: you can redistribute it and/or modify
|
|
7
|
+
* it under the terms of the GNU Affero General Public License, version 3,
|
|
8
|
+
* as published by the Free Software Foundation.
|
|
9
|
+
*
|
|
10
|
+
* This program is distributed in the hope that it will be useful,
|
|
11
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
+
* GNU Affero General Public License for more details.
|
|
14
|
+
*
|
|
15
|
+
* You should have received a copy of the GNU Affero General Public License
|
|
16
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
|
+
*/
|
|
18
|
+
export const dms_typeObjects = [
|
|
19
|
+
{
|
|
20
|
+
modelName: 'com.axelor.dms.db.DMSFile',
|
|
21
|
+
fields: {
|
|
22
|
+
actionKey: {
|
|
23
|
+
content: [
|
|
24
|
+
{ key: 'Open', value: 'open', title: '' },
|
|
25
|
+
{ key: 'Favorite', value: 'favorite', title: '' },
|
|
26
|
+
{ key: 'Download', value: 'download', title: '' },
|
|
27
|
+
{ key: 'Rename', value: 'rename', title: '' },
|
|
28
|
+
{ key: 'Delete', value: 'delete', title: '' },
|
|
29
|
+
],
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
];
|
|
34
|
+
//# sourceMappingURL=typeObjects.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typeObjects.js","sourceRoot":"","sources":["../../src/models/typeObjects.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAIH,MAAM,CAAC,MAAM,eAAe,GAAqB;IAC/C;QACE,SAAS,EAAE,2BAA2B;QACtC,MAAM,EAAE;YACN,SAAS,EAAE;gBACT,OAAO,EAAE;oBACP,EAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,EAAC;oBACvC,EAAC,GAAG,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,EAAE,EAAC;oBAC/C,EAAC,GAAG,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,EAAE,EAAC;oBAC/C,EAAC,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,EAAC;oBAC3C,EAAC,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,EAAC;iBAC5C;aACF;SACF;KACF;CACF,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
type LeafActionBuilder = (item: any, context?: any) => any[];
|
|
2
|
+
type BranchActionBuilder = (branch: any, context?: any) => any[];
|
|
3
|
+
declare class DocumentActionsProvider {
|
|
4
|
+
private leafBuilders;
|
|
5
|
+
private branchBuilders;
|
|
6
|
+
private callbacks;
|
|
7
|
+
registerLeafActions(key: string, builder: LeafActionBuilder): void;
|
|
8
|
+
registerBranchActions(key: string, builder: BranchActionBuilder): void;
|
|
9
|
+
private aggregate;
|
|
10
|
+
getLeafActions(item: any, context?: any): any[];
|
|
11
|
+
getBranchActions(branch: any, context?: any): any[];
|
|
12
|
+
registerCallback(callback: Function): void;
|
|
13
|
+
unregisterCallback(callback: Function): void;
|
|
14
|
+
private notify;
|
|
15
|
+
}
|
|
16
|
+
export declare const documentActionsProvider: DocumentActionsProvider;
|
|
17
|
+
export declare const useDocumentActions: () => {
|
|
18
|
+
getLeafActions: (item: any, context?: any) => any[];
|
|
19
|
+
getBranchActions: (branch: any, context?: any) => any[];
|
|
20
|
+
};
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Axelor Business Solutions
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2026 Axelor (<http://axelor.com>).
|
|
5
|
+
*
|
|
6
|
+
* This program is free software: you can redistribute it and/or modify
|
|
7
|
+
* it under the terms of the GNU Affero General Public License, version 3,
|
|
8
|
+
* as published by the Free Software Foundation.
|
|
9
|
+
*
|
|
10
|
+
* This program is distributed in the hope that it will be useful,
|
|
11
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
+
* GNU Affero General Public License for more details.
|
|
14
|
+
*
|
|
15
|
+
* You should have received a copy of the GNU Affero General Public License
|
|
16
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
|
+
*/
|
|
18
|
+
import { useEffect, useState } from 'react';
|
|
19
|
+
class DocumentActionsProvider {
|
|
20
|
+
leafBuilders = {};
|
|
21
|
+
branchBuilders = {};
|
|
22
|
+
callbacks = [];
|
|
23
|
+
registerLeafActions(key, builder) {
|
|
24
|
+
this.leafBuilders[key] = builder;
|
|
25
|
+
this.notify();
|
|
26
|
+
}
|
|
27
|
+
registerBranchActions(key, builder) {
|
|
28
|
+
this.branchBuilders[key] = builder;
|
|
29
|
+
this.notify();
|
|
30
|
+
}
|
|
31
|
+
aggregate(builders, arg, context) {
|
|
32
|
+
const keyedActions = new Map();
|
|
33
|
+
const unkeyedActions = [];
|
|
34
|
+
Object.values(builders).forEach(_builder => {
|
|
35
|
+
(_builder(arg, context) ?? []).forEach(_action => {
|
|
36
|
+
if (_action == null)
|
|
37
|
+
return;
|
|
38
|
+
if (_action.key != null) {
|
|
39
|
+
keyedActions.set(_action.key, _action);
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
unkeyedActions.push(_action);
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
return [...keyedActions.values(), ...unkeyedActions];
|
|
47
|
+
}
|
|
48
|
+
getLeafActions(item, context) {
|
|
49
|
+
return this.aggregate(this.leafBuilders, item, context);
|
|
50
|
+
}
|
|
51
|
+
getBranchActions(branch, context) {
|
|
52
|
+
return this.aggregate(this.branchBuilders, branch, context);
|
|
53
|
+
}
|
|
54
|
+
registerCallback(callback) {
|
|
55
|
+
this.callbacks.push(callback);
|
|
56
|
+
}
|
|
57
|
+
unregisterCallback(callback) {
|
|
58
|
+
this.callbacks = this.callbacks.filter(_callback => _callback !== callback);
|
|
59
|
+
}
|
|
60
|
+
notify() {
|
|
61
|
+
this.callbacks.forEach(_callback => _callback());
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
export const documentActionsProvider = new DocumentActionsProvider();
|
|
65
|
+
export const useDocumentActions = () => {
|
|
66
|
+
const [, setRefresh] = useState(0);
|
|
67
|
+
useEffect(() => {
|
|
68
|
+
const callback = () => setRefresh(_value => _value + 1);
|
|
69
|
+
documentActionsProvider.registerCallback(callback);
|
|
70
|
+
return () => documentActionsProvider.unregisterCallback(callback);
|
|
71
|
+
}, []);
|
|
72
|
+
return {
|
|
73
|
+
getLeafActions: (item, context) => documentActionsProvider.getLeafActions(item, context),
|
|
74
|
+
getBranchActions: (branch, context) => documentActionsProvider.getBranchActions(branch, context),
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
//# sourceMappingURL=DocumentActionsProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DocumentActionsProvider.js","sourceRoot":"","sources":["../../src/providers/DocumentActionsProvider.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAC,SAAS,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AAK1C,MAAM,uBAAuB;IACnB,YAAY,GAAuC,EAAE,CAAC;IACtD,cAAc,GAAyC,EAAE,CAAC;IAC1D,SAAS,GAAe,EAAE,CAAC;IAEnC,mBAAmB,CAAC,GAAW,EAAE,OAA0B;QACzD,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC;QACjC,IAAI,CAAC,MAAM,EAAE,CAAC;IAChB,CAAC;IAED,qBAAqB,CAAC,GAAW,EAAE,OAA4B;QAC7D,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC;QACnC,IAAI,CAAC,MAAM,EAAE,CAAC;IAChB,CAAC;IAEO,SAAS,CACf,QAA6D,EAC7D,GAAQ,EACR,OAAa;QAEb,MAAM,YAAY,GAAG,IAAI,GAAG,EAAe,CAAC;QAC5C,MAAM,cAAc,GAAU,EAAE,CAAC;QAEjC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;YACzC,CAAC,QAAQ,CAAC,GAAG,EAAE,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE;gBAC/C,IAAI,OAAO,IAAI,IAAI;oBAAE,OAAO;gBAE5B,IAAI,OAAO,CAAC,GAAG,IAAI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CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QACxD,uBAAuB,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC;QAEnD,OAAO,GAAG,EAAE,CAAC,uBAAuB,CAAC,kBAAkB,CAAC,QAAQ,CAAC,CAAC;IACpE,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO;QACL,cAAc,EAAE,CAAC,IAAS,EAAE,OAAa,EAAE,EAAE,CAC3C,uBAAuB,CAAC,cAAc,CAAC,IAAI,EAAE,OAAO,CAAC;QACvD,gBAAgB,EAAE,CAAC,MAAW,EAAE,OAAa,EAAE,EAAE,CAC/C,uBAAuB,CAAC,gBAAgB,CAAC,MAAM,EAAE,OAAO,CAAC;KAC5D,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { documentActionsProvider, useDocumentActions, } from './DocumentActionsProvider';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Axelor Business Solutions
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2026 Axelor (<http://axelor.com>).
|
|
5
|
+
*
|
|
6
|
+
* This program is free software: you can redistribute it and/or modify
|
|
7
|
+
* it under the terms of the GNU Affero General Public License, version 3,
|
|
8
|
+
* as published by the Free Software Foundation.
|
|
9
|
+
*
|
|
10
|
+
* This program is distributed in the hope that it will be useful,
|
|
11
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
+
* GNU Affero General Public License for more details.
|
|
14
|
+
*
|
|
15
|
+
* You should have received a copy of the GNU Affero General Public License
|
|
16
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
|
+
*/
|
|
18
|
+
export { documentActionsProvider, useDocumentActions, } from './DocumentActionsProvider';
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/providers/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EACL,uBAAuB,EACvB,kBAAkB,GACnB,MAAM,2BAA2B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@axelor/aos-mobile-dms",
|
|
3
|
-
"version": "9.0
|
|
3
|
+
"version": "9.1.0",
|
|
4
4
|
"author": "Axelor",
|
|
5
5
|
"license": "AGPL-3.0-only",
|
|
6
6
|
"publishConfig": {
|
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
"react-native": "0.83.9"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@axelor/aos-mobile-core": "9.0
|
|
31
|
-
"@axelor/aos-mobile-ui": "9.0
|
|
30
|
+
"@axelor/aos-mobile-core": "9.1.0",
|
|
31
|
+
"@axelor/aos-mobile-ui": "9.1.0",
|
|
32
32
|
"@reduxjs/toolkit": "2.11.2"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|