@leav/ui 1.5.3 → 1.6.0-0f019af0

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.
Files changed (203) hide show
  1. package/dist/_gqlTypes/index.d.ts +640 -701
  2. package/dist/_gqlTypes/index.js +50 -167
  3. package/dist/_gqlTypes/index.js.map +1 -1
  4. package/dist/_queries/trees/treeNodeChildrenQuery.js +2 -0
  5. package/dist/_queries/trees/treeNodeChildrenQuery.js.map +1 -1
  6. package/dist/_queries/views/viewDetailsFragment.js +1 -0
  7. package/dist/_queries/views/viewDetailsFragment.js.map +1 -1
  8. package/dist/components/AttributesSelectionList/sharedComponents.d.ts +159 -153
  9. package/dist/components/Explorer/Explorer.js +5 -3
  10. package/dist/components/Explorer/Explorer.js.map +1 -1
  11. package/dist/components/Explorer/ExplorerFiltersAndSorts.js +1 -1
  12. package/dist/components/Explorer/ExplorerFiltersAndSorts.js.map +1 -1
  13. package/dist/components/Explorer/TableCell.js +6 -7
  14. package/dist/components/Explorer/TableCell.js.map +1 -1
  15. package/dist/components/Explorer/TableNameCell.js +9 -3
  16. package/dist/components/Explorer/TableNameCell.js.map +1 -1
  17. package/dist/components/Explorer/_queries/useExplorerData.d.ts +7 -7
  18. package/dist/components/Explorer/_queries/useExplorerData.js +19 -7
  19. package/dist/components/Explorer/_queries/useExplorerData.js.map +1 -1
  20. package/dist/components/Explorer/_types.d.ts +1 -0
  21. package/dist/components/Explorer/_types.js.map +1 -1
  22. package/dist/components/Explorer/actions-item/useEditStatusItemAction.js +3 -2
  23. package/dist/components/Explorer/actions-item/useEditStatusItemAction.js.map +1 -1
  24. package/dist/components/Explorer/actions-item/useReplaceItemAction.d.ts +2 -1
  25. package/dist/components/Explorer/actions-item/useReplaceItemAction.js +5 -4
  26. package/dist/components/Explorer/actions-item/useReplaceItemAction.js.map +1 -1
  27. package/dist/components/Explorer/actions-mass/export/ExportProfileSelectionModal.d.ts +10 -0
  28. package/dist/components/Explorer/actions-mass/export/ExportProfileSelectionModal.js +46 -0
  29. package/dist/components/Explorer/actions-mass/export/ExportProfileSelectionModal.js.map +1 -0
  30. package/dist/components/Explorer/actions-mass/export/content/NoProfiles.d.ts +1 -0
  31. package/dist/components/Explorer/actions-mass/export/content/NoProfiles.js +17 -0
  32. package/dist/components/Explorer/actions-mass/export/content/NoProfiles.js.map +1 -0
  33. package/dist/components/Explorer/actions-mass/export/content/ProfilesSelection.d.ts +8 -0
  34. package/dist/components/Explorer/actions-mass/export/content/ProfilesSelection.js +49 -0
  35. package/dist/components/Explorer/actions-mass/export/content/ProfilesSelection.js.map +1 -0
  36. package/dist/components/Explorer/actions-mass/export/useGetLibraryExportProfiles.d.ts +27 -0
  37. package/dist/components/Explorer/actions-mass/export/useGetLibraryExportProfiles.js +48 -0
  38. package/dist/components/Explorer/actions-mass/export/useGetLibraryExportProfiles.js.map +1 -0
  39. package/dist/components/Explorer/actions-mass/useDeactivateMassAction.js +3 -2
  40. package/dist/components/Explorer/actions-mass/useDeactivateMassAction.js.map +1 -1
  41. package/dist/components/Explorer/actions-mass/useDeleteLinkValues.js +3 -2
  42. package/dist/components/Explorer/actions-mass/useDeleteLinkValues.js.map +1 -1
  43. package/dist/components/Explorer/actions-mass/useEditAttributeMassAction.js +8 -7
  44. package/dist/components/Explorer/actions-mass/useEditAttributeMassAction.js.map +1 -1
  45. package/dist/components/Explorer/actions-mass/useExportMassAction.d.ts +7 -4
  46. package/dist/components/Explorer/actions-mass/useExportMassAction.js +81 -74
  47. package/dist/components/Explorer/actions-mass/useExportMassAction.js.map +1 -1
  48. package/dist/components/Explorer/actions-mass/useMassActions.js +3 -2
  49. package/dist/components/Explorer/actions-mass/useMassActions.js.map +1 -1
  50. package/dist/components/Explorer/actions-primary/useCreatePrimaryAction.js +3 -2
  51. package/dist/components/Explorer/actions-primary/useCreatePrimaryAction.js.map +1 -1
  52. package/dist/components/Explorer/actions-primary/useLinkPrimaryAction.d.ts +2 -1
  53. package/dist/components/Explorer/actions-primary/useLinkPrimaryAction.js +5 -4
  54. package/dist/components/Explorer/actions-primary/useLinkPrimaryAction.js.map +1 -1
  55. package/dist/components/Explorer/link-item/LinkModal.d.ts +1 -0
  56. package/dist/components/Explorer/link-item/LinkModal.js +2 -2
  57. package/dist/components/Explorer/link-item/LinkModal.js.map +1 -1
  58. package/dist/components/Explorer/list-saved-views/SavedViews.js +12 -9
  59. package/dist/components/Explorer/list-saved-views/SavedViews.js.map +1 -1
  60. package/dist/components/Explorer/manage-view-settings/_shared/ColumnItem.js +5 -8
  61. package/dist/components/Explorer/manage-view-settings/_shared/ColumnItem.js.map +1 -1
  62. package/dist/components/Explorer/manage-view-settings/configure-display/attributes/SelectVisibleAttributes.js +3 -2
  63. package/dist/components/Explorer/manage-view-settings/configure-display/attributes/SelectVisibleAttributes.js.map +1 -1
  64. package/dist/components/Explorer/manage-view-settings/filter-items/FilterItems.js +7 -6
  65. package/dist/components/Explorer/manage-view-settings/filter-items/FilterItems.js.map +1 -1
  66. package/dist/components/Explorer/manage-view-settings/filter-items/FilterListItem.js +3 -2
  67. package/dist/components/Explorer/manage-view-settings/filter-items/FilterListItem.js.map +1 -1
  68. package/dist/components/Explorer/manage-view-settings/open-view-settings/useOpenViewSettings.js +4 -3
  69. package/dist/components/Explorer/manage-view-settings/open-view-settings/useOpenViewSettings.js.map +1 -1
  70. package/dist/components/Explorer/manage-view-settings/router-menu/SettingItem.js +3 -2
  71. package/dist/components/Explorer/manage-view-settings/router-menu/SettingItem.js.map +1 -1
  72. package/dist/components/Explorer/manage-view-settings/router-menu/SettingsPanel.js +3 -2
  73. package/dist/components/Explorer/manage-view-settings/router-menu/SettingsPanel.js.map +1 -1
  74. package/dist/components/Explorer/manage-view-settings/save-view/LabelViewFormModal.js +3 -2
  75. package/dist/components/Explorer/manage-view-settings/save-view/LabelViewFormModal.js.map +1 -1
  76. package/dist/components/Explorer/manage-view-settings/save-view/prepareViewForRequest.js +3 -0
  77. package/dist/components/Explorer/manage-view-settings/save-view/prepareViewForRequest.js.map +1 -1
  78. package/dist/components/Explorer/manage-view-settings/save-view/useCreateNewView.js +3 -2
  79. package/dist/components/Explorer/manage-view-settings/save-view/useCreateNewView.js.map +1 -1
  80. package/dist/components/Explorer/manage-view-settings/save-view/useDeleteView.js +4 -3
  81. package/dist/components/Explorer/manage-view-settings/save-view/useDeleteView.js.map +1 -1
  82. package/dist/components/Explorer/manage-view-settings/save-view/useEditLabelView.js +3 -2
  83. package/dist/components/Explorer/manage-view-settings/save-view/useEditLabelView.js.map +1 -1
  84. package/dist/components/Explorer/manage-view-settings/save-view/useResetView.js +3 -2
  85. package/dist/components/Explorer/manage-view-settings/save-view/useResetView.js.map +1 -1
  86. package/dist/components/Explorer/manage-view-settings/save-view/useShareView.js +3 -2
  87. package/dist/components/Explorer/manage-view-settings/save-view/useShareView.js.map +1 -1
  88. package/dist/components/Explorer/manage-view-settings/save-view/useUpdateView.js +3 -2
  89. package/dist/components/Explorer/manage-view-settings/save-view/useUpdateView.js.map +1 -1
  90. package/dist/components/Explorer/manage-view-settings/sort-items/SortItems.js +7 -6
  91. package/dist/components/Explorer/manage-view-settings/sort-items/SortItems.js.map +1 -1
  92. package/dist/components/Explorer/manage-view-settings/sort-items/SortListItem.js +3 -2
  93. package/dist/components/Explorer/manage-view-settings/sort-items/SortListItem.js.map +1 -1
  94. package/dist/components/Explorer/manage-view-settings/store-view-settings/viewSettingsReducer.js.map +1 -1
  95. package/dist/components/Explorer/useSearchInput.js +6 -2
  96. package/dist/components/Explorer/useSearchInput.js.map +1 -1
  97. package/dist/components/Filters/FiltersProvider.d.ts +2 -2
  98. package/dist/components/Filters/FiltersProvider.js.map +1 -1
  99. package/dist/components/Filters/_types.d.ts +3 -0
  100. package/dist/components/Filters/_types.js.map +1 -1
  101. package/dist/components/Filters/context/filtersReducer.js +7 -4
  102. package/dist/components/Filters/context/filtersReducer.js.map +1 -1
  103. package/dist/components/Filters/context/useGetTreeFilters.js +3 -1
  104. package/dist/components/Filters/context/useGetTreeFilters.js.map +1 -1
  105. package/dist/components/Filters/filter-items/CommonFilterItem.d.ts +1 -0
  106. package/dist/components/Filters/filter-items/CommonFilterItem.js +28 -8
  107. package/dist/components/Filters/filter-items/CommonFilterItem.js.map +1 -1
  108. package/dist/components/Filters/filter-items/EmptyValueCheckbox.d.ts +8 -0
  109. package/dist/components/Filters/filter-items/EmptyValueCheckbox.js +16 -0
  110. package/dist/components/Filters/filter-items/EmptyValueCheckbox.js.map +1 -0
  111. package/dist/components/Filters/filter-items/filter-type/BooleanAttributeDropdown.js +23 -9
  112. package/dist/components/Filters/filter-items/filter-type/BooleanAttributeDropdown.js.map +1 -1
  113. package/dist/components/Filters/filter-items/filter-type/ColorAttributeDropDown.js +9 -8
  114. package/dist/components/Filters/filter-items/filter-type/ColorAttributeDropDown.js.map +1 -1
  115. package/dist/components/Filters/filter-items/filter-type/FilterDropDown.js +4 -3
  116. package/dist/components/Filters/filter-items/filter-type/FilterDropDown.js.map +1 -1
  117. package/dist/components/Filters/filter-items/filter-type/FilterDropdownContent.js +1 -1
  118. package/dist/components/Filters/filter-items/filter-type/FilterDropdownContent.js.map +1 -1
  119. package/dist/components/Filters/filter-items/filter-type/FilterValueListDropDown.d.ts +0 -1
  120. package/dist/components/Filters/filter-items/filter-type/FilterValueListDropDown.js +17 -23
  121. package/dist/components/Filters/filter-items/filter-type/FilterValueListDropDown.js.map +1 -1
  122. package/dist/components/Filters/filter-items/filter-type/TreeAttributeDropDown.js +10 -12
  123. package/dist/components/Filters/filter-items/filter-type/TreeAttributeDropDown.js.map +1 -1
  124. package/dist/components/Filters/filter-items/filter-type/useConditionOptionsByType.js +3 -13
  125. package/dist/components/Filters/filter-items/filter-type/useConditionOptionsByType.js.map +1 -1
  126. package/dist/components/Filters/index.d.ts +1 -0
  127. package/dist/components/Filters/index.js +1 -0
  128. package/dist/components/Filters/index.js.map +1 -1
  129. package/dist/components/Filters/prepareFiltersForRequest.js +36 -3
  130. package/dist/components/Filters/prepareFiltersForRequest.js.map +1 -1
  131. package/dist/components/Filters/useFilters.d.ts +5 -0
  132. package/dist/components/Filters/useTransformFilters.js +4 -0
  133. package/dist/components/Filters/useTransformFilters.js.map +1 -1
  134. package/dist/components/ImportModal/ImportModalSelectFileStep/ImportModalSelectFileStep.js +8 -4
  135. package/dist/components/ImportModal/ImportModalSelectFileStep/ImportModalSelectFileStep.js.map +1 -1
  136. package/dist/components/LibraryItemsList/FiltersPanel/FiltersOptions.js +1 -8
  137. package/dist/components/LibraryItemsList/FiltersPanel/FiltersOptions.js.map +1 -1
  138. package/dist/components/LibraryItemsList/LibraryItemsListContent/LibraryItemsListContent.js +5 -3
  139. package/dist/components/LibraryItemsList/LibraryItemsListContent/LibraryItemsListContent.js.map +1 -1
  140. package/dist/components/LibraryItemsList/MenuView/MenuView.js +4 -4
  141. package/dist/components/LibraryItemsList/MenuView/MenuView.js.map +1 -1
  142. package/dist/components/LibraryItemsList/ViewPanel/View/View.js +3 -2
  143. package/dist/components/LibraryItemsList/ViewPanel/View/View.js.map +1 -1
  144. package/dist/components/Notifications/hooks/useNotificationSubscription.js +10 -8
  145. package/dist/components/Notifications/hooks/useNotificationSubscription.js.map +1 -1
  146. package/dist/components/RecordEdition/EditRecordContent/shared/ValuesVersionBtn/ValuesVersionBtn.js +5 -20
  147. package/dist/components/RecordEdition/EditRecordContent/shared/ValuesVersionBtn/ValuesVersionBtn.js.map +1 -1
  148. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/link-record/useLinkRecords.js +4 -3
  149. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/link-record/useLinkRecords.js.map +1 -1
  150. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/shared/ExplorerWrapper.d.ts +53 -51
  151. package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardField.js +4 -3
  152. package/dist/components/RecordEdition/EditRecordContent/uiElements/StandardField/StandardField.js.map +1 -1
  153. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/TreeField.js +9 -2
  154. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/TreeField.js.map +1 -1
  155. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/display-tree-node/TreeFieldWrapper.d.ts +53 -51
  156. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/display-tree-node/TreeNodeItem.js +3 -2
  157. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/display-tree-node/TreeNodeItem.js.map +1 -1
  158. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/manage-tree-node-selection/SelectTreeNodeModal.d.ts +2 -1
  159. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/manage-tree-node-selection/SelectTreeNodeModal.js +4 -7
  160. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/manage-tree-node-selection/SelectTreeNodeModal.js.map +1 -1
  161. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/manage-tree-node-selection/useManageTreeNodeSelection.d.ts +3 -2
  162. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/manage-tree-node-selection/useManageTreeNodeSelection.js +2 -2
  163. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/manage-tree-node-selection/useManageTreeNodeSelection.js.map +1 -1
  164. package/dist/components/RecordEdition/EditRecordContent/uiElements/shared/ComputeIndicator.js +3 -2
  165. package/dist/components/RecordEdition/EditRecordContent/uiElements/shared/ComputeIndicator.js.map +1 -1
  166. package/dist/components/RecordEdition/EditRecordSidebar/RecordSummary/RecordInformations/RecordInformations.js +3 -2
  167. package/dist/components/RecordEdition/EditRecordSidebar/RecordSummary/RecordInformations/RecordInformations.js.map +1 -1
  168. package/dist/components/RecordEdition/EditRecordSidebar/ValuesSummary/ValuesSummary.js +4 -3
  169. package/dist/components/RecordEdition/EditRecordSidebar/ValuesSummary/ValuesSummary.js.map +1 -1
  170. package/dist/components/RecordEdition/EditRecordSidebar/ValuesVersions/ValuesVersions.js +3 -2
  171. package/dist/components/RecordEdition/EditRecordSidebar/ValuesVersions/ValuesVersions.js.map +1 -1
  172. package/dist/components/SelectRecordForLinkModal/SelectRecordForLinkModal.d.ts +1 -0
  173. package/dist/components/SelectRecordForLinkModal/SelectRecordForLinkModal.js +7 -7
  174. package/dist/components/SelectRecordForLinkModal/SelectRecordForLinkModal.js.map +1 -1
  175. package/dist/components/SelectTreeNode/SelectTreeNode.d.ts +2 -1
  176. package/dist/components/SelectTreeNode/SelectTreeNode.js +3 -3
  177. package/dist/components/SelectTreeNode/SelectTreeNode.js.map +1 -1
  178. package/dist/components/SelectTreeNode/SelectTreeNodeContent.d.ts +2 -1
  179. package/dist/components/SelectTreeNode/SelectTreeNodeContent.js +6 -2
  180. package/dist/components/SelectTreeNode/SelectTreeNodeContent.js.map +1 -1
  181. package/dist/components/SelectTreeNode/TreeNodeTitle.js +3 -2
  182. package/dist/components/SelectTreeNode/TreeNodeTitle.js.map +1 -1
  183. package/dist/components/TriggerPreviewsGenerationModal/TriggerPreviewsGenerationModal.js +14 -4
  184. package/dist/components/TriggerPreviewsGenerationModal/TriggerPreviewsGenerationModal.js.map +1 -1
  185. package/dist/constants.d.ts +5 -1
  186. package/dist/constants.js +5 -1
  187. package/dist/constants.js.map +1 -1
  188. package/dist/hooks/useIFrameMessenger/messageHandlers.d.ts +2 -1
  189. package/dist/hooks/useIFrameMessenger/messageHandlers.js +8 -0
  190. package/dist/hooks/useIFrameMessenger/messageHandlers.js.map +1 -1
  191. package/dist/hooks/useIFrameMessenger/schema.d.ts +5 -0
  192. package/dist/hooks/useIFrameMessenger/schema.js +2 -0
  193. package/dist/hooks/useIFrameMessenger/schema.js.map +1 -1
  194. package/dist/hooks/useIFrameMessenger/types.d.ts +12 -2
  195. package/dist/hooks/useIFrameMessenger/types.js.map +1 -1
  196. package/dist/hooks/useIFrameMessenger/useIFrameMessenger.d.ts +1 -0
  197. package/dist/hooks/useIFrameMessenger/useIFrameMessenger.js +16 -2
  198. package/dist/hooks/useIFrameMessenger/useIFrameMessenger.js.map +1 -1
  199. package/dist/hooks/useIFrameMessengerClient/iFrameMessengerClientContext.d.ts +1 -0
  200. package/dist/hooks/useIFrameMessengerClient/useIFrameMessengerClient.d.ts +1 -0
  201. package/dist/locales/en/shared.json +15 -3
  202. package/dist/locales/fr/shared.json +15 -3
  203. package/package.json +21 -24
