@leav/ui 1.3.0-abbf4a20 → 1.3.0-caadf1e1
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/_gqlTypes/index.d.ts +3 -6
- package/dist/_gqlTypes/index.js +3 -6
- package/dist/_gqlTypes/index.js.map +1 -1
- package/dist/components/Explorer/DataView.d.ts +0 -1
- package/dist/components/Explorer/DataView.js +30 -63
- package/dist/components/Explorer/DataView.js.map +1 -1
- package/dist/components/Explorer/Explorer.d.ts +1 -3
- package/dist/components/Explorer/Explorer.js +5 -12
- package/dist/components/Explorer/Explorer.js.map +1 -1
- package/dist/components/Explorer/IdCard.js +1 -1
- package/dist/components/Explorer/IdCard.js.map +1 -1
- package/dist/components/Explorer/TableNameCell.d.ts +7 -0
- package/dist/components/Explorer/TableNameCell.js +65 -0
- package/dist/components/Explorer/TableNameCell.js.map +1 -0
- package/dist/components/Explorer/_constants.d.ts +1 -0
- package/dist/components/Explorer/_constants.js +1 -0
- package/dist/components/Explorer/_constants.js.map +1 -1
- package/dist/components/Explorer/_types.d.ts +1 -0
- package/dist/components/Explorer/_types.js.map +1 -1
- package/dist/components/Explorer/actions-primary/useCreatePrimaryAction.js +2 -1
- package/dist/components/Explorer/actions-primary/useCreatePrimaryAction.js.map +1 -1
- package/dist/components/Explorer/link-item/LinkModal.js +1 -1
- package/dist/components/Explorer/link-item/LinkModal.js.map +1 -1
- package/dist/components/RecordEdition/EditRecord/EditRecord.js +1 -1
- package/dist/components/RecordEdition/EditRecord/EditRecord.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/hooks/useCreateEmptyRecordMutation.js +4 -12
- package/dist/components/RecordEdition/EditRecordContent/hooks/useCreateEmptyRecordMutation.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/link-record/useLinkRecords.js +27 -6
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/link-record/useLinkRecords.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordModal/useEditRecordModal.d.ts +14 -0
- package/dist/components/RecordEdition/EditRecordModal/useEditRecordModal.js +22 -0
- package/dist/components/RecordEdition/EditRecordModal/useEditRecordModal.js.map +1 -0
- package/dist/components/SelectRecordForLinkModal/SelectRecordForLinkModal.js +43 -22
- package/dist/components/SelectRecordForLinkModal/SelectRecordForLinkModal.js.map +1 -1
- package/dist/hooks/useIFrameMessenger/schema.d.ts +2 -2
- package/dist/hooks/useIFrameMessenger/schema.js +3 -3
- package/dist/hooks/useIFrameMessenger/schema.js.map +1 -1
- package/package.json +1 -1
- package/dist/components/Explorer/actions-item/useEditItemAction.d.ts +0 -19
- package/dist/components/Explorer/actions-item/useEditItemAction.js +0 -57
- package/dist/components/Explorer/actions-item/useEditItemAction.js.map +0 -1
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
// Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06
|
|
3
|
-
// This file is released under LGPL V3
|
|
4
|
-
// License text available at https://www.gnu.org/licenses/lgpl-3.0.txt
|
|
5
|
-
import { useMemo, useState } from 'react';
|
|
6
|
-
import { FaEye } from 'react-icons/fa';
|
|
7
|
-
import { useSharedTranslation } from '../../../hooks/useSharedTranslation';
|
|
8
|
-
import { EditRecordModal } from '../../../components/RecordEdition/EditRecordModal';
|
|
9
|
-
import { RecordFilterCondition, useExplorerLibraryDataLazyQuery } from '../../../_gqlTypes';
|
|
10
|
-
import { EDIT_RECORD_MODAL_CLASSNAME } from '../_constants';
|
|
11
|
-
/**
|
|
12
|
-
* Hook used to get the action for `<DataView />` component.
|
|
13
|
-
*
|
|
14
|
-
* When the mutation for editing is done, the Apollo cache will be refreshed (`Record` and `RecordIdentity`)
|
|
15
|
-
* from only edited record.
|
|
16
|
-
*
|
|
17
|
-
* It returns also two parts : one for the action button call - one for displaying the modal required by the action.
|
|
18
|
-
*
|
|
19
|
-
* @param isEnabled - whether the action is present
|
|
20
|
-
*/
|
|
21
|
-
export const useEditItemAction = ({ isEnabled, formId, onEdit, refetch }) => {
|
|
22
|
-
const { t } = useSharedTranslation();
|
|
23
|
-
const [refreshItem] = useExplorerLibraryDataLazyQuery({ fetchPolicy: 'network-only' });
|
|
24
|
-
const [editingItem, setEditingItem] = useState(null);
|
|
25
|
-
const _editItemAction = {
|
|
26
|
-
label: t('explorer.edit-item'),
|
|
27
|
-
icon: _jsx(FaEye, {}),
|
|
28
|
-
callback: item => {
|
|
29
|
-
setEditingItem(item);
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
const _handleEditModalClose = (item) => {
|
|
33
|
-
refetch();
|
|
34
|
-
refreshItem({
|
|
35
|
-
variables: {
|
|
36
|
-
libraryId: item.libraryId,
|
|
37
|
-
attributeIds: ['id'], // TODO: get list of displayed attributes stored in the view
|
|
38
|
-
pagination: { limit: 1 },
|
|
39
|
-
filters: [
|
|
40
|
-
{
|
|
41
|
-
condition: RecordFilterCondition.EQUAL,
|
|
42
|
-
field: 'id',
|
|
43
|
-
value: item.itemId
|
|
44
|
-
}
|
|
45
|
-
]
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
onEdit?.(item);
|
|
49
|
-
setEditingItem(null);
|
|
50
|
-
};
|
|
51
|
-
const editAction = useMemo(() => ({
|
|
52
|
-
editItemAction: isEnabled ? _editItemAction : null,
|
|
53
|
-
editItemModal: isEnabled && editingItem !== null ? (_jsx(EditRecordModal, { className: EDIT_RECORD_MODAL_CLASSNAME, open: true, editionFormId: formId, record: editingItem.whoAmI, library: editingItem.libraryId, onClose: () => _handleEditModalClose(editingItem) })) : null
|
|
54
|
-
}), [isEnabled, editingItem]);
|
|
55
|
-
return editAction;
|
|
56
|
-
};
|
|
57
|
-
//# sourceMappingURL=useEditItemAction.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useEditItemAction.js","sourceRoot":"","sources":["../../../../src/components/Explorer/actions-item/useE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