@leav/ui 1.5.0-fd91b119 → 1.5.1-1929c505
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 +2 -17
- package/dist/_gqlTypes/index.js +2 -0
- package/dist/_gqlTypes/index.js.map +1 -1
- package/dist/components/Explorer/DataView.js +4 -3
- package/dist/components/Explorer/DataView.js.map +1 -1
- package/dist/components/Explorer/Explorer.js +1 -1
- package/dist/components/Explorer/Explorer.js.map +1 -1
- package/dist/components/Explorer/ExplorerFiltersAndSorts.d.ts +1 -0
- package/dist/components/Explorer/ExplorerFiltersAndSorts.js +2 -2
- package/dist/components/Explorer/ExplorerFiltersAndSorts.js.map +1 -1
- package/dist/components/Explorer/ExplorerToolbar.d.ts +1 -0
- package/dist/components/Explorer/ExplorerToolbar.js +2 -2
- package/dist/components/Explorer/ExplorerToolbar.js.map +1 -1
- package/dist/components/Explorer/IdCard.js +2 -2
- package/dist/components/Explorer/IdCard.js.map +1 -1
- package/dist/components/Explorer/actions-mass/useExportMassAction.js +5 -6
- package/dist/components/Explorer/actions-mass/useExportMassAction.js.map +1 -1
- package/dist/components/Filters/filter-items/filter-type/TextAttributeDropDown.js +24 -7
- package/dist/components/Filters/filter-items/filter-type/TextAttributeDropDown.js.map +1 -1
- package/dist/components/Filters/index.js.map +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/display-tree-node/TreeNodeList.js +1 -1
- package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/display-tree-node/TreeNodeList.js.map +1 -1
- package/dist/components/RecordHistory/RecordHistory.js +11 -6
- package/dist/components/RecordHistory/RecordHistory.js.map +1 -1
- package/dist/components/RecordHistory/RecordHistoryLogEntry.js +13 -7
- package/dist/components/RecordHistory/RecordHistoryLogEntry.js.map +1 -1
- package/dist/constants.d.ts +1 -0
- package/dist/constants.js +1 -0
- package/dist/constants.js.map +1 -1
- package/dist/hooks/useIFrameMessenger/messageHandlers.d.ts +3 -1
- package/dist/hooks/useIFrameMessenger/messageHandlers.js +12 -0
- package/dist/hooks/useIFrameMessenger/messageHandlers.js.map +1 -1
- package/dist/hooks/useIFrameMessenger/schema.d.ts +1 -0
- package/dist/hooks/useIFrameMessenger/schema.js +1 -0
- package/dist/hooks/useIFrameMessenger/schema.js.map +1 -1
- package/dist/hooks/useIFrameMessenger/types.d.ts +17 -3
- package/dist/hooks/useIFrameMessenger/types.js.map +1 -1
- package/dist/hooks/useIFrameMessenger/useIFrameMessenger.d.ts +2 -0
- package/dist/hooks/useIFrameMessengerClient/iFrameMessengerClientContext.d.ts +2 -0
- package/dist/hooks/useIFrameMessengerClient/useIFrameMessengerClient.d.ts +2 -0
- package/dist/locales/en/shared.json +2 -2
- package/dist/locales/fr/shared.json +2 -2
- package/package.json +5 -5
|
@@ -88,9 +88,10 @@ export const DataView = memo(({ dataGroupedFilteredSorted, attributesToDisplay,
|
|
|
88
88
|
title: attributeName === WHO_AM_I_COLUMN ? t('explorer.name') : attributesProperties[attributeName].label,
|
|
89
89
|
dataIndex: USELESS,
|
|
90
90
|
width: getFieldColumnWidth(attributesProperties[attributeName]),
|
|
91
|
-
shouldCellUpdate: (record, prevRecord) =>
|
|
92
|
-
|
|
93
|
-
|
|
91
|
+
shouldCellUpdate: (record, prevRecord) => isMassSelectionAll ||
|
|
92
|
+
(attributeName === WHO_AM_I_COLUMN
|
|
93
|
+
? record.whoAmI !== prevRecord.whoAmI
|
|
94
|
+
: record.propertiesById[attributeName] !== prevRecord.propertiesById[attributeName]),
|
|
94
95
|
render: (_, item) => attributeName === WHO_AM_I_COLUMN ? (_jsx(TableNameCell, { item: item, itemActions: itemActions })) : (_jsx(TableCell, { attributeProperties: attributesProperties[attributeName], values: item.propertiesById[attributeName] })),
|
|
95
96
|
}));
|
|
96
97
|
//TODO: test row click
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataView.js","sourceRoot":"","sources":["../../../src/components/Explorer/D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EAAC,CAAC,EAAE,eAAe,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,YAAY,EAAE,CAAC,EAAE,MAAM,EAAC,EAC/D,UAAU,EAAE,yBAAyB,EACrC,UAAU,EAAE,KAAK,EACjB,YAAY,EAAE,aAAa,EAC3B,KAAK,EAAE,CAAC,IAAe,EAAE,EAAE,CAAC,CAAC;oBACzB,OAAO,EAAE,GAAG,EAAE,CAAC,yBAAyB,EAAE,QAAQ,CAAC,IAAI,CAAC;iBAC3D,CAAC,GACJ,EACD,eAAe,IAAI,CAChB,cAAK,SAAS,EAAC,YAAY,YACvB,KAAC,aAAa,kBACC,YAAY,EACvB,eAAe,QACf,SAAS,EAAE,CAAC,KAAK,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,EAAE,EAAE,CAC7B,CAAC,CAAC,kCAAkC,EAAE,EAAC,IAAI,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAC,CAAC,EAEnE,KAAK,EAAE,eAAe,CAAC,UAAU,EACjC,cAAc,EAAE,eAAe,CAAC,WAAW,EAC3C,eAAe,EAAE,eAAe,CAAC,QAAQ,EACzC,eAAe,EAAE,eAAe,CAAC,eAAe,EAChD,QAAQ,EAAE,eAAe,CAAC,UAAU,EACpC,gBAAgB,EAAE,eAAe,CAAC,cAAc,GAClD,GACA,CACT,IACwB,CAChC,CAAC;AACN,CAAC,EACD,aAAa,CAChB,CAAC","sourcesContent":["// Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06\n// This file is released under LGPL V3\n// License text available at https://www.gnu.org/licenses/lgpl-3.0.txt\nimport {type ComponentProps, type FunctionComponent, type Key, memo} from 'react';\nimport {KitPagination, KitTable} from 'aristid-ds';\nimport {type KitTableColumnType} from 'aristid-ds/dist/Kit/DataDisplay/Table/types';\nimport styled from 'styled-components';\nimport isEqual from 'lodash/isEqual';\nimport {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\nimport {type IExplorerData, type IItemAction, type IItemData} from './_types';\nimport {TableCell} from './TableCell';\nimport {defaultPaginationHeight, useTableScrollableHeight} from './useTableScrollableHeight';\nimport {useColumnWidth} from './useColumnWidth';\nimport {WHO_AM_I_COLUMN} from './_constants';\nimport {TableNameCell} from './TableNameCell';\nimport cn from 'classnames';\n\nconst USELESS = '';\n\nconst tableRowHeight = 56;\nconst tableHeaderMinLineHeight = 22;\n\nconst DataViewContainerDivStyled = styled.div`\n flex: 1 1 min-content;\n max-height: minmax(0, 1fr);\n overflow: hidden;\n\n &.headless {\n overflow-y: auto;\n }\n\n .kit-table {\n padding-bottom: ${defaultPaginationHeight}px;\n position: relative;\n }\n\n .pagination {\n flex: 0 0 auto;\n justify-content: center;\n display: flex;\n padding-top: calc(var(--general-spacing-xs) * 1px);\n }\n`;\n\n// TODO: Table component should be updated fix header display\nconst StyledTable = styled(KitTable)`\n .ant-table-thead > tr > th {\n padding-top: calc(var(--general-spacing-xxs) * 1px) !important;\n padding-bottom: calc(var(--general-spacing-xxs) * 1px) !important;\n height: ${tableRowHeight}px;\n\n .ant-table-cell {\n min-height: ${tableHeaderMinLineHeight}px;\n height: auto !important;\n padding: 0 calc(var(--general-spacing-s) * 1px) 0 0;\n }\n }\n\n .ant-table-tbody > tr:hover .ant-table-cell {\n .actions-list {\n display: inline-flex;\n }\n }\n\n .ant-table-tbody > tr {\n .ant-table-cell {\n min-height: ${tableRowHeight}px;\n height: auto !important;\n }\n }\n\n &.row-clickable {\n .ant-table-tbody > tr {\n cursor: pointer;\n }\n }\n`;\n\ninterface IDataViewProps {\n dataGroupedFilteredSorted: IItemData[];\n itemActions: IItemAction[];\n attributesProperties: IExplorerData['attributes'];\n attributesToDisplay: string[];\n paginationProps?: {\n pageSizeOptions: number[];\n totalCount: number;\n currentPage: number;\n pageSize: number;\n setNewPage: (page: number, pageSize: number) => void;\n setNewPageSize: (page: number, pageSize: number) => void;\n };\n selection: {\n onSelectionChange: null | ((keys: Key[]) => void);\n isMassSelectionAll: boolean;\n selectedKeys: Key[];\n mode?: 'simple' | 'multiple';\n };\n hideTableHeader: boolean;\n}\n\n// TODO: tests will fail if we don't check attributeToDisplay because we have a render with no attributes but data is present. We should check why there's this behavior\nconst arePropsEqual = (prevProps: IDataViewProps, nextProps: IDataViewProps) =>\n isEqual(\n {\n attributesToDisplay: prevProps.attributesToDisplay,\n data: prevProps.dataGroupedFilteredSorted,\n selectedKeys: prevProps.selection.selectedKeys,\n },\n {\n attributesToDisplay: nextProps.attributesToDisplay,\n data: nextProps.dataGroupedFilteredSorted,\n selectedKeys: nextProps.selection.selectedKeys,\n },\n );\n\nexport const DataView: FunctionComponent<IDataViewProps> = memo(\n ({\n dataGroupedFilteredSorted,\n attributesToDisplay,\n attributesProperties,\n paginationProps,\n itemActions,\n selection: {onSelectionChange, selectedKeys, isMassSelectionAll, mode},\n hideTableHeader = false,\n }) => {\n const {t} = useSharedTranslation();\n\n const {containerRef, scrollHeight} = useTableScrollableHeight(!!paginationProps);\n const {getFieldColumnWidth} = useColumnWidth();\n\n const columns = attributesToDisplay.map<KitTableColumnType<IItemData>>(attributeName => ({\n title: attributeName === WHO_AM_I_COLUMN ? t('explorer.name') : attributesProperties[attributeName].label,\n dataIndex: USELESS,\n width: getFieldColumnWidth(attributesProperties[attributeName]),\n shouldCellUpdate: (record, prevRecord) =>\n attributeName === WHO_AM_I_COLUMN\n ? record.whoAmI !== prevRecord.whoAmI\n : record.propertiesById[attributeName] !== prevRecord.propertiesById[attributeName],\n render: (_, item) =>\n attributeName === WHO_AM_I_COLUMN ? (\n <TableNameCell item={item} itemActions={itemActions} />\n ) : (\n <TableCell\n attributeProperties={attributesProperties[attributeName]}\n values={item.propertiesById[attributeName]}\n />\n ),\n }));\n\n //TODO: test row click\n const itemActionToUseOnRowClick = itemActions.find(itemAction => itemAction.useItemActionOnRowClick);\n\n const _rowSelection: ComponentProps<typeof KitTable>['rowSelection'] =\n onSelectionChange === null\n ? undefined\n : {\n type: mode === 'simple' ? 'radio' : 'checkbox',\n columnTitle: ' ', // blank string to hide select all checkbox from <KitTable />\n selectedRowKeys: selectedKeys,\n preserveSelectedRowKeys: true,\n // TODO: review types from antd directly\n onChange: (selectedRowKeys: Key[]) => onSelectionChange(selectedRowKeys),\n getCheckboxProps: isMassSelectionAll\n ? () => ({\n disabled: true,\n })\n : undefined,\n };\n\n // TODO: handle columns width based on attribute type/format\n return (\n <DataViewContainerDivStyled ref={containerRef} className={cn({headless: hideTableHeader})}>\n <StyledTable\n className={cn({\n 'row-clickable': itemActionToUseOnRowClick,\n })}\n showHeader={dataGroupedFilteredSorted.length > 0 && !hideTableHeader}\n columns={columns}\n tableLayout=\"fixed\"\n scroll={{y: hideTableHeader ? '100%' : scrollHeight, x: '100%'}}\n dataSource={dataGroupedFilteredSorted}\n pagination={false}\n rowSelection={_rowSelection}\n onRow={(item: IItemData) => ({\n onClick: () => itemActionToUseOnRowClick?.callback(item),\n })}\n />\n {paginationProps && (\n <div className=\"pagination\">\n <KitPagination\n aria-label=\"pagination\"\n showSizeChanger\n showTotal={(total, [from, to]) =>\n t('explorer.pagination-total-number', {from, to, count: total})\n }\n total={paginationProps.totalCount}\n defaultCurrent={paginationProps.currentPage}\n defaultPageSize={paginationProps.pageSize}\n pageSizeOptions={paginationProps.pageSizeOptions}\n onChange={paginationProps.setNewPage}\n onShowSizeChange={paginationProps.setNewPageSize}\n />\n </div>\n )}\n </DataViewContainerDivStyled>\n );\n },\n arePropsEqual,\n);\n"]}
|
|
1
|
+
{"version":3,"file":"DataView.js","sourceRoot":"","sources":["../../../src/components/Explorer/DataView.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAwD,IAAI,EAAC,MAAM,OAAO,CAAC;AAClF,OAAO,EAAC,aAAa,EAAE,QAAQ,EAAC,MAAM,YAAY,CAAC;AAEnD,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,OAAO,MAAM,gBAAgB,CAAC;AACrC,OAAO,EAAC,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O,EAAE,GAAG,EAAE,CAAC,yBAAyB,EAAE,QAAQ,CAAC,IAAI,CAAC;iBAC3D,CAAC,GACJ,EACD,eAAe,IAAI,CAChB,cAAK,SAAS,EAAC,YAAY,YACvB,KAAC,aAAa,kBACC,YAAY,EACvB,eAAe,QACf,SAAS,EAAE,CAAC,KAAK,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,EAAE,EAAE,CAC7B,CAAC,CAAC,kCAAkC,EAAE,EAAC,IAAI,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAC,CAAC,EAEnE,KAAK,EAAE,eAAe,CAAC,UAAU,EACjC,cAAc,EAAE,eAAe,CAAC,WAAW,EAC3C,eAAe,EAAE,eAAe,CAAC,QAAQ,EACzC,eAAe,EAAE,eAAe,CAAC,eAAe,EAChD,QAAQ,EAAE,eAAe,CAAC,UAAU,EACpC,gBAAgB,EAAE,eAAe,CAAC,cAAc,GAClD,GACA,CACT,IACwB,CAChC,CAAC;AACN,CAAC,EACD,aAAa,CAChB,CAAC","sourcesContent":["// Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06\n// This file is released under LGPL V3\n// License text available at https://www.gnu.org/licenses/lgpl-3.0.txt\nimport {type ComponentProps, type FunctionComponent, type Key, memo} from 'react';\nimport {KitPagination, KitTable} from 'aristid-ds';\nimport {type KitTableColumnType} from 'aristid-ds/dist/Kit/DataDisplay/Table/types';\nimport styled from 'styled-components';\nimport isEqual from 'lodash/isEqual';\nimport {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\nimport {type IExplorerData, type IItemAction, type IItemData} from './_types';\nimport {TableCell} from './TableCell';\nimport {defaultPaginationHeight, useTableScrollableHeight} from './useTableScrollableHeight';\nimport {useColumnWidth} from './useColumnWidth';\nimport {WHO_AM_I_COLUMN} from './_constants';\nimport {TableNameCell} from './TableNameCell';\nimport cn from 'classnames';\n\nconst USELESS = '';\n\nconst tableRowHeight = 56;\nconst tableHeaderMinLineHeight = 22;\n\nconst DataViewContainerDivStyled = styled.div`\n flex: 1 1 min-content;\n max-height: minmax(0, 1fr);\n overflow: hidden;\n\n &.headless {\n overflow-y: auto;\n }\n\n .kit-table {\n padding-bottom: ${defaultPaginationHeight}px;\n position: relative;\n }\n\n .pagination {\n flex: 0 0 auto;\n justify-content: center;\n display: flex;\n padding-top: calc(var(--general-spacing-xs) * 1px);\n }\n`;\n\n// TODO: Table component should be updated fix header display\nconst StyledTable = styled(KitTable)`\n .ant-table-thead > tr > th {\n padding-top: calc(var(--general-spacing-xxs) * 1px) !important;\n padding-bottom: calc(var(--general-spacing-xxs) * 1px) !important;\n height: ${tableRowHeight}px;\n\n .ant-table-cell {\n min-height: ${tableHeaderMinLineHeight}px;\n height: auto !important;\n padding: 0 calc(var(--general-spacing-s) * 1px) 0 0;\n }\n }\n\n .ant-table-tbody > tr:hover .ant-table-cell {\n .actions-list {\n display: inline-flex;\n }\n }\n\n .ant-table-tbody > tr {\n .ant-table-cell {\n min-height: ${tableRowHeight}px;\n height: auto !important;\n }\n }\n\n &.row-clickable {\n .ant-table-tbody > tr {\n cursor: pointer;\n }\n }\n`;\n\ninterface IDataViewProps {\n dataGroupedFilteredSorted: IItemData[];\n itemActions: IItemAction[];\n attributesProperties: IExplorerData['attributes'];\n attributesToDisplay: string[];\n paginationProps?: {\n pageSizeOptions: number[];\n totalCount: number;\n currentPage: number;\n pageSize: number;\n setNewPage: (page: number, pageSize: number) => void;\n setNewPageSize: (page: number, pageSize: number) => void;\n };\n selection: {\n onSelectionChange: null | ((keys: Key[]) => void);\n isMassSelectionAll: boolean;\n selectedKeys: Key[];\n mode?: 'simple' | 'multiple';\n };\n hideTableHeader: boolean;\n}\n\n// TODO: tests will fail if we don't check attributeToDisplay because we have a render with no attributes but data is present. We should check why there's this behavior\nconst arePropsEqual = (prevProps: IDataViewProps, nextProps: IDataViewProps) =>\n isEqual(\n {\n attributesToDisplay: prevProps.attributesToDisplay,\n data: prevProps.dataGroupedFilteredSorted,\n selectedKeys: prevProps.selection.selectedKeys,\n },\n {\n attributesToDisplay: nextProps.attributesToDisplay,\n data: nextProps.dataGroupedFilteredSorted,\n selectedKeys: nextProps.selection.selectedKeys,\n },\n );\n\nexport const DataView: FunctionComponent<IDataViewProps> = memo(\n ({\n dataGroupedFilteredSorted,\n attributesToDisplay,\n attributesProperties,\n paginationProps,\n itemActions,\n selection: {onSelectionChange, selectedKeys, isMassSelectionAll, mode},\n hideTableHeader = false,\n }) => {\n const {t} = useSharedTranslation();\n\n const {containerRef, scrollHeight} = useTableScrollableHeight(!!paginationProps);\n const {getFieldColumnWidth} = useColumnWidth();\n\n const columns = attributesToDisplay.map<KitTableColumnType<IItemData>>(attributeName => ({\n title: attributeName === WHO_AM_I_COLUMN ? t('explorer.name') : attributesProperties[attributeName].label,\n dataIndex: USELESS,\n width: getFieldColumnWidth(attributesProperties[attributeName]),\n shouldCellUpdate: (record, prevRecord) =>\n isMassSelectionAll ||\n (attributeName === WHO_AM_I_COLUMN\n ? record.whoAmI !== prevRecord.whoAmI\n : record.propertiesById[attributeName] !== prevRecord.propertiesById[attributeName]),\n render: (_, item) =>\n attributeName === WHO_AM_I_COLUMN ? (\n <TableNameCell item={item} itemActions={itemActions} />\n ) : (\n <TableCell\n attributeProperties={attributesProperties[attributeName]}\n values={item.propertiesById[attributeName]}\n />\n ),\n }));\n\n //TODO: test row click\n const itemActionToUseOnRowClick = itemActions.find(itemAction => itemAction.useItemActionOnRowClick);\n\n const _rowSelection: ComponentProps<typeof KitTable>['rowSelection'] =\n onSelectionChange === null\n ? undefined\n : {\n type: mode === 'simple' ? 'radio' : 'checkbox',\n columnTitle: ' ', // blank string to hide select all checkbox from <KitTable />\n selectedRowKeys: selectedKeys,\n preserveSelectedRowKeys: true,\n // TODO: review types from antd directly\n onChange: (selectedRowKeys: Key[]) => onSelectionChange(selectedRowKeys),\n getCheckboxProps: isMassSelectionAll\n ? () => ({\n disabled: true,\n })\n : undefined,\n };\n\n // TODO: handle columns width based on attribute type/format\n return (\n <DataViewContainerDivStyled ref={containerRef} className={cn({headless: hideTableHeader})}>\n <StyledTable\n className={cn({\n 'row-clickable': itemActionToUseOnRowClick,\n })}\n showHeader={dataGroupedFilteredSorted.length > 0 && !hideTableHeader}\n columns={columns}\n tableLayout=\"fixed\"\n scroll={{y: hideTableHeader ? '100%' : scrollHeight, x: '100%'}}\n dataSource={dataGroupedFilteredSorted}\n pagination={false}\n rowSelection={_rowSelection}\n onRow={(item: IItemData) => ({\n onClick: () => itemActionToUseOnRowClick?.callback(item),\n })}\n />\n {paginationProps && (\n <div className=\"pagination\">\n <KitPagination\n aria-label=\"pagination\"\n showSizeChanger\n showTotal={(total, [from, to]) =>\n t('explorer.pagination-total-number', {from, to, count: total})\n }\n total={paginationProps.totalCount}\n defaultCurrent={paginationProps.currentPage}\n defaultPageSize={paginationProps.pageSize}\n pageSizeOptions={paginationProps.pageSizeOptions}\n onChange={paginationProps.setNewPage}\n onShowSizeChange={paginationProps.setNewPageSize}\n />\n </div>\n )}\n </DataViewContainerDivStyled>\n );\n },\n arePropsEqual,\n);\n"]}
|
|
@@ -165,7 +165,7 @@ export const Explorer = forwardRef(({ entrypoint, itemActions = [], primaryActio
|
|
|
165
165
|
linkAction: linkPrimaryAction,
|
|
166
166
|
totalCount,
|
|
167
167
|
}), [createPrimaryAction?.disabled, linkPrimaryAction?.disabled, totalCount]);
|
|
168
|
-
return (_jsxs(_Fragment, { children: [_jsx(FiltersContext.Provider, { value: { filtersData, dispatch: filtersDispatch }, children: _jsxs(ViewSettingsContext.Provider, { value: { view, dispatch: viewSettingsDispatch }, 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
|
|
168
|
+
return (_jsxs(_Fragment, { children: [_jsx(FiltersContext.Provider, { value: { filtersData, dispatch: filtersDispatch }, children: _jsxs(ViewSettingsContext.Provider, { value: { view, dispatch: viewSettingsDispatch }, 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, canRemoveFilters: view?.enableConfigureView ?? false, 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
|
|
169
169
|
? {
|
|
170
170
|
pageSizeOptions: defaultPageSizeOptions,
|
|
171
171
|
currentPage,
|
|
@@ -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,EAAE,OAAO,EAAC,MAAM,OAAO,CAAC;AAC/E,OAAO,EAAC,YAAY,EAAC,MAAM,WAAW,CAAC;AACvC,OAAO,EAAC,QAAQ,EAAE,mBAAmB,EAAE,aAAa,EAAC,MAAM,YAAY,CAAC;AACxE,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,OAAO,EAAC,uBAAuB,EAAC,MAAM,wCAAwC,CAAC;AAC/E,OAAO,EACH,sBAAsB,EACtB,SAAS,EACT,eAAe,EACf,mB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mB,EACvB,oBAAoB,IAAI,YAAY,CAAC,KAAC,SAAS,KAAG,EAAE,oBAAoB,EAAE,EAAE,IAAI,QAAQ,CAAC,IAAI,CAAC,EAC9F,gBAAgB,EAChB,WAAW,EACX,SAAS,IACiB,GACT,EAC1B,KAAC,mBAAmB,IAAC,EAAE,EAAE,oBAAoB,GAAI,IAClD,CACN,CAAC;AACN,CAAC,CACJ,CAAC","sourcesContent":["// Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06\n// This file is released under LGPL V3\n// License text available at https://www.gnu.org/licenses/lgpl-3.0.txt\nimport {forwardRef, type ReactNode, useImperativeHandle, useMemo} from 'react';\nimport {createPortal} from 'react-dom';\nimport {KitEmpty, KitSnackBarProvider, KitTypography} from 'aristid-ds';\nimport styled from 'styled-components';\nimport {Loading} from '_ui/components/Loading';\nimport {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\nimport {type ISubmitMultipleResult} from '_ui/components/RecordEdition/EditRecordContent/_types';\nimport {\n type DefaultViewSettings,\n type Entrypoint,\n type IItemAction,\n type IMassActions,\n type IPrimaryAction,\n} from './_types';\nimport {useExplorerData} from './_queries/useExplorerData';\nimport {DataView} from './DataView';\nimport {ExplorerTitle} from './ExplorerTitle';\nimport {ExplorerToolbar} from './ExplorerToolbar';\nimport {useEditStatusItemAction} from './actions-item/useEditStatusItemAction';\nimport {usePrimaryActionsButton} from './actions-primary/usePrimaryActions';\nimport {useCreatePrimaryAction} from './actions-primary/useCreatePrimaryAction';\nimport {useLinkPrimaryAction} from './actions-primary/useLinkPrimaryAction';\nimport {useMassActions} from './actions-mass/useMassActions';\nimport {useDeactivateMassAction} from './actions-mass/useDeactivateMassAction';\nimport {\n defaultPageSizeOptions,\n SidePanel,\n useEditSettings,\n useOpenViewSettings,\n ViewSettingsContext,\n} from './manage-view-settings';\nimport {useSearchInput} from './useSearchInput';\nimport {usePagination} from './usePagination';\nimport {useViewSettingsReducer} from './useViewSettingsReducer';\nimport {MASS_SELECTION_ALL, SNACKBAR_MASS_ID, WHO_AM_I_COLUMN} from './_constants';\nimport {useDeleteLinkValues} from './actions-mass/useDeleteLinkValues';\nimport {useReplaceItemAction} from './actions-item/useReplaceItemAction';\nimport {type JoinLibraryContextFragment} from '_ui/_gqlTypes';\nimport {useFiltersReducer} from '_ui/components/Filters/context/useFiltersReducer';\nimport {FiltersContext} from '_ui/components/Filters/context/filtersContext';\nimport {useExportMassAction} from './actions-mass/useExportMassAction';\n\nconst isNotEmpty = <T extends unknown[]>(union: T): union is Exclude<T, []> => union.length > 0;\n\nconst emptyArray = [];\nconst emptyObject = {};\n\nconst ExplorerHeaderDivStyled = styled.div`\n display: flex;\n align-items: flex-start;\n padding: calc(var(--general-spacing-xs) * 1px);\n`;\n\nconst ExplorerPageDivStyled = styled.div`\n display: flex;\n flex-direction: column;\n height: 100%;\n overflow: hidden;\n`;\n\nconst ExplorerEmptyDataStyled = styled.div`\n flex: 1;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n`;\n\nexport interface IExplorerProps {\n entrypoint: Entrypoint;\n noPagination?: true;\n itemActions?: IItemAction[];\n primaryActions?: IPrimaryAction[];\n massActions?: IMassActions[];\n title?: string;\n selectionMode?: 'multiple' | 'simple';\n emptyPlaceholder?: ReactNode;\n defaultActionsForItem?: Array<'replaceLink' | 'remove' | 'activate'>;\n defaultPrimaryActions?: Array<'create'>;\n defaultMassActions?: Array<'deactivate' | 'export'>;\n defaultViewSettings?: DefaultViewSettings;\n defaultCallbacks?: {\n item?: {\n edit?: IItemAction['callback'];\n replaceLink?: (replaceValuesResult: ISubmitMultipleResult) => void;\n remove?: IItemAction['callback'];\n };\n primary?: {\n create?: ({\n recordIdCreated,\n saveValuesResultOnLink,\n }: {\n recordIdCreated: string;\n saveValuesResultOnLink?: ISubmitMultipleResult;\n }) => void;\n link?: (saveValuesResult: ISubmitMultipleResult) => void;\n };\n mass?: {\n deactivate?: IMassActions['callback'];\n export?: IMassActions['callback'];\n };\n };\n showCreateOnNoResultOnly?: boolean;\n showFilters?: boolean;\n showSorts?: boolean;\n hideFirstActionLabel?: boolean;\n /**\n * Optional to `false` load the last added view when `props.defaultViewSettings.viewId` is `undefined`,\n * if set to `true` load default view.\n */\n ignoreViewByDefault?: boolean;\n showTitle?: boolean;\n showSearch?: boolean;\n disableSelection?: boolean;\n hideSelectAllAction?: boolean;\n hidePrimaryActions?: boolean;\n hideTableHeader?: boolean;\n creationFormId?: string;\n joinLibraryContext?: JoinLibraryContextFragment;\n}\n\nexport interface IExplorerRef {\n createAction: IPrimaryAction | null;\n linkAction: IPrimaryAction | null;\n totalCount: number;\n}\n\nexport const Explorer = forwardRef<IExplorerRef, IExplorerProps>(\n (\n {\n entrypoint,\n itemActions = [],\n primaryActions = [],\n massActions = [],\n title,\n selectionMode = 'multiple',\n emptyPlaceholder,\n noPagination,\n creationFormId,\n showCreateOnNoResultOnly = false,\n showFilters = false,\n showSorts = false,\n hideFirstActionLabel = false,\n disableSelection = false,\n hideSelectAllAction = false,\n showTitle = false,\n showSearch = false,\n hidePrimaryActions = false,\n hideTableHeader = false,\n ignoreViewByDefault = false,\n defaultActionsForItem = ['replaceLink', 'remove', 'activate'],\n defaultPrimaryActions = ['create'],\n defaultMassActions = ['deactivate'],\n defaultCallbacks,\n defaultViewSettings,\n joinLibraryContext,\n },\n ref,\n ) => {\n const {t} = useSharedTranslation();\n\n const {panelElement: settingsPanelElement} = useEditSettings();\n\n const {\n loading: viewSettingsLoading,\n view,\n dispatch: viewSettingsDispatch,\n } = useViewSettingsReducer(entrypoint, defaultViewSettings, ignoreViewByDefault);\n\n const {filtersData, dispatch: filtersDispatch} = useFiltersReducer({\n libraryId: view.libraryId,\n viewId: view.viewId ?? undefined,\n filters: defaultViewSettings?.filters ?? undefined,\n filtersOperator: defaultViewSettings?.filtersOperator ?? undefined,\n ignoreViewByDefault,\n skip: viewSettingsLoading,\n });\n\n const {currentPage, setNewPageSize, setNewPage} = usePagination(viewSettingsDispatch);\n\n const {\n data,\n isMultivalue,\n canEditLinkAttributeValues,\n loading: loadingData,\n refetch,\n } = useExplorerData({\n entrypoint,\n libraryId: view.libraryId,\n attributeIds: view.attributesIds,\n fulltextSearch: view.fulltextSearch,\n pagination: noPagination ? null : {limit: view.pageSize, offset: view.pageSize * (currentPage - 1)},\n sorts: view.sort,\n filters: filtersData.filters,\n filtersOperator: filtersData.filtersOperator,\n skip: viewSettingsLoading,\n }); // TODO: refresh when go back on page\n const isMassSelectionAll = view.massSelection === MASS_SELECTION_ALL;\n const isLink = entrypoint.type === 'link';\n\n const {editStatusItemAction} = useEditStatusItemAction({\n isEnabled:\n isNotEmpty(defaultActionsForItem) &&\n (defaultActionsForItem.includes('remove') || defaultActionsForItem.includes('activate')),\n onRemove: defaultCallbacks?.item?.remove,\n canDeleteLinkValues: canEditLinkAttributeValues,\n store: {view, dispatch: viewSettingsDispatch},\n entrypoint,\n });\n\n const {replaceItemAction, replaceItemModal} = useReplaceItemAction({\n isEnabled: isLink && isNotEmpty(defaultActionsForItem) && defaultActionsForItem.includes('replaceLink'),\n isMultivalue,\n onReplace: defaultCallbacks?.item?.replaceLink,\n canReplaceLinkValues: canEditLinkAttributeValues,\n });\n\n const totalCount = data?.totalCount ?? 0;\n\n const hasNoResults = data === null || data.totalCount === 0;\n\n const isAllowedFreeEntry = !(entrypoint.type === 'library' && !entrypoint.allowFreeEntry);\n\n const showCreatePrimaryButton = showCreateOnNoResultOnly\n ? !hidePrimaryActions && !loadingData && hasNoResults && isAllowedFreeEntry\n : true;\n\n const {createPrimaryAction, createModal} = useCreatePrimaryAction({\n isEnabled: isNotEmpty(defaultPrimaryActions) && defaultPrimaryActions.includes('create'),\n isVisible: showCreatePrimaryButton,\n libraryId: view.libraryId,\n canCreateAndLinkValue: canEditLinkAttributeValues,\n onCreate: defaultCallbacks?.primary?.create,\n joinLibraryContext,\n entrypoint,\n isMultivalue,\n totalCount,\n formId: creationFormId,\n refetch,\n });\n const {linkPrimaryAction, linkModal} = useLinkPrimaryAction({\n isEnabled: isLink,\n joinLibraryContext,\n isVisible: showCreatePrimaryButton,\n canAddLinkValue: canEditLinkAttributeValues,\n onLink: defaultCallbacks?.primary?.link,\n linkId: data?.totalCount === 0 ? undefined : data?.records[0]?.id_value,\n isMultivalue,\n maxItemsLeft: null, // TODO: use KitTable.row\n });\n\n const allVisibleKeys = data?.records.map(({key}) => key) ?? [];\n\n const {exportMassAction} = useExportMassAction({\n isEnabled: !isLink && isNotEmpty(defaultMassActions) && defaultMassActions.includes('export'),\n store: {view, dispatch: viewSettingsDispatch},\n totalCount,\n onExport: defaultCallbacks?.mass?.export,\n });\n\n const {deactivateMassAction} = useDeactivateMassAction({\n isEnabled: !isLink && isNotEmpty(defaultMassActions) && defaultMassActions.includes('deactivate'),\n store: {view, dispatch: viewSettingsDispatch},\n allVisibleKeys,\n totalCount,\n onDeactivate: defaultCallbacks?.mass?.deactivate,\n refetch,\n });\n\n const {unlinkMassAction} = useDeleteLinkValues({\n isEnabled: isLink && isNotEmpty(defaultMassActions) && defaultMassActions.includes('deactivate'),\n store: {view, dispatch: viewSettingsDispatch},\n filtersStore: filtersData,\n pagination: noPagination ? null : {limit: view.pageSize, offset: view.pageSize * (currentPage - 1)},\n allVisibleKeys,\n onDelete: defaultCallbacks?.mass?.deactivate,\n refetch,\n });\n\n const _isSelectionDisable = disableSelection || (isLink && !isMultivalue && totalCount > 0);\n\n const massActionSnackbarId = useMemo(() => `${SNACKBAR_MASS_ID}_${Date.now()}`, []);\n\n const {setSelectedKeys, selectAllButton} = useMassActions({\n isEnabled:\n totalCount > 0 && !_isSelectionDisable && (isNotEmpty(defaultMassActions) || isNotEmpty(massActions)),\n store: {view, dispatch: viewSettingsDispatch},\n filtersStore: filtersData,\n totalCount,\n allVisibleKeys,\n massActions: [exportMassAction, deactivateMassAction, unlinkMassAction, ...massActions].filter(Boolean),\n snackbarId: massActionSnackbarId,\n });\n\n const {primaryButton} = usePrimaryActionsButton({\n view,\n actions: [createPrimaryAction, linkPrimaryAction, ...primaryActions].filter(Boolean),\n hideFirstActionLabel,\n });\n\n const {viewSettingsButton, viewListButton} = useOpenViewSettings({view, isEnabled: !isMassSelectionAll});\n\n const {searchInput} = useSearchInput({view, dispatch: viewSettingsDispatch, setNewPage});\n\n useImperativeHandle(\n ref,\n () => ({\n createAction: createPrimaryAction,\n linkAction: linkPrimaryAction,\n totalCount,\n }),\n [createPrimaryAction?.disabled, linkPrimaryAction?.disabled, totalCount],\n );\n\n return (\n <>\n <FiltersContext.Provider value={{filtersData, dispatch: filtersDispatch}}>\n <ViewSettingsContext.Provider value={{view, dispatch: viewSettingsDispatch}}>\n <ExplorerPageDivStyled>\n {showTitle && (\n <ExplorerHeaderDivStyled>\n <KitTypography.Title level=\"h3\">\n {\n !viewSettingsLoading && (\n <ExplorerTitle\n library={view.libraryId}\n title={title}\n entrypoint={entrypoint}\n />\n ) /*TODO: manage loading*/\n }\n </KitTypography.Title>\n </ExplorerHeaderDivStyled>\n )}\n <ExplorerToolbar\n showFilters={showFilters}\n showSorts={showSorts}\n isMassSelectionAll={isMassSelectionAll}\n headless={hideTableHeader}\n selectAllButton={hideSelectAllAction ? null : selectAllButton}\n viewSettingsLoading={viewSettingsLoading}\n >\n {view?.enableConfigureView ? viewListButton : null}\n {showSearch ? searchInput : null}\n {view?.enableConfigureView ? viewSettingsButton : null}\n {hidePrimaryActions ? null : primaryButton}\n </ExplorerToolbar>\n {loadingData || viewSettingsLoading ? (\n <Loading />\n ) : hasNoResults ? (\n <ExplorerEmptyDataStyled>\n {emptyPlaceholder || <KitEmpty title={t('explorer.empty-data')} />}\n </ExplorerEmptyDataStyled>\n ) : (\n <DataView\n dataGroupedFilteredSorted={data?.records ?? emptyArray}\n attributesProperties={data?.attributes ?? emptyObject}\n attributesToDisplay={[WHO_AM_I_COLUMN, ...view.attributesIds]}\n hideTableHeader={hideTableHeader}\n paginationProps={\n entrypoint.type === 'library' && !noPagination\n ? {\n pageSizeOptions: defaultPageSizeOptions,\n currentPage,\n pageSize: view.pageSize,\n setNewPageSize,\n setNewPage,\n totalCount,\n }\n : undefined\n }\n itemActions={[...itemActions, replaceItemAction, editStatusItemAction]\n .filter(Boolean)\n .map(action => ({\n ...action,\n disabled: isMassSelectionAll || action.disabled,\n }))}\n selection={{\n onSelectionChange: _isSelectionDisable ? null : setSelectedKeys,\n isMassSelectionAll,\n selectedKeys: isMassSelectionAll\n ? data?.records.map(({whoAmI}) => whoAmI.id)\n : (view.massSelection as string[]),\n mode: selectionMode,\n }}\n />\n )}\n </ExplorerPageDivStyled>\n {settingsPanelElement && createPortal(<SidePanel />, settingsPanelElement?.() ?? document.body)}\n {replaceItemModal}\n {createModal}\n {linkModal}\n </ViewSettingsContext.Provider>\n </FiltersContext.Provider>\n <KitSnackBarProvider id={massActionSnackbarId} />\n </>\n );\n },\n);\n"]}
|
|
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,EAAC,MAAM,OAAO,CAAC;AAC/E,OAAO,EAAC,YAAY,EAAC,MAAM,WAAW,CAAC;AACvC,OAAO,EAAC,QAAQ,EAAE,mBAAmB,EAAE,aAAa,EAAC,MAAM,YAAY,CAAC;AACxE,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,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BAAkB,IAAI,MAAM,CAAC,QAAQ;qCAClD,CAAC,CAAC,EACP,SAAS,EAAE;wCACP,iBAAiB,EAAE,mBAAmB,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,eAAe;wCAC/D,kBAAkB;wCAClB,YAAY,EAAE,kBAAkB;4CAC5B,CAAC,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,EAAC,MAAM,EAAC,EAAE,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC;4CAC5C,CAAC,CAAE,IAAI,CAAC,aAA0B;wCACtC,IAAI,EAAE,aAAa;qCACtB,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,GACT,EAC1B,KAAC,mBAAmB,IAAC,EAAE,EAAE,oBAAoB,GAAI,IAClD,CACN,CAAC;AACN,CAAC,CACJ,CAAC","sourcesContent":["// Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06\n// This file is released under LGPL V3\n// License text available at https://www.gnu.org/licenses/lgpl-3.0.txt\nimport {forwardRef, type ReactNode, useImperativeHandle, useMemo} from 'react';\nimport {createPortal} from 'react-dom';\nimport {KitEmpty, KitSnackBarProvider, KitTypography} from 'aristid-ds';\nimport styled from 'styled-components';\nimport {Loading} from '_ui/components/Loading';\nimport {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\nimport {type ISubmitMultipleResult} from '_ui/components/RecordEdition/EditRecordContent/_types';\nimport {\n type DefaultViewSettings,\n type Entrypoint,\n type IItemAction,\n type IMassActions,\n type IPrimaryAction,\n} from './_types';\nimport {useExplorerData} from './_queries/useExplorerData';\nimport {DataView} from './DataView';\nimport {ExplorerTitle} from './ExplorerTitle';\nimport {ExplorerToolbar} from './ExplorerToolbar';\nimport {useEditStatusItemAction} from './actions-item/useEditStatusItemAction';\nimport {usePrimaryActionsButton} from './actions-primary/usePrimaryActions';\nimport {useCreatePrimaryAction} from './actions-primary/useCreatePrimaryAction';\nimport {useLinkPrimaryAction} from './actions-primary/useLinkPrimaryAction';\nimport {useMassActions} from './actions-mass/useMassActions';\nimport {useDeactivateMassAction} from './actions-mass/useDeactivateMassAction';\nimport {\n defaultPageSizeOptions,\n SidePanel,\n useEditSettings,\n useOpenViewSettings,\n ViewSettingsContext,\n} from './manage-view-settings';\nimport {useSearchInput} from './useSearchInput';\nimport {usePagination} from './usePagination';\nimport {useViewSettingsReducer} from './useViewSettingsReducer';\nimport {MASS_SELECTION_ALL, SNACKBAR_MASS_ID, WHO_AM_I_COLUMN} from './_constants';\nimport {useDeleteLinkValues} from './actions-mass/useDeleteLinkValues';\nimport {useReplaceItemAction} from './actions-item/useReplaceItemAction';\nimport {type JoinLibraryContextFragment} from '_ui/_gqlTypes';\nimport {useFiltersReducer} from '_ui/components/Filters/context/useFiltersReducer';\nimport {FiltersContext} from '_ui/components/Filters/context/filtersContext';\nimport {useExportMassAction} from './actions-mass/useExportMassAction';\n\nconst isNotEmpty = <T extends unknown[]>(union: T): union is Exclude<T, []> => union.length > 0;\n\nconst emptyArray = [];\nconst emptyObject = {};\n\nconst ExplorerHeaderDivStyled = styled.div`\n display: flex;\n align-items: flex-start;\n padding: calc(var(--general-spacing-xs) * 1px);\n`;\n\nconst ExplorerPageDivStyled = styled.div`\n display: flex;\n flex-direction: column;\n height: 100%;\n overflow: hidden;\n`;\n\nconst ExplorerEmptyDataStyled = styled.div`\n flex: 1;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n`;\n\nexport interface IExplorerProps {\n entrypoint: Entrypoint;\n noPagination?: true;\n itemActions?: IItemAction[];\n primaryActions?: IPrimaryAction[];\n massActions?: IMassActions[];\n title?: string;\n selectionMode?: 'multiple' | 'simple';\n emptyPlaceholder?: ReactNode;\n defaultActionsForItem?: Array<'replaceLink' | 'remove' | 'activate'>;\n defaultPrimaryActions?: Array<'create'>;\n defaultMassActions?: Array<'deactivate' | 'export'>;\n defaultViewSettings?: DefaultViewSettings;\n defaultCallbacks?: {\n item?: {\n edit?: IItemAction['callback'];\n replaceLink?: (replaceValuesResult: ISubmitMultipleResult) => void;\n remove?: IItemAction['callback'];\n };\n primary?: {\n create?: ({\n recordIdCreated,\n saveValuesResultOnLink,\n }: {\n recordIdCreated: string;\n saveValuesResultOnLink?: ISubmitMultipleResult;\n }) => void;\n link?: (saveValuesResult: ISubmitMultipleResult) => void;\n };\n mass?: {\n deactivate?: IMassActions['callback'];\n export?: IMassActions['callback'];\n };\n };\n showCreateOnNoResultOnly?: boolean;\n showFilters?: boolean;\n showSorts?: boolean;\n hideFirstActionLabel?: boolean;\n /**\n * Optional to `false` load the last added view when `props.defaultViewSettings.viewId` is `undefined`,\n * if set to `true` load default view.\n */\n ignoreViewByDefault?: boolean;\n showTitle?: boolean;\n showSearch?: boolean;\n disableSelection?: boolean;\n hideSelectAllAction?: boolean;\n hidePrimaryActions?: boolean;\n hideTableHeader?: boolean;\n creationFormId?: string;\n joinLibraryContext?: JoinLibraryContextFragment;\n}\n\nexport interface IExplorerRef {\n createAction: IPrimaryAction | null;\n linkAction: IPrimaryAction | null;\n totalCount: number;\n}\n\nexport const Explorer = forwardRef<IExplorerRef, IExplorerProps>(\n (\n {\n entrypoint,\n itemActions = [],\n primaryActions = [],\n massActions = [],\n title,\n selectionMode = 'multiple',\n emptyPlaceholder,\n noPagination,\n creationFormId,\n showCreateOnNoResultOnly = false,\n showFilters = false,\n showSorts = false,\n hideFirstActionLabel = false,\n disableSelection = false,\n hideSelectAllAction = false,\n showTitle = false,\n showSearch = false,\n hidePrimaryActions = false,\n hideTableHeader = false,\n ignoreViewByDefault = false,\n defaultActionsForItem = ['replaceLink', 'remove', 'activate'],\n defaultPrimaryActions = ['create'],\n defaultMassActions = ['deactivate'],\n defaultCallbacks,\n defaultViewSettings,\n joinLibraryContext,\n },\n ref,\n ) => {\n const {t} = useSharedTranslation();\n\n const {panelElement: settingsPanelElement} = useEditSettings();\n\n const {\n loading: viewSettingsLoading,\n view,\n dispatch: viewSettingsDispatch,\n } = useViewSettingsReducer(entrypoint, defaultViewSettings, ignoreViewByDefault);\n\n const {filtersData, dispatch: filtersDispatch} = useFiltersReducer({\n libraryId: view.libraryId,\n viewId: view.viewId ?? undefined,\n filters: defaultViewSettings?.filters ?? undefined,\n filtersOperator: defaultViewSettings?.filtersOperator ?? undefined,\n ignoreViewByDefault,\n skip: viewSettingsLoading,\n });\n\n const {currentPage, setNewPageSize, setNewPage} = usePagination(viewSettingsDispatch);\n\n const {\n data,\n isMultivalue,\n canEditLinkAttributeValues,\n loading: loadingData,\n refetch,\n } = useExplorerData({\n entrypoint,\n libraryId: view.libraryId,\n attributeIds: view.attributesIds,\n fulltextSearch: view.fulltextSearch,\n pagination: noPagination ? null : {limit: view.pageSize, offset: view.pageSize * (currentPage - 1)},\n sorts: view.sort,\n filters: filtersData.filters,\n filtersOperator: filtersData.filtersOperator,\n skip: viewSettingsLoading,\n }); // TODO: refresh when go back on page\n const isMassSelectionAll = view.massSelection === MASS_SELECTION_ALL;\n const isLink = entrypoint.type === 'link';\n\n const {editStatusItemAction} = useEditStatusItemAction({\n isEnabled:\n isNotEmpty(defaultActionsForItem) &&\n (defaultActionsForItem.includes('remove') || defaultActionsForItem.includes('activate')),\n onRemove: defaultCallbacks?.item?.remove,\n canDeleteLinkValues: canEditLinkAttributeValues,\n store: {view, dispatch: viewSettingsDispatch},\n entrypoint,\n });\n\n const {replaceItemAction, replaceItemModal} = useReplaceItemAction({\n isEnabled: isLink && isNotEmpty(defaultActionsForItem) && defaultActionsForItem.includes('replaceLink'),\n isMultivalue,\n onReplace: defaultCallbacks?.item?.replaceLink,\n canReplaceLinkValues: canEditLinkAttributeValues,\n });\n\n const totalCount = data?.totalCount ?? 0;\n\n const hasNoResults = data === null || data.totalCount === 0;\n\n const isAllowedFreeEntry = !(entrypoint.type === 'library' && !entrypoint.allowFreeEntry);\n\n const showCreatePrimaryButton = showCreateOnNoResultOnly\n ? !hidePrimaryActions && !loadingData && hasNoResults && isAllowedFreeEntry\n : true;\n\n const {createPrimaryAction, createModal} = useCreatePrimaryAction({\n isEnabled: isNotEmpty(defaultPrimaryActions) && defaultPrimaryActions.includes('create'),\n isVisible: showCreatePrimaryButton,\n libraryId: view.libraryId,\n canCreateAndLinkValue: canEditLinkAttributeValues,\n onCreate: defaultCallbacks?.primary?.create,\n joinLibraryContext,\n entrypoint,\n isMultivalue,\n totalCount,\n formId: creationFormId,\n refetch,\n });\n const {linkPrimaryAction, linkModal} = useLinkPrimaryAction({\n isEnabled: isLink,\n joinLibraryContext,\n isVisible: showCreatePrimaryButton,\n canAddLinkValue: canEditLinkAttributeValues,\n onLink: defaultCallbacks?.primary?.link,\n linkId: data?.totalCount === 0 ? undefined : data?.records[0]?.id_value,\n isMultivalue,\n maxItemsLeft: null, // TODO: use KitTable.row\n });\n\n const allVisibleKeys = data?.records.map(({key}) => key) ?? [];\n\n const {exportMassAction} = useExportMassAction({\n isEnabled: !isLink && isNotEmpty(defaultMassActions) && defaultMassActions.includes('export'),\n store: {view, dispatch: viewSettingsDispatch},\n totalCount,\n onExport: defaultCallbacks?.mass?.export,\n });\n\n const {deactivateMassAction} = useDeactivateMassAction({\n isEnabled: !isLink && isNotEmpty(defaultMassActions) && defaultMassActions.includes('deactivate'),\n store: {view, dispatch: viewSettingsDispatch},\n allVisibleKeys,\n totalCount,\n onDeactivate: defaultCallbacks?.mass?.deactivate,\n refetch,\n });\n\n const {unlinkMassAction} = useDeleteLinkValues({\n isEnabled: isLink && isNotEmpty(defaultMassActions) && defaultMassActions.includes('deactivate'),\n store: {view, dispatch: viewSettingsDispatch},\n filtersStore: filtersData,\n pagination: noPagination ? null : {limit: view.pageSize, offset: view.pageSize * (currentPage - 1)},\n allVisibleKeys,\n onDelete: defaultCallbacks?.mass?.deactivate,\n refetch,\n });\n\n const _isSelectionDisable = disableSelection || (isLink && !isMultivalue && totalCount > 0);\n\n const massActionSnackbarId = useMemo(() => `${SNACKBAR_MASS_ID}_${Date.now()}`, []);\n\n const {setSelectedKeys, selectAllButton} = useMassActions({\n isEnabled:\n totalCount > 0 && !_isSelectionDisable && (isNotEmpty(defaultMassActions) || isNotEmpty(massActions)),\n store: {view, dispatch: viewSettingsDispatch},\n filtersStore: filtersData,\n totalCount,\n allVisibleKeys,\n massActions: [exportMassAction, deactivateMassAction, unlinkMassAction, ...massActions].filter(Boolean),\n snackbarId: massActionSnackbarId,\n });\n\n const {primaryButton} = usePrimaryActionsButton({\n view,\n actions: [createPrimaryAction, linkPrimaryAction, ...primaryActions].filter(Boolean),\n hideFirstActionLabel,\n });\n\n const {viewSettingsButton, viewListButton} = useOpenViewSettings({view, isEnabled: !isMassSelectionAll});\n\n const {searchInput} = useSearchInput({view, dispatch: viewSettingsDispatch, setNewPage});\n\n useImperativeHandle(\n ref,\n () => ({\n createAction: createPrimaryAction,\n linkAction: linkPrimaryAction,\n totalCount,\n }),\n [createPrimaryAction?.disabled, linkPrimaryAction?.disabled, totalCount],\n );\n\n return (\n <>\n <FiltersContext.Provider value={{filtersData, dispatch: filtersDispatch}}>\n <ViewSettingsContext.Provider value={{view, dispatch: viewSettingsDispatch}}>\n <ExplorerPageDivStyled>\n {showTitle && (\n <ExplorerHeaderDivStyled>\n <KitTypography.Title level=\"h3\">\n {\n !viewSettingsLoading && (\n <ExplorerTitle\n library={view.libraryId}\n title={title}\n entrypoint={entrypoint}\n />\n ) /*TODO: manage loading*/\n }\n </KitTypography.Title>\n </ExplorerHeaderDivStyled>\n )}\n <ExplorerToolbar\n showFilters={showFilters}\n showSorts={showSorts}\n isMassSelectionAll={isMassSelectionAll}\n headless={hideTableHeader}\n canRemoveFilters={view?.enableConfigureView ?? false}\n selectAllButton={hideSelectAllAction ? null : selectAllButton}\n viewSettingsLoading={viewSettingsLoading}\n >\n {view?.enableConfigureView ? viewListButton : null}\n {showSearch ? searchInput : null}\n {view?.enableConfigureView ? viewSettingsButton : null}\n {hidePrimaryActions ? null : primaryButton}\n </ExplorerToolbar>\n {loadingData || viewSettingsLoading ? (\n <Loading />\n ) : hasNoResults ? (\n <ExplorerEmptyDataStyled>\n {emptyPlaceholder || <KitEmpty title={t('explorer.empty-data')} />}\n </ExplorerEmptyDataStyled>\n ) : (\n <DataView\n dataGroupedFilteredSorted={data?.records ?? emptyArray}\n attributesProperties={data?.attributes ?? emptyObject}\n attributesToDisplay={[WHO_AM_I_COLUMN, ...view.attributesIds]}\n hideTableHeader={hideTableHeader}\n paginationProps={\n entrypoint.type === 'library' && !noPagination\n ? {\n pageSizeOptions: defaultPageSizeOptions,\n currentPage,\n pageSize: view.pageSize,\n setNewPageSize,\n setNewPage,\n totalCount,\n }\n : undefined\n }\n itemActions={[...itemActions, replaceItemAction, editStatusItemAction]\n .filter(Boolean)\n .map(action => ({\n ...action,\n disabled: isMassSelectionAll || action.disabled,\n }))}\n selection={{\n onSelectionChange: _isSelectionDisable ? null : setSelectedKeys,\n isMassSelectionAll,\n selectedKeys: isMassSelectionAll\n ? data?.records.map(({whoAmI}) => whoAmI.id)\n : (view.massSelection as string[]),\n mode: selectionMode,\n }}\n />\n )}\n </ExplorerPageDivStyled>\n {settingsPanelElement && createPortal(<SidePanel />, settingsPanelElement?.() ?? document.body)}\n {replaceItemModal}\n {createModal}\n {linkModal}\n </ViewSettingsContext.Provider>\n </FiltersContext.Provider>\n <KitSnackBarProvider id={massActionSnackbarId} />\n </>\n );\n },\n);\n"]}
|
|
@@ -18,12 +18,12 @@ const DividerStyled = styled(KitDivider) `
|
|
|
18
18
|
height: 26px;
|
|
19
19
|
margin-inline: calc(var(--general-spacing-xxs) * 1px);
|
|
20
20
|
`;
|
|
21
|
-
export const ExplorerFiltersAndSorts = ({ isMassSelectionAll, showFilters, showSorts, selectAllButton }) => {
|
|
21
|
+
export const ExplorerFiltersAndSorts = ({ isMassSelectionAll, showFilters, showSorts, canRemoveFilters, selectAllButton }) => {
|
|
22
22
|
const { t } = useSharedTranslation();
|
|
23
23
|
const { view } = useViewSettingsContext();
|
|
24
24
|
const { sort } = view;
|
|
25
25
|
const { openSettingsPanel } = useOpenViewSettings({ view, isEnabled: true });
|
|
26
|
-
const { filtersProps } = useFilters();
|
|
26
|
+
const { filtersProps } = useFilters(!canRemoveFilters);
|
|
27
27
|
const { attributeDetailsById } = useAttributeDetailsData(view.libraryId);
|
|
28
28
|
// const visibleFilters = filters.filter(filterItem => !filterItem.hidden);
|
|
29
29
|
if (((filtersProps.length === 0 && sort.length === 0) || (!showFilters && !showSorts)) && !selectAllButton) {
|
|
@@ -1 +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,uBAAuB,EAAC,MAAM,wDAAwD,CAAC;AAC/F,OAAO,EAAC,mBAAmB,EAAC,MAAM,wBAAwB,CAAC;AAE3D,OAAO,EAAC,UAAU,EAAE,SAAS,EAAC,MAAM,YAAY,CAAC;AACjD,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,EAAC,gBAAgB,EAA0B,MAAM,sDAAsD,CAAC;AAC/G,OAAO,EAAC,UAAU,EAAC,MAAM,mCAAmC,CAAC;AAE7D,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,
|
|
1
|
+
{"version":3,"file":"ExplorerF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S,CAAC,IAAI,CAC3B,8BACK,YAAY,CAAC,MAAM,GAAG,CAAC;wBACpB,YAAY,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE,CAAC,CAC5B,uBACI,KAAC,gBAAgB,OACR,WAAkC,EACvC,QAAQ,EAAE,kBAAkB,GAC9B,IAJG,WAAW,CAAC,GAAG,CAKnB,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","sourcesContent":["// Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06\n// This file is released under LGPL V3\n// License text available at https://www.gnu.org/licenses/lgpl-3.0.txt\nimport {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\nimport {SortOrder} from '_ui/_gqlTypes';\nimport {useViewSettingsContext} from './manage-view-settings/store-view-settings/useViewSettingsContext';\nimport {useAttributeDetailsData} from './manage-view-settings/_shared/useAttributeDetailsData';\nimport {useOpenViewSettings} from './manage-view-settings';\nimport {type ComponentProps, type FunctionComponent, type ReactNode} from 'react';\nimport {KitDivider, KitFilter} from 'aristid-ds';\nimport styled from 'styled-components';\nimport {CommonFilterItem, type ICommonFilterProps} from '_ui/components/Filters/filter-items/CommonFilterItem';\nimport {useFilters} from '_ui/components/Filters/useFilters';\n\nconst FilterStyled = styled(KitFilter)`\n flex: 0 0 auto;\n`;\n\nconst DividerStyled = styled(KitDivider)`\n height: 26px;\n margin-inline: calc(var(--general-spacing-xxs) * 1px);\n`;\n\nexport const ExplorerFiltersAndSorts: FunctionComponent<{\n isMassSelectionAll: boolean;\n showFilters: boolean;\n showSorts: boolean;\n canRemoveFilters: boolean;\n selectAllButton: ReactNode | null;\n}> = ({isMassSelectionAll, showFilters, showSorts, canRemoveFilters, selectAllButton}) => {\n const {t} = useSharedTranslation();\n\n const {view} = useViewSettingsContext();\n const {sort} = view;\n\n const {openSettingsPanel} = useOpenViewSettings({view, isEnabled: true});\n const {filtersProps} = useFilters(!canRemoveFilters);\n\n const {attributeDetailsById} = useAttributeDetailsData(view.libraryId);\n // const visibleFilters = filters.filter(filterItem => !filterItem.hidden);\n\n if (((filtersProps.length === 0 && sort.length === 0) || (!showFilters && !showSorts)) && !selectAllButton) {\n return null;\n }\n\n const sortValues =\n sort.length === 0\n ? undefined\n : sort.map(\n ({field, order}) =>\n (attributeDetailsById?.[field]?.label ?? field) +\n ' ' +\n (order === SortOrder.asc ? t('explorer.sort-ascending') : t('explorer.sort-descending')),\n );\n\n const _handleClickOnSort: ComponentProps<typeof FilterStyled>['onClick'] = () =>\n isMassSelectionAll ? undefined : openSettingsPanel('sort-items');\n\n if (!Object.keys(attributeDetailsById).length) {\n return <></>;\n }\n return (\n <>\n {selectAllButton && (\n <>\n <li>{selectAllButton}</li>\n {((showFilters && filtersProps.length !== 0) || (showSorts && sort.length > 0)) && (\n <DividerStyled type=\"vertical\" />\n )}\n </>\n )}\n {(showFilters || showSorts) && (\n <>\n {filtersProps.length > 0 &&\n filtersProps.map(filterProps => (\n <li key={filterProps.key}>\n <CommonFilterItem\n {...(filterProps as ICommonFilterProps)}\n disabled={isMassSelectionAll}\n />\n </li>\n ))}\n {showSorts && sort.length > 0 && (\n <li>\n <FilterStyled\n label={t('explorer.sort-items')}\n values={sortValues}\n disabled={isMassSelectionAll}\n onClick={_handleClickOnSort}\n />\n </li>\n )}\n </>\n )}\n </>\n );\n};\n"]}
|
|
@@ -32,8 +32,8 @@ const Section = styled.div `
|
|
|
32
32
|
align-items: center;
|
|
33
33
|
gap: calc(var(--general-spacing-xxs) * 1px);
|
|
34
34
|
`;
|
|
35
|
-
export const ExplorerToolbar = ({ isMassSelectionAll, showFilters, showSorts, headless, selectAllButton, viewSettingsLoading, children }) => {
|
|
35
|
+
export const ExplorerToolbar = ({ isMassSelectionAll, showFilters, showSorts, headless, canRemoveFilters, selectAllButton, viewSettingsLoading, children, }) => {
|
|
36
36
|
const { t } = useSharedTranslation();
|
|
37
|
-
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 })] }));
|
|
37
|
+
return (_jsxs(ExplorerToolbarListStyled, { "aria-label": t('explorer.toolbar'), className: headless ? 'headless' : '', children: [_jsx(Section, { children: !viewSettingsLoading && (_jsx(ExplorerFiltersAndSorts, { selectAllButton: selectAllButton, showFilters: showFilters, showSorts: showSorts, canRemoveFilters: canRemoveFilters, isMassSelectionAll: isMassSelectionAll })) }), _jsx(Section, { children: children })] }));
|
|
38
38
|
};
|
|
39
39
|
//# sourceMappingURL=ExplorerToolbar.js.map
|
|
@@ -1 +1 @@
|
|
|
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;;;;;;;;;;;;;;;;;;;;;;;CAuB1C,CAAC;AAEF,MAAM,OAAO,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;CAKzB,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,
|
|
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;;;;;;;;;;;;;;;;;;;;;;;CAuB1C,CAAC;AAEF,MAAM,OAAO,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;CAKzB,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAQvB,CAAC,EACF,kBAAkB,EAClB,WAAW,EACX,SAAS,EACT,QAAQ,EACR,gBAAgB,EAChB,eAAe,EACf,mBAAmB,EACnB,QAAQ,GACX,EAAE,EAAE;IACD,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,gBAAgB,EAAE,gBAAgB,EAClC,kBAAkB,EAAE,kBAAkB,GACxC,CACL,GACK,EACV,KAAC,OAAO,cAAE,QAAQ,GAAW,IACL,CAC/B,CAAC;AACN,CAAC,CAAC","sourcesContent":["// Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06\n// This file is released under LGPL V3\n// License text available at https://www.gnu.org/licenses/lgpl-3.0.txt\nimport {type ReactNode, type FunctionComponent} from 'react';\nimport {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\nimport {ExplorerFiltersAndSorts} from './ExplorerFiltersAndSorts';\nimport styled from 'styled-components';\n\nconst ExplorerToolbarListStyled = styled.ul`\n padding: calc(var(--general-spacing-xs) * 1px);\n margin: 0;\n margin-bottom: calc(var(--general-spacing-s) * 1px);\n background: var(--general-colors-neutral-grey-100);\n border-radius: calc(var(--general-border-radius-s) * 1px);\n list-style: none;\n display: flex;\n overflow: auto;\n align-items: center;\n gap: calc(var(--general-spacing-xxs) * 1px);\n white-space: nowrap;\n min-height: 26px; // height of the filter chip\n justify-content: space-between;\n\n &.headless {\n margin-bottom: 0;\n }\n\n & > div:last-of-type {\n flex-shrink: 0;\n align-self: start;\n }\n`;\n\nconst Section = styled.div`\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n gap: calc(var(--general-spacing-xxs) * 1px);\n`;\n\nexport const ExplorerToolbar: FunctionComponent<{\n isMassSelectionAll: boolean;\n showFilters: boolean;\n showSorts: boolean;\n headless: boolean;\n canRemoveFilters: boolean;\n selectAllButton: ReactNode | null;\n viewSettingsLoading: boolean;\n}> = ({\n isMassSelectionAll,\n showFilters,\n showSorts,\n headless,\n canRemoveFilters,\n selectAllButton,\n viewSettingsLoading,\n children,\n}) => {\n const {t} = useSharedTranslation();\n\n return (\n <ExplorerToolbarListStyled aria-label={t('explorer.toolbar')} className={headless ? 'headless' : ''}>\n <Section>\n {!viewSettingsLoading && (\n <ExplorerFiltersAndSorts\n selectAllButton={selectAllButton}\n showFilters={showFilters}\n showSorts={showSorts}\n canRemoveFilters={canRemoveFilters}\n isMassSelectionAll={isMassSelectionAll}\n />\n )}\n </Section>\n <Section>{children}</Section>\n </ExplorerToolbarListStyled>\n );\n};\n"]}
|
|
@@ -4,12 +4,12 @@ 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, preview, subLabel } = item;
|
|
7
|
+
const { id, label, preview, subLabel, color } = item;
|
|
8
8
|
const itemLabel = label ?? id;
|
|
9
9
|
const avatarProps = { label: itemLabel };
|
|
10
10
|
if (preview) {
|
|
11
11
|
avatarProps.src = preview.small;
|
|
12
12
|
}
|
|
13
|
-
return _jsx(KitIdCard, { avatarProps: avatarProps, title: label ?? id, description: subLabel ?? undefined });
|
|
13
|
+
return (_jsx(KitIdCard, { avatarProps: avatarProps, title: label ?? id, description: subLabel ?? undefined, color: color ?? undefined }));
|
|
14
14
|
};
|
|
15
15
|
//# sourceMappingURL=IdCard.js.map
|
|
@@ -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,QAAQ,EAAC,GAAG,IAAI,CAAC;
|
|
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,EAAE,KAAK,EAAC,GAAG,IAAI,CAAC;IACnD,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,CACH,KAAC,SAAS,IACN,WAAW,EAAE,WAAW,EACxB,KAAK,EAAE,KAAK,IAAI,EAAE,EAClB,WAAW,EAAE,QAAQ,IAAI,SAAS,EAClC,KAAK,EAAE,KAAK,IAAI,SAAS,GAC3B,CACL,CAAC;AACN,CAAC,CAAC","sourcesContent":["// Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06\n// This file is released under LGPL V3\n// License text available at https://www.gnu.org/licenses/lgpl-3.0.txt\nimport {KitIdCard} from 'aristid-ds';\nimport {type IKitAvatar} from 'aristid-ds/dist/Kit/DataDisplay/Avatar/types';\nimport {type FunctionComponent} from 'react';\nimport {type RecordIdentityFragment} from '_ui/_gqlTypes';\n\ninterface IIdCardProps {\n item: RecordIdentityFragment['whoAmI'];\n}\n\nexport const IdCard: FunctionComponent<IIdCardProps> = ({item}) => {\n const {id, label, preview, subLabel, color} = item;\n const itemLabel = label ?? id;\n const avatarProps: IKitAvatar = {label: itemLabel};\n\n if (preview) {\n avatarProps.src = preview.small;\n }\n\n return (\n <KitIdCard\n avatarProps={avatarProps}\n title={label ?? id}\n description={subLabel ?? undefined}\n color={color ?? undefined}\n />\n );\n};\n"]}
|
|
@@ -4,17 +4,18 @@ 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 { useMemo } from 'react';
|
|
6
6
|
import { FaFileExport } from 'react-icons/fa';
|
|
7
|
-
import { KitAlert, KitModal } from 'aristid-ds';
|
|
7
|
+
import { KitAlert, KitModal, useKitNotification } from 'aristid-ds';
|
|
8
8
|
import { useExportLazyQuery } from '../../../_gqlTypes';
|
|
9
9
|
import { useSharedTranslation } from '../../../hooks/useSharedTranslation';
|
|
10
10
|
import { BREAK_TWO_LINES, MASS_SELECTION_ALL } from '../_constants';
|
|
11
|
-
import { ERROR_ALERT_DURATION,
|
|
11
|
+
import { ERROR_ALERT_DURATION, INFO_NOTIFICATION_DURATION_SECONDS } from '../../../constants';
|
|
12
12
|
/**
|
|
13
13
|
* Hook that provides a mass action configuration for exporting selected or all items
|
|
14
14
|
* from a view/data set
|
|
15
15
|
*/
|
|
16
16
|
export const useExportMassAction = ({ isEnabled, store: { view, dispatch }, totalCount, onExport, }) => {
|
|
17
17
|
const { t } = useSharedTranslation();
|
|
18
|
+
const { kitNotification } = useKitNotification();
|
|
18
19
|
const [exportQuery] = useExportLazyQuery();
|
|
19
20
|
const _exportMassAction = useMemo(() => ({
|
|
20
21
|
label: t('explorer.massAction.export'),
|
|
@@ -53,15 +54,13 @@ export const useExportMassAction = ({ isEnabled, store: { view, dispatch }, tota
|
|
|
53
54
|
errorWithExtensions.extensions = graphQLError?.extensions;
|
|
54
55
|
throw errorWithExtensions;
|
|
55
56
|
}
|
|
56
|
-
|
|
57
|
-
showIcon: true,
|
|
58
|
-
duration: SUCCESS_ALERT_DURATION,
|
|
57
|
+
kitNotification.info({
|
|
59
58
|
message: t('explorer.massAction.export_message', { count: total }),
|
|
60
59
|
description: t('explorer.massAction.export_description', {
|
|
61
60
|
count: total,
|
|
62
61
|
total,
|
|
63
62
|
}),
|
|
64
|
-
|
|
63
|
+
duration: INFO_NOTIFICATION_DURATION_SECONDS,
|
|
65
64
|
});
|
|
66
65
|
onExport?.(massSelectionFilter, view.massSelection);
|
|
67
66
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useExportMassAction.js","sourceRoot":"","sources":["../../../../src/components/Explorer/actions-mass/useExportMassAction.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAgB,OAAO,EAAC,MAAM,OAAO,CAAC;AAC7C,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAC,QAAQ,EAAE,QAAQ,EAAC,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"useExportMassAction.js","sourceRoot":"","sources":["../../../../src/components/Explorer/actions-mass/useExportMassAction.tsx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BAAgB,EAAE,SAAS,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,IAAI;KACzD,CAAC;AACN,CAAC,CAAC","sourcesContent":["// Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06\n// This file is released under LGPL V3\n// License text available at https://www.gnu.org/licenses/lgpl-3.0.txt\nimport {type Dispatch, useMemo} from 'react';\nimport {FaFileExport} from 'react-icons/fa';\nimport {KitAlert, KitModal, useKitNotification} from 'aristid-ds';\nimport {useExportLazyQuery} from '_ui/_gqlTypes';\nimport {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\nimport {type FeatureHook, type IMassActions} from '../_types';\nimport {type IViewSettingsAction, type IViewSettingsState} from '../manage-view-settings';\nimport {BREAK_TWO_LINES, MASS_SELECTION_ALL} from '../_constants';\nimport {ERROR_ALERT_DURATION, INFO_NOTIFICATION_DURATION_SECONDS} from '_ui/constants';\n\n/**\n * Hook that provides a mass action configuration for exporting selected or all items\n * from a view/data set\n */\nexport const useExportMassAction = ({\n isEnabled,\n store: {view, dispatch},\n totalCount,\n onExport,\n}: FeatureHook<{\n store: {\n view: IViewSettingsState;\n dispatch: Dispatch<IViewSettingsAction>;\n };\n totalCount: number;\n onExport?: IMassActions['callback'];\n}>) => {\n const {t} = useSharedTranslation();\n const {kitNotification} = useKitNotification();\n\n const [exportQuery] = useExportLazyQuery();\n\n const _exportMassAction: IMassActions = useMemo(\n () => ({\n label: t('explorer.massAction.export'),\n icon: <FaFileExport />,\n deselectAll: false,\n callback: massSelectionFilter => {\n KitModal.confirm({\n width: '100%',\n style: {content: {width: '90vw', maxWidth: '656px'}},\n icon: false,\n type: 'confirm',\n title:\n t('explorer.export_item', {\n count: view.massSelection === MASS_SELECTION_ALL ? Infinity : view.massSelection.length,\n }) ?? undefined,\n content:\n t('explorer.export_item_description', {\n count: view.massSelection === MASS_SELECTION_ALL ? Infinity : view.massSelection.length,\n }) +\n BREAK_TWO_LINES +\n t('global.are_you_sure'),\n okText: t('global.confirm') ?? undefined,\n cancelText: t('global.cancel') ?? undefined,\n onOk: async () => {\n const total =\n view.massSelection === MASS_SELECTION_ALL ? totalCount : view.massSelection.length;\n try {\n const {data, error} = await exportQuery({\n variables: {\n library: view.libraryId,\n filters: massSelectionFilter,\n profile: 'default', // Set 'default' by default, it'll change when we can select a profile from the UI\n },\n });\n if (error) {\n // Preserve the extensions property which contains the error code\n const graphQLError = error.graphQLErrors?.[0];\n const errorWithExtensions = new Error(error.message);\n (errorWithExtensions as any).extensions = graphQLError?.extensions;\n throw errorWithExtensions;\n }\n\n kitNotification.info({\n message: t('explorer.massAction.export_message', {count: total}),\n description: t('explorer.massAction.export_description', {\n count: total,\n total,\n }),\n duration: INFO_NOTIFICATION_DURATION_SECONDS,\n });\n\n onExport?.(massSelectionFilter, view.massSelection);\n } catch (e) {\n if (e.extensions?.code === 'CUSTOM_CONFIG_ERROR') {\n KitAlert.error({\n showIcon: true,\n duration: ERROR_ALERT_DURATION,\n message: t('error.error_occurred', {count: total}),\n description: t('explorer.massAction.export_config_error_description', {\n library: view.libraryId,\n }),\n closable: true,\n });\n } else {\n KitAlert.error({\n showIcon: true,\n duration: ERROR_ALERT_DURATION,\n message: t('error.error_occurred'),\n description: t('explorer.massAction.export_error_description', {count: total}),\n closable: true,\n });\n }\n }\n },\n });\n },\n }),\n [t, exportQuery, view.massSelection, dispatch, view.libraryId],\n );\n\n return {\n exportMassAction: isEnabled ? _exportMassAction : null,\n };\n};\n"]}
|
|
@@ -1,28 +1,45 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, 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 { useEffect, useState } from 'react';
|
|
2
6
|
import styled from 'styled-components';
|
|
3
7
|
import { KitInput, KitSelect } from 'aristid-ds';
|
|
4
8
|
import { AttributeConditionFilter } from '../../../../types';
|
|
5
9
|
import { useSharedTranslation } from '../../../../hooks/useSharedTranslation';
|
|
6
10
|
import { useConditionsOptionsByType } from './useConditionOptionsByType';
|
|
11
|
+
import { useDebouncedValue } from '../../../../hooks/useDebouncedValue';
|
|
7
12
|
const InputStyled = styled(KitInput) `
|
|
8
13
|
width: 100%;
|
|
9
14
|
`;
|
|
10
15
|
export const TextAttributeDropDown = ({ filter, onFilterChange, selectDropDownRef, }) => {
|
|
11
16
|
const { t } = useSharedTranslation();
|
|
12
17
|
const { conditionOptionsByType } = useConditionsOptionsByType(filter);
|
|
18
|
+
const [inputValue, setInputValue] = useState(filter.value || '');
|
|
19
|
+
const debouncedInputValue = useDebouncedValue(inputValue, 300);
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
setInputValue(filter.value || '');
|
|
22
|
+
}, [filter.value]);
|
|
23
|
+
// Only apply onFilterChange when the input is empty or there are more than 2 characters
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
const valueToApply = debouncedInputValue;
|
|
26
|
+
if (valueToApply.length === 0 && filter.value !== null) {
|
|
27
|
+
onFilterChange({ ...filter, value: null });
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
if (valueToApply.length >= 3 && filter.value !== valueToApply) {
|
|
31
|
+
onFilterChange({ ...filter, value: valueToApply });
|
|
32
|
+
}
|
|
33
|
+
}, [debouncedInputValue, onFilterChange, filter]);
|
|
13
34
|
const _onConditionChanged = condition => {
|
|
14
35
|
onFilterChange({ ...filter, condition });
|
|
15
36
|
};
|
|
16
|
-
// TODO debounce ?
|
|
17
37
|
const _onInputChanged = event => {
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
onFilterChange({ ...filter, value: event.target.value.length === 0 ? null : event.target.value });
|
|
38
|
+
const newInputValue = event.target.value;
|
|
39
|
+
setInputValue(newInputValue);
|
|
23
40
|
};
|
|
24
41
|
const showSearch = filter.condition !== AttributeConditionFilter.IS_EMPTY &&
|
|
25
42
|
filter.condition !== AttributeConditionFilter.IS_NOT_EMPTY;
|
|
26
|
-
return (_jsxs(_Fragment, { children: [_jsx(KitSelect, { options: conditionOptionsByType, onChange: _onConditionChanged, value: filter.condition, getPopupContainer: () => selectDropDownRef?.current ?? document.body, "aria-label": String(t('explorer.filter-condition')) }), showSearch && (_jsx(InputStyled, { placeholder: String(t('explorer.type-a-value')), value:
|
|
43
|
+
return (_jsxs(_Fragment, { children: [_jsx(KitSelect, { options: conditionOptionsByType, onChange: _onConditionChanged, value: filter.condition, getPopupContainer: () => selectDropDownRef?.current ?? document.body, "aria-label": String(t('explorer.filter-condition')) }), showSearch && (_jsx(InputStyled, { placeholder: String(t('explorer.type-a-value')), value: inputValue, onChange: _onInputChanged }))] }));
|
|
27
44
|
};
|
|
28
45
|
//# sourceMappingURL=TextAttributeDropDown.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextAttributeDropDown.js","sourceRoot":"","sources":["../../../../../src/components/Filters/filter-items/filter-type/TextAttributeDropDown.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"TextAttributeDropDown.js","sourceRoot":"","sources":["../../../../../src/components/Filters/filter-items/filter-type/TextAttributeDropDown.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAA8C,SAAS,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AACvF,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,EAAC,QAAQ,EAAE,SAAS,EAAC,MAAM,YAAY,CAAC;AAC/C,OAAO,EAAC,wBAAwB,EAAC,MAAM,WAAW,CAAC;AACnD,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AAEpE,OAAO,EAAC,0BAA0B,EAAC,MAAM,6BAA6B,CAAC;AACvE,OAAO,EAAC,iBAAiB,EA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c,CAAC,EAAC,GAAG,MAAM,EAAE,SAAS,EAAC,CAAC,CAAC;IAC3C,CAAC,CAAC;IAEF,MAAM,eAAe,GAAgD,KAAK,CAAC,EAAE;QACzE,MAAM,aAAa,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC;QACzC,aAAa,CAAC,aAAa,CAAC,CAAC;IACjC,CAAC,CAAC;IAEF,MAAM,UAAU,GACZ,MAAM,CAAC,SAAS,KAAK,wBAAwB,CAAC,QAAQ;QACtD,MAAM,CAAC,SAAS,KAAK,wBAAwB,CAAC,YAAY,CAAC;IAE/D,OAAO,CACH,8BACI,KAAC,SAAS,IACN,OAAO,EAAE,sBAAsB,EAC/B,QAAQ,EAAE,mBAAmB,EAC7B,KAAK,EAAE,MAAM,CAAC,SAAS,EACvB,iBAAiB,EAAE,GAAG,EAAE,CAAC,iBAAiB,EAAE,OAAO,IAAI,QAAQ,CAAC,IAAI,gBACxD,MAAM,CAAC,CAAC,CAAC,2BAA2B,CAAC,CAAC,GACpD,EACD,UAAU,IAAI,CACX,KAAC,WAAW,IACR,WAAW,EAAE,MAAM,CAAC,CAAC,CAAC,uBAAuB,CAAC,CAAC,EAC/C,KAAK,EAAE,UAAU,EACjB,QAAQ,EAAE,eAAe,GAC3B,CACL,IACF,CACN,CAAC;AACN,CAAC,CAAC","sourcesContent":["// Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06\n// This file is released under LGPL V3\n// License text available at https://www.gnu.org/licenses/lgpl-3.0.txt\nimport {type ComponentProps, type FunctionComponent, useEffect, useState} from 'react';\nimport styled from 'styled-components';\nimport {KitInput, KitSelect} from 'aristid-ds';\nimport {AttributeConditionFilter} from '_ui/types';\nimport {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\nimport {type IFilterChildrenDropDownProps} from './_types';\nimport {useConditionsOptionsByType} from './useConditionOptionsByType';\nimport {useDebouncedValue} from '_ui/hooks/useDebouncedValue';\n\nconst InputStyled = styled(KitInput)`\n width: 100%;\n`;\n\nexport const TextAttributeDropDown: FunctionComponent<IFilterChildrenDropDownProps> = ({\n filter,\n onFilterChange,\n selectDropDownRef,\n}) => {\n const {t} = useSharedTranslation();\n\n const {conditionOptionsByType} = useConditionsOptionsByType(filter);\n const [inputValue, setInputValue] = useState(filter.value || '');\n const debouncedInputValue = useDebouncedValue(inputValue, 300);\n\n useEffect(() => {\n setInputValue(filter.value || '');\n }, [filter.value]);\n\n // Only apply onFilterChange when the input is empty or there are more than 2 characters\n useEffect(() => {\n const valueToApply = debouncedInputValue;\n\n if (valueToApply.length === 0 && filter.value !== null) {\n onFilterChange({...filter, value: null});\n return;\n }\n\n if (valueToApply.length >= 3 && filter.value !== valueToApply) {\n onFilterChange({...filter, value: valueToApply});\n }\n }, [debouncedInputValue, onFilterChange, filter]);\n\n const _onConditionChanged: ComponentProps<typeof KitSelect>['onChange'] = condition => {\n onFilterChange({...filter, condition});\n };\n\n const _onInputChanged: ComponentProps<typeof KitInput>['onChange'] = event => {\n const newInputValue = event.target.value;\n setInputValue(newInputValue);\n };\n\n const showSearch =\n filter.condition !== AttributeConditionFilter.IS_EMPTY &&\n filter.condition !== AttributeConditionFilter.IS_NOT_EMPTY;\n\n return (\n <>\n <KitSelect\n options={conditionOptionsByType}\n onChange={_onConditionChanged}\n value={filter.condition}\n getPopupContainer={() => selectDropDownRef?.current ?? document.body}\n aria-label={String(t('explorer.filter-condition'))}\n />\n {showSearch && (\n <InputStyled\n placeholder={String(t('explorer.type-a-value'))}\n value={inputValue}\n onChange={_onInputChanged}\n />\n )}\n </>\n );\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Filters/index.
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Filters/index.ts"],"names":[],"mappings":"AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAC,UAAU,EAAC,MAAM,cAAc,CAAC;AACxC,OAAO,EAAC,iBAAiB,EAAC,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAC,mBAAmB,EAAC,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAC,eAAe,EAAC,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAC,wBAAwB,EAAC,MAAM,4BAA4B,CAAC;AACpE,OAAO,EAAC,iBAAiB,EAAC,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAC,gBAAgB,EAAC,MAAM,iCAAiC,CAAC;AACjE,cAAc,UAAU,CAAC","sourcesContent":["// Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06\n// This file is released under LGPL V3\n// License text available at https://www.gnu.org/licenses/lgpl-3.0.txt\nexport {useFilters} from './useFilters';\nexport {useFiltersContext} from './useFiltersContext';\nexport {useTransformFilters} from './useTransformFilters';\nexport {FiltersProvider} from './FiltersProvider';\nexport {prepareFiltersForRequest} from './prepareFiltersForRequest';\nexport {useFiltersReducer} from './context/useFiltersReducer';\nexport {CommonFilterItem} from './filter-items/CommonFilterItem';\nexport * from './_types';\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import TreeNodeItem from './TreeNodeItem';
|
|
3
3
|
import { TreeFieldWrapper } from './TreeFieldWrapper';
|
|
4
|
-
export const TreeNodeList = ({ attribute, backendValues, removeTreeNode, isReadOnly, }) => (_jsx(TreeFieldWrapper, { children: backendValues.map((value, index) => (_jsx(TreeNodeItem, { isReadOnly: isReadOnly, color: value.treeValue
|
|
4
|
+
export const TreeNodeList = ({ attribute, backendValues, removeTreeNode, isReadOnly, }) => (_jsx(TreeFieldWrapper, { children: backendValues.map((value, index) => (_jsx(TreeNodeItem, { isReadOnly: isReadOnly, color: value.treeValue?.record.whoAmI.color, label: value.treeValue?.record.whoAmI.label, ancestors: value.treeValue?.ancestors, canDelete: !isReadOnly &&
|
|
5
5
|
((attribute.required && attribute.multiple_values && backendValues.length > 1) ||
|
|
6
6
|
!attribute.required), onClickToDelete: () => removeTreeNode(value) }, index))) }));
|
|
7
7
|
//# sourceMappingURL=TreeNodeList.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TreeNodeList.js","sourceRoot":"","sources":["../../../../../../../src/components/RecordEdition/EditRecordContent/uiElements/TreeField/display-tree-node/TreeNodeList.tsx"],"names":[],"mappings":";AAMA,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAC,gBAAgB,EAAC,MAAM,oBAAoB,CAAC;AASpD,MAAM,CAAC,MAAM,YAAY,GAA6C,CAAC,EACnE,SAAS,EACT,aAAa,EACb,cAAc,EACd,UAAU,GACb,EAAE,EAAE,CAAC,CACF,KAAC,gBAAgB,cACZ,aAAa,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,CACjC,KAAC,YAAY,IAET,UAAU,EAAE,UAAU,EACtB,KAAK,EAAE,KAAK,CAAC,SAAS,
|
|
1
|
+
{"version":3,"file":"TreeNodeList.js","sourceRoot":"","sources":["../../../../../../../src/components/RecordEdition/EditRecordContent/uiElements/TreeField/display-tree-node/TreeNodeList.tsx"],"names":[],"mappings":";AAMA,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAC,gBAAgB,EAAC,MAAM,oBAAoB,CAAC;AASpD,MAAM,CAAC,MAAM,YAAY,GAA6C,CAAC,EACnE,SAAS,EACT,aAAa,EACb,cAAc,EACd,UAAU,GACb,EAAE,EAAE,CAAC,CACF,KAAC,gBAAgB,cACZ,aAAa,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,CACjC,KAAC,YAAY,IAET,UAAU,EAAE,UAAU,EACtB,KAAK,EAAE,KAAK,CAAC,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,KAAK,EAC3C,KAAK,EAAE,KAAK,CAAC,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,KAAK,EAC3C,SAAS,EAAE,KAAK,CAAC,SAAS,EAAE,SAAS,EACrC,SAAS,EACL,CAAC,UAAU;YACX,CAAC,CAAC,SAAS,CAAC,QAAQ,IAAI,SAAS,CAAC,eAAe,IAAI,aAAa,CAAC,MAAM,GAAG,CAAC,CAAC;gBAC1E,CAAC,SAAS,CAAC,QAAQ,CAAC,EAE5B,eAAe,EAAE,GAAG,EAAE,CAAC,cAAc,CAAC,KAAK,CAAC,IAVvC,KAAK,CAWZ,CACL,CAAC,GACa,CACtB,CAAC","sourcesContent":["// Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06\n// This file is released under LGPL V3\n// License text available at https://www.gnu.org/licenses/lgpl-3.0.txt\nimport {type FunctionComponent} from 'react';\nimport {type RecordFormElementsValueTreeValue} from '_ui/hooks/useGetRecordForm';\nimport {type RecordFormAttributeTreeAttributeFragment} from '_ui/_gqlTypes';\nimport TreeNodeItem from './TreeNodeItem';\nimport {TreeFieldWrapper} from './TreeFieldWrapper';\n\ninterface IDisplayTreeNodeProps {\n attribute: RecordFormAttributeTreeAttributeFragment;\n backendValues: RecordFormElementsValueTreeValue[];\n removeTreeNode: (nodeValue: RecordFormElementsValueTreeValue) => void;\n isReadOnly: boolean;\n}\n\nexport const TreeNodeList: FunctionComponent<IDisplayTreeNodeProps> = ({\n attribute,\n backendValues,\n removeTreeNode,\n isReadOnly,\n}) => (\n <TreeFieldWrapper>\n {backendValues.map((value, index) => (\n <TreeNodeItem\n key={index}\n isReadOnly={isReadOnly}\n color={value.treeValue?.record.whoAmI.color}\n label={value.treeValue?.record.whoAmI.label}\n ancestors={value.treeValue?.ancestors}\n canDelete={\n !isReadOnly &&\n ((attribute.required && attribute.multiple_values && backendValues.length > 1) ||\n !attribute.required)\n }\n onClickToDelete={() => removeTreeNode(value)}\n />\n ))}\n </TreeFieldWrapper>\n);\n"]}
|