@@ -3,7 +3,6 @@ import { jsx as _jsx } 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 { KitButton } from 'aristid-ds';
6
- import { FaSave } from 'react-icons/fa';
7
6
  import { useSharedTranslation } from '../../../../hooks/useSharedTranslation';
8
7
  import { useViewSettingsContext } from '../store-view-settings/useViewSettingsContext';
9
8
  import { ViewSettingsActionTypes } from '../store-view-settings/viewSettingsReducer';
@@ -15,6 +14,8 @@ import { useMeQuery } from '../../../../_gqlTypes';
15
14
  import { useTransformFilters } from '../../../../components/Filters/useTransformFilters';
16
15
  import { useFiltersContext } from '../../../../components/Filters/useFiltersContext';
17
16
  import { FiltersActionTypes } from '../../../../components/Filters/context/filtersReducer';
17
+ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
18
+ import { faSave } from '@fortawesome/free-solid-svg-icons';
18
19
  export const useUpdateView = () => {
19
20
  const { t } = useSharedTranslation();
20
21
  const { toValidFilters } = useTransformFilters();
@@ -71,7 +72,7 @@ export const useUpdateView = () => {
71
72
  }
72
73
  };
73
74
  return {
74
- updateViewButton: !view.viewId || !view.savedViews.length || !isOwnerView ? null : (_jsx(KitButton, { type: "action", icon: _jsx(FaSave, {}), onClick: _updateView, children: t('global.save') })),
75
+ updateViewButton: !view.viewId || !view.savedViews.length || !isOwnerView ? null : (_jsx(KitButton, { type: "action", icon: _jsx(FontAwesomeIcon, { icon: faSave }), onClick: _updateView, children: t('global.save') })),
75
76
  };
76
77
  };
77
78
  //# sourceMappingURL=useUpdateView.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useUpdateView.js","sourceR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AAE,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE;oBACtC,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,KAAK;oBAC5B,MAAM,EAAE,IAAI,CAAC,UAAU,CAAC,MAAM;oBAC9B,OAAO,EAAE,YAAY;oBACrB,IAAI,EAAE,IAAI,CAAC,UAAU,CAAC,IAAI,IAAI,EAAE;oBAChC,OAAO,EAAG,IAAI,CAAC,UAAU,CAAC,OAAwB,IAAI;wBAClD,IAAI,EAAE,+BAA+B,CAAC,IAAI,CAAC,QAAQ,CAAC;qBACvD;oBACD,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,UAAU,EAAE,GAAG,CAAC,CAAC,EAAC,EAAE,EAAC,EAAE,EAAE,CAAC,EAAE,CAAC,IAAI,EAAE;iBACnE;aACJ,CAAC,CAAC;YACH,eAAe,CAAC;gBACZ,IAAI,EAAE,kBAAkB,CAAC,YAAY;gBACrC,OAAO,EAAE;oBACL,GAAG,WAAW;oBACd,MAAM,EAAE,IAAI,CAAC,UAAU,CAAC,EAAE;oBAC1B,OAAO,EAAE,IAAI,CAAC,UAAU,CAAC,OAAqB;iBACjD;aACJ,CAAC,CAAC;QACP,CAAC;IACL,CAAC,CAAC;IAEF,OAAO;QACH,gBAAgB,EACZ,CAAC,IAAI,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAC7D,KAAC,SAAS,IAAC,IAAI,EAAC,QAAQ,EAAC,IAAI,EAAE,KAAC,MAAM,KAAG,EAAE,OAAO,EAAE,WAAW,YAC1D,CAAC,CAAC,aAAa,CAAC,GACT,CACf;KACR,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 {KitButton} from 'aristid-ds';\nimport {FaSave} from 'react-icons/fa';\nimport {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\nimport {useViewSettingsContext} from '../store-view-settings/useViewSettingsContext';\nimport {ViewSettingsActionTypes} from '../store-view-settings/viewSettingsReducer';\nimport useExecuteUpdateViewMutation from '../../_queries/useExecuteUpdateViewMutation';\nimport {prepareViewForRequest} from './prepareViewForRequest';\nimport {type IViewDisplay} from '_ui/types';\nimport {mapViewTypeFromExplorerToLegacy} from '../../_constants';\nimport {useEffect, useRef, useState} from 'react';\nimport {useMeQuery} from '_ui/_gqlTypes';\nimport {type IUserView} from '../../_types';\nimport {useTransformFilters} from '_ui/components/Filters/useTransformFilters';\nimport {useFiltersContext} from '_ui/components/Filters/useFiltersContext';\nimport {FiltersActionTypes} from '_ui/components/Filters/context/filtersReducer';\nimport {type UIFilter} from '_ui/components/Filters/_types';\n\nexport const useUpdateView = () => {\n const {t} = useSharedTranslation();\n const {toValidFilters} = useTransformFilters();\n const {view, dispatch} = useViewSettingsContext();\n const {filtersData, dispatch: filtersDispatch} = useFiltersContext();\n const {updateView} = useExecuteUpdateViewMutation();\n const [isOwnerView, setIsOwnerView] = useState(false);\n const currentView = useRef<IUserView | undefined>();\n\n const {data: userData} = useMeQuery();\n\n useEffect(() => {\n currentView.current = view.savedViews.find(v => v.id === view.viewId);\n if (currentView.current === undefined) {\n return;\n }\n setIsOwnerView(currentView.current.ownerId === userData?.me?.whoAmI?.id);\n }, [view.viewId]);\n\n const _updateView = async () => {\n if (!view.viewId) {\n return;\n }\n const mappedView = {\n ...prepareViewForRequest(view, filtersData.filters, view.viewLabels),\n id: view.viewId,\n shared: currentView.current?.shared ?? false,\n };\n\n const {data} = await updateView({\n view: mappedView,\n });\n\n if (data) {\n const validFilters = toValidFilters(data.updateView.filters);\n dispatch({\n type: ViewSettingsActionTypes.UPDATE_VIEWS,\n payload: {\n id: data.updateView.id,\n ownerId: data.updateView.created_by.id,\n label: data.updateView.label,\n shared: data.updateView.shared,\n filters: validFilters,\n sort: data.updateView.sort ?? [],\n display: (data.updateView.display as IViewDisplay) ?? {\n type: mapViewTypeFromExplorerToLegacy[view.viewType],\n },\n attributes: data.updateView?.attributes?.map(({id}) => id) ?? [],\n },\n });\n filtersDispatch({\n type: FiltersActionTypes.UPDATE_VIEWS,\n payload: {\n ...filtersData,\n viewId: data.updateView.id,\n filters: data.updateView.filters as UIFilter[],\n },\n });\n }\n };\n\n return {\n updateViewButton:\n !view.viewId || !view.savedViews.length || !isOwnerView ? null : (\n <KitButton type=\"action\" icon={<FaSave />} onClick={_updateView}>\n {t('global.save')}\n </KitButton>\n ),\n };\n};\n"]}
1
+ {"version":3,"file":"useUpdateView.js","sourceRoot":"","sources":["../../../../../src/components/Explorer/manage-view-settings/save-view/useUpdateView.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAC,SAAS,EAAC,MAAM,YAAY,CAAC;AACrC,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAC,sBAAsB,EAAC,MAAM,+CAA+C,CAAC;AACrF,OAAO,EAAC,uBAAuB,EAAC,MAAM,4CAA4C,CAAC;AACnF,OAAO,4BAA4B,MAAM,6CAA6C,CAAC;AACvF,OAAO,EAAC,qBAAqB,EAAC,MAAM,yBAAyB,CAAC;AAE9D,OAAO,EAAC,+BAA+B,EAAC,MAAM,kBAAkB,CAAC;AACjE,OAAO,EAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AAClD,OAAO,EAAC,UAAU,EAAC,MAAM,eAAe,CAAC;AAEzC,OAAO,EAAC,mBAAmB,EAAC,MAAM,4CAA4C,CAAC;AAC/E,OAAO,EAAC,iBAAiB,EAAC,MAAM,0CAA0C,CAAC;AAC3E,OAAO,EAAC,kBAAkB,EAAC,MAAM,+CAA+C,CAAC;AAEjF,OAAO,EAAC,eAAe,EAAC,MAAM,gCAAgC,CAAC;A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AC,CAAC;IAEF,OAAO;QACH,gBAAgB,EACZ,CAAC,IAAI,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAC7D,KAAC,SAAS,IAAC,IAAI,EAAC,QAAQ,EAAC,IAAI,EAAE,KAAC,eAAe,IAAC,IAAI,EAAE,MAAM,GAAI,EAAE,OAAO,EAAE,WAAW,YACjF,CAAC,CAAC,aAAa,CAAC,GACT,CACf;KACR,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 {KitButton} from 'aristid-ds';\nimport {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\nimport {useViewSettingsContext} from '../store-view-settings/useViewSettingsContext';\nimport {ViewSettingsActionTypes} from '../store-view-settings/viewSettingsReducer';\nimport useExecuteUpdateViewMutation from '../../_queries/useExecuteUpdateViewMutation';\nimport {prepareViewForRequest} from './prepareViewForRequest';\nimport {type IViewDisplay} from '_ui/types';\nimport {mapViewTypeFromExplorerToLegacy} from '../../_constants';\nimport {useEffect, useRef, useState} from 'react';\nimport {useMeQuery} from '_ui/_gqlTypes';\nimport {type IUserView} from '../../_types';\nimport {useTransformFilters} from '_ui/components/Filters/useTransformFilters';\nimport {useFiltersContext} from '_ui/components/Filters/useFiltersContext';\nimport {FiltersActionTypes} from '_ui/components/Filters/context/filtersReducer';\nimport {type UIFilter} from '_ui/components/Filters/_types';\nimport {FontAwesomeIcon} from '@fortawesome/react-fontawesome';\nimport {faSave} from '@fortawesome/free-solid-svg-icons';\n\nexport const useUpdateView = () => {\n const {t} = useSharedTranslation();\n const {toValidFilters} = useTransformFilters();\n const {view, dispatch} = useViewSettingsContext();\n const {filtersData, dispatch: filtersDispatch} = useFiltersContext();\n const {updateView} = useExecuteUpdateViewMutation();\n const [isOwnerView, setIsOwnerView] = useState(false);\n const currentView = useRef<IUserView | undefined>();\n\n const {data: userData} = useMeQuery();\n\n useEffect(() => {\n currentView.current = view.savedViews.find(v => v.id === view.viewId);\n if (currentView.current === undefined) {\n return;\n }\n setIsOwnerView(currentView.current.ownerId === userData?.me?.whoAmI?.id);\n }, [view.viewId]);\n\n const _updateView = async () => {\n if (!view.viewId) {\n return;\n }\n const mappedView = {\n ...prepareViewForRequest(view, filtersData.filters, view.viewLabels),\n id: view.viewId,\n shared: currentView.current?.shared ?? false,\n };\n\n const {data} = await updateView({\n view: mappedView,\n });\n\n if (data) {\n const validFilters = toValidFilters(data.updateView.filters);\n dispatch({\n type: ViewSettingsActionTypes.UPDATE_VIEWS,\n payload: {\n id: data.updateView.id,\n ownerId: data.updateView.created_by.id,\n label: data.updateView.label,\n shared: data.updateView.shared,\n filters: validFilters,\n sort: data.updateView.sort ?? [],\n display: (data.updateView.display as IViewDisplay) ?? {\n type: mapViewTypeFromExplorerToLegacy[view.viewType],\n },\n attributes: data.updateView?.attributes?.map(({id}) => id) ?? [],\n },\n });\n filtersDispatch({\n type: FiltersActionTypes.UPDATE_VIEWS,\n payload: {\n ...filtersData,\n viewId: data.updateView.id,\n filters: data.updateView.filters as UIFilter[],\n },\n });\n }\n };\n\n return {\n updateViewButton:\n !view.viewId || !view.savedViews.length || !isOwnerView ? null : (\n <KitButton type=\"action\" icon={<FontAwesomeIcon icon={faSave} />} onClick={_updateView}>\n {t('global.save')}\n </KitButton>\n ),\n };\n};\n"]}
@@ -1,5 +1,4 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { FaEye, FaEyeSlash, FaSearch } from 'react-icons/fa';
3
2
  import { KitInput, KitTypography } from 'aristid-ds';
4
3
  import styled from 'styled-components';
5
4
  import { useSharedTranslation } from '../../../../hooks/useSharedTranslation';
@@ -10,6 +9,8 @@ import { useAttributeDetailsData } from '../_shared/useAttributeDetailsData';
10
9
  import { ViewSettingsActionTypes } from '../store-view-settings/viewSettingsReducer';
11
10
  import { useViewSettingsContext } from '../store-view-settings/useViewSettingsContext';
12
11
  import { SortListItem } from './SortListItem';
12
+ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
13
+ import { faSearch, faEye, faEyeSlash } from '@fortawesome/free-solid-svg-icons';
13
14
  const StyledListContainer = styled.div `
14
15
  display: flex;
15
16
  flex-direction: column;
@@ -20,10 +21,10 @@ const StyledList = styled.ul `
20
21
  list-style: none;
21
22
  color: var(--general-utilities-text-primary);
22
23
  `;
23
- const StyledEyeSlash = styled(FaEyeSlash) `
24
+ const StyledEyeSlash = styled(FontAwesomeIcon) `
24
25
  color: var(--general-utilities-neutral-dark);
25
26
  `;
26
- const StyledFaEye = styled(FaEye) `
27
+ const StyledFaEye = styled(FontAwesomeIcon) `
27
28
  color: var(--general-utilities-neutral-deepDark);
28
29
  `;
29
30
  export const SortItems = ({ libraryId }) => {
@@ -97,13 +98,13 @@ export const SortItems = ({ libraryId }) => {
97
98
  },
98
99
  },
99
100
  }, visibilityButtonProps: {
100
- icon: _jsx(StyledFaEye, {}),
101
+ icon: _jsx(StyledFaEye, { icon: faEye }),
101
102
  title: String(t('explorer.hide')),
102
103
  onClick: _toggleColumnVisibility(field),
103
- } }, field))) }) }) })), _jsx(KitTypography.Title, { level: "h4", children: t('explorer.available-attributes') }), _jsx(KitInput, { placeholder: String(t('global.search')), onChange: onSearchChanged, allowClear: true, prefix: _jsx(FaSearch, {}) }), _jsx(StyledList, { "aria-label": t('explorer.sort-list.inactive'), children: inactiveFilters.map(field => (_jsx(SortListItem, { attributeId: field, filterChipProps: {
104
+ } }, field))) }) }) })), _jsx(KitTypography.Title, { level: "h4", children: t('explorer.available-attributes') }), _jsx(KitInput, { placeholder: String(t('global.search')), onChange: onSearchChanged, allowClear: true, prefix: _jsx(FontAwesomeIcon, { icon: faSearch }) }), _jsx(StyledList, { "aria-label": t('explorer.sort-list.inactive'), children: inactiveFilters.map(field => (_jsx(SortListItem, { attributeId: field, filterChipProps: {
104
105
  label: attributeDetailsById[field].label,
105
106
  }, visibilityButtonProps: {
106
- icon: _jsx(StyledEyeSlash, {}),
107
+ icon: _jsx(StyledEyeSlash, { icon: faEyeSlash }),
107
108
  title: String(t('explorer.show')),
108
109
  onClick: _toggleColumnVisibility(field),
109
110
  } }, field))) })] }));
@@ -1 +1 @@
1
- {"version":3,"file":"SortItems.js","sourceRoot":"","sources":["../../../../../src/components/Explorer/manage-view-settings/sort-items/SortItems.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAC,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAC,MAAM,gBAAgB,CAAC;AAC3D,OAAO,EAAC,QAAQ,EAAE,aAAa,EAAC,MAAM,YAAY,CAAC;AACnD,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAC,SAAS,EAAC,MAAM,eAAe,CAAC;AACxC,OAAO,EACH,aAAa,EACb,UAAU,EAEV,cAAc,EACd,aAAa,EACb,SAAS,EACT,UAAU,GACb,MAAM,eAAe,CAAC;AACvB,OAAO,EAAC,eAAe,EAAE,2BAA2B,EAAE,2BAA2B,EAAC,MAAM,mBAAmB,CAAC;AAC5G,OAAO,EAAC,uBAAuB,EAAC,MAAM,oCAAoC,CAAC;AAC3E,OAAO,EAAC,uBAAuB,EAAC,MAAM,4CAA4C,CAAC;AACnF,OAAO,EAAC,sBAAsB,EAAC,MAAM,+CAA+C,CAAC;AACrF,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAE5C,MAAM,mBAAmB,GAAG,MAAM,CAAC,GAAG,CAAA;;;CAGrC,CAAC;AAEF,MAAM,UAAU,GAAG,MAAM,CAAC,EAAE,CAAA;;;;;CAK3B,CAAC;AAEF,MAAM,cAAc,GAAG,MAAM,CAAC,UAAU,CAAC,CAAA;;CAExC,CAAC;AAEF,MAAM,WAAW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KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC;gCACjC,OAAO,EAAE,uBAAuB,CAAC,KAAK,CAAC;6BAC1C,IApCI,KAAK,CAqCZ,CACL,CAAC,GACY,GACT,GACJ,CAChB,EACD,KAAC,aAAa,CAAC,KAAK,IAAC,KAAK,EAAC,IAAI,YAAE,CAAC,CAAC,+BAA+B,CAAC,GAAuB,EAC1F,KAAC,QAAQ,IACL,WAAW,EAAE,MAAM,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,EACvC,QAAQ,EAAE,eAAe,EACzB,UAAU,QACV,MAAM,EAAE,KAAC,QAAQ,KAAG,GACtB,EACF,KAAC,UAAU,kBAAa,CAAC,CAAC,6BAA6B,CAAC,YACnD,eAAe,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,CAC1B,KAAC,YAAY,IAET,WAAW,EAAE,KAAK,EAClB,eAAe,EAAE;wBACb,KAAK,EAAE,oBAAoB,CAAC,KAAK,CAAC,CAAC,KAAK;qBAC3C,EACD,qBAAqB,EAAE;wBACnB,IAAI,EAAE,KAAC,cAAc,KAAG;wBACxB,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC;wBACjC,OAAO,EAAE,uBAAuB,CAAC,KAAK,CAAC;qBAC1C,IATI,KAAK,CAUZ,CACL,CAAC,GACO,IACK,CACzB,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 FunctionComponent} from 'react';\nimport {FaEye, FaEyeSlash, FaSearch} from 'react-icons/fa';\nimport {KitInput, KitTypography} from 'aristid-ds';\nimport styled from 'styled-components';\nimport {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\nimport {SortOrder} from '_ui/_gqlTypes';\nimport {\n closestCenter,\n DndContext,\n type DragEndEvent,\n KeyboardSensor,\n PointerSensor,\n useSensor,\n useSensors,\n} from '@dnd-kit/core';\nimport {SortableContext, sortableKeyboardCoordinates, verticalListSortingStrategy} from '@dnd-kit/sortable';\nimport {useAttributeDetailsData} from '../_shared/useAttributeDetailsData';\nimport {ViewSettingsActionTypes} from '../store-view-settings/viewSettingsReducer';\nimport {useViewSettingsContext} from '../store-view-settings/useViewSettingsContext';\nimport {SortListItem} from './SortListItem';\n\nconst StyledListContainer = styled.div`\n display: flex;\n flex-direction: column;\n`;\n\nconst StyledList = styled.ul`\n padding: calc(var(--general-spacing-s) * 1px) 0;\n margin: 0;\n list-style: none;\n color: var(--general-utilities-text-primary);\n`;\n\nconst StyledEyeSlash = styled(FaEyeSlash)`\n color: var(--general-utilities-neutral-dark);\n`;\n\nconst StyledFaEye = styled(FaEye)`\n color: var(--general-utilities-neutral-deepDark);\n`;\n\nexport const SortItems: FunctionComponent<{libraryId: string}> = ({libraryId}) => {\n const {t} = useSharedTranslation();\n const {view, dispatch} = useViewSettingsContext();\n\n const {onSearchChanged, searchFilteredColumnsIds, attributeDetailsById} = useAttributeDetailsData(libraryId);\n\n const sensors = useSensors(\n useSensor(PointerSensor),\n useSensor(KeyboardSensor, {\n coordinateGetter: sortableKeyboardCoordinates,\n }),\n );\n\n const _toggleColumnVisibility = (field: string) => () => {\n const isAttributeAlreadySorting = view.sort.some(sortItem => sortItem.field === field);\n if (isAttributeAlreadySorting) {\n dispatch({\n type: ViewSettingsActionTypes.REMOVE_SORT,\n payload: {\n field,\n },\n });\n } else {\n dispatch({\n type: ViewSettingsActionTypes.ADD_SORT,\n payload: {\n order: SortOrder.asc,\n field,\n },\n });\n }\n };\n\n const _changeOrderActiveFilterTo = (field: string) => (order: SortOrder) =>\n dispatch({\n type: ViewSettingsActionTypes.CHANGE_SORT_ORDER,\n payload: {\n field,\n order,\n },\n });\n\n const _handleDragEnd = ({active: draggedElement, over: dropTarget}: DragEndEvent) => {\n const indexFrom = activeFilters.findIndex(({field}) => field === String(draggedElement.id));\n const indexTo = activeFilters.findIndex(({field}) => field === String(dropTarget?.id));\n\n if (!dropTarget || indexFrom === indexTo || indexTo === -1) {\n return;\n }\n\n dispatch({type: ViewSettingsActionTypes.MOVE_SORT, payload: {indexFrom, indexTo}});\n };\n\n const activeFilters = view.sort.filter(({field}) => searchFilteredColumnsIds.includes(field));\n const inactiveFilters = searchFilteredColumnsIds.filter(field =>\n view.sort.every(sortItem => sortItem.field !== field),\n );\n\n return (\n <StyledListContainer>\n {activeFilters.length > 0 && (\n <StyledList aria-label={t('explorer.sort-list.active')}>\n <DndContext sensors={sensors} collisionDetection={closestCenter} onDragEnd={_handleDragEnd}>\n <SortableContext\n items={activeFilters.map(({field}) => ({id: field}))}\n strategy={verticalListSortingStrategy}\n >\n {activeFilters.map(({field, order}) => (\n <SortListItem\n key={field}\n attributeId={field}\n isDraggable\n filterChipProps={{\n label: attributeDetailsById[field].label,\n values: [\n order === SortOrder.asc\n ? t('explorer.sort-ascending')\n : t('explorer.sort-descending'),\n ],\n expandable: true,\n dropDownProps: {\n menu: {\n selectable: true,\n selectedKeys: [order],\n items: [\n {\n key: SortOrder.asc,\n label: t('explorer.sort-ascending'),\n },\n {\n key: SortOrder.desc,\n label: t('explorer.sort-descending'),\n },\n ],\n onSelect: ({selectedKeys: [newOrder]}) =>\n _changeOrderActiveFilterTo(field)(newOrder as SortOrder),\n onDeselect: ({selectedKeys: [newOrder]}) =>\n _changeOrderActiveFilterTo(field)(newOrder as SortOrder),\n },\n },\n }}\n visibilityButtonProps={{\n icon: <StyledFaEye />,\n title: String(t('explorer.hide')),\n onClick: _toggleColumnVisibility(field),\n }}\n />\n ))}\n </SortableContext>\n </DndContext>\n </StyledList>\n )}\n <KitTypography.Title level=\"h4\">{t('explorer.available-attributes')}</KitTypography.Title>\n <KitInput\n placeholder={String(t('global.search'))}\n onChange={onSearchChanged}\n allowClear\n prefix={<FaSearch />}\n />\n <StyledList aria-label={t('explorer.sort-list.inactive')}>\n {inactiveFilters.map(field => (\n <SortListItem\n key={field}\n attributeId={field}\n filterChipProps={{\n label: attributeDetailsById[field].label,\n }}\n visibilityButtonProps={{\n icon: <StyledEyeSlash />,\n title: String(t('explorer.show')),\n onClick: _toggleColumnVisibility(field),\n }}\n />\n ))}\n </StyledList>\n </StyledListContainer>\n );\n};\n"]}
1
+ {"version":3,"file":"SortItems.js","sourceRoot":"","sources":["../../../../../src/components/Explorer/manage-view-settings/sort-items/SortItems.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAC,QAAQ,EAAE,aAAa,EAAC,MAAM,YAAY,CAAC;AACnD,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAC,SAAS,EAAC,MAAM,eAAe,CAAC;AACxC,OAAO,EACH,aAAa,EACb,UAAU,EAEV,cAAc,EACd,aAAa,EACb,SAAS,EACT,UAAU,GACb,MAAM,eAAe,CAAC;AACvB,OAAO,EAAC,eAAe,EAAE,2BAA2B,EAAE,2BAA2B,EAAC,MAAM,mBAAmB,CAAC;AAC5G,OAAO,EAAC,uBAAuB,EAAC,MAAM,oCAAoC,CAAC;AAC3E,OAAO,EAAC,uBAAuB,EAAC,MAAM,4CAA4C,CAAC;AACnF,OAAO,EAAC,sBAAsB,EAAC,MAAM,+CAA+C,CAAC;AACrF,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAC,eAAe,EAAC,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAC,QAAQ,EAAE,KAAK,EAAE,UAAU,EAAC,MAAM,mCAAmC,CAAC;AAE9E,MAAM,mBAAmB,GAAG,MAAM,CAAC,GAAG,CAAA;;;CAGrC,CAAC;AAEF,MAAM,UAAU,GAAG,MAAM,CAAC,EAAE,CAAA;;;;;CAK3B,CAAC;AAEF,MAAM,cAAc,GAAG,MAAM,CAAC,eAAe,CAAC,CAAA;;CAE7C,CAAC;AAEF,MAAM,WAA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EAAE,KAAK,GAAI;gCAClC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC;gCACjC,OAAO,EAAE,uBAAuB,CAAC,KAAK,CAAC;6BAC1C,IApCI,KAAK,CAqCZ,CACL,CAAC,GACY,GACT,GACJ,CAChB,EACD,KAAC,aAAa,CAAC,KAAK,IAAC,KAAK,EAAC,IAAI,YAAE,CAAC,CAAC,+BAA+B,CAAC,GAAuB,EAC1F,KAAC,QAAQ,IACL,WAAW,EAAE,MAAM,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,EACvC,QAAQ,EAAE,eAAe,EACzB,UAAU,QACV,MAAM,EAAE,KAAC,eAAe,IAAC,IAAI,EAAE,QAAQ,GAAI,GAC7C,EACF,KAAC,UAAU,kBAAa,CAAC,CAAC,6BAA6B,CAAC,YACnD,eAAe,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,CAC1B,KAAC,YAAY,IAET,WAAW,EAAE,KAAK,EAClB,eAAe,EAAE;wBACb,KAAK,EAAE,oBAAoB,CAAC,KAAK,CAAC,CAAC,KAAK;qBAC3C,EACD,qBAAqB,EAAE;wBACnB,IAAI,EAAE,KAAC,cAAc,IAAC,IAAI,EAAE,UAAU,GAAI;wBAC1C,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC;wBACjC,OAAO,EAAE,uBAAuB,CAAC,KAAK,CAAC;qBAC1C,IATI,KAAK,CAUZ,CACL,CAAC,GACO,IACK,CACzB,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 FunctionComponent} from 'react';\nimport {KitInput, KitTypography} from 'aristid-ds';\nimport styled from 'styled-components';\nimport {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\nimport {SortOrder} from '_ui/_gqlTypes';\nimport {\n closestCenter,\n DndContext,\n type DragEndEvent,\n KeyboardSensor,\n PointerSensor,\n useSensor,\n useSensors,\n} from '@dnd-kit/core';\nimport {SortableContext, sortableKeyboardCoordinates, verticalListSortingStrategy} from '@dnd-kit/sortable';\nimport {useAttributeDetailsData} from '../_shared/useAttributeDetailsData';\nimport {ViewSettingsActionTypes} from '../store-view-settings/viewSettingsReducer';\nimport {useViewSettingsContext} from '../store-view-settings/useViewSettingsContext';\nimport {SortListItem} from './SortListItem';\nimport {FontAwesomeIcon} from '@fortawesome/react-fontawesome';\nimport {faSearch, faEye, faEyeSlash} from '@fortawesome/free-solid-svg-icons';\n\nconst StyledListContainer = styled.div`\n display: flex;\n flex-direction: column;\n`;\n\nconst StyledList = styled.ul`\n padding: calc(var(--general-spacing-s) * 1px) 0;\n margin: 0;\n list-style: none;\n color: var(--general-utilities-text-primary);\n`;\n\nconst StyledEyeSlash = styled(FontAwesomeIcon)`\n color: var(--general-utilities-neutral-dark);\n`;\n\nconst StyledFaEye = styled(FontAwesomeIcon)`\n color: var(--general-utilities-neutral-deepDark);\n`;\n\nexport const SortItems: FunctionComponent<{libraryId: string}> = ({libraryId}) => {\n const {t} = useSharedTranslation();\n const {view, dispatch} = useViewSettingsContext();\n\n const {onSearchChanged, searchFilteredColumnsIds, attributeDetailsById} = useAttributeDetailsData(libraryId);\n\n const sensors = useSensors(\n useSensor(PointerSensor),\n useSensor(KeyboardSensor, {\n coordinateGetter: sortableKeyboardCoordinates,\n }),\n );\n\n const _toggleColumnVisibility = (field: string) => () => {\n const isAttributeAlreadySorting = view.sort.some(sortItem => sortItem.field === field);\n if (isAttributeAlreadySorting) {\n dispatch({\n type: ViewSettingsActionTypes.REMOVE_SORT,\n payload: {\n field,\n },\n });\n } else {\n dispatch({\n type: ViewSettingsActionTypes.ADD_SORT,\n payload: {\n order: SortOrder.asc,\n field,\n },\n });\n }\n };\n\n const _changeOrderActiveFilterTo = (field: string) => (order: SortOrder) =>\n dispatch({\n type: ViewSettingsActionTypes.CHANGE_SORT_ORDER,\n payload: {\n field,\n order,\n },\n });\n\n const _handleDragEnd = ({active: draggedElement, over: dropTarget}: DragEndEvent) => {\n const indexFrom = activeFilters.findIndex(({field}) => field === String(draggedElement.id));\n const indexTo = activeFilters.findIndex(({field}) => field === String(dropTarget?.id));\n\n if (!dropTarget || indexFrom === indexTo || indexTo === -1) {\n return;\n }\n\n dispatch({type: ViewSettingsActionTypes.MOVE_SORT, payload: {indexFrom, indexTo}});\n };\n\n const activeFilters = view.sort.filter(({field}) => searchFilteredColumnsIds.includes(field));\n const inactiveFilters = searchFilteredColumnsIds.filter(field =>\n view.sort.every(sortItem => sortItem.field !== field),\n );\n\n return (\n <StyledListContainer>\n {activeFilters.length > 0 && (\n <StyledList aria-label={t('explorer.sort-list.active')}>\n <DndContext sensors={sensors} collisionDetection={closestCenter} onDragEnd={_handleDragEnd}>\n <SortableContext\n items={activeFilters.map(({field}) => ({id: field}))}\n strategy={verticalListSortingStrategy}\n >\n {activeFilters.map(({field, order}) => (\n <SortListItem\n key={field}\n attributeId={field}\n isDraggable\n filterChipProps={{\n label: attributeDetailsById[field].label,\n values: [\n order === SortOrder.asc\n ? t('explorer.sort-ascending')\n : t('explorer.sort-descending'),\n ],\n expandable: true,\n dropDownProps: {\n menu: {\n selectable: true,\n selectedKeys: [order],\n items: [\n {\n key: SortOrder.asc,\n label: t('explorer.sort-ascending'),\n },\n {\n key: SortOrder.desc,\n label: t('explorer.sort-descending'),\n },\n ],\n onSelect: ({selectedKeys: [newOrder]}) =>\n _changeOrderActiveFilterTo(field)(newOrder as SortOrder),\n onDeselect: ({selectedKeys: [newOrder]}) =>\n _changeOrderActiveFilterTo(field)(newOrder as SortOrder),\n },\n },\n }}\n visibilityButtonProps={{\n icon: <StyledFaEye icon={faEye} />,\n title: String(t('explorer.hide')),\n onClick: _toggleColumnVisibility(field),\n }}\n />\n ))}\n </SortableContext>\n </DndContext>\n </StyledList>\n )}\n <KitTypography.Title level=\"h4\">{t('explorer.available-attributes')}</KitTypography.Title>\n <KitInput\n placeholder={String(t('global.search'))}\n onChange={onSearchChanged}\n allowClear\n prefix={<FontAwesomeIcon icon={faSearch} />}\n />\n <StyledList aria-label={t('explorer.sort-list.inactive')}>\n {inactiveFilters.map(field => (\n <SortListItem\n key={field}\n attributeId={field}\n filterChipProps={{\n label: attributeDetailsById[field].label,\n }}\n visibilityButtonProps={{\n icon: <StyledEyeSlash icon={faEyeSlash} />,\n title: String(t('explorer.show')),\n onClick: _toggleColumnVisibility(field),\n }}\n />\n ))}\n </StyledList>\n </StyledListContainer>\n );\n};\n"]}
@@ -1,9 +1,10 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import styled from 'styled-components';
3
- import { FaGripLines } from 'react-icons/fa';
4
3
  import { KitButton, KitFilter } from 'aristid-ds';
5
4
  import { useSortable } from '@dnd-kit/sortable';
6
5
  import { CSS } from '@dnd-kit/utilities';
6
+ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
7
+ import { faGripLines } from '@fortawesome/free-solid-svg-icons';
7
8
  const StyledSortListItem = styled.li `
8
9
  display: flex;
9
10
  justify-content: space-between;
@@ -27,6 +28,6 @@ export const SortListItem = ({ attributeId, isDraggable, visibilityButtonProps,
27
28
  transform: CSS.Transform.toString(transform),
28
29
  transition,
29
30
  };
30
- return (_jsxs(StyledSortListItem, { ref: setNodeRef, style: style, children: [_jsxs("div", { children: [isDraggable && (_jsx(StyledDragHandle, { ...attributes, ...listeners, "$isDragging": isDragging, children: _jsx(FaGripLines, {}) })), _jsx(KitFilter, { ...filterChipProps }, attributeId)] }), _jsx(KitButton, { size: "m", type: "tertiary", ...visibilityButtonProps })] }));
31
+ return (_jsxs(StyledSortListItem, { ref: setNodeRef, style: style, children: [_jsxs("div", { children: [isDraggable && (_jsx(StyledDragHandle, { ...attributes, ...listeners, "$isDragging": isDragging, children: _jsx(FontAwesomeIcon, { icon: faGripLines }) })), _jsx(KitFilter, { ...filterChipProps }, attributeId)] }), _jsx(KitButton, { size: "m", type: "tertiary", ...visibilityButtonProps })] }));
31
32
  };
32
33
  //# sourceMappingURL=SortListItem.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SortListItem.js","sourceRoot":"","sources":["../../../../../src/components/Explorer/manage-view-settings/sort-items/SortListItem.tsx"],"names":[],"mappings":";AAIA,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAC,SAAS,EAAE,SAAS,EAAC,MAAM,YAAY,CAAC;AAChD,OAAO,EAAC,WAAW,EAAC,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAC,GAAG,EAAC,MAAM,oBAAoB,CAAC;AAEvC,MAAM,kBAAkB,GAAG,MAAM,CAAC,EAAE,CAAA;;;;;;;;;;;CAWnC,CAAC;AAEF,MAAM,gBAAgB,GAAG,MAAM,CAAC,IAAI,CAAwB;;;cAG9C,KAAK,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC;CAC/D,CAAC;AASF,MAAM,CAAC,MAAM,YAAY,GAAkD,CAAC,EACxE,WAAW,EACX,WAAW,EACX,qBAAqB,EACrB,eAAe,GAClB,EAAE,EAAE;IACD,MAAM,EAAC,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,EAAC,GAAG,WAAW,CAAC,EAAC,EAAE,EAAE,WAAW,EAAC,CAAC,CAAC;IAC9G,MAAM,KAAK,GAAG;QACV,SAAS,EAAE,GAAG,CAAC,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC;QAC5C,UAAU;KACb,CAAC;IAEF,OAAO,CACH,MAAC,kBAAkB,IAAC,GAAG,EAAE,UAAU,EAAE,KAAK,EAAE,KAAK,aAC7C,0BACK,WAAW,IAAI,CACZ,KAAC,gBAAgB,OAAK,UAAU,KAAM,SAAS,iBAAe,UAAU,YACpE,KAAC,WAAW,KAAG,GACA,CACtB,EACD,KAAC,SAAS,OAAuB,eAAe,IAAhC,WAAW,CAAyB,IAClD,EACN,KAAC,SAAS,IAAC,IAAI,EAAC,GAAG,EAAC,IAAI,EAAC,UAAU,KAAK,qBAAqB,GAAI,IAChD,CACxB,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} from 'react';\nimport styled from 'styled-components';\nimport {FaGripLines} from 'react-icons/fa';\nimport {KitButton, KitFilter} from 'aristid-ds';\nimport {useSortable} from '@dnd-kit/sortable';\nimport {CSS} from '@dnd-kit/utilities';\n\nconst StyledSortListItem = styled.li`\n display: flex;\n justify-content: space-between;\n align-items: center;\n\n div {\n display: flex;\n justify-content: center;\n align-items: center;\n gap: calc(var(--general-spacing-xs) * 1px);\n }\n`;\n\nconst StyledDragHandle = styled.span<{$isDragging: boolean}>`\n display: flex;\n align-items: center;\n cursor: ${props => (props.$isDragging ? 'grabbing' : 'grab')};\n`;\n\ninterface IActiveFilterListItemProps {\n attributeId: string;\n isDraggable?: true;\n filterChipProps: Pick<ComponentProps<typeof KitFilter>, 'label' | 'values' | 'expandable' | 'dropDownProps'>;\n visibilityButtonProps: Pick<ComponentProps<typeof KitButton>, 'onClick' | 'icon' | 'title'>;\n}\n\nexport const SortListItem: FunctionComponent<IActiveFilterListItemProps> = ({\n attributeId,\n isDraggable,\n visibilityButtonProps,\n filterChipProps,\n}) => {\n const {attributes, listeners, setNodeRef, transform, transition, isDragging} = useSortable({id: attributeId});\n const style = {\n transform: CSS.Transform.toString(transform),\n transition,\n };\n\n return (\n <StyledSortListItem ref={setNodeRef} style={style}>\n <div>\n {isDraggable && (\n <StyledDragHandle {...attributes} {...listeners} $isDragging={isDragging}>\n <FaGripLines />\n </StyledDragHandle>\n )}\n <KitFilter key={attributeId} {...filterChipProps} />\n </div>\n <KitButton size=\"m\" type=\"tertiary\" {...visibilityButtonProps} />\n </StyledSortListItem>\n );\n};\n"]}
1
+ {"version":3,"file":"SortListItem.js","sourceRoot":"","sources":["../../../../../src/components/Explorer/manage-view-settings/sort-items/SortListItem.tsx"],"names":[],"mappings":";AAIA,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,EAAC,SAAS,EAAE,SAAS,EAAC,MAAM,YAAY,CAAC;AAChD,OAAO,EAAC,WAAW,EAAC,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAC,GAAG,EAAC,MAAM,oBAAoB,CAAC;AACvC,OAAO,EAAC,eAAe,EAAC,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAC,WAAW,EAAC,MAAM,mCAAmC,CAAC;AAE9D,MAAM,kBAAkB,GAAG,MAAM,CAAC,EAAE,CAAA;;;;;;;;;;;CAWnC,CAAC;AAEF,MAAM,gBAAgB,GAAG,MAAM,CAAC,IAAI,CAAwB;;;cAG9C,KAAK,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC;CAC/D,CAAC;AASF,MAAM,CAAC,MAAM,YAAY,GAAkD,CAAC,EACxE,WAAW,EACX,WAAW,EACX,qBAAqB,EACrB,eAAe,GAClB,EAAE,EAAE;IACD,MAAM,EAAC,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,EAAC,GAAG,WAAW,CAAC,EAAC,EAAE,EAAE,WAAW,EAAC,CAAC,CAAC;IAC9G,MAAM,KAAK,GAAG;QACV,SAAS,EAAE,GAAG,CAAC,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC;QAC5C,UAAU;KACb,CAAC;IAEF,OAAO,CACH,MAAC,kBAAkB,IAAC,GAAG,EAAE,UAAU,EAAE,KAAK,EAAE,KAAK,aAC7C,0BACK,WAAW,IAAI,CACZ,KAAC,gBAAgB,OAAK,UAAU,KAAM,SAAS,iBAAe,UAAU,YACpE,KAAC,eAAe,IAAC,IAAI,EAAE,WAAW,GAAI,GACvB,CACtB,EACD,KAAC,SAAS,OAAuB,eAAe,IAAhC,WAAW,CAAyB,IAClD,EACN,KAAC,SAAS,IAAC,IAAI,EAAC,GAAG,EAAC,IAAI,EAAC,UAAU,KAAK,qBAAqB,GAAI,IAChD,CACxB,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} from 'react';\nimport styled from 'styled-components';\nimport {KitButton, KitFilter} from 'aristid-ds';\nimport {useSortable} from '@dnd-kit/sortable';\nimport {CSS} from '@dnd-kit/utilities';\nimport {FontAwesomeIcon} from '@fortawesome/react-fontawesome';\nimport {faGripLines} from '@fortawesome/free-solid-svg-icons';\n\nconst StyledSortListItem = styled.li`\n display: flex;\n justify-content: space-between;\n align-items: center;\n\n div {\n display: flex;\n justify-content: center;\n align-items: center;\n gap: calc(var(--general-spacing-xs) * 1px);\n }\n`;\n\nconst StyledDragHandle = styled.span<{$isDragging: boolean}>`\n display: flex;\n align-items: center;\n cursor: ${props => (props.$isDragging ? 'grabbing' : 'grab')};\n`;\n\ninterface IActiveFilterListItemProps {\n attributeId: string;\n isDraggable?: true;\n filterChipProps: Pick<ComponentProps<typeof KitFilter>, 'label' | 'values' | 'expandable' | 'dropDownProps'>;\n visibilityButtonProps: Pick<ComponentProps<typeof KitButton>, 'onClick' | 'icon' | 'title'>;\n}\n\nexport const SortListItem: FunctionComponent<IActiveFilterListItemProps> = ({\n attributeId,\n isDraggable,\n visibilityButtonProps,\n filterChipProps,\n}) => {\n const {attributes, listeners, setNodeRef, transform, transition, isDragging} = useSortable({id: attributeId});\n const style = {\n transform: CSS.Transform.toString(transform),\n transition,\n };\n\n return (\n <StyledSortListItem ref={setNodeRef} style={style}>\n <div>\n {isDraggable && (\n <StyledDragHandle {...attributes} {...listeners} $isDragging={isDragging}>\n <FontAwesomeIcon icon={faGripLines} />\n </StyledDragHandle>\n )}\n <KitFilter key={attributeId} {...filterChipProps} />\n </div>\n <KitButton size=\"m\" type=\"tertiary\" {...visibilityButtonProps} />\n </StyledSortListItem>\n );\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"viewSettingsReducer.js","sourceRoot":"","sources":["../../../../../src/components/Explorer/manage-view-settings/store-view-settings/viewSettingsReducer.ts"],"names":[],"mappings":"AAQA,OAAO,EAAC,aAAa,EAAC,MAAM,4BAA4B,CAAC;AAmBzD,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACnC,KAAK,EAAE,OAAO;IACd,aAAa,EAAE,eAAe;IAC9B,gBAAgB,EAAE,kBAAkB;IACpC,cAAc,EAAE,gBAAgB;IAChC,gBAAgB,EAAE,kBAAkB;IACpC,gBAAgB,EAAE,kBAAkB;IACpC,QAAQ,EAAE,UAAU;IACpB,WAAW,EAAE,aAAa;IAC1B,SAAS,EAAE,WAAW;IACtB,iBAAiB,EAAE,mBAAmB;IACtC,gBAAgB,EAAE,kBAAkB;IACpC,sBAAsB,EAAE,wBAAwB;IAChD,qBAAqB,EAAE,uBAAuB;IAC9C,UAAU,EAAE,YAAY;IACxB,YAAY,EAAE,cAAc;IAC5B,aAAa,EAAE,eAAe;IAC9B,WAAW,EAAE,aAAa;IAC1B,oBAAoB,EAAE,sBAAsB;IAC5C,iBAAiB,EAAE,mBAAmB;IACtC,6BAA6B,EAAE,+BAA+B;IAC9D,YAAY,EAAE,cAAc;IAC5B,WAAW,EAAE,aAAa;IAC1B,WAAW,EAAE,aAAa;IAC1B,SAAS,EAAE,WAAW;CAChB,CAAC;AAwKX,MAAM,cAAc,GAA+C,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE,CAAC,CAAC;IACpF,GAAG,KAA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AAK,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;QAClD,CAAC;QACD,KAAK,uBAAuB,CAAC,6BAA6B,CAAC,CAAC,CAAC;YACzD,OAAO,0BAA0B,CAAC,KAAK,CAAC,CAAC;QAC7C,CAAC;QACD,KAAK,uBAAuB,CAAC,YAAY,CAAC,CAAC,CAAC;YACxC,OAAO,4BAA4B,CAAC,KAAK,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;QAC/D,CAAC;QACD,KAAK,uBAAuB,CAAC,WAAW,CAAC,CAAC,CAAC;YACvC,OAAO,UAAU,CAAC,KAAK,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;QAC7C,CAAC;QACD,KAAK,uBAAuB,CAAC,WAAW,CAAC,CAAC,CAAC;YACvC,OAAO,UAAU,CAAC,KAAK,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;QAC7C,CAAC;QACD,KAAK,uBAAuB,CAAC,SAAS,CAAC,CAAC,CAAC;YACrC,OAAO,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;QAC3C,CAAC;QACD;YACI,OAAO,KAAK,CAAC;IACrB,CAAC;AACL,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 {v4 as uuid} from 'uuid';\nimport {AttributeFormat, type RecordFilterCondition, type SortOrder} from '_ui/_gqlTypes';\nimport {type DefaultViewSettings, type Entrypoint, type IUserView, type MassSelection} from '../../_types';\nimport {hasOnlyNoValueConditions, nullValueConditions} from '../../conditionsHelper';\nimport {AttributeConditionFilter, ThroughConditionFilter} from '_ui/types';\nimport {DefaultViewId} from './viewSettingsInitialState';\nimport {isLinkAttribute} from '_ui/_utils/attributeType';\nimport {\n conditionsByFormat,\n getFirstConditionByFilterType,\n} from '_ui/components/Filters/filter-items/filter-type/useConditionOptionsByType';\nimport {\n isUIFilterLink,\n isUIFilterStandard,\n isUIFilterThrough,\n isUIFilterTree,\n isUIFilterValueList,\n type IUIFilterStandard,\n type IUIFilterTree,\n type UIFilter,\n} from '_ui/components/Filters';\n\nexport type ViewType = 'table' | 'list' | 'timeline' | 'mosaic';\n\nexport const ViewSettingsActionTypes = {\n RESET: 'RESET',\n ADD_ATTRIBUTE: 'ADD_ATTRIBUTE',\n REMOVE_ATTRIBUTE: 'REMOVE_ATTRIBUTE',\n MOVE_ATTRIBUTE: 'MOVE_ATTRIBUTE',\n RESET_ATTRIBUTES: 'RESET_ATTRIBUTES',\n CHANGE_VIEW_TYPE: 'CHANGE_VIEW_TYPE',\n ADD_SORT: 'ADD_SORT',\n REMOVE_SORT: 'REMOVE_SORT',\n MOVE_SORT: 'MOVE_SORT',\n CHANGE_SORT_ORDER: 'CHANGE_SORT_ORDER',\n CHANGE_PAGE_SIZE: 'CHANGE_PAGE_SIZE',\n CHANGE_FULLTEXT_SEARCH: 'CHANGE_FULLTEXT_SEARCH',\n CLEAR_FULLTEXT_SEARCH: 'CLEAR_FULLTEXT_SEARCH',\n ADD_FILTER: 'ADD_FILTER',\n RESET_FILTER: 'RESET_FILTER',\n REMOVE_FILTER: 'REMOVE_FILTER',\n MOVE_FILTER: 'MOVE_FILTER',\n CHANGE_FILTER_CONFIG: 'CHANGE_FILTER_CONFIG',\n SET_SELECTED_KEYS: 'SET_SELECTED_KEYS',\n RESTORE_INITIAL_VIEW_SETTINGS: 'RESTORE_INITIAL_VIEW_SETTINGS',\n UPDATE_VIEWS: 'UPDATE_VIEWS',\n RENAME_VIEW: 'RENAME_VIEW',\n DELETE_VIEW: 'DELETE_VIEW',\n LOAD_VIEW: 'LOAD_VIEW',\n} as const;\n\nexport interface IViewSettingsState {\n libraryId: string;\n viewId: string | null;\n viewLabels: Record<string, string>;\n viewModified: boolean;\n entrypoint: Entrypoint;\n viewType: ViewType;\n savedViews: IUserView[];\n attributesIds: string[];\n fulltextSearch: string;\n sort: Array<{\n field: string;\n order: SortOrder;\n }>;\n pageSize: number;\n initialViewSettings: Pick<IViewSettingsState, 'viewType' | 'attributesIds' | 'sort' | 'pageSize'>;\n defaultViewSettings: DefaultViewSettings;\n massSelection: MassSelection;\n enableConfigureView?: boolean;\n}\n\ninterface IViewSettingsActionChangePageSize {\n type: typeof ViewSettingsActionTypes.CHANGE_PAGE_SIZE;\n payload: {pageSize: number};\n}\n\ninterface IViewSettingsActionAddAttribute {\n type: typeof ViewSettingsActionTypes.ADD_ATTRIBUTE;\n payload: {attributeId: string};\n}\n\ninterface IViewSettingsActionRemoveAttribute {\n type: typeof ViewSettingsActionTypes.REMOVE_ATTRIBUTE;\n payload: {attributeId: string};\n}\n\ninterface IViewSettingsActionMoveAttribute {\n type: typeof ViewSettingsActionTypes.MOVE_ATTRIBUTE;\n payload: {\n indexFrom: number;\n indexTo: number;\n };\n}\n\ninterface IViewSettingsActionChangeViewType {\n type: typeof ViewSettingsActionTypes.CHANGE_VIEW_TYPE;\n payload: {viewType: ViewType};\n}\n\ninterface IViewSettingsActionResetAttributes {\n type: typeof ViewSettingsActionTypes.RESET_ATTRIBUTES;\n}\n\ninterface IViewSettingsActionAddSort {\n type: typeof ViewSettingsActionTypes.ADD_SORT;\n payload: {field: string; order: SortOrder};\n}\n\ninterface IViewSettingsActionRemoveSort {\n type: typeof ViewSettingsActionTypes.REMOVE_SORT;\n payload: {field: string};\n}\n\ninterface IViewSettingsActionChangeSortOrder {\n type: typeof ViewSettingsActionTypes.CHANGE_SORT_ORDER;\n payload: {field: string; order: SortOrder};\n}\n\ninterface IViewSettingsActionMoveSort {\n type: typeof ViewSettingsActionTypes.MOVE_SORT;\n payload: {\n indexFrom: number;\n indexTo: number;\n };\n}\n\ninterface IViewSettingsActionChangeFulltextSearch {\n type: typeof ViewSettingsActionTypes.CHANGE_FULLTEXT_SEARCH;\n payload: {search: string};\n}\n\ninterface IViewSettingsActionClearFulltextSearch {\n type: typeof ViewSettingsActionTypes.CLEAR_FULLTEXT_SEARCH;\n}\n\ninterface IViewSettingsActionAddFilter {\n type: typeof ViewSettingsActionTypes.ADD_FILTER;\n payload: Omit<UIFilter, 'id' | 'value' | 'condition'>;\n}\n\ninterface IViewSettingsActionResetFilter {\n type: typeof ViewSettingsActionTypes.RESET_FILTER;\n payload: Pick<UIFilter, 'id'>;\n}\n\ninterface IViewSettingsActionRemoveFilter {\n type: typeof ViewSettingsActionTypes.REMOVE_FILTER;\n payload: Pick<UIFilter, 'id'>;\n}\n\ninterface IViewSettingsActionChangeFilterConfig {\n type: typeof ViewSettingsActionTypes.CHANGE_FILTER_CONFIG;\n payload: UIFilter | IUIFilterTree;\n}\n\ninterface IViewSettingsActionMoveFilter {\n type: typeof ViewSettingsActionTypes.MOVE_FILTER;\n payload: {\n indexFrom: number;\n indexTo: number;\n };\n}\n\ninterface IViewSettingsActionReset {\n type: typeof ViewSettingsActionTypes.RESET;\n payload: IViewSettingsState;\n}\n\ninterface IViewSettingsActionSetSelectedKeys {\n type: typeof ViewSettingsActionTypes.SET_SELECTED_KEYS;\n payload: MassSelection;\n}\n\ninterface IViewSettingsActionRestoreInitialViewSettings {\n type: typeof ViewSettingsActionTypes.RESTORE_INITIAL_VIEW_SETTINGS;\n}\n\ninterface IViewSettingsActionUpdateViewListAndCurrentView {\n type: typeof ViewSettingsActionTypes.UPDATE_VIEWS;\n payload: IUserView;\n}\n\ninterface IViewDataPayload {\n id: string;\n label: Record<string, string>;\n}\n\ninterface IViewSettingsActionRenameView {\n type: typeof ViewSettingsActionTypes.RENAME_VIEW;\n payload: IViewDataPayload;\n}\n\ninterface IViewSettingsActionDeleteView {\n type: typeof ViewSettingsActionTypes.DELETE_VIEW;\n payload: {id: string};\n}\n\nexport type IViewSettingsActionLoadViewPayload = Pick<\n IViewSettingsState,\n 'viewId' | 'viewLabels' | 'viewType' | 'attributesIds' | 'sort'\n>;\n\ninterface IViewSettingsActionLoadView {\n type: typeof ViewSettingsActionTypes.LOAD_VIEW;\n payload: IViewSettingsActionLoadViewPayload;\n}\n\ntype Reducer<\n PAYLOAD extends {\n type: keyof typeof ViewSettingsActionTypes;\n payload?: unknown;\n } = {type: any; payload: 'no_payload'},\n> = PAYLOAD['payload'] extends 'no_payload'\n ? (state: IViewSettingsState) => IViewSettingsState\n : (state: IViewSettingsState, payload: PAYLOAD['payload']) => IViewSettingsState;\n\nconst changePageSize: Reducer<IViewSettingsActionChangePageSize> = (state, payload) => ({\n ...state,\n pageSize: payload.pageSize,\n});\n\nconst addAttribute: Reducer<IViewSettingsActionAddAttribute> = (state, payload) => ({\n ...state,\n attributesIds: [...state.attributesIds, payload.attributeId],\n viewModified: true,\n});\n\nconst removeAttribute: Reducer<IViewSettingsActionRemoveAttribute> = (state, payload) => ({\n ...state,\n attributesIds: state.attributesIds.filter(attributesId => attributesId !== payload.attributeId),\n viewModified: true,\n});\n\nconst moveAttribute: Reducer<IViewSettingsActionMoveAttribute> = (state, payload) => {\n const attributesIds = [...state.attributesIds];\n const [attributeIdToMove] = attributesIds.splice(payload.indexFrom, 1);\n // TODO use newES6 syntax (toSpliced)\n attributesIds.splice(payload.indexTo, 0, attributeIdToMove);\n return {\n ...state,\n attributesIds,\n viewModified: true,\n };\n};\n\nconst resetAttributes: Reducer = state => ({\n ...state,\n attributesIds: [],\n});\n\nconst changeViewType: Reducer<IViewSettingsActionChangeViewType> = (state, payload) => ({\n ...state,\n viewType: payload.viewType,\n viewModified: true,\n});\n\nconst addSort: Reducer<IViewSettingsActionAddSort> = (state, payload) => ({\n ...state,\n sort: [...state.sort, {field: payload.field, order: payload.order}],\n viewModified: true,\n});\n\nconst removeSort: Reducer<IViewSettingsActionRemoveSort> = (state, payload) => ({\n ...state,\n sort: state.sort.filter(({field: attributeId}) => attributeId !== payload.field),\n viewModified: true,\n});\n\nconst changeSortOrder: Reducer<IViewSettingsActionChangeSortOrder> = (state, payload) => ({\n ...state,\n sort: state.sort.map(sort => (sort.field === payload.field ? {...sort, order: payload.order} : sort)),\n viewModified: true,\n});\n\nconst moveSort: Reducer<IViewSettingsActionMoveSort> = (state, payload) => {\n const attributesUsedToSort = [...state.sort];\n const [sortToMove] = attributesUsedToSort.splice(payload.indexFrom, 1);\n attributesUsedToSort.splice(payload.indexTo, 0, sortToMove);\n return {\n ...state,\n sort: attributesUsedToSort,\n viewModified: true,\n };\n};\n\nconst changeFulltextSearch: Reducer<IViewSettingsActionChangeFulltextSearch> = (state, payload) => ({\n ...state,\n fulltextSearch: payload.search,\n});\n\nexport const clearFulltextSearch: Reducer = state => ({\n ...state,\n fulltextSearch: '',\n});\n\nconst reset: Reducer<IViewSettingsActionReset> = (_, payload) => payload;\n\nconst setSelectedKeys: Reducer<IViewSettingsActionSetSelectedKeys> = (state, payload) => ({\n ...state,\n massSelection: payload,\n});\n\nconst restoreInitialViewSettings: Reducer = state => ({\n ...state,\n ...state.initialViewSettings,\n viewModified: false,\n});\n\nconst updateViewListAndCurrentView: Reducer<IViewSettingsActionUpdateViewListAndCurrentView> = (state, payload) => ({\n ...state,\n viewId: payload.id ?? null,\n viewLabels: payload.label,\n savedViews: state.savedViews.find(({id}) => id === payload.id)\n ? state.savedViews.map(view => (view.id === payload.id ? payload : view))\n : state.savedViews.concat([payload]),\n initialViewSettings: {\n viewType: state.viewType,\n attributesIds: state.attributesIds,\n sort: state.sort,\n pageSize: state.pageSize,\n },\n viewModified: false,\n});\n\nconst renameView: Reducer<IViewSettingsActionRenameView> = (state, payload) => ({\n ...state,\n viewLabels: payload.label,\n savedViews: state.savedViews.map(view => (view.id === payload.id ? {...view, label: payload?.label} : view)),\n});\n\nconst deleteView: Reducer<IViewSettingsActionDeleteView> = (state, payload) => {\n const newSavedViews = [...state.savedViews];\n const indexViewDeleted = newSavedViews.findIndex(view => view.id === payload.id);\n // TODO use newES6 syntax (toSpliced)\n if (indexViewDeleted !== -1) {\n newSavedViews.splice(indexViewDeleted, 1);\n }\n if (state.viewId === payload.id) {\n const defaultViewSettings = {\n ...state.defaultViewSettings,\n viewId: DefaultViewId,\n viewLabels: {},\n viewModified: false,\n };\n return {\n ...state,\n ...defaultViewSettings,\n savedViews: newSavedViews,\n };\n }\n return {\n ...state,\n savedViews: newSavedViews,\n };\n};\n\nconst loadView: Reducer<IViewSettingsActionLoadView> = (state, payload) => ({\n ...state,\n ...payload,\n initialViewSettings: {\n viewType: payload.viewType,\n attributesIds: payload.attributesIds,\n sort: payload.sort,\n pageSize: state.pageSize,\n },\n viewModified: false,\n});\n\nexport type IViewSettingsAction =\n | IViewSettingsActionResetAttributes\n | IViewSettingsActionAddAttribute\n | IViewSettingsActionRemoveAttribute\n | IViewSettingsActionMoveAttribute\n | IViewSettingsActionChangeViewType\n | IViewSettingsActionAddSort\n | IViewSettingsActionRemoveSort\n | IViewSettingsActionChangeSortOrder\n | IViewSettingsActionMoveSort\n | IViewSettingsActionChangePageSize\n | IViewSettingsActionChangeFulltextSearch\n | IViewSettingsActionClearFulltextSearch\n | IViewSettingsActionAddFilter\n | IViewSettingsActionResetFilter\n | IViewSettingsActionRemoveFilter\n | IViewSettingsActionChangeFilterConfig\n | IViewSettingsActionMoveFilter\n | IViewSettingsActionReset\n | IViewSettingsActionSetSelectedKeys\n | IViewSettingsActionRestoreInitialViewSettings\n | IViewSettingsActionUpdateViewListAndCurrentView\n | IViewSettingsActionRenameView\n | IViewSettingsActionDeleteView\n | IViewSettingsActionLoadView;\n\nexport const viewSettingsReducer = (state: IViewSettingsState, action: IViewSettingsAction): IViewSettingsState => {\n switch (action.type) {\n case ViewSettingsActionTypes.CHANGE_PAGE_SIZE: {\n return changePageSize(state, action.payload);\n }\n case ViewSettingsActionTypes.ADD_ATTRIBUTE: {\n return addAttribute(state, action.payload);\n }\n case ViewSettingsActionTypes.REMOVE_ATTRIBUTE: {\n return removeAttribute(state, action.payload);\n }\n case ViewSettingsActionTypes.MOVE_ATTRIBUTE: {\n return moveAttribute(state, action.payload);\n }\n case ViewSettingsActionTypes.RESET_ATTRIBUTES: {\n return resetAttributes(state);\n }\n case ViewSettingsActionTypes.CHANGE_VIEW_TYPE: {\n return changeViewType(state, action.payload);\n }\n case ViewSettingsActionTypes.ADD_SORT: {\n return addSort(state, action.payload);\n }\n case ViewSettingsActionTypes.REMOVE_SORT: {\n return removeSort(state, action.payload);\n }\n case ViewSettingsActionTypes.MOVE_SORT: {\n return moveSort(state, action.payload);\n }\n case ViewSettingsActionTypes.CHANGE_SORT_ORDER: {\n return changeSortOrder(state, action.payload);\n }\n case ViewSettingsActionTypes.CHANGE_FULLTEXT_SEARCH: {\n return changeFulltextSearch(state, action.payload);\n }\n case ViewSettingsActionTypes.CLEAR_FULLTEXT_SEARCH: {\n return clearFulltextSearch(state);\n }\n /*case ViewSettingsActionTypes.ADD_FILTER: {\n return addFilter(state, action.payload);\n }\n case ViewSettingsActionTypes.RESET_FILTER: {\n return resetFilter(state, action.payload);\n }\n case ViewSettingsActionTypes.REMOVE_FILTER: {\n return removeFilter(state, action.payload);\n }\n case ViewSettingsActionTypes.CHANGE_FILTER_CONFIG: {\n return changeFilterConfig(state, action.payload);\n }\n case ViewSettingsActionTypes.MOVE_FILTER: {\n return moveFilter(state, action.payload);\n }*/\n case ViewSettingsActionTypes.RESET: {\n return reset(state, action.payload);\n }\n case ViewSettingsActionTypes.SET_SELECTED_KEYS: {\n return setSelectedKeys(state, action.payload);\n }\n case ViewSettingsActionTypes.RESTORE_INITIAL_VIEW_SETTINGS: {\n return restoreInitialViewSettings(state);\n }\n case ViewSettingsActionTypes.UPDATE_VIEWS: {\n return updateViewListAndCurrentView(state, action.payload);\n }\n case ViewSettingsActionTypes.RENAME_VIEW: {\n return renameView(state, action.payload);\n }\n case ViewSettingsActionTypes.DELETE_VIEW: {\n return deleteView(state, action.payload);\n }\n case ViewSettingsActionTypes.LOAD_VIEW: {\n return loadView(state, action.payload);\n }\n default:\n return state;\n }\n};\n"]}
1
+ {"version":3,"file":"viewSettingsReducer.js","sourceRoot":"","sources":["../../../../../src/components/Explorer/manage-view-settings/store-view-settings/viewSettingsReducer.ts"],"names":[],"m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AAO,CAAC,CAAC;QAC7C,CAAC;QACD,KAAK,uBAAuB,CAAC,WAAW,CAAC,CAAC,CAAC;YACvC,OAAO,UAAU,CAAC,KAAK,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;QAC7C,CAAC;QACD,KAAK,uBAAuB,CAAC,SAAS,CAAC,CAAC,CAAC;YACrC,OAAO,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;QAC3C,CAAC;QACD;YACI,OAAO,KAAK,CAAC;IACrB,CAAC;AACL,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 {AttributeFormat, type RecordFilterCondition, type SortOrder} from '_ui/_gqlTypes';\nimport {type DefaultViewSettings, type Entrypoint, type IUserView, type MassSelection} from '../../_types';\nimport {hasOnlyNoValueConditions, nullValueConditions} from '../../conditionsHelper';\nimport {AttributeConditionFilter, ThroughConditionFilter} from '_ui/types';\nimport {DefaultViewId} from './viewSettingsInitialState';\nimport {isLinkAttribute} from '_ui/_utils/attributeType';\nimport {\n conditionsByFormat,\n getFirstConditionByFilterType,\n} from '_ui/components/Filters/filter-items/filter-type/useConditionOptionsByType';\nimport {\n isUIFilterLink,\n isUIFilterStandard,\n isUIFilterThrough,\n isUIFilterTree,\n isUIFilterValueList,\n type IUIFilterStandard,\n type IUIFilterTree,\n type UIFilter,\n} from '_ui/components/Filters';\n\nexport type ViewType = 'table' | 'list' | 'timeline' | 'mosaic';\n\nexport const ViewSettingsActionTypes = {\n RESET: 'RESET',\n ADD_ATTRIBUTE: 'ADD_ATTRIBUTE',\n REMOVE_ATTRIBUTE: 'REMOVE_ATTRIBUTE',\n MOVE_ATTRIBUTE: 'MOVE_ATTRIBUTE',\n RESET_ATTRIBUTES: 'RESET_ATTRIBUTES',\n CHANGE_VIEW_TYPE: 'CHANGE_VIEW_TYPE',\n ADD_SORT: 'ADD_SORT',\n REMOVE_SORT: 'REMOVE_SORT',\n MOVE_SORT: 'MOVE_SORT',\n CHANGE_SORT_ORDER: 'CHANGE_SORT_ORDER',\n CHANGE_PAGE_SIZE: 'CHANGE_PAGE_SIZE',\n CHANGE_FULLTEXT_SEARCH: 'CHANGE_FULLTEXT_SEARCH',\n CLEAR_FULLTEXT_SEARCH: 'CLEAR_FULLTEXT_SEARCH',\n ADD_FILTER: 'ADD_FILTER',\n RESET_FILTER: 'RESET_FILTER',\n REMOVE_FILTER: 'REMOVE_FILTER',\n MOVE_FILTER: 'MOVE_FILTER',\n CHANGE_FILTER_CONFIG: 'CHANGE_FILTER_CONFIG',\n SET_SELECTED_KEYS: 'SET_SELECTED_KEYS',\n RESTORE_INITIAL_VIEW_SETTINGS: 'RESTORE_INITIAL_VIEW_SETTINGS',\n UPDATE_VIEWS: 'UPDATE_VIEWS',\n RENAME_VIEW: 'RENAME_VIEW',\n DELETE_VIEW: 'DELETE_VIEW',\n LOAD_VIEW: 'LOAD_VIEW',\n} as const;\n\nexport interface IViewSettingsState {\n libraryId: string;\n viewId: string | null;\n viewLabels: Record<string, string>;\n viewModified: boolean;\n entrypoint: Entrypoint;\n viewType: ViewType;\n savedViews: IUserView[];\n attributesIds: string[];\n fulltextSearch: string;\n sort: Array<{\n field: string;\n order: SortOrder;\n }>;\n pageSize: number;\n initialViewSettings: Pick<IViewSettingsState, 'viewType' | 'attributesIds' | 'sort' | 'pageSize'>;\n defaultViewSettings: DefaultViewSettings;\n massSelection: MassSelection;\n enableConfigureView?: boolean;\n}\n\ninterface IViewSettingsActionChangePageSize {\n type: typeof ViewSettingsActionTypes.CHANGE_PAGE_SIZE;\n payload: {pageSize: number};\n}\n\ninterface IViewSettingsActionAddAttribute {\n type: typeof ViewSettingsActionTypes.ADD_ATTRIBUTE;\n payload: {attributeId: string};\n}\n\ninterface IViewSettingsActionRemoveAttribute {\n type: typeof ViewSettingsActionTypes.REMOVE_ATTRIBUTE;\n payload: {attributeId: string};\n}\n\ninterface IViewSettingsActionMoveAttribute {\n type: typeof ViewSettingsActionTypes.MOVE_ATTRIBUTE;\n payload: {\n indexFrom: number;\n indexTo: number;\n };\n}\n\ninterface IViewSettingsActionChangeViewType {\n type: typeof ViewSettingsActionTypes.CHANGE_VIEW_TYPE;\n payload: {viewType: ViewType};\n}\n\ninterface IViewSettingsActionResetAttributes {\n type: typeof ViewSettingsActionTypes.RESET_ATTRIBUTES;\n}\n\ninterface IViewSettingsActionAddSort {\n type: typeof ViewSettingsActionTypes.ADD_SORT;\n payload: {field: string; order: SortOrder};\n}\n\ninterface IViewSettingsActionRemoveSort {\n type: typeof ViewSettingsActionTypes.REMOVE_SORT;\n payload: {field: string};\n}\n\ninterface IViewSettingsActionChangeSortOrder {\n type: typeof ViewSettingsActionTypes.CHANGE_SORT_ORDER;\n payload: {field: string; order: SortOrder};\n}\n\ninterface IViewSettingsActionMoveSort {\n type: typeof ViewSettingsActionTypes.MOVE_SORT;\n payload: {\n indexFrom: number;\n indexTo: number;\n };\n}\n\ninterface IViewSettingsActionChangeFulltextSearch {\n type: typeof ViewSettingsActionTypes.CHANGE_FULLTEXT_SEARCH;\n payload: {search: string};\n}\n\ninterface IViewSettingsActionClearFulltextSearch {\n type: typeof ViewSettingsActionTypes.CLEAR_FULLTEXT_SEARCH;\n}\n\ninterface IViewSettingsActionAddFilter {\n type: typeof ViewSettingsActionTypes.ADD_FILTER;\n payload: Omit<UIFilter, 'id' | 'value' | 'condition'>;\n}\n\ninterface IViewSettingsActionResetFilter {\n type: typeof ViewSettingsActionTypes.RESET_FILTER;\n payload: Pick<UIFilter, 'id'>;\n}\n\ninterface IViewSettingsActionRemoveFilter {\n type: typeof ViewSettingsActionTypes.REMOVE_FILTER;\n payload: Pick<UIFilter, 'id'>;\n}\n\ninterface IViewSettingsActionChangeFilterConfig {\n type: typeof ViewSettingsActionTypes.CHANGE_FILTER_CONFIG;\n payload: UIFilter | IUIFilterTree;\n}\n\ninterface IViewSettingsActionMoveFilter {\n type: typeof ViewSettingsActionTypes.MOVE_FILTER;\n payload: {\n indexFrom: number;\n indexTo: number;\n };\n}\n\ninterface IViewSettingsActionReset {\n type: typeof ViewSettingsActionTypes.RESET;\n payload: IViewSettingsState;\n}\n\ninterface IViewSettingsActionSetSelectedKeys {\n type: typeof ViewSettingsActionTypes.SET_SELECTED_KEYS;\n payload: MassSelection;\n}\n\ninterface IViewSettingsActionRestoreInitialViewSettings {\n type: typeof ViewSettingsActionTypes.RESTORE_INITIAL_VIEW_SETTINGS;\n}\n\ninterface IViewSettingsActionUpdateViewListAndCurrentView {\n type: typeof ViewSettingsActionTypes.UPDATE_VIEWS;\n payload: IUserView;\n}\n\ninterface IViewDataPayload {\n id: string;\n label: Record<string, string>;\n}\n\ninterface IViewSettingsActionRenameView {\n type: typeof ViewSettingsActionTypes.RENAME_VIEW;\n payload: IViewDataPayload;\n}\n\ninterface IViewSettingsActionDeleteView {\n type: typeof ViewSettingsActionTypes.DELETE_VIEW;\n payload: {id: string};\n}\n\nexport type IViewSettingsActionLoadViewPayload = Pick<\n IViewSettingsState,\n 'viewId' | 'viewLabels' | 'viewType' | 'attributesIds' | 'sort'\n>;\n\ninterface IViewSettingsActionLoadView {\n type: typeof ViewSettingsActionTypes.LOAD_VIEW;\n payload: IViewSettingsActionLoadViewPayload;\n}\n\ntype Reducer<\n PAYLOAD extends {\n type: keyof typeof ViewSettingsActionTypes;\n payload?: unknown;\n } = {type: any; payload: 'no_payload'},\n> = PAYLOAD['payload'] extends 'no_payload'\n ? (state: IViewSettingsState) => IViewSettingsState\n : (state: IViewSettingsState, payload: PAYLOAD['payload']) => IViewSettingsState;\n\nconst changePageSize: Reducer<IViewSettingsActionChangePageSize> = (state, payload) => ({\n ...state,\n pageSize: payload.pageSize,\n});\n\nconst addAttribute: Reducer<IViewSettingsActionAddAttribute> = (state, payload) => ({\n ...state,\n attributesIds: [...state.attributesIds, payload.attributeId],\n viewModified: true,\n});\n\nconst removeAttribute: Reducer<IViewSettingsActionRemoveAttribute> = (state, payload) => ({\n ...state,\n attributesIds: state.attributesIds.filter(attributesId => attributesId !== payload.attributeId),\n viewModified: true,\n});\n\nconst moveAttribute: Reducer<IViewSettingsActionMoveAttribute> = (state, payload) => {\n const attributesIds = [...state.attributesIds];\n const [attributeIdToMove] = attributesIds.splice(payload.indexFrom, 1);\n // TODO use newES6 syntax (toSpliced)\n attributesIds.splice(payload.indexTo, 0, attributeIdToMove);\n return {\n ...state,\n attributesIds,\n viewModified: true,\n };\n};\n\nconst resetAttributes: Reducer = state => ({\n ...state,\n attributesIds: [],\n});\n\nconst changeViewType: Reducer<IViewSettingsActionChangeViewType> = (state, payload) => ({\n ...state,\n viewType: payload.viewType,\n viewModified: true,\n});\n\nconst addSort: Reducer<IViewSettingsActionAddSort> = (state, payload) => ({\n ...state,\n sort: [...state.sort, {field: payload.field, order: payload.order}],\n viewModified: true,\n});\n\nconst removeSort: Reducer<IViewSettingsActionRemoveSort> = (state, payload) => ({\n ...state,\n sort: state.sort.filter(({field: attributeId}) => attributeId !== payload.field),\n viewModified: true,\n});\n\nconst changeSortOrder: Reducer<IViewSettingsActionChangeSortOrder> = (state, payload) => ({\n ...state,\n sort: state.sort.map(sort => (sort.field === payload.field ? {...sort, order: payload.order} : sort)),\n viewModified: true,\n});\n\nconst moveSort: Reducer<IViewSettingsActionMoveSort> = (state, payload) => {\n const attributesUsedToSort = [...state.sort];\n const [sortToMove] = attributesUsedToSort.splice(payload.indexFrom, 1);\n attributesUsedToSort.splice(payload.indexTo, 0, sortToMove);\n return {\n ...state,\n sort: attributesUsedToSort,\n viewModified: true,\n };\n};\n\nconst changeFulltextSearch: Reducer<IViewSettingsActionChangeFulltextSearch> = (state, payload) => ({\n ...state,\n fulltextSearch: payload.search,\n});\n\nexport const clearFulltextSearch: Reducer = state => ({\n ...state,\n fulltextSearch: '',\n});\n\nconst reset: Reducer<IViewSettingsActionReset> = (_, payload) => payload;\n\nconst setSelectedKeys: Reducer<IViewSettingsActionSetSelectedKeys> = (state, payload) => ({\n ...state,\n massSelection: payload,\n});\n\nconst restoreInitialViewSettings: Reducer = state => ({\n ...state,\n ...state.initialViewSettings,\n viewModified: false,\n});\n\nconst updateViewListAndCurrentView: Reducer<IViewSettingsActionUpdateViewListAndCurrentView> = (state, payload) => ({\n ...state,\n viewId: payload.id ?? null,\n viewLabels: payload.label,\n savedViews: state.savedViews.find(({id}) => id === payload.id)\n ? state.savedViews.map(view => (view.id === payload.id ? payload : view))\n : state.savedViews.concat([payload]),\n initialViewSettings: {\n viewType: state.viewType,\n attributesIds: state.attributesIds,\n sort: state.sort,\n pageSize: state.pageSize,\n },\n viewModified: false,\n});\n\nconst renameView: Reducer<IViewSettingsActionRenameView> = (state, payload) => ({\n ...state,\n viewLabels: payload.label,\n savedViews: state.savedViews.map(view => (view.id === payload.id ? {...view, label: payload?.label} : view)),\n});\n\nconst deleteView: Reducer<IViewSettingsActionDeleteView> = (state, payload) => {\n const newSavedViews = [...state.savedViews];\n const indexViewDeleted = newSavedViews.findIndex(view => view.id === payload.id);\n // TODO use newES6 syntax (toSpliced)\n if (indexViewDeleted !== -1) {\n newSavedViews.splice(indexViewDeleted, 1);\n }\n if (state.viewId === payload.id) {\n const defaultViewSettings = {\n ...state.defaultViewSettings,\n viewId: DefaultViewId,\n viewLabels: {},\n viewModified: false,\n };\n return {\n ...state,\n ...defaultViewSettings,\n savedViews: newSavedViews,\n };\n }\n return {\n ...state,\n savedViews: newSavedViews,\n };\n};\n\nconst loadView: Reducer<IViewSettingsActionLoadView> = (state, payload) => ({\n ...state,\n ...payload,\n initialViewSettings: {\n viewType: payload.viewType,\n attributesIds: payload.attributesIds,\n sort: payload.sort,\n pageSize: state.pageSize,\n },\n viewModified: false,\n});\n\nexport type IViewSettingsAction =\n | IViewSettingsActionResetAttributes\n | IViewSettingsActionAddAttribute\n | IViewSettingsActionRemoveAttribute\n | IViewSettingsActionMoveAttribute\n | IViewSettingsActionChangeViewType\n | IViewSettingsActionAddSort\n | IViewSettingsActionRemoveSort\n | IViewSettingsActionChangeSortOrder\n | IViewSettingsActionMoveSort\n | IViewSettingsActionChangePageSize\n | IViewSettingsActionChangeFulltextSearch\n | IViewSettingsActionClearFulltextSearch\n | IViewSettingsActionAddFilter\n | IViewSettingsActionResetFilter\n | IViewSettingsActionRemoveFilter\n | IViewSettingsActionChangeFilterConfig\n | IViewSettingsActionMoveFilter\n | IViewSettingsActionReset\n | IViewSettingsActionSetSelectedKeys\n | IViewSettingsActionRestoreInitialViewSettings\n | IViewSettingsActionUpdateViewListAndCurrentView\n | IViewSettingsActionRenameView\n | IViewSettingsActionDeleteView\n | IViewSettingsActionLoadView;\n\nexport const viewSettingsReducer = (state: IViewSettingsState, action: IViewSettingsAction): IViewSettingsState => {\n switch (action.type) {\n case ViewSettingsActionTypes.CHANGE_PAGE_SIZE: {\n return changePageSize(state, action.payload);\n }\n case ViewSettingsActionTypes.ADD_ATTRIBUTE: {\n return addAttribute(state, action.payload);\n }\n case ViewSettingsActionTypes.REMOVE_ATTRIBUTE: {\n return removeAttribute(state, action.payload);\n }\n case ViewSettingsActionTypes.MOVE_ATTRIBUTE: {\n return moveAttribute(state, action.payload);\n }\n case ViewSettingsActionTypes.RESET_ATTRIBUTES: {\n return resetAttributes(state);\n }\n case ViewSettingsActionTypes.CHANGE_VIEW_TYPE: {\n return changeViewType(state, action.payload);\n }\n case ViewSettingsActionTypes.ADD_SORT: {\n return addSort(state, action.payload);\n }\n case ViewSettingsActionTypes.REMOVE_SORT: {\n return removeSort(state, action.payload);\n }\n case ViewSettingsActionTypes.MOVE_SORT: {\n return moveSort(state, action.payload);\n }\n case ViewSettingsActionTypes.CHANGE_SORT_ORDER: {\n return changeSortOrder(state, action.payload);\n }\n case ViewSettingsActionTypes.CHANGE_FULLTEXT_SEARCH: {\n return changeFulltextSearch(state, action.payload);\n }\n case ViewSettingsActionTypes.CLEAR_FULLTEXT_SEARCH: {\n return clearFulltextSearch(state);\n }\n /*case ViewSettingsActionTypes.ADD_FILTER: {\n return addFilter(state, action.payload);\n }\n case ViewSettingsActionTypes.RESET_FILTER: {\n return resetFilter(state, action.payload);\n }\n case ViewSettingsActionTypes.REMOVE_FILTER: {\n return removeFilter(state, action.payload);\n }\n case ViewSettingsActionTypes.CHANGE_FILTER_CONFIG: {\n return changeFilterConfig(state, action.payload);\n }\n case ViewSettingsActionTypes.MOVE_FILTER: {\n return moveFilter(state, action.payload);\n }*/\n case ViewSettingsActionTypes.RESET: {\n return reset(state, action.payload);\n }\n case ViewSettingsActionTypes.SET_SELECTED_KEYS: {\n return setSelectedKeys(state, action.payload);\n }\n case ViewSettingsActionTypes.RESTORE_INITIAL_VIEW_SETTINGS: {\n return restoreInitialViewSettings(state);\n }\n case ViewSettingsActionTypes.UPDATE_VIEWS: {\n return updateViewListAndCurrentView(state, action.payload);\n }\n case ViewSettingsActionTypes.RENAME_VIEW: {\n return renameView(state, action.payload);\n }\n case ViewSettingsActionTypes.DELETE_VIEW: {\n return deleteView(state, action.payload);\n }\n case ViewSettingsActionTypes.LOAD_VIEW: {\n return loadView(state, action.payload);\n }\n default:\n return state;\n }\n};\n"]}
@@ -3,12 +3,16 @@ import { jsx as _jsx } 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 { useSharedTranslation } from '../../hooks/useSharedTranslation';
6
- import { KitInput } from 'aristid-ds';
6
+ import { KitSearchInput } from 'aristid-ds';
7
7
  import { useState } from 'react';
8
8
  import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
9
9
  import { faMagnifyingGlass } from '@fortawesome/free-solid-svg-icons';
10
10
  import { ViewSettingsActionTypes, } from './manage-view-settings/store-view-settings/viewSettingsReducer';
11
11
  import { MASS_SELECTION_ALL } from './_constants';
12
+ import styled from 'styled-components';
13
+ const SearchInputStyled = styled(KitSearchInput) `
14
+ width: 214px;
15
+ `;
12
16
  /**
13
17
  * Hook used to handle a full search text in a library
14
18
  *
@@ -37,7 +41,7 @@ export const useSearchInput = ({ view, dispatch, setNewPage, }) => {
37
41
  setNewPage(1, 0);
38
42
  };
39
43
  return {
40
- searchInput: view.entrypoint.type === 'library' ? (_jsx("form", { onSubmit: _handleSubmit, children: _jsx(KitInput, { prefix: _jsx(FontAwesomeIcon, { icon: faMagnifyingGlass }), title: String(t('global.search')), placeholder: String(t('global.search')), value: search ?? '', disabled: view.massSelection === MASS_SELECTION_ALL, onChange: _handleChange, size: "middle" }) })) : null,
44
+ searchInput: view.entrypoint.type === 'library' ? (_jsx("form", { onSubmit: _handleSubmit, children: _jsx(SearchInputStyled, { prefix: _jsx(FontAwesomeIcon, { icon: faMagnifyingGlass }), title: String(t('global.search')), placeholder: String(t('global.search')), value: search ?? '', disabled: view.massSelection === MASS_SELECTION_ALL, onChange: _handleChange, size: "middle", expandable: true }) })) : null,
41
45
  };
42
46
  };
43
47
  //# sourceMappingURL=useSearchInput.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useSearchInput.js","sourceRoot":"","sources":["../../../src/components/Explorer/useSearchInput.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAC;AACpC,OAAO,EAAyD,QAAQ,EAAC,MAAM,OAAO,CAAC;AACvF,OAAO,EAAC,eAAe,EAAC,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAC,iBAAiB,EAAC,MAAM,mCAAmC,CAAC;AACpE,OAAO,EAGH,uBAAuB,GAC1B,MAAM,gEAAgE,CAAC;AACxE,OAAO,EAAC,kBAAkB,EAAC,MAAM,cAAc,CAAC;AAGhD;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,EAC3B,IAAI,EACJ,QAAQ,EACR,UAAU,GAKb,EAAE,EAAE;IACD,MAAM,EAAC,CAAC,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EACvB,IAAI,EAAC,QAAQ,GACf,GACC,CACV,CAAC,CAAC,CAAC,IAAI;KACf,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 {KitInput} from 'aristid-ds';\nimport {type ComponentProps, type Dispatch, type DOMAttributes, useState} from 'react';\nimport {FontAwesomeIcon} from '@fortawesome/react-fontawesome';\nimport {faMagnifyingGlass} from '@fortawesome/free-solid-svg-icons';\nimport {\n type IViewSettingsAction,\n type IViewSettingsState,\n ViewSettingsActionTypes,\n} from './manage-view-settings/store-view-settings/viewSettingsReducer';\nimport {MASS_SELECTION_ALL} from './_constants';\nimport {type SetNewPage} from './_types';\n\n/**\n * Hook used to handle a full search text in a library\n *\n * > The feature is hidden on a link entrypoint.\n *\n * @param view - represent the current view\n * @param dispatch - method to change the current view\n */\nexport const useSearchInput = ({\n view,\n dispatch,\n setNewPage,\n}: {\n view: IViewSettingsState;\n dispatch: Dispatch<IViewSettingsAction>;\n setNewPage: SetNewPage;\n}) => {\n const {t} = useSharedTranslation();\n const [search, setSearch] = useState<string>(view.fulltextSearch);\n\n const _handleChange: ComponentProps<typeof KitInput>['onChange'] = e => {\n if (!e.target.value) {\n setSearch('');\n dispatch({type: ViewSettingsActionTypes.CLEAR_FULLTEXT_SEARCH});\n setNewPage(1, 0);\n } else {\n setSearch(e.target.value);\n }\n };\n\n const _handleSubmit: DOMAttributes<HTMLFormElement>['onSubmit'] = e => {\n e.preventDefault();\n e.stopPropagation();\n dispatch({type: ViewSettingsActionTypes.CHANGE_FULLTEXT_SEARCH, payload: {search}});\n setNewPage(1, 0);\n };\n\n return {\n searchInput:\n view.entrypoint.type === 'library' ? (\n <form onSubmit={_handleSubmit}>\n <KitInput\n prefix={<FontAwesomeIcon icon={faMagnifyingGlass} />}\n title={String(t('global.search'))}\n placeholder={String(t('global.search'))}\n value={search ?? ''}\n disabled={view.massSelection === MASS_SELECTION_ALL}\n onChange={_handleChange}\n size=\"middle\"\n />\n </form>\n ) : null,\n };\n};\n"]}
1
+ {"version":3,"file":"useSearchInput.js","sourceRoot":"","sources":["../../../src/components/Explorer/useSearchInput.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAC,cAAc,EAAC,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAyD,QAAQ,EAAC,MAAM,OAAO,CAAC;AACvF,OAAO,EAAC,eAAe,EAAC,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAC,iBAAiB,EAAC,MAAM,mCAAmC,CAAC;AACpE,OAAO,EAGH,uBAAuB,GAC1B,MAAM,gEAAgE,CAAC;AACxE,OAAO,EAAC,kBAAkB,EAAC,MAAM,cAAc,CAAC;AAEhD,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAEvC,MAAM,iBAAiB,GAAG,MAAM,CAAC,cAAc,CAAC,CAAA;;CAE/C,CAAC;AACF;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,EAC3B,IAAI,EACJ,QAAQ,EACR,UAAU,GAKb,EAAE,EAAE;IACD,MAAM,EAAC,CAAC,EAAC,GAAG,oBAAoB,EAAE,CAAC;IACnC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAS,IAAI,CAAC,cAAc,CAAC,CAAC;IAElE,MAAM,aAAa,GAAsD,CAAC,CAAC,EAAE;QACzE,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;YAClB,SAAS,CAAC,EAAE,CAAC,CAAC;YACd,QAAQ,CAAC,EAAC,IAAI,EAAE,uBAAuB,CAAC,qBAAqB,EAAC,CAAC,CAAC;YAChE,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QACrB,CAAC;aAAM,CAAC;YACJ,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAC9B,CAAC;IACL,CAAC,CAAC;IAEF,MAAM,aAAa,GAA+C,CAAC,CAAC,EAAE;QAClE,CAAC,CAAC,cAAc,EAAE,CAAC;QACnB,CAAC,CAAC,eAAe,EAAE,CAAC;QACpB,QAAQ,CAAC,EAAC,IAAI,EAAE,uBAAuB,CAAC,sBAAsB,EAAE,OAAO,EAAE,EAAC,MAAM,EAAC,EAAC,CAAC,CAAC;QACpF,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACrB,CAAC,CAAC;IAEF,OAAO;QACH,WAAW,EACP,IAAI,CAAC,UAAU,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,CACjC,eAAM,QAAQ,EAAE,aAAa,YACzB,KAAC,iBAAiB,IACd,MAAM,EAAE,KAAC,eAAe,IAAC,IAAI,EAAE,iBAAiB,GAAI,EACpD,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,EACjC,WAAW,EAAE,MAAM,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,EACvC,KAAK,EAAE,MAAM,IAAI,EAAE,EACnB,QAAQ,EAAE,IAAI,CAAC,aAAa,KAAK,kBAAkB,EACnD,QAAQ,EAAE,aAAa,EACvB,IAAI,EAAC,QAAQ,EACb,UAAU,SACZ,GACC,CACV,CAAC,CAAC,CAAC,IAAI;KACf,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 {KitSearchInput} from 'aristid-ds';\nimport {type ComponentProps, type Dispatch, type DOMAttributes, useState} from 'react';\nimport {FontAwesomeIcon} from '@fortawesome/react-fontawesome';\nimport {faMagnifyingGlass} from '@fortawesome/free-solid-svg-icons';\nimport {\n type IViewSettingsAction,\n type IViewSettingsState,\n ViewSettingsActionTypes,\n} from './manage-view-settings/store-view-settings/viewSettingsReducer';\nimport {MASS_SELECTION_ALL} from './_constants';\nimport {type SetNewPage} from './_types';\nimport styled from 'styled-components';\n\nconst SearchInputStyled = styled(KitSearchInput)`\n width: 214px;\n`;\n/**\n * Hook used to handle a full search text in a library\n *\n * > The feature is hidden on a link entrypoint.\n *\n * @param view - represent the current view\n * @param dispatch - method to change the current view\n */\nexport const useSearchInput = ({\n view,\n dispatch,\n setNewPage,\n}: {\n view: IViewSettingsState;\n dispatch: Dispatch<IViewSettingsAction>;\n setNewPage: SetNewPage;\n}) => {\n const {t} = useSharedTranslation();\n const [search, setSearch] = useState<string>(view.fulltextSearch);\n\n const _handleChange: ComponentProps<typeof KitSearchInput>['onChange'] = e => {\n if (!e.target.value) {\n setSearch('');\n dispatch({type: ViewSettingsActionTypes.CLEAR_FULLTEXT_SEARCH});\n setNewPage(1, 0);\n } else {\n setSearch(e.target.value);\n }\n };\n\n const _handleSubmit: DOMAttributes<HTMLFormElement>['onSubmit'] = e => {\n e.preventDefault();\n e.stopPropagation();\n dispatch({type: ViewSettingsActionTypes.CHANGE_FULLTEXT_SEARCH, payload: {search}});\n setNewPage(1, 0);\n };\n\n return {\n searchInput:\n view.entrypoint.type === 'library' ? (\n <form onSubmit={_handleSubmit}>\n <SearchInputStyled\n prefix={<FontAwesomeIcon icon={faMagnifyingGlass} />}\n title={String(t('global.search'))}\n placeholder={String(t('global.search'))}\n value={search ?? ''}\n disabled={view.massSelection === MASS_SELECTION_ALL}\n onChange={_handleChange}\n size=\"middle\"\n expandable\n />\n </form>\n ) : null,\n };\n};\n"]}
@@ -1,3 +1,3 @@
1
- import { type FunctionComponent } from 'react';
1
+ import { type FunctionComponent, type PropsWithChildren } from 'react';
2
2
  import { type IFiltersProviderProps } from './context/useFiltersReducer';
3
- export declare const FiltersProvider: FunctionComponent<IFiltersProviderProps>;
3
+ export declare const FiltersProvider: FunctionComponent<PropsWithChildren<IFiltersProviderProps>>;
@@ -1 +1 @@
1
- {"version":3,"file":"FiltersProvider.js","sourceRoot":"","sources":["../../../src/components/Filters/FiltersProvider.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAC,cAAc,EAAC,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAA6B,iBAAiB,EAAC,MAAM,6BAA6B,CAAC;AAE1F,MAAM,CAAC,MAAM,eAAe,GAA6C,CAAC,EAAC,QAAQ,EAAE,GAAG,KAAK,EAAC,EAAE,EAAE;IAC9F,MAAM,EAAC,WAAW,EAAE,QAAQ,EAAC,GAAG,iBAAiB,CAAC,KAAK,CAAC,CAAC;IAEzD,OAAO,KAAC,cAAc,CAAC,QAAQ,IAAC,KAAK,EAAE,EAAC,WAAW,EAAE,QAAQ,EAAC,YAAG,QAAQ,GAA2B,CAAC;AACzG,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 FunctionComponent} from 'react';\nimport {FiltersContext} from './context/filtersContext';\nimport {type IFiltersProviderProps, useFiltersReducer} from './context/useFiltersReducer';\n\nexport const FiltersProvider: FunctionComponent<IFiltersProviderProps> = ({children, ...props}) => {\n const {filtersData, dispatch} = useFiltersReducer(props);\n\n return <FiltersContext.Provider value={{filtersData, dispatch}}>{children}</FiltersContext.Provider>;\n};\n"]}
1
+ {"version":3,"file":"FiltersProvider.js","sourceRoot":"","sources":["../../../src/components/Filters/FiltersProvider.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAC,cAAc,EAAC,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAA6B,iBAAiB,EAAC,MAAM,6BAA6B,CAAC;AAE1F,MAAM,CAAC,MAAM,eAAe,GAAgE,CAAC,EAAC,QAAQ,EAAE,GAAG,KAAK,EAAC,EAAE,EAAE;IACjH,MAAM,EAAC,WAAW,EAAE,QAAQ,EAAC,GAAG,iBAAiB,CAAC,KAAK,CAAC,CAAC;IAEzD,OAAO,KAAC,cAAc,CAAC,QAAQ,IAAC,KAAK,EAAE,EAAC,WAAW,EAAE,QAAQ,EAAC,YAAG,QAAQ,GAA2B,CAAC;AACzG,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 FunctionComponent, type PropsWithChildren} from 'react';\nimport {FiltersContext} from './context/filtersContext';\nimport {type IFiltersProviderProps, useFiltersReducer} from './context/useFiltersReducer';\n\nexport const FiltersProvider: FunctionComponent<PropsWithChildren<IFiltersProviderProps>> = ({children, ...props}) => {\n const {filtersData, dispatch} = useFiltersReducer(props);\n\n return <FiltersContext.Provider value={{filtersData, dispatch}}>{children}</FiltersContext.Provider>;\n};\n"]}
@@ -44,6 +44,7 @@ interface IUIFilterBase {
44
44
  value: string | null;
45
45
  formattedValue?: string | null;
46
46
  hidden?: boolean | undefined;
47
+ withEmptyValues?: boolean;
47
48
  }
48
49
  export interface IUIFilterStandard extends Omit<IUIFilterBase, 'field'> {
49
50
  attribute: IUIFilterStandardAttribute;
@@ -110,12 +111,14 @@ export declare const isUIFilterTree: (filter: UIFilter) => filter is IUIFilterTr
110
111
  export declare const isUIFilterTreeWithValueList: (filter: UIFilter) => filter is IUIFilterTreeValueList;
111
112
  export interface IUIFilterDropDownProps {
112
113
  filter: UIFilter;
114
+ canReset: boolean;
113
115
  canRemove: boolean;
114
116
  }
115
117
  export type ValidFieldFilter = Override<ViewDetailsFilterFragment, {
116
118
  field: NonNullable<ViewDetailsFilterFragment['field']>;
117
119
  condition: NonNullable<ViewDetailsFilterFragment['condition']>;
118
120
  hidden: boolean;
121
+ withEmptyValues?: boolean;
119
122
  }>;
120
123
  export type ValidFieldFilterStandardValuesList = Override<ValidFieldFilter, {
121
124
  valuesList: StandardAttributeDetailsFragment['valuesList'];
@@ -1 +1 @@
1
- {"version":3,"file":"_types.js","sourceRoot":"","sources":["../../../src/components/Filters/_types.ts"],"names":[],"mappings":"AAIA,OAAO,EAEH,aAAa,GAKhB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAC,sBAAsB,EAAC,MAAM,kBAAkB,CAAC;AAoHxD,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,MAAgB,EAA+B,EAAE,CAChF,CAAC,aAAa,CAAC,MAAM,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;AAEnF,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,MAAgB,EAA2B,EAAE,CACxE,CAAC,aAAa,CAAC,WAAW,EAAE,aAAa,CAAC,aAAa,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC;IACxF,MAAM,CAAC,SAAS,KAAK,sBAAsB,CAAC,OAAO,CAAC;AAExD,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,MAAgB,EAA8B,EAAE,CAC9E,CAAC,aAAa,CAAC,WAAW,EAAE,aAAa,CAAC,aAAa,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC;IACxF,MAAM,CAAC,SAAS,KAAK,sBAAsB,CAAC,OAAO,CAAC;AAExD,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,MAAgB,EAAgC,EAAE,CAClF,CAAC,kBAAkB,CAAC,MAAM,CAAC,IAAI,cAAc,CAAC,MAAM,CAAC,CAAC,IAAI,WAAW,CAAC,MAAM,CAAC,CAAC;AAElF,MAAM,CAAC,MAAM,+BAA+B,GAAG,CAAC,MAAgB,EAAwC,EAAE,CACtG,CAAC,aAAa,CAAC,MAAM,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,WAAW,CAAC,MAAM,CAAC,CAAC;AAE1G,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,MAAgB,EAAoC,EAAE,CAC9F,CAAC,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,cAAc,GAAG,CAAC,MAAgB,EAA2B,EAAE,CACxE,MAAM,CAAC,SAAS,CAAC,IAAI,KAAK,aAAa,CAAC,IAAI,CAAC;AAEjD,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,MAAgB,EAAoC,EAAE,CAC9F,cAAc,CAAC,MAAM,CAAC,IAAI,WAAW,CAAC,MAAM,CAAC,CAAC;AAElD,MAAM,WAAW,GAAG,CAAC,MAAgB,EAAmE,EAAE,CACtG,CAAC,CAAC,MAAM,CAAC,SAAS,EAAE,UAAU,IAAI,MAAM,CAAC,SAAS,EAAE,UAAU,CAAC,MAAM,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 Override} from '@leav/utils';\nimport {\n type AttributeFormat,\n AttributeType,\n type LinkAttributeDetailsFragment,\n type RecordFilterCondition,\n type StandardAttributeDetailsFragment,\n type ViewDetailsFilterFragment,\n} from '_ui/_gqlTypes';\nimport {ThroughConditionFilter} from '_ui/types/search';\n\nexport type FiltersOperator = 'AND' | 'OR';\n\nexport interface IUIFilterBaseAttribute {\n type: AttributeType;\n /**\n * Used to display the label of the filter.\n *\n * > Not displayed when filter is hidden\n */\n label: string;\n /**\n * Used to verify unicity: one filter per attribute\n */\n id: string;\n format?: AttributeFormat | null | undefined;\n valuesList?:\n | NonNullable<StandardAttributeDetailsFragment['valuesList']>\n | NonNullable<LinkAttributeDetailsFragment['valuesList']>;\n}\n\nexport interface IUIFilterStandardAttribute extends IUIFilterBaseAttribute {\n format: AttributeFormat;\n}\n\nexport interface IUIFilterLinkAttribute extends IUIFilterBaseAttribute {\n linkedLibrary?: {\n id: string;\n };\n}\n\nexport interface IUIFilterTreeAttribute extends IUIFilterBaseAttribute {\n linkedTree?: {\n id: string;\n };\n}\n\ninterface IUIFilterBase {\n id: string;\n attribute: IUIFilterBaseAttribute;\n condition: RecordFilterCondition | ThroughConditionFilter | null;\n /**\n * Used to build filter field.\n *\n * - ex: `campaigns_id_pac`\n * - ex with **subField**: `campaigns_id_pac.id`\n */\n field: any;\n value: string | null;\n formattedValue?: string | null;\n hidden?: boolean | undefined;\n}\n\nexport interface IUIFilterStandard extends Omit<IUIFilterBase, 'field'> {\n attribute: IUIFilterStandardAttribute;\n condition: RecordFilterCondition | null;\n field: string;\n}\n\nexport interface IUIFilterLink extends Omit<IUIFilterBase, 'field'> {\n attribute: IUIFilterLinkAttribute;\n condition: RecordFilterCondition | null;\n field: string;\n}\n\nexport interface IUIFilterThrough extends Omit<IUIFilterBase, 'field'> {\n attribute: IUIFilterLinkAttribute;\n condition: ThroughConditionFilter.THROUGH | null;\n subCondition: RecordFilterCondition | null;\n subField: string | null;\n field: string;\n}\n\nexport interface IUIFilterTree extends Omit<IUIFilterBase, 'value' | 'formattedValue' | 'field'> {\n attribute: IUIFilterTreeAttribute;\n condition: RecordFilterCondition | null;\n value: string[] | null;\n formattedValue?: string[] | null;\n nodes?: null | Array<{nodeId: string; libraryId: string}>;\n field: string[];\n}\n\nexport interface IUIFilterValueList extends Omit<IUIFilterBase, 'value' | 'formattedValue'> {\n attribute: (IUIFilterStandardAttribute | IUIFilterLinkAttribute) & {\n valuesList:\n | NonNullable<StandardAttributeDetailsFragment['valuesList']>\n | NonNullable<LinkAttributeDetailsFragment['valuesList']>;\n };\n value: string[] | null;\n condition: RecordFilterCondition | null;\n field: string | string[];\n}\n\nexport interface IUIFilterStandardValueList extends Omit<IUIFilterStandard, 'attribute' | 'value'>, IUIFilterValueList {\n attribute: IUIFilterStandardAttribute & {\n valuesList: NonNullable<StandardAttributeDetailsFragment['valuesList']>;\n };\n field: string;\n}\n\nexport interface IUIFilterLinkValueList extends Omit<IUIFilterLink, 'attribute' | 'value'>, IUIFilterValueList {\n attribute: IUIFilterLinkAttribute & {\n valuesList: NonNullable<LinkAttributeDetailsFragment['valuesList']>;\n };\n field: string;\n}\nexport interface IUIFilterTreeValueList extends Omit<IUIFilterTree, 'attribute' | 'value'>, IUIFilterValueList {\n attribute: IUIFilterLinkAttribute & {\n valuesList: NonNullable<LinkAttributeDetailsFragment['valuesList']>;\n };\n field: string[];\n}\n\nexport type UIFilter = IUIFilterStandard | IUIFilterLink | IUIFilterThrough | IUIFilterValueList | IUIFilterTree;\n\nexport const isUIFilterStandard = (filter: UIFilter): filter is IUIFilterStandard =>\n [AttributeType.simple, AttributeType.advanced].includes(filter.attribute.type);\n\nexport const isUIFilterLink = (filter: UIFilter): filter is IUIFilterLink =>\n [AttributeType.simple_link, AttributeType.advanced_link].includes(filter.attribute.type) &&\n filter.condition !== ThroughConditionFilter.THROUGH;\n\nexport const isUIFilterThrough = (filter: UIFilter): filter is IUIFilterThrough =>\n [AttributeType.simple_link, AttributeType.advanced_link].includes(filter.attribute.type) &&\n filter.condition === ThroughConditionFilter.THROUGH;\n\nexport const isUIFilterValueList = (filter: UIFilter): filter is IUIFilterValueList =>\n (isUIFilterStandard(filter) || isUIFilterLink(filter)) && isValueList(filter);\n\nexport const isUIFilterStandardWithValueList = (filter: UIFilter): filter is IUIFilterStandardValueList =>\n [AttributeType.simple, AttributeType.advanced].includes(filter.attribute.type) && isValueList(filter);\n\nexport const isUIFilterLinkWithValueList = (filter: UIFilter): filter is IUIFilterLinkValueList =>\n [AttributeType.simple_link, AttributeType.advanced_link].includes(filter.attribute.type) && isValueList(filter);\n\nexport const isUIFilterTree = (filter: UIFilter): filter is IUIFilterTree =>\n filter.attribute.type === AttributeType.tree;\n\nexport const isUIFilterTreeWithValueList = (filter: UIFilter): filter is IUIFilterTreeValueList =>\n isUIFilterTree(filter) && isValueList(filter);\n\nconst isValueList = (filter: UIFilter): filter is UIFilter & {attribute: {valuesList: {enabled: true}}} =>\n !!filter.attribute?.valuesList && filter.attribute?.valuesList.enable;\n\nexport interface IUIFilterDropDownProps {\n filter: UIFilter;\n canRemove: boolean;\n}\n\nexport type ValidFieldFilter = Override<\n ViewDetailsFilterFragment,\n {\n field: NonNullable<ViewDetailsFilterFragment['field']>;\n condition: NonNullable<ViewDetailsFilterFragment['condition']>;\n hidden: boolean;\n }\n>;\n\nexport type ValidFieldFilterStandardValuesList = Override<\n ValidFieldFilter,\n {\n valuesList: StandardAttributeDetailsFragment['valuesList'];\n }\n>;\n\nexport type ValidFieldFilterLinkValuesList = Override<\n ValidFieldFilter,\n {\n valuesList: LinkAttributeDetailsFragment['valuesList'];\n }\n>;\n\nexport type ValidFieldFilterThrough = Override<\n ValidFieldFilter,\n {\n condition: ThroughConditionFilter.THROUGH;\n hidden: boolean;\n }\n> & {\n subField: NonNullable<ViewDetailsFilterFragment['field']>;\n subCondition?: ViewDetailsFilterFragment['condition'];\n};\n\nexport type ValidFilter =\n | ValidFieldFilter\n | ValidFieldFilterThrough\n | ValidFieldFilterStandardValuesList\n | ValidFieldFilterLinkValuesList;\n"]}
1
+ {"version":3,"file":"_types.js","sourceRoot":"","sources":["../../../src/components/Filters/_types.ts"],"names":[],"mappings":"AAIA,OAAO,EAEH,aAAa,GAKhB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAC,sBAAsB,EAAC,MAAM,kBAAkB,CAAC;AAqHxD,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,MAAgB,EAA+B,EAAE,CAChF,CAAC,aAAa,CAAC,MAAM,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI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EjD,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,MAAgB,EAAoC,EAAE,CAC9F,cAAc,CAAC,MAAM,CAAC,IAAI,WAAW,CAAC,MAAM,CAAC,CAAC;AAElD,MAAM,WAAW,GAAG,CAAC,MAAgB,EAAmE,EAAE,CACtG,CAAC,CAAC,MAAM,CAAC,SAAS,EAAE,UAAU,IAAI,MAAM,CAAC,SAAS,EAAE,UAAU,CAAC,MAAM,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 Override} from '@leav/utils';\nimport {\n type AttributeFormat,\n AttributeType,\n type LinkAttributeDetailsFragment,\n type RecordFilterCondition,\n type StandardAttributeDetailsFragment,\n type ViewDetailsFilterFragment,\n} from '_ui/_gqlTypes';\nimport {ThroughConditionFilter} from '_ui/types/search';\n\nexport type FiltersOperator = 'AND' | 'OR';\n\nexport interface IUIFilterBaseAttribute {\n type: AttributeType;\n /**\n * Used to display the label of the filter.\n *\n * > Not displayed when filter is hidden\n */\n label: string;\n /**\n * Used to verify unicity: one filter per attribute\n */\n id: string;\n format?: AttributeFormat | null | undefined;\n valuesList?:\n | NonNullable<StandardAttributeDetailsFragment['valuesList']>\n | NonNullable<LinkAttributeDetailsFragment['valuesList']>;\n}\n\nexport interface IUIFilterStandardAttribute extends IUIFilterBaseAttribute {\n format: AttributeFormat;\n}\n\nexport interface IUIFilterLinkAttribute extends IUIFilterBaseAttribute {\n linkedLibrary?: {\n id: string;\n };\n}\n\nexport interface IUIFilterTreeAttribute extends IUIFilterBaseAttribute {\n linkedTree?: {\n id: string;\n };\n}\n\ninterface IUIFilterBase {\n id: string;\n attribute: IUIFilterBaseAttribute;\n condition: RecordFilterCondition | ThroughConditionFilter | null;\n /**\n * Used to build filter field.\n *\n * - ex: `campaigns_id_pac`\n * - ex with **subField**: `campaigns_id_pac.id`\n */\n field: any;\n value: string | null;\n formattedValue?: string | null;\n hidden?: boolean | undefined;\n withEmptyValues?: boolean;\n}\n\nexport interface IUIFilterStandard extends Omit<IUIFilterBase, 'field'> {\n attribute: IUIFilterStandardAttribute;\n condition: RecordFilterCondition | null;\n field: string;\n}\n\nexport interface IUIFilterLink extends Omit<IUIFilterBase, 'field'> {\n attribute: IUIFilterLinkAttribute;\n condition: RecordFilterCondition | null;\n field: string;\n}\n\nexport interface IUIFilterThrough extends Omit<IUIFilterBase, 'field'> {\n attribute: IUIFilterLinkAttribute;\n condition: ThroughConditionFilter.THROUGH | null;\n subCondition: RecordFilterCondition | null;\n subField: string | null;\n field: string;\n}\n\nexport interface IUIFilterTree extends Omit<IUIFilterBase, 'value' | 'formattedValue' | 'field'> {\n attribute: IUIFilterTreeAttribute;\n condition: RecordFilterCondition | null;\n value: string[] | null;\n formattedValue?: string[] | null;\n nodes?: null | Array<{nodeId: string; libraryId: string}>;\n field: string[];\n}\n\nexport interface IUIFilterValueList extends Omit<IUIFilterBase, 'value' | 'formattedValue'> {\n attribute: (IUIFilterStandardAttribute | IUIFilterLinkAttribute) & {\n valuesList:\n | NonNullable<StandardAttributeDetailsFragment['valuesList']>\n | NonNullable<LinkAttributeDetailsFragment['valuesList']>;\n };\n value: string[] | null;\n condition: RecordFilterCondition | null;\n field: string | string[];\n}\n\nexport interface IUIFilterStandardValueList extends Omit<IUIFilterStandard, 'attribute' | 'value'>, IUIFilterValueList {\n attribute: IUIFilterStandardAttribute & {\n valuesList: NonNullable<StandardAttributeDetailsFragment['valuesList']>;\n };\n field: string;\n}\n\nexport interface IUIFilterLinkValueList extends Omit<IUIFilterLink, 'attribute' | 'value'>, IUIFilterValueList {\n attribute: IUIFilterLinkAttribute & {\n valuesList: NonNullable<LinkAttributeDetailsFragment['valuesList']>;\n };\n field: string;\n}\nexport interface IUIFilterTreeValueList extends Omit<IUIFilterTree, 'attribute' | 'value'>, IUIFilterValueList {\n attribute: IUIFilterLinkAttribute & {\n valuesList: NonNullable<LinkAttributeDetailsFragment['valuesList']>;\n };\n field: string[];\n}\n\nexport type UIFilter = IUIFilterStandard | IUIFilterLink | IUIFilterThrough | IUIFilterValueList | IUIFilterTree;\n\nexport const isUIFilterStandard = (filter: UIFilter): filter is IUIFilterStandard =>\n [AttributeType.simple, AttributeType.advanced].includes(filter.attribute.type);\n\nexport const isUIFilterLink = (filter: UIFilter): filter is IUIFilterLink =>\n [AttributeType.simple_link, AttributeType.advanced_link].includes(filter.attribute.type) &&\n filter.condition !== ThroughConditionFilter.THROUGH;\n\nexport const isUIFilterThrough = (filter: UIFilter): filter is IUIFilterThrough =>\n [AttributeType.simple_link, AttributeType.advanced_link].includes(filter.attribute.type) &&\n filter.condition === ThroughConditionFilter.THROUGH;\n\nexport const isUIFilterValueList = (filter: UIFilter): filter is IUIFilterValueList =>\n (isUIFilterStandard(filter) || isUIFilterLink(filter)) && isValueList(filter);\n\nexport const isUIFilterStandardWithValueList = (filter: UIFilter): filter is IUIFilterStandardValueList =>\n [AttributeType.simple, AttributeType.advanced].includes(filter.attribute.type) && isValueList(filter);\n\nexport const isUIFilterLinkWithValueList = (filter: UIFilter): filter is IUIFilterLinkValueList =>\n [AttributeType.simple_link, AttributeType.advanced_link].includes(filter.attribute.type) && isValueList(filter);\n\nexport const isUIFilterTree = (filter: UIFilter): filter is IUIFilterTree =>\n filter.attribute.type === AttributeType.tree;\n\nexport const isUIFilterTreeWithValueList = (filter: UIFilter): filter is IUIFilterTreeValueList =>\n isUIFilterTree(filter) && isValueList(filter);\n\nconst isValueList = (filter: UIFilter): filter is UIFilter & {attribute: {valuesList: {enabled: true}}} =>\n !!filter.attribute?.valuesList && filter.attribute?.valuesList.enable;\n\nexport interface IUIFilterDropDownProps {\n filter: UIFilter;\n canReset: boolean;\n canRemove: boolean;\n}\n\nexport type ValidFieldFilter = Override<\n ViewDetailsFilterFragment,\n {\n field: NonNullable<ViewDetailsFilterFragment['field']>;\n condition: NonNullable<ViewDetailsFilterFragment['condition']>;\n hidden: boolean;\n withEmptyValues?: boolean;\n }\n>;\n\nexport type ValidFieldFilterStandardValuesList = Override<\n ValidFieldFilter,\n {\n valuesList: StandardAttributeDetailsFragment['valuesList'];\n }\n>;\n\nexport type ValidFieldFilterLinkValuesList = Override<\n ValidFieldFilter,\n {\n valuesList: LinkAttributeDetailsFragment['valuesList'];\n }\n>;\n\nexport type ValidFieldFilterThrough = Override<\n ValidFieldFilter,\n {\n condition: ThroughConditionFilter.THROUGH;\n hidden: boolean;\n }\n> & {\n subField: NonNullable<ViewDetailsFilterFragment['field']>;\n subCondition?: ViewDetailsFilterFragment['condition'];\n};\n\nexport type ValidFilter =\n | ValidFieldFilter\n | ValidFieldFilterThrough\n | ValidFieldFilterStandardValuesList\n | ValidFieldFilterLinkValuesList;\n"]}
@@ -1,7 +1,6 @@
1
1
  // Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06
2
2
  // This file is released under LGPL V3
3
3
  // License text available at https://www.gnu.org/licenses/lgpl-3.0.txt
4
- import { v4 as uuid } from 'uuid';
5
4
  import { AttributeFormat } from '../../../_gqlTypes';
6
5
  import { isUIFilterLink, isUIFilterStandard, isUIFilterThrough, isUIFilterTree, isUIFilterValueList, } from '../_types';
7
6
  import { hasOnlyNoValueConditions, nullValueConditions } from '../conditionsHelper';
@@ -20,7 +19,7 @@ export const FiltersActionTypes = {
20
19
  UPDATE_VIEWS: 'UPDATE_VIEWS',
21
20
  };
22
21
  const addFilter = (state, payload) => {
23
- const hasValueList = payload.attribute.valuesList;
22
+ const hasValueList = payload.attribute.valuesList?.enable;
24
23
  let condition = hasOnlyNoValueConditions(payload.attribute.format)
25
24
  ? null
26
25
  : (conditionsByFormat[payload.attribute.format][0] ?? null);
@@ -36,7 +35,7 @@ const addFilter = (state, payload) => {
36
35
  else {
37
36
  filterToAdd = {
38
37
  ...payload,
39
- id: uuid(),
38
+ id: window.crypto.randomUUID(),
40
39
  field: Array.isArray(payload.field) ? payload.field : [payload.field],
41
40
  condition: hasOnlyNoValueConditions(payload.attribute.format)
42
41
  ? null
@@ -49,7 +48,7 @@ const addFilter = (state, payload) => {
49
48
  filterToAdd = {
50
49
  ...payload,
51
50
  field: isLinkAttribute(payload.attribute.type) ? `${payload.field}.id` : payload.field,
52
- id: uuid(),
51
+ id: window.crypto.randomUUID(),
53
52
  condition,
54
53
  value: null,
55
54
  valuesList: hasValueList ? payload.attribute.valuesList : undefined,
@@ -83,6 +82,7 @@ const resetFilter = (state, payload) => ({
83
82
  ? null
84
83
  : conditionsByFormat[filter.attribute.format][0],
85
84
  value: null,
85
+ formattedValue: null,
86
86
  };
87
87
  }
88
88
  if (isUIFilterThrough(filter)) {
@@ -90,6 +90,7 @@ const resetFilter = (state, payload) => ({
90
90
  ...filter,
91
91
  condition: ThroughConditionFilter.THROUGH,
92
92
  value: null,
93
+ formattedValue: null,
93
94
  };
94
95
  }
95
96
  if (isUIFilterLink(filter)) {
@@ -97,6 +98,7 @@ const resetFilter = (state, payload) => ({
97
98
  ...filter,
98
99
  condition: conditionsByFormat[AttributeFormat.text][0],
99
100
  value: null,
101
+ formattedValue: null,
100
102
  };
101
103
  }
102
104
  if (isUIFilterTree(filter)) {
@@ -104,6 +106,7 @@ const resetFilter = (state, payload) => ({
104
106
  ...filter,
105
107
  condition: null,
106
108
  value: null,
109
+ formattedValue: null,
107
110
  };
108
111
  }
109
112
  }