@leav/ui 1.3.0 → 1.4.0-c456a7bc
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 +29 -6
- package/dist/_gqlTypes/index.js +16 -6
- package/dist/_gqlTypes/index.js.map +1 -1
- package/dist/_queries/records/getRecordsFromLibraryQuery.d.ts +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 +2 -3
- package/dist/components/Explorer/Explorer.js +32 -41
- package/dist/components/Explorer/Explorer.js.map +1 -1
- package/dist/components/Explorer/ExplorerFiltersAndSorts.d.ts +7 -0
- package/dist/components/Explorer/ExplorerFiltersAndSorts.js +48 -0
- package/dist/components/Explorer/ExplorerFiltersAndSorts.js.map +1 -0
- package/dist/components/Explorer/ExplorerToolbar.d.ts +3 -1
- package/dist/components/Explorer/ExplorerToolbar.js +12 -46
- package/dist/components/Explorer/ExplorerToolbar.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 +2 -0
- package/dist/components/Explorer/_constants.js +2 -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-mass/useMassActions.d.ts +3 -2
- package/dist/components/Explorer/actions-mass/useMassActions.js +9 -14
- package/dist/components/Explorer/actions-mass/useMassActions.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/actions-primary/usePrimaryActions.d.ts +3 -1
- package/dist/components/Explorer/actions-primary/usePrimaryActions.js +14 -10
- package/dist/components/Explorer/actions-primary/usePrimaryActions.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/Explorer/list-saved-views/SavedViews.js +26 -2
- package/dist/components/Explorer/list-saved-views/SavedViews.js.map +1 -1
- package/dist/components/Explorer/manage-view-settings/filter-items/filter-type/TreeAttributeDropDown.js.map +1 -1
- package/dist/components/Explorer/manage-view-settings/open-view-settings/useOpenViewSettings.js +2 -2
- package/dist/components/Explorer/manage-view-settings/open-view-settings/useOpenViewSettings.js.map +1 -1
- package/dist/components/Explorer/manage-view-settings/save-view/LabelViewFormModal.js +1 -1
- package/dist/components/Explorer/manage-view-settings/save-view/LabelViewFormModal.js.map +1 -1
- package/dist/components/Explorer/manage-view-settings/save-view/useDeleteView.js +1 -1
- package/dist/components/Explorer/manage-view-settings/save-view/useDeleteView.js.map +1 -1
- package/dist/components/Explorer/useSearchInput.js +1 -1
- package/dist/components/Explorer/useSearchInput.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/LinkField.js +2 -0
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/LinkField.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/link-record/useLinkRecords.d.ts +2 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/link-record/useLinkRecords.js +28 -7
- package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/link-record/useLinkRecords.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardField.js +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardField.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/manage-tree-node-selection/SelectTreeNodeModal.js +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/manage-tree-node-selection/SelectTreeNodeModal.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordModal/EditRecordModal.js +1 -1
- package/dist/components/RecordEdition/EditRecordModal/EditRecordModal.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/components/SelectTreeNode/SelectTreeNodeContent.js +1 -6
- package/dist/components/SelectTreeNode/SelectTreeNodeContent.js.map +1 -1
- package/dist/components/SelectTreeNode/TreeNodeTitle.d.ts +7 -5
- package/dist/components/SelectTreeNode/TreeNodeTitle.js +22 -6
- package/dist/components/SelectTreeNode/TreeNodeTitle.js.map +1 -1
- package/dist/constants.d.ts +10 -2
- package/dist/constants.js +1 -2
- package/dist/constants.js.map +1 -1
- package/dist/hooks/useAppLang/useAppLang.js +2 -1
- package/dist/hooks/useAppLang/useAppLang.js.map +1 -1
- package/dist/hooks/useAuth/useAuth.js +2 -1
- package/dist/hooks/useAuth/useAuth.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/dist/hooks/useLoginChecker/useLoginChecker.js +2 -1
- package/dist/hooks/useLoginChecker/useLoginChecker.js.map +1 -1
- package/dist/locales/en/shared.json +3 -1
- package/dist/locales/fr/shared.json +3 -1
- package/package.json +4 -4
- 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,10 +1,10 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
// Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06
|
|
3
3
|
// This file is released under LGPL V3
|
|
4
4
|
// License text available at https://www.gnu.org/licenses/lgpl-3.0.txt
|
|
5
|
-
import { forwardRef, useImperativeHandle } from 'react';
|
|
5
|
+
import { forwardRef, useImperativeHandle, useMemo } from 'react';
|
|
6
6
|
import { createPortal } from 'react-dom';
|
|
7
|
-
import { KitEmpty,
|
|
7
|
+
import { KitEmpty, KitSnackBarProvider, KitTypography } from 'aristid-ds';
|
|
8
8
|
import styled from 'styled-components';
|
|
9
9
|
import { Loading } from '../../components/Loading';
|
|
10
10
|
import { useSharedTranslation } from '../../hooks/useSharedTranslation';
|
|
@@ -13,7 +13,6 @@ import { DataView } from './DataView';
|
|
|
13
13
|
import { ExplorerTitle } from './ExplorerTitle';
|
|
14
14
|
import { ExplorerToolbar } from './ExplorerToolbar';
|
|
15
15
|
import { useEditStatusItemAction } from './actions-item/useEditStatusItemAction';
|
|
16
|
-
import { useEditItemAction } from './actions-item/useEditItemAction';
|
|
17
16
|
import { usePrimaryActionsButton } from './actions-primary/usePrimaryActions';
|
|
18
17
|
import { useCreatePrimaryAction } from './actions-primary/useCreatePrimaryAction';
|
|
19
18
|
import { useLinkPrimaryAction } from './actions-primary/useLinkPrimaryAction';
|
|
@@ -23,7 +22,7 @@ import { defaultPageSizeOptions, SidePanel, useEditSettings, useOpenViewSettings
|
|
|
23
22
|
import { useSearchInput } from './useSearchInput';
|
|
24
23
|
import { usePagination } from './usePagination';
|
|
25
24
|
import { useViewSettingsReducer } from './useViewSettingsReducer';
|
|
26
|
-
import { MASS_SELECTION_ALL } from './_constants';
|
|
25
|
+
import { MASS_SELECTION_ALL, SNACKBAR_MASS_ID, WHO_AM_I_COLUMN } from './_constants';
|
|
27
26
|
import { useDeleteLinkValues } from './actions-mass/useDeleteLinkValues';
|
|
28
27
|
import { useReplaceItemAction } from './actions-item/useReplaceItemAction';
|
|
29
28
|
const isNotEmpty = (union) => union.length > 0;
|
|
@@ -34,11 +33,6 @@ const ExplorerHeaderDivStyled = styled.div `
|
|
|
34
33
|
align-items: flex-start;
|
|
35
34
|
padding: calc(var(--general-spacing-xs) * 1px);
|
|
36
35
|
`;
|
|
37
|
-
const ExplorerActionsDivStyled = styled.div `
|
|
38
|
-
display: flex;
|
|
39
|
-
justify-content: space-between;
|
|
40
|
-
padding: calc(var(--general-spacing-xs) * 1px);
|
|
41
|
-
`;
|
|
42
36
|
const ExplorerPageDivStyled = styled.div `
|
|
43
37
|
display: flex;
|
|
44
38
|
flex-direction: column;
|
|
@@ -52,7 +46,7 @@ const ExplorerEmptyDataStyled = styled.div `
|
|
|
52
46
|
align-items: center;
|
|
53
47
|
justify-content: center;
|
|
54
48
|
`;
|
|
55
|
-
export const Explorer = forwardRef(({ entrypoint, itemActions = [], primaryActions = [], massActions = [], title, selectionMode = 'multiple', emptyPlaceholder, noPagination, creationFormId,
|
|
49
|
+
export const Explorer = forwardRef(({ entrypoint, itemActions = [], primaryActions = [], massActions = [], title, selectionMode = 'multiple', emptyPlaceholder, noPagination, creationFormId, showCreateOnNoResultOnly = false, showFilters = false, showSorts = false, hideFirstActionLabel = false, disableSelection = false, hideSelectAllAction = false, showTitle = false, showSearch = false, hidePrimaryActions = false, hideTableHeader = false, ignoreViewByDefault = false, defaultActionsForItem = ['replaceLink', 'remove', 'activate'], defaultPrimaryActions = ['create'], defaultMassActions = ['deactivate'], defaultCallbacks, defaultViewSettings, joinLibraryContext }, ref) => {
|
|
56
50
|
const { t } = useSharedTranslation();
|
|
57
51
|
const { panelElement: settingsPanelElement } = useEditSettings();
|
|
58
52
|
const { loading: viewSettingsLoading, view, dispatch } = useViewSettingsReducer(entrypoint, defaultViewSettings, ignoreViewByDefault);
|
|
@@ -84,12 +78,6 @@ export const Explorer = forwardRef(({ entrypoint, itemActions = [], primaryActio
|
|
|
84
78
|
onReplace: defaultCallbacks?.item?.replaceLink,
|
|
85
79
|
canReplaceLinkValues: canEditLinkAttributeValues
|
|
86
80
|
});
|
|
87
|
-
const { editItemAction, editItemModal } = useEditItemAction({
|
|
88
|
-
isEnabled: isNotEmpty(defaultActionsForItem) && defaultActionsForItem.includes('edit'),
|
|
89
|
-
onEdit: defaultCallbacks?.item?.edit,
|
|
90
|
-
formId: editionFormId,
|
|
91
|
-
refetch
|
|
92
|
-
});
|
|
93
81
|
const totalCount = data?.totalCount ?? 0;
|
|
94
82
|
const hasNoResults = data === null || data.totalCount === 0;
|
|
95
83
|
const isAllowedFreeEntry = !(entrypoint.type === 'library' && !entrypoint.allowFreeEntry);
|
|
@@ -137,16 +125,19 @@ export const Explorer = forwardRef(({ entrypoint, itemActions = [], primaryActio
|
|
|
137
125
|
refetch
|
|
138
126
|
});
|
|
139
127
|
const _isSelectionDisable = disableSelection || (isLink && !isMultivalue && totalCount > 0);
|
|
128
|
+
const massActionSnackbarId = useMemo(() => `${SNACKBAR_MASS_ID}_${Date.now()}`, []);
|
|
140
129
|
const { setSelectedKeys, selectAllButton } = useMassActions({
|
|
141
130
|
isEnabled: totalCount > 0 && !_isSelectionDisable && (isNotEmpty(defaultMassActions) || isNotEmpty(massActions)),
|
|
142
131
|
store: { view, dispatch },
|
|
143
132
|
totalCount,
|
|
144
133
|
allVisibleKeys,
|
|
145
|
-
massActions: [deactivateMassAction, unlinkMassAction, ...massActions].filter(Boolean)
|
|
134
|
+
massActions: [deactivateMassAction, unlinkMassAction, ...massActions].filter(Boolean),
|
|
135
|
+
snackbarId: massActionSnackbarId
|
|
146
136
|
});
|
|
147
137
|
const { primaryButton } = usePrimaryActionsButton({
|
|
148
138
|
view,
|
|
149
|
-
actions: [createPrimaryAction, linkPrimaryAction, ...primaryActions].filter(Boolean)
|
|
139
|
+
actions: [createPrimaryAction, linkPrimaryAction, ...primaryActions].filter(Boolean),
|
|
140
|
+
hideFirstActionLabel
|
|
150
141
|
});
|
|
151
142
|
const { viewSettingsButton, viewListButton } = useOpenViewSettings({ view, isEnabled: !isMassSelectionAll });
|
|
152
143
|
const { searchInput } = useSearchInput({ view, dispatch, setNewPage });
|
|
@@ -155,27 +146,27 @@ export const Explorer = forwardRef(({ entrypoint, itemActions = [], primaryActio
|
|
|
155
146
|
linkAction: linkPrimaryAction,
|
|
156
147
|
totalCount
|
|
157
148
|
}), [createPrimaryAction?.disabled, linkPrimaryAction?.disabled, totalCount]);
|
|
158
|
-
return (_jsxs(ViewSettingsContext.Provider, { value: { view, dispatch }, children: [_jsxs(ExplorerPageDivStyled, { children: [showTitle && (_jsx(ExplorerHeaderDivStyled, { children: _jsx(KitTypography.Title, { level: "h3", children: !viewSettingsLoading && (_jsx(ExplorerTitle, { library: view.libraryId, title: title, entrypoint: entrypoint })) /*TODO: manage loading*/ }) })), (
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
149
|
+
return (_jsxs(_Fragment, { children: [_jsxs(ViewSettingsContext.Provider, { value: { view, dispatch }, children: [_jsxs(ExplorerPageDivStyled, { children: [showTitle && (_jsx(ExplorerHeaderDivStyled, { children: _jsx(KitTypography.Title, { level: "h3", children: !viewSettingsLoading && (_jsx(ExplorerTitle, { library: view.libraryId, title: title, entrypoint: entrypoint })) /*TODO: manage loading*/ }) })), _jsxs(ExplorerToolbar, { showFilters: showFilters, showSorts: showSorts, isMassSelectionAll: isMassSelectionAll, headless: hideTableHeader, selectAllButton: hideSelectAllAction ? null : selectAllButton, viewSettingsLoading: viewSettingsLoading, children: [view?.enableConfigureView ? viewListButton : null, showSearch ? searchInput : null, view?.enableConfigureView ? viewSettingsButton : null, hidePrimaryActions ? null : primaryButton] }), loadingData || viewSettingsLoading ? (_jsx(Loading, {})) : hasNoResults ? (_jsx(ExplorerEmptyDataStyled, { children: emptyPlaceholder || _jsx(KitEmpty, { title: t('explorer.empty-data') }) })) : (_jsx(DataView, { dataGroupedFilteredSorted: data?.records ?? emptyArray, attributesProperties: data?.attributes ?? emptyObject, attributesToDisplay: [WHO_AM_I_COLUMN, ...view.attributesIds], hideTableHeader: hideTableHeader, paginationProps: entrypoint.type === 'library' && !noPagination
|
|
150
|
+
? {
|
|
151
|
+
pageSizeOptions: defaultPageSizeOptions,
|
|
152
|
+
currentPage,
|
|
153
|
+
pageSize: view.pageSize,
|
|
154
|
+
setNewPageSize,
|
|
155
|
+
setNewPage,
|
|
156
|
+
totalCount
|
|
157
|
+
}
|
|
158
|
+
: undefined, itemActions: [...itemActions, replaceItemAction, editStatusItemAction]
|
|
159
|
+
.filter(Boolean)
|
|
160
|
+
.map(action => ({
|
|
161
|
+
...action,
|
|
162
|
+
disabled: isMassSelectionAll || action.disabled
|
|
163
|
+
})), selection: {
|
|
164
|
+
onSelectionChange: _isSelectionDisable ? null : setSelectedKeys,
|
|
165
|
+
isMassSelectionAll,
|
|
166
|
+
selectedKeys: isMassSelectionAll
|
|
167
|
+
? data?.records.map(({ whoAmI }) => whoAmI.id)
|
|
168
|
+
: view.massSelection,
|
|
169
|
+
mode: selectionMode
|
|
170
|
+
} }))] }), settingsPanelElement && createPortal(_jsx(SidePanel, {}), settingsPanelElement?.() ?? document.body), replaceItemModal, createModal, linkModal] }), _jsx(KitSnackBarProvider, { id: massActionSnackbarId })] }));
|
|
180
171
|
});
|
|
181
172
|
//# sourceMappingURL=Explorer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Explorer.js","sourceRoot":"","sources":["../../../src/components/Explorer/Explorer.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAC,UAAU,EAAkB,mBAAmB,
|
|
1
|
+
{"version":3,"file":"Explorer.js","sourceRoot":"","sources":["../../../src/components/Explorer/Explorer.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAC,UAAU,EAAkB,mBAAmB,EAAE,OAAO,EAAS,MAAM,OAAO,CAAC;AACvF,OAAO,EAAC,YAAY,EAAC,MAAM,WAAW,CAAC;AACvC,OAAO,EAAC,QAAQ,EAAE,mBAAmB,EAAY,aAAa,EAAC,MAAM,YAAY,CAAC;AAClF,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,EAAC,OAAO,EAAC,MAAM,wBAAwB,CAAC;AAC/C,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AASpE,OAAO,EAAC,eAAe,EAAC,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAC;AACpC,OAAO,EAAC,aAAa,EAAC,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAC,eAAe,EAAC,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAC,uBAAuB,EAAC,MAAM,wCAAwC,CAAC;AAC/E,OAAO,EAAC,uBAAuB,EAAC,MAAM,qCAAqC,CAAC;AAC5E,OAAO,EAAC,sBAAsB,EAAC,MAAM,0CAA0C,CAAC;AAChF,OAAO,EAAC,oBAAoB,EAAC,MAAM,wCAAwC,CAAC;AAC5E,OAAO,EAAC,cAAc,EAAC,MAAM,+BAA+B,CAAC;AAC7D,OAA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AAC,CAAC,CAAC,eAAe;oCAC/D,kBAAkB;oCAClB,YAAY,EAAE,kBAAkB;wCAC5B,CAAC,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,EAAC,MAAM,EAAC,EAAE,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC;wCAC5C,CAAC,CAAE,IAAI,CAAC,aAA0B;oCACtC,IAAI,EAAE,aAAa;iCACtB,GACH,CACL,IACmB,EACvB,oBAAoB,IAAI,YAAY,CAAC,KAAC,SAAS,KAAG,EAAE,oBAAoB,EAAE,EAAE,IAAI,QAAQ,CAAC,IAAI,CAAC,EAC9F,gBAAgB,EAChB,WAAW,EACX,SAAS,IACiB,EAC/B,KAAC,mBAAmB,IAAC,EAAE,EAAE,oBAAoB,GAAI,IAClD,CACN,CAAC;AACN,CAAC,CACJ,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } 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 { useSharedTranslation } from '../../hooks/useSharedTranslation';
|
|
6
|
+
import { SortOrder } from '../../_gqlTypes';
|
|
7
|
+
import { useViewSettingsContext } from './manage-view-settings/store-view-settings/useViewSettingsContext';
|
|
8
|
+
import { CommonFilterItem } from './manage-view-settings/_shared/CommonFilterItem';
|
|
9
|
+
import { useAttributeDetailsData } from './manage-view-settings/_shared/useAttributeDetailsData';
|
|
10
|
+
import { useOpenViewSettings } from './manage-view-settings';
|
|
11
|
+
import { KitDivider, KitFilter } from 'aristid-ds';
|
|
12
|
+
import styled from 'styled-components';
|
|
13
|
+
const FilterStyled = styled(KitFilter) `
|
|
14
|
+
flex: 0 0 auto;
|
|
15
|
+
`;
|
|
16
|
+
const DividerStyled = styled(KitDivider) `
|
|
17
|
+
height: 26px;
|
|
18
|
+
margin-inline: calc(var(--general-spacing-xxs) * 1px);
|
|
19
|
+
`;
|
|
20
|
+
export const ExplorerFiltersAndSorts = ({ isMassSelectionAll, showFilters, showSorts, selectAllButton }) => {
|
|
21
|
+
const { t } = useSharedTranslation();
|
|
22
|
+
const { view } = useViewSettingsContext();
|
|
23
|
+
const { filters, sort } = view;
|
|
24
|
+
const { openSettingsPanel } = useOpenViewSettings({ view, isEnabled: true });
|
|
25
|
+
const { attributeDetailsById } = useAttributeDetailsData(view.libraryId);
|
|
26
|
+
const visibleFilters = filters.filter(filterItem => !filterItem.hidden);
|
|
27
|
+
if (((visibleFilters.length === 0 && sort.length === 0) || (!showFilters && !showSorts)) && !selectAllButton) {
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
const sortValues = sort.length === 0
|
|
31
|
+
? undefined
|
|
32
|
+
: sort.map(({ field, order }) => (attributeDetailsById?.[field]?.label ?? field) +
|
|
33
|
+
' ' +
|
|
34
|
+
(order === SortOrder.asc ? t('explorer.sort-ascending') : t('explorer.sort-descending')));
|
|
35
|
+
const _handleClickOnSort = () => isMassSelectionAll ? undefined : openSettingsPanel('sort-items');
|
|
36
|
+
if (!Object.keys(attributeDetailsById).length) {
|
|
37
|
+
return _jsx(_Fragment, {});
|
|
38
|
+
}
|
|
39
|
+
return (_jsxs(_Fragment, { children: [selectAllButton && (_jsxs(_Fragment, { children: [_jsx("li", { children: selectAllButton }), ((showFilters && visibleFilters.length !== 0) || (showSorts && sort.length > 0)) && (_jsx(DividerStyled, { type: "vertical" }))] })), (showFilters || showSorts) && (_jsxs(_Fragment, { children: [visibleFilters.length > 0 &&
|
|
40
|
+
visibleFilters.map(filter => (_jsx("li", { children: _jsx(CommonFilterItem, { filter: {
|
|
41
|
+
...filter,
|
|
42
|
+
attribute: {
|
|
43
|
+
...attributeDetailsById[filter?.attribute?.id],
|
|
44
|
+
...filter.attribute
|
|
45
|
+
}
|
|
46
|
+
}, disabled: isMassSelectionAll }, filter.id) }, filter.id))), showSorts && sort.length > 0 && (_jsx("li", { children: _jsx(FilterStyled, { label: t('explorer.sort-items'), values: sortValues, disabled: isMassSelectionAll, onClick: _handleClickOnSort }) }))] }))] }));
|
|
47
|
+
};
|
|
48
|
+
//# sourceMappingURL=ExplorerFiltersAndSorts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExplorerFiltersAndSorts.js","sourceRoot":"","sources":["../../../src/components/Explorer/ExplorerFiltersAndSorts.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAC,SAAS,EAAC,MAAM,eAAe,CAAC;AACxC,OAAO,EAAC,sBAAsB,EAAC,MAAM,mEAAmE,CAAC;AACzG,OAAO,EAAC,gBAAgB,EAAC,MAAM,iDAAiD,CAAC;AACjF,OAAO,EAAC,uBAAuB,EAAC,MAAM,wDAAwD,CAAC;AAC/F,OAAO,EAAC,mBAAmB,EAAC,MAAM,wBAAwB,CAAC;AAG3D,OAAO,EAAC,UAAU,EAAE,SAAS,EAAC,MAAM,YAAY,CAAC;AACjD,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAEvC,MAAM,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,CAAA;;CAErC,CAAC;AAEF,MAAM,aAAa,GAAG,MAAM,CAAC,UAAU,CAAC,CAAA;;;CAGvC,CAAC;AAEF,MAAM,CAAC,MAAM,uBAAuB,GAK/B,CAAC,EAAC,kBAAkB,EAAE,WAAW,EAAE,SAAS,EAAE,eAAe,EAAC,EAAE,EAAE;IACnE,MAAM,EAAC,CAAC,EAAC,GAAG,oBAAoB,EAAE,CAAC;IAEnC,MAAM,EAAC,IAAI,EAAC,GAAG,sBAAsB,EAAE,CAAC;IACxC,MAAM,EAAC,OAAO,EAAE,IAAI,EAAC,GAAG,IAAI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Ae,GAAM,EACzB,CAAC,CAAC,WAAW,IAAI,cAAc,CAAC,MAAM,KAAK,CAAC,CAAC,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,IAAI,CACjF,KAAC,aAAa,IAAC,IAAI,EAAC,UAAU,GAAG,CACpC,IACF,CACN,EACA,CAAC,WAAW,IAAI,SAAS,CAAC,IAAI,CAC3B,8BACK,cAAc,CAAC,MAAM,GAAG,CAAC;wBACtB,cAAc,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CACzB,uBACI,KAAC,gBAAgB,IAEb,MAAM,EACF;oCACI,GAAG,MAAM;oCACT,SAAS,EAAE;wCACP,GAAG,oBAAoB,CAAC,MAAM,EAAE,SAAS,EAAE,EAAE,CAAC;wCAC9C,GAAG,MAAM,CAAC,SAAS;qCACtB;iCACc,EAEvB,QAAQ,EAAE,kBAAkB,IAVvB,MAAM,CAAC,EAAE,CAWhB,IAbG,MAAM,CAAC,EAAE,CAcb,CACR,CAAC,EACL,SAAS,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,IAAI,CAC7B,uBACI,KAAC,YAAY,IACT,KAAK,EAAE,CAAC,CAAC,qBAAqB,CAAC,EAC/B,MAAM,EAAE,UAAU,EAClB,QAAQ,EAAE,kBAAkB,EAC5B,OAAO,EAAE,kBAAkB,GAC7B,GACD,CACR,IACF,CACN,IACF,CACN,CAAC;AACN,CAAC,CAAC"}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { type FunctionComponent } from 'react';
|
|
1
|
+
import { type ReactNode, type FunctionComponent } from 'react';
|
|
2
2
|
export declare const ExplorerToolbar: FunctionComponent<{
|
|
3
3
|
isMassSelectionAll: boolean;
|
|
4
4
|
showFilters: boolean;
|
|
5
5
|
showSorts: boolean;
|
|
6
6
|
headless: boolean;
|
|
7
|
+
selectAllButton: ReactNode | null;
|
|
8
|
+
viewSettingsLoading: boolean;
|
|
7
9
|
}>;
|
|
@@ -1,15 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { KitDivider, KitFilter } from 'aristid-ds';
|
|
3
|
-
import styled from 'styled-components';
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
4
2
|
import { useSharedTranslation } from '../../hooks/useSharedTranslation';
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
import { CommonFilterItem } from './manage-view-settings/_shared/CommonFilterItem';
|
|
8
|
-
import { useAttributeDetailsData } from './manage-view-settings/_shared/useAttributeDetailsData';
|
|
9
|
-
import { useOpenViewSettings } from './manage-view-settings';
|
|
10
|
-
const FilterStyled = styled(KitFilter) `
|
|
11
|
-
flex: 0 0 auto;
|
|
12
|
-
`;
|
|
3
|
+
import { ExplorerFiltersAndSorts } from './ExplorerFiltersAndSorts';
|
|
4
|
+
import styled from 'styled-components';
|
|
13
5
|
const ExplorerToolbarListStyled = styled.ul `
|
|
14
6
|
padding: calc(var(--general-spacing-xs) * 1px);
|
|
15
7
|
margin: 0;
|
|
@@ -18,53 +10,27 @@ const ExplorerToolbarListStyled = styled.ul `
|
|
|
18
10
|
border-radius: calc(var(--general-border-radius-s) * 1px);
|
|
19
11
|
list-style: none;
|
|
20
12
|
display: flex;
|
|
13
|
+
flex-wrap: wrap;
|
|
14
|
+
align-self: center;
|
|
21
15
|
overflow: auto;
|
|
22
|
-
flex-wrap: nowrap;
|
|
23
16
|
align-items: center;
|
|
24
17
|
gap: calc(var(--general-spacing-xxs) * 1px);
|
|
25
18
|
white-space: nowrap;
|
|
26
19
|
min-height: 26px; // height of the filter chip
|
|
27
20
|
width: 100%;
|
|
28
|
-
|
|
29
|
-
display: flex;
|
|
30
|
-
flex-wrap: wrap;
|
|
31
|
-
align-items: center;
|
|
32
|
-
align-self: center;
|
|
21
|
+
justify-content: space-between;
|
|
33
22
|
|
|
34
23
|
&.headless {
|
|
35
24
|
margin-bottom: 0;
|
|
36
25
|
}
|
|
37
26
|
`;
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
|
|
27
|
+
const Section = styled.div `
|
|
28
|
+
display: flex;
|
|
29
|
+
align-items: center;
|
|
30
|
+
gap: calc(var(--general-spacing-xxs) * 1px);
|
|
41
31
|
`;
|
|
42
|
-
export const ExplorerToolbar = ({ isMassSelectionAll, showFilters, showSorts, headless, children }) => {
|
|
32
|
+
export const ExplorerToolbar = ({ isMassSelectionAll, showFilters, showSorts, headless, selectAllButton, viewSettingsLoading, children }) => {
|
|
43
33
|
const { t } = useSharedTranslation();
|
|
44
|
-
|
|
45
|
-
const { filters, sort } = view;
|
|
46
|
-
const { openSettingsPanel } = useOpenViewSettings({ view, isEnabled: true });
|
|
47
|
-
const { attributeDetailsById } = useAttributeDetailsData(view.libraryId);
|
|
48
|
-
const visibleFilters = filters.filter(filterItem => !filterItem.hidden);
|
|
49
|
-
if (((visibleFilters.length === 0 && sort.length === 0) || (!showFilters && !showSorts)) && !children) {
|
|
50
|
-
return null;
|
|
51
|
-
}
|
|
52
|
-
const sortValues = sort.length === 0
|
|
53
|
-
? undefined
|
|
54
|
-
: sort.map(({ field, order }) => (attributeDetailsById?.[field]?.label ?? field) +
|
|
55
|
-
' ' +
|
|
56
|
-
(order === SortOrder.asc ? t('explorer.sort-ascending') : t('explorer.sort-descending')));
|
|
57
|
-
const _handleClickOnSort = () => isMassSelectionAll ? undefined : openSettingsPanel('sort-items');
|
|
58
|
-
if (!Object.keys(attributeDetailsById).length) {
|
|
59
|
-
return _jsx(_Fragment, {});
|
|
60
|
-
}
|
|
61
|
-
return (_jsxs(ExplorerToolbarListStyled, { "aria-label": t('explorer.toolbar'), className: headless ? 'headless' : '', children: [!!children && (_jsxs(_Fragment, { children: [_jsx("li", { children: children }), ((showFilters && visibleFilters.length !== 0) || (showSorts && sort.length > 0)) && (_jsx(DividerStyled, { type: "vertical" }))] })), (showFilters || showSorts) && (_jsxs(_Fragment, { children: [visibleFilters.length > 0 &&
|
|
62
|
-
visibleFilters.map(filter => (_jsx("li", { children: _jsx(CommonFilterItem, { filter: {
|
|
63
|
-
...filter,
|
|
64
|
-
attribute: {
|
|
65
|
-
...attributeDetailsById[filter?.attribute?.id],
|
|
66
|
-
...filter.attribute
|
|
67
|
-
}
|
|
68
|
-
}, disabled: isMassSelectionAll }, filter.id) }, filter.id))), showSorts && sort.length > 0 && (_jsx("li", { children: _jsx(FilterStyled, { label: t('explorer.sort-items'), values: sortValues, disabled: isMassSelectionAll, onClick: _handleClickOnSort }) }))] }))] }));
|
|
34
|
+
return (_jsxs(ExplorerToolbarListStyled, { "aria-label": t('explorer.toolbar'), className: headless ? 'headless' : '', children: [_jsx(Section, { children: !viewSettingsLoading && (_jsx(ExplorerFiltersAndSorts, { selectAllButton: selectAllButton, showFilters: showFilters, showSorts: showSorts, isMassSelectionAll: isMassSelectionAll })) }), _jsx(Section, { children: children })] }));
|
|
69
35
|
};
|
|
70
36
|
//# sourceMappingURL=ExplorerToolbar.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExplorerToolbar.js","sourceRoot":"","sources":["../../../src/components/Explorer/ExplorerToolbar.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAC,
|
|
1
|
+
{"version":3,"file":"ExplorerToolbar.js","sourceRoot":"","sources":["../../../src/components/Explorer/ExplorerToolbar.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAC,uBAAuB,EAAC,MAAM,2BAA2B,CAAC;AAClE,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAEvC,MAAM,yBAAyB,GAAG,MAAM,CAAC,EAAE,CAAA;;;;;;;;;;;;;;;;;;;;;CAqB1C,CAAC;AAEF,MAAM,OAAO,GAAG,MAAM,CAAC,GAAG,CAAA;;;;CAIzB,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAOvB,CAAC,EAAC,kBAAkB,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,eAAe,EAAE,mBAAmB,EAAE,QAAQ,EAAC,EAAE,EAAE;IAC5G,MAAM,EAAC,CAAC,EAAC,GAAG,oBAAoB,EAAE,CAAC;IAEnC,OAAO,CACH,MAAC,yBAAyB,kBAAa,CAAC,CAAC,kBAAkB,CAAC,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,aAC/F,KAAC,OAAO,cACH,CAAC,mBAAmB,IAAI,CACrB,KAAC,uBAAuB,IACpB,eAAe,EAAE,eAAe,EAChC,WAAW,EAAE,WAAW,EACxB,SAAS,EAAE,SAAS,EACpB,kBAAkB,EAAE,kBAAkB,GACxC,CACL,GACK,EACV,KAAC,OAAO,cAAE,QAAQ,GAAW,IACL,CAC/B,CAAC;AACN,CAAC,CAAC"}
|
|
@@ -4,7 +4,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
4
4
|
// License text available at https://www.gnu.org/licenses/lgpl-3.0.txt
|
|
5
5
|
import { KitIdCard } from 'aristid-ds';
|
|
6
6
|
export const IdCard = ({ item }) => {
|
|
7
|
-
const { id, label,
|
|
7
|
+
const { id, label, preview, subLabel } = item;
|
|
8
8
|
const itemLabel = label ?? id;
|
|
9
9
|
const avatarProps = { label: itemLabel };
|
|
10
10
|
if (preview) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IdCard.js","sourceRoot":"","sources":["../../../src/components/Explorer/IdCard.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAC,SAAS,EAAC,MAAM,YAAY,CAAC;AASrC,MAAM,CAAC,MAAM,MAAM,GAAoC,CAAC,EAAC,IAAI,EAAC,EAAE,EAAE;IAC9D,MAAM,EAAC,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"IdCard.js","sourceRoot":"","sources":["../../../src/components/Explorer/IdCard.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAC,SAAS,EAAC,MAAM,YAAY,CAAC;AASrC,MAAM,CAAC,MAAM,MAAM,GAAoC,CAAC,EAAC,IAAI,EAAC,EAAE,EAAE;IAC9D,MAAM,EAAC,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAC,GAAG,IAAI,CAAC;IAC5C,MAAM,SAAS,GAAG,KAAK,IAAI,EAAE,CAAC;IAC9B,MAAM,WAAW,GAAe,EAAC,KAAK,EAAE,SAAS,EAAC,CAAC;IAEnD,IAAI,OAAO,EAAE,CAAC;QACV,WAAW,CAAC,GAAG,GAAG,OAAO,CAAC,KAAK,CAAC;IACpC,CAAC;IAED,OAAO,KAAC,SAAS,IAAC,WAAW,EAAE,WAAW,EAAE,KAAK,EAAE,KAAK,IAAI,EAAE,EAAE,WAAW,EAAE,QAAQ,IAAI,SAAS,GAAI,CAAC;AAC3G,CAAC,CAAC"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } 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 { IdCard } from './IdCard';
|
|
6
|
+
import { cloneElement, useRef } from 'react';
|
|
7
|
+
import { KitButton, KitDropDown, KitTooltip } from 'aristid-ds';
|
|
8
|
+
import styled from 'styled-components';
|
|
9
|
+
import { FaEllipsisH } from 'react-icons/fa';
|
|
10
|
+
import { useSharedTranslation } from '../../hooks/useSharedTranslation';
|
|
11
|
+
import { TOOLTIP_DEFAULT_DELAY_IN_SECONDS } from '../../constants';
|
|
12
|
+
const StyledTableNameCellContainer = styled.div `
|
|
13
|
+
position: relative;
|
|
14
|
+
display: inline-flex;
|
|
15
|
+
align-items: center;
|
|
16
|
+
width: 100%;
|
|
17
|
+
`;
|
|
18
|
+
const StyledActionsList = styled.div `
|
|
19
|
+
/* Action are displayed when the user hover the table row (CSS in DataView.tsx) */
|
|
20
|
+
display: none;
|
|
21
|
+
gap: calc(var(--general-spacing-xxs) * 1px);
|
|
22
|
+
transition:
|
|
23
|
+
display 0.2s ease-in-out,
|
|
24
|
+
align-items: center;
|
|
25
|
+
justify-content: center;
|
|
26
|
+
margin-left: calc(var(--general-spacing-xs) * 1px);
|
|
27
|
+
`;
|
|
28
|
+
const StyledIdCard = styled.div `
|
|
29
|
+
flex: 1;
|
|
30
|
+
`;
|
|
31
|
+
const resolveItemActionProp = (itemData, itemActionProp) => (typeof itemActionProp === 'function' ? itemActionProp(itemData) : itemActionProp);
|
|
32
|
+
export const TableNameCell = ({ item, itemActions }) => {
|
|
33
|
+
const { t } = useSharedTranslation();
|
|
34
|
+
const containerRef = useRef(null);
|
|
35
|
+
const itemActionsWithCallback = itemActions.map(action => ({
|
|
36
|
+
...action,
|
|
37
|
+
callback: () => action.callback(item)
|
|
38
|
+
}));
|
|
39
|
+
const isMoreThanThreeActions = itemActionsWithCallback.length > 3;
|
|
40
|
+
const itemsActionsWithCallbackToDisplay = isMoreThanThreeActions
|
|
41
|
+
? itemActionsWithCallback.slice(0, 2)
|
|
42
|
+
: itemActionsWithCallback;
|
|
43
|
+
const _handleButtonClick = (event, callback) => {
|
|
44
|
+
// Stop event propagation to avoid the row click event to be triggered
|
|
45
|
+
event.stopPropagation();
|
|
46
|
+
callback();
|
|
47
|
+
};
|
|
48
|
+
return (_jsxs(StyledTableNameCellContainer, { ref: containerRef, children: [_jsx(StyledIdCard, { children: _jsx(IdCard, { item: item.whoAmI }) }), _jsxs(StyledActionsList, { className: "actions-list", children: [itemsActionsWithCallbackToDisplay.map(({ label, icon, isDanger, callback, disabled }, actionIndex) => (_jsx(KitTooltip, { title: resolveItemActionProp(item, label), mouseEnterDelay: TOOLTIP_DEFAULT_DELAY_IN_SECONDS, children: _jsx(KitButton, { size: "m", "aria-label": resolveItemActionProp(item, label), icon: resolveItemActionProp(item, icon), onClick: event => _handleButtonClick(event, callback), danger: resolveItemActionProp(item, isDanger), disabled: resolveItemActionProp(item, disabled) }) }, actionIndex))), isMoreThanThreeActions && (_jsx(KitDropDown, { placement: "bottomRight", getPopupContainer: () => containerRef.current || document.body, destroyPopupOnHide: true, menu: {
|
|
49
|
+
items: itemActionsWithCallback
|
|
50
|
+
.slice(2)
|
|
51
|
+
.map(({ callback, icon, label, isDanger, disabled }) => ({
|
|
52
|
+
key: resolveItemActionProp(item, label),
|
|
53
|
+
danger: resolveItemActionProp(item, isDanger),
|
|
54
|
+
disabled: resolveItemActionProp(item, disabled),
|
|
55
|
+
label: resolveItemActionProp(item, label),
|
|
56
|
+
icon: icon
|
|
57
|
+
? cloneElement(resolveItemActionProp(item, icon), {
|
|
58
|
+
size: '2em'
|
|
59
|
+
})
|
|
60
|
+
: null, // TODO: find better tuning
|
|
61
|
+
onClick: callback
|
|
62
|
+
}))
|
|
63
|
+
}, children: _jsx(KitTooltip, { title: t('explorer.more-actions'), mouseEnterDelay: TOOLTIP_DEFAULT_DELAY_IN_SECONDS, children: _jsx(KitButton, { size: "m", "aria-label": t('explorer.more-actions') ?? undefined, icon: _jsx(FaEllipsisH, {}) }) }) }))] })] }));
|
|
64
|
+
};
|
|
65
|
+
//# sourceMappingURL=TableNameCell.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TableNameCell.js","sourceRoot":"","sources":["../../../src/components/Explorer/TableNameCell.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAC,MAAM,EAAC,MAAM,UAAU,CAAC;AAEhC,OAAO,EAAC,YAAY,EAAqB,MAAM,EAAC,MAAM,OAAO,CAAC;AAC9D,OAAO,EAAC,SAAS,EAAE,WAAW,EAAE,UAAU,EAAC,MAAM,YAAY,CAAC;AAC9D,OAAO,MAAM,MAAM,m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AE,CAAC,CAAC;gCACnD,GAAG,EAAE,qBAAqB,CAAC,IAAI,EAAE,KAAK,CAAC;gCACvC,MAAM,EAAE,qBAAqB,CAAC,IAAI,EAAE,QAAQ,CAAC;gCAC7C,QAAQ,EAAE,qBAAqB,CAAC,IAAI,EAAE,QAAQ,CAAC;gCAC/C,KAAK,EAAE,qBAAqB,CAAC,IAAI,EAAE,KAAK,CAAC;gCACzC,IAAI,EAAE,IAAI;oCACN,CAAC,CAAC,YAAY,CAAC,qBAAqB,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE;wCAC5C,IAAI,EAAE,KAAK;qCACd,CAAC;oCACJ,CAAC,CAAC,IAAI,EAAE,2BAA2B;gCACvC,OAAO,EAAE,QAAQ;6BACpB,CAAC,CAAC;yBACV,YAED,KAAC,UAAU,IACP,KAAK,EAAE,CAAC,CAAC,uBAAuB,CAAC,EACjC,eAAe,EAAE,gCAAgC,YAEjD,KAAC,SAAS,IACN,IAAI,EAAC,GAAG,gBACI,CAAC,CAAC,uBAAuB,CAAC,IAAI,SAAS,EACnD,IAAI,EAAE,KAAC,WAAW,KAAG,GACvB,GACO,GACH,CACjB,IACe,IACO,CAClC,CAAC;AACN,CAAC,CAAC"}
|
|
@@ -6,3 +6,5 @@ export declare const MASS_SELECTION_ALL = "all";
|
|
|
6
6
|
export declare const LINK_RECORDS_MODAL_CLASSNAME = "link-modal";
|
|
7
7
|
export declare const CREATE_RECORD_MODAL_CLASSNAME = "create-record-modal";
|
|
8
8
|
export declare const EDIT_RECORD_MODAL_CLASSNAME = "edit-record-modal";
|
|
9
|
+
export declare const WHO_AM_I_COLUMN = "whoAmI";
|
|
10
|
+
export declare const SNACKBAR_MASS_ID = "SNACKBAR_MASS_ID";
|
|
@@ -18,4 +18,6 @@ export const MASS_SELECTION_ALL = 'all';
|
|
|
18
18
|
export const LINK_RECORDS_MODAL_CLASSNAME = 'link-modal';
|
|
19
19
|
export const CREATE_RECORD_MODAL_CLASSNAME = 'create-record-modal';
|
|
20
20
|
export const EDIT_RECORD_MODAL_CLASSNAME = 'edit-record-modal';
|
|
21
|
+
export const WHO_AM_I_COLUMN = 'whoAmI';
|
|
22
|
+
export const SNACKBAR_MASS_ID = 'SNACKBAR_MASS_ID';
|
|
21
23
|
//# sourceMappingURL=_constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_constants.js","sourceRoot":"","sources":["../../../src/components/Explorer/_constants.ts"],"names":[],"mappings":"AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAC,SAAS,EAAC,MAAM,eAAe,CAAC;AAGxC,yJAAyJ;AACzJ,MAAM,CAAC,MAAM,+BAA+B,GAAgC;IACxE,KAAK,EAAE,SAAS,CAAC,IAAI;IACrB,MAAM,EAAE,SAAS,CAAC,KAAK;IACvB,QAAQ,EAAE,SAAS,CAAC,QAAQ;IAC5B,IAAI,EAAE,SAAS,CAAC,IAAI;CACvB,CAAC;AAEF,MAAM,CAAC,MAAM,+BAA+B,GAAgC;IACxE,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,OAAO;IACzB,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,QAAQ;IAC3B,CAAC,SAAS,CAAC,QAAQ,CAAC,EAAE,UAAU;CACnC,CAAC;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAAG,KAAK,CAAC;AAExC,MAAM,CAAC,MAAM,4BAA4B,GAAG,YAAY,CAAC;AAEzD,MAAM,CAAC,MAAM,6BAA6B,GAAG,qBAAqB,CAAC;AAEnE,MAAM,CAAC,MAAM,2BAA2B,GAAG,mBAAmB,CAAC"}
|
|
1
|
+
{"version":3,"file":"_constants.js","sourceRoot":"","sources":["../../../src/components/Explorer/_constants.ts"],"names":[],"mappings":"AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAC,SAAS,EAAC,MAAM,eAAe,CAAC;AAGxC,yJAAyJ;AACzJ,MAAM,CAAC,MAAM,+BAA+B,GAAgC;IACxE,KAAK,EAAE,SAAS,CAAC,IAAI;IACrB,MAAM,EAAE,SAAS,CAAC,KAAK;IACvB,QAAQ,EAAE,SAAS,CAAC,QAAQ;IAC5B,IAAI,EAAE,SAAS,CAAC,IAAI;CACvB,CAAC;AAEF,MAAM,CAAC,MAAM,+BAA+B,GAAgC;IACxE,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,OAAO;IACzB,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,QAAQ;IAC3B,CAAC,SAAS,CAAC,QAAQ,CAAC,EAAE,UAAU;CACnC,CAAC;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAAG,KAAK,CAAC;AAExC,MAAM,CAAC,MAAM,4BAA4B,GAAG,YAAY,CAAC;AAEzD,MAAM,CAAC,MAAM,6BAA6B,GAAG,qBAAqB,CAAC;AAEnE,MAAM,CAAC,MAAM,2BAA2B,GAAG,mBAAmB,CAAC;AAE/D,MAAM,CAAC,MAAM,eAAe,GAAG,QAAQ,CAAC;AAExC,MAAM,CAAC,MAAM,gBAAgB,GAAG,kBAAkB,CAAC"}
|
|
@@ -38,6 +38,7 @@ export interface IItemAction {
|
|
|
38
38
|
iconOnly?: boolean;
|
|
39
39
|
isDanger?: boolean | ((item: IItemData) => boolean);
|
|
40
40
|
disabled?: boolean | ((item: IItemData) => boolean);
|
|
41
|
+
useItemActionOnRowClick?: boolean;
|
|
41
42
|
}
|
|
42
43
|
export interface IPrimaryAction {
|
|
43
44
|
callback: () => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_types.js","sourceRoot":"","sources":["../../../src/components/Explorer/_types.ts"],"names":[],"mappings":"AAIA,OAAO,EAGH,aAAa,EAQhB,MAAM,eAAe,CAAC;AAGvB,OAAO,EAAC,sBAAsB,EAAC,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"_types.js","sourceRoot":"","sources":["../../../src/components/Explorer/_types.ts"],"names":[],"mappings":"AAIA,OA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AAC,aAAa,CAAC,WAAW,EAAE,aAAa,CAAC,aAAa,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,WAAW,CAAC,MAAM,CAAC,CAAC;AAEpH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,MAAsB,EAAiC,EAAE,CAC1F,MAAM,CAAC,SAAS,CAAC,IAAI,KAAK,aAAa,CAAC,IAAI,CAAC;AAEjD,MAAM,WAAW,GAAG,CAAC,MAAsB,EAAyE,EAAE,CAClH,CAAC,CAAC,MAAM,CAAC,SAAS,EAAE,UAAU,IAAI,MAAM,CAAC,SAAS,EAAE,UAAU,CAAC,MAAM,CAAC"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { type Dispatch } from 'react';
|
|
2
2
|
import { type IMassActions, type MassSelection } from '../_types';
|
|
3
3
|
import { type IViewSettingsAction, type IViewSettingsState } from '../manage-view-settings';
|
|
4
|
-
export declare const SNACKBAR_MASS_ID = "SNACKBAR_MASS_ID";
|
|
5
4
|
/**
|
|
6
5
|
* Hook used to manage mass selection as the snackbar and all kind of selection (manual, all in page, all in filters)
|
|
7
6
|
*
|
|
@@ -11,8 +10,9 @@ export declare const SNACKBAR_MASS_ID = "SNACKBAR_MASS_ID";
|
|
|
11
10
|
* @param totalCount - used for display only
|
|
12
11
|
* @param allVisibleKeys - list of all ids currently selected
|
|
13
12
|
* @param massActions - array of all actions available on mass selection
|
|
13
|
+
* @param snackbarId - id of the snackbar displayed
|
|
14
14
|
*/
|
|
15
|
-
export declare const useMassActions: ({ isEnabled, store: { dispatch, view }, totalCount, allVisibleKeys, massActions }: {
|
|
15
|
+
export declare const useMassActions: ({ isEnabled, store: { dispatch, view }, totalCount, allVisibleKeys, massActions, snackbarId }: {
|
|
16
16
|
isEnabled: boolean;
|
|
17
17
|
store: {
|
|
18
18
|
view: IViewSettingsState;
|
|
@@ -21,6 +21,7 @@ export declare const useMassActions: ({ isEnabled, store: { dispatch, view }, to
|
|
|
21
21
|
totalCount: number;
|
|
22
22
|
allVisibleKeys: string[];
|
|
23
23
|
massActions: IMassActions[];
|
|
24
|
+
snackbarId: string;
|
|
24
25
|
}) => {
|
|
25
26
|
selectAllButton: JSX.Element;
|
|
26
27
|
setSelectedKeys: (keys: MassSelection) => void;
|
|
@@ -3,7 +3,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
// This file is released under LGPL V3
|
|
4
4
|
// License text available at https://www.gnu.org/licenses/lgpl-3.0.txt
|
|
5
5
|
import { closeKitSnackBar, KitCheckbox, KitDropDown, KitSpace, openKitSnackBar } from 'aristid-ds';
|
|
6
|
-
import { useCallback, useEffect
|
|
6
|
+
import { useCallback, useEffect } from 'react';
|
|
7
7
|
import { FaChevronDown } from 'react-icons/fa';
|
|
8
8
|
import { RecordFilterCondition, RecordFilterOperator } from '../../../_gqlTypes';
|
|
9
9
|
import { useSharedTranslation } from '../../../hooks/useSharedTranslation';
|
|
@@ -11,7 +11,6 @@ import { interleaveElement } from '../../../_utils/interleaveElement';
|
|
|
11
11
|
import { MASS_SELECTION_ALL } from '../_constants';
|
|
12
12
|
import { ViewSettingsActionTypes } from '../manage-view-settings';
|
|
13
13
|
import { prepareFiltersForRequest } from '../_queries/prepareFiltersForRequest';
|
|
14
|
-
export const SNACKBAR_MASS_ID = 'SNACKBAR_MASS_ID';
|
|
15
14
|
/**
|
|
16
15
|
* Hook used to manage mass selection as the snackbar and all kind of selection (manual, all in page, all in filters)
|
|
17
16
|
*
|
|
@@ -21,21 +20,17 @@ export const SNACKBAR_MASS_ID = 'SNACKBAR_MASS_ID';
|
|
|
21
20
|
* @param totalCount - used for display only
|
|
22
21
|
* @param allVisibleKeys - list of all ids currently selected
|
|
23
22
|
* @param massActions - array of all actions available on mass selection
|
|
23
|
+
* @param snackbarId - id of the snackbar displayed
|
|
24
24
|
*/
|
|
25
|
-
export const useMassActions = ({ isEnabled, store: { dispatch, view }, totalCount, allVisibleKeys, massActions }) => {
|
|
25
|
+
export const useMassActions = ({ isEnabled, store: { dispatch, view }, totalCount, allVisibleKeys, massActions, snackbarId }) => {
|
|
26
26
|
const { t } = useSharedTranslation();
|
|
27
|
-
/**
|
|
28
|
-
* Use in the case of two `<Explorer />` components on the same page to avoid closing the snackbar of the other one.
|
|
29
|
-
*
|
|
30
|
-
* > Can be replaced by `useId` when we will migrate to React 19.
|
|
31
|
-
*/
|
|
32
|
-
const uniqId = useRef(Date.now());
|
|
33
27
|
useEffect(() => {
|
|
34
28
|
if (view.massSelection === MASS_SELECTION_ALL || view.massSelection.length !== 0) {
|
|
35
29
|
openKitSnackBar({
|
|
36
30
|
duration: 0,
|
|
37
31
|
closable: true,
|
|
38
|
-
snackbarId
|
|
32
|
+
snackbarId,
|
|
33
|
+
toasterId: snackbarId,
|
|
39
34
|
onClose: () => _setSelectedKeys([]),
|
|
40
35
|
message: t('explorer.massAction.selectedItems', {
|
|
41
36
|
count: view.massSelection === MASS_SELECTION_ALL ? totalCount : view.massSelection.length
|
|
@@ -63,16 +58,16 @@ export const useMassActions = ({ isEnabled, store: { dispatch, view }, totalCoun
|
|
|
63
58
|
});
|
|
64
59
|
}
|
|
65
60
|
else {
|
|
66
|
-
closeKitSnackBar(
|
|
61
|
+
closeKitSnackBar(snackbarId);
|
|
67
62
|
}
|
|
68
63
|
}, [view.massSelection, view.filters, totalCount]);
|
|
69
|
-
useEffect(() => () => closeKitSnackBar(
|
|
64
|
+
useEffect(() => () => closeKitSnackBar(snackbarId), []);
|
|
70
65
|
const isOnePage = view.pageSize > totalCount;
|
|
71
66
|
const hasSelectedAllAvailableItems = view.massSelection === MASS_SELECTION_ALL || view.massSelection.length === totalCount;
|
|
72
67
|
const hasSelectedSomeItems = view.massSelection !== MASS_SELECTION_ALL &&
|
|
73
68
|
view.massSelection.length > 0 &&
|
|
74
69
|
view.massSelection.length < totalCount;
|
|
75
|
-
const _selectAllButton = isOnePage ? (_jsx(KitCheckbox, { indeterminate: hasSelectedSomeItems, checked: hasSelectedAllAvailableItems, onChange: _ => {
|
|
70
|
+
const _selectAllButton = isOnePage ? (_jsx(KitCheckbox, { "aria-checked": hasSelectedSomeItems ? 'mixed' : hasSelectedAllAvailableItems ? 'true' : 'false', indeterminate: hasSelectedSomeItems, checked: hasSelectedAllAvailableItems, onChange: _ => {
|
|
76
71
|
if (hasSelectedAllAvailableItems) {
|
|
77
72
|
_setSelectedKeys([]);
|
|
78
73
|
}
|
|
@@ -105,7 +100,7 @@ export const useMassActions = ({ isEnabled, store: { dispatch, view }, totalCoun
|
|
|
105
100
|
}
|
|
106
101
|
}
|
|
107
102
|
]
|
|
108
|
-
}, children: _jsx(KitCheckbox, { indeterminate: hasSelectedSomeItems, checked: hasSelectedAllAvailableItems, children: _jsxs(KitSpace, { size: "s", children: [t('explorer.massAction.itemsTotal', { count: totalCount }), _jsx(FaChevronDown, {})] }) }) }));
|
|
103
|
+
}, children: _jsx(KitCheckbox, { "aria-checked": hasSelectedSomeItems ? 'mixed' : hasSelectedAllAvailableItems ? 'true' : 'false', indeterminate: hasSelectedSomeItems, checked: hasSelectedAllAvailableItems, children: _jsxs(KitSpace, { size: "s", children: [t('explorer.massAction.itemsTotal', { count: totalCount }), _jsx(FaChevronDown, {})] }) }) }));
|
|
109
104
|
const _setSelectedKeys = useCallback((keys) => dispatch({
|
|
110
105
|
type: ViewSettingsActionTypes.SET_SELECTED_KEYS,
|
|
111
106
|
payload: keys
|