@leav/ui 1.6.0-b54abb33 → 1.6.0-b8aae5a2

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 (79) hide show
  1. package/dist/_gqlTypes/index.d.ts +7 -0
  2. package/dist/_gqlTypes/index.js +1 -0
  3. package/dist/_gqlTypes/index.js.map +1 -1
  4. package/dist/_queries/views/viewDetailsFragment.js +1 -0
  5. package/dist/_queries/views/viewDetailsFragment.js.map +1 -1
  6. package/dist/components/AttributesSelectionList/sharedComponents.d.ts +159 -153
  7. package/dist/components/Explorer/Explorer.js +3 -1
  8. package/dist/components/Explorer/Explorer.js.map +1 -1
  9. package/dist/components/Explorer/ExplorerFiltersAndSorts.js +1 -1
  10. package/dist/components/Explorer/ExplorerFiltersAndSorts.js.map +1 -1
  11. package/dist/components/Explorer/TableCell.js +1 -0
  12. package/dist/components/Explorer/TableCell.js.map +1 -1
  13. package/dist/components/Explorer/actions-item/useReplaceItemAction.d.ts +2 -1
  14. package/dist/components/Explorer/actions-item/useReplaceItemAction.js +2 -2
  15. package/dist/components/Explorer/actions-item/useReplaceItemAction.js.map +1 -1
  16. package/dist/components/Explorer/actions-primary/useLinkPrimaryAction.d.ts +2 -1
  17. package/dist/components/Explorer/actions-primary/useLinkPrimaryAction.js +2 -2
  18. package/dist/components/Explorer/actions-primary/useLinkPrimaryAction.js.map +1 -1
  19. package/dist/components/Explorer/link-item/LinkModal.d.ts +1 -0
  20. package/dist/components/Explorer/link-item/LinkModal.js +2 -2
  21. package/dist/components/Explorer/link-item/LinkModal.js.map +1 -1
  22. package/dist/components/Explorer/manage-view-settings/save-view/prepareViewForRequest.js +3 -0
  23. package/dist/components/Explorer/manage-view-settings/save-view/prepareViewForRequest.js.map +1 -1
  24. package/dist/components/Filters/FiltersProvider.d.ts +2 -2
  25. package/dist/components/Filters/FiltersProvider.js.map +1 -1
  26. package/dist/components/Filters/_types.d.ts +3 -0
  27. package/dist/components/Filters/_types.js.map +1 -1
  28. package/dist/components/Filters/context/filtersReducer.js +5 -1
  29. package/dist/components/Filters/context/filtersReducer.js.map +1 -1
  30. package/dist/components/Filters/filter-items/CommonFilterItem.d.ts +1 -0
  31. package/dist/components/Filters/filter-items/CommonFilterItem.js +28 -8
  32. package/dist/components/Filters/filter-items/CommonFilterItem.js.map +1 -1
  33. package/dist/components/Filters/filter-items/EmptyValueCheckbox.d.ts +8 -0
  34. package/dist/components/Filters/filter-items/EmptyValueCheckbox.js +16 -0
  35. package/dist/components/Filters/filter-items/EmptyValueCheckbox.js.map +1 -0
  36. package/dist/components/Filters/filter-items/filter-type/ColorAttributeDropDown.js +9 -8
  37. package/dist/components/Filters/filter-items/filter-type/ColorAttributeDropDown.js.map +1 -1
  38. package/dist/components/Filters/filter-items/filter-type/FilterDropDown.js +2 -2
  39. package/dist/components/Filters/filter-items/filter-type/FilterDropDown.js.map +1 -1
  40. package/dist/components/Filters/filter-items/filter-type/FilterDropdownContent.js +1 -1
  41. package/dist/components/Filters/filter-items/filter-type/FilterDropdownContent.js.map +1 -1
  42. package/dist/components/Filters/filter-items/filter-type/FilterValueListDropDown.d.ts +0 -1
  43. package/dist/components/Filters/filter-items/filter-type/FilterValueListDropDown.js +14 -21
  44. package/dist/components/Filters/filter-items/filter-type/FilterValueListDropDown.js.map +1 -1
  45. package/dist/components/Filters/filter-items/filter-type/TreeAttributeDropDown.js +10 -12
  46. package/dist/components/Filters/filter-items/filter-type/TreeAttributeDropDown.js.map +1 -1
  47. package/dist/components/Filters/filter-items/filter-type/useConditionOptionsByType.js +3 -13
  48. package/dist/components/Filters/filter-items/filter-type/useConditionOptionsByType.js.map +1 -1
  49. package/dist/components/Filters/prepareFiltersForRequest.js +36 -3
  50. package/dist/components/Filters/prepareFiltersForRequest.js.map +1 -1
  51. package/dist/components/Filters/useFilters.d.ts +5 -0
  52. package/dist/components/Filters/useTransformFilters.js +4 -0
  53. package/dist/components/Filters/useTransformFilters.js.map +1 -1
  54. package/dist/components/LibraryItemsList/FiltersPanel/FiltersOptions.js +1 -8
  55. package/dist/components/LibraryItemsList/FiltersPanel/FiltersOptions.js.map +1 -1
  56. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/shared/ExplorerWrapper.d.ts +53 -51
  57. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/display-tree-node/TreeFieldWrapper.d.ts +53 -51
  58. package/dist/components/SelectRecordForLinkModal/SelectRecordForLinkModal.d.ts +1 -0
  59. package/dist/components/SelectRecordForLinkModal/SelectRecordForLinkModal.js +4 -2
  60. package/dist/components/SelectRecordForLinkModal/SelectRecordForLinkModal.js.map +1 -1
  61. package/dist/constants.d.ts +1 -0
  62. package/dist/constants.js +1 -0
  63. package/dist/constants.js.map +1 -1
  64. package/dist/hooks/useIFrameMessenger/messageHandlers.d.ts +2 -1
  65. package/dist/hooks/useIFrameMessenger/messageHandlers.js +8 -0
  66. package/dist/hooks/useIFrameMessenger/messageHandlers.js.map +1 -1
  67. package/dist/hooks/useIFrameMessenger/schema.d.ts +3 -0
  68. package/dist/hooks/useIFrameMessenger/schema.js +1 -0
  69. package/dist/hooks/useIFrameMessenger/schema.js.map +1 -1
  70. package/dist/hooks/useIFrameMessenger/types.d.ts +12 -2
  71. package/dist/hooks/useIFrameMessenger/types.js.map +1 -1
  72. package/dist/hooks/useIFrameMessenger/useIFrameMessenger.d.ts +1 -0
  73. package/dist/hooks/useIFrameMessenger/useIFrameMessenger.js +15 -0
  74. package/dist/hooks/useIFrameMessenger/useIFrameMessenger.js.map +1 -1
  75. package/dist/hooks/useIFrameMessengerClient/iFrameMessengerClientContext.d.ts +1 -0
  76. package/dist/hooks/useIFrameMessengerClient/useIFrameMessengerClient.d.ts +1 -0
  77. package/dist/locales/en/shared.json +2 -1
  78. package/dist/locales/fr/shared.json +2 -1
  79. package/package.json +3 -5
@@ -39,6 +39,6 @@ export const ExplorerFiltersAndSorts = ({ isMassSelectionAll, showFilters, showS
39
39
  return _jsx(_Fragment, {});
40
40
  }
41
41
  return (_jsxs(_Fragment, { children: [selectAllButton && (_jsxs(_Fragment, { children: [_jsx("li", { children: selectAllButton }), ((showFilters && filtersProps.length !== 0) || (showSorts && sort.length > 0)) && (_jsx(DividerStyled, { type: "vertical" }))] })), (showFilters || showSorts) && (_jsxs(_Fragment, { children: [filtersProps.length > 0 &&
42
- filtersProps.map(filterProps => (_jsx("li", { children: _jsx(CommonFilterItem, { ...filterProps, disabled: isMassSelectionAll }) }, filterProps.key))), showSorts && sort.length > 0 && (_jsx("li", { children: _jsx(FilterStyled, { label: t('explorer.sort-items'), values: sortValues, disabled: isMassSelectionAll, onClick: _handleClickOnSort }) }))] }))] }));
42
+ filtersProps.map(filterProps => (_jsx("li", { children: _jsx(CommonFilterItem, { filter: filterProps.filter, isPinned: filterProps.isPinned, disabled: isMassSelectionAll }) }, filterProps.key))), showSorts && sort.length > 0 && (_jsx("li", { children: _jsx(FilterStyled, { label: t('explorer.sort-items'), values: sortValues, disabled: isMassSelectionAll, onClick: _handleClickOnSort }) }))] }))] }));
43
43
  };
44
44
  //# sourceMappingURL=ExplorerFiltersAndSorts.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ExplorerFiltersAndSorts.js","sourceRoot":"","sources":["../../../src/components/Explorer/ExplorerFiltersAndSorts.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAC,SAAS,EAAC,MAAM,eAAe,CAAC;AACxC,OAAO,EAAC,sBAAsB,EAAC,MAAM,mEAAmE,CAAC;AACzG,OAAO,EAAC,uBAAuB,EAAC,MAAM,wDAAwD,CAAC;AAC/F,OAAO,EAAC,mBAAmB,EAAC,MAAM,wBAAwB,CAAC;AAE3D,OAAO,EAAC,UAAU,EAAE,SAAS,EAAC,MAAM,YAAY,CAAC;AACjD,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,EAA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// Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06\n// This file is released under LGPL V3\n// License text available at https://www.gnu.org/licenses/lgpl-3.0.txt\nimport {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\nimport {SortOrder} from '_ui/_gqlTypes';\nimport {useViewSettingsContext} from './manage-view-settings/store-view-settings/useViewSettingsContext';\nimport {useAttributeDetailsData} from './manage-view-settings/_shared/useAttributeDetailsData';\nimport {useOpenViewSettings} from './manage-view-settings';\nimport {type ComponentProps, type FunctionComponent, type ReactNode} from 'react';\nimport {KitDivider, KitFilter} from 'aristid-ds';\nimport styled from 'styled-components';\nimport {CommonFilterItem, type ICommonFilterProps} from '_ui/components/Filters/filter-items/CommonFilterItem';\nimport {useFilters} from '_ui/components/Filters/useFilters';\n\nconst FilterStyled = styled(KitFilter)`\n flex: 0 0 auto;\n`;\n\nconst DividerStyled = styled(KitDivider)`\n height: 26px;\n margin-inline: calc(var(--general-spacing-xxs) * 1px);\n`;\n\nexport const ExplorerFiltersAndSorts: FunctionComponent<{\n isMassSelectionAll: boolean;\n showFilters: boolean;\n showSorts: boolean;\n canRemoveFilters: boolean;\n selectAllButton: ReactNode | null;\n}> = ({isMassSelectionAll, showFilters, showSorts, canRemoveFilters, selectAllButton}) => {\n const {t} = useSharedTranslation();\n\n const {view} = useViewSettingsContext();\n const {sort} = view;\n\n const {openSettingsPanel} = useOpenViewSettings({view, isEnabled: true});\n const {filtersProps} = useFilters(!canRemoveFilters);\n\n const {attributeDetailsById} = useAttributeDetailsData(view.libraryId);\n // const visibleFilters = filters.filter(filterItem => !filterItem.hidden);\n\n if (((filtersProps.length === 0 && sort.length === 0) || (!showFilters && !showSorts)) && !selectAllButton) {\n return null;\n }\n\n const sortValues =\n sort.length === 0\n ? undefined\n : sort.map(\n ({field, order}) =>\n (attributeDetailsById?.[field]?.label ?? field) +\n ' ' +\n (order === SortOrder.asc ? t('explorer.sort-ascending') : t('explorer.sort-descending')),\n );\n\n const _handleClickOnSort: ComponentProps<typeof FilterStyled>['onClick'] = () =>\n isMassSelectionAll ? undefined : openSettingsPanel('sort-items');\n\n if (!Object.keys(attributeDetailsById).length) {\n return <></>;\n }\n return (\n <>\n {selectAllButton && (\n <>\n <li>{selectAllButton}</li>\n {((showFilters && filtersProps.length !== 0) || (showSorts && sort.length > 0)) && (\n <DividerStyled type=\"vertical\" />\n )}\n </>\n )}\n {(showFilters || showSorts) && (\n <>\n {filtersProps.length > 0 &&\n filtersProps.map(filterProps => (\n <li key={filterProps.key}>\n <CommonFilterItem\n {...(filterProps as ICommonFilterProps)}\n disabled={isMassSelectionAll}\n />\n </li>\n ))}\n {showSorts && sort.length > 0 && (\n <li>\n <FilterStyled\n label={t('explorer.sort-items')}\n values={sortValues}\n disabled={isMassSelectionAll}\n onClick={_handleClickOnSort}\n />\n </li>\n )}\n </>\n )}\n </>\n );\n};\n"]}
1
+ {"version":3,"file":"ExplorerFiltersAndSorts.js","sourceRoot":"","sources":["../../../src/components/Explorer/ExplorerFiltersAndSorts.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAC,SAAS,EAAC,MAAM,eAAe,CAAC;AACxC,OAAO,EAAC,sBAAsB,EAAC,MAAM,mEAAmE,CAAC;AACzG,OAAO,EAAC,uBAAuB,EAAC,MAAM,wDAAwD,CAAC;AAC/F,OAAO,EAAC,mBAAmB,EAAC,MAAM,wBAAwB,CAAC;AAE3D,OAAO,EAAC,UAAU,EAAE,SAAS,EAAC,MAAM,YAAY,CAAC;AACjD,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,EAAC,gBAAgB,EAAC,MAAM,sDAAsD,CAAC;AACtF,OAAO,EAAC,UAAU,EAAC,MAAM,mCAAmC,CAAC;AAG7D,MAAM,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,CAAA;;CAErC,CAAC;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B,CAAC,CAAC,CAC/F,CAAC;IAEZ,MAAM,kBAAkB,GAAmD,GAAG,EAAE,CAC5E,kBAAkB,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,iBAAiB,CAAC,YAAY,CAAC,CAAC;IAErE,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC,MAAM,EAAE,CAAC;QAC5C,OAAO,mBAAK,CAAC;IACjB,CAAC;IAED,OAAO,CACH,8BACK,eAAe,IAAI,CAChB,8BACI,uBAAK,eAAe,GAAM,EACzB,CAAC,CAAC,WAAW,IAAI,YAAY,CAAC,MAAM,KAAK,CAAC,CAAC,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,IAAI,CAC/E,KAAC,aAAa,IAAC,IAAI,EAAC,UAAU,GAAG,CACpC,IACF,CACN,EACA,CAAC,WAAW,IAAI,SAAS,CAAC,IAAI,CAC3B,8BACK,YAAY,CAAC,MAAM,GAAG,CAAC;wBACpB,YAAY,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE,CAAC,CAC5B,uBACI,KAAC,gBAAgB,IACb,MAAM,EAAE,WAAW,CAAC,MAAkB,EACtC,QAAQ,EAAE,WAAW,CAAC,QAAQ,EAC9B,QAAQ,EAAE,kBAAkB,GAC9B,IALG,WAAW,CAAC,GAAG,CAMnB,CACR,CAAC,EACL,SAAS,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,IAAI,CAC7B,uBACI,KAAC,YAAY,IACT,KAAK,EAAE,CAAC,CAAC,qBAAqB,CAAC,EAC/B,MAAM,EAAE,UAAU,EAClB,QAAQ,EAAE,kBAAkB,EAC5B,OAAO,EAAE,kBAAkB,GAC7B,GACD,CACR,IACF,CACN,IACF,CACN,CAAC;AACN,CAAC,CAAC","sourcesContent":["// Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06\n// This file is released under LGPL V3\n// License text available at https://www.gnu.org/licenses/lgpl-3.0.txt\nimport {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\nimport {SortOrder} from '_ui/_gqlTypes';\nimport {useViewSettingsContext} from './manage-view-settings/store-view-settings/useViewSettingsContext';\nimport {useAttributeDetailsData} from './manage-view-settings/_shared/useAttributeDetailsData';\nimport {useOpenViewSettings} from './manage-view-settings';\nimport {type ComponentProps, type FunctionComponent, type ReactNode} from 'react';\nimport {KitDivider, KitFilter} from 'aristid-ds';\nimport styled from 'styled-components';\nimport {CommonFilterItem} from '_ui/components/Filters/filter-items/CommonFilterItem';\nimport {useFilters} from '_ui/components/Filters/useFilters';\nimport {type UIFilter} from '../Filters';\n\nconst FilterStyled = styled(KitFilter)`\n flex: 0 0 auto;\n`;\n\nconst DividerStyled = styled(KitDivider)`\n height: 26px;\n margin-inline: calc(var(--general-spacing-xxs) * 1px);\n`;\n\nexport const ExplorerFiltersAndSorts: FunctionComponent<{\n isMassSelectionAll: boolean;\n showFilters: boolean;\n showSorts: boolean;\n canRemoveFilters: boolean;\n selectAllButton: ReactNode | null;\n}> = ({isMassSelectionAll, showFilters, showSorts, canRemoveFilters, selectAllButton}) => {\n const {t} = useSharedTranslation();\n\n const {view} = useViewSettingsContext();\n const {sort} = view;\n\n const {openSettingsPanel} = useOpenViewSettings({view, isEnabled: true});\n const {filtersProps} = useFilters(!canRemoveFilters);\n\n const {attributeDetailsById} = useAttributeDetailsData(view.libraryId);\n // const visibleFilters = filters.filter(filterItem => !filterItem.hidden);\n\n if (((filtersProps.length === 0 && sort.length === 0) || (!showFilters && !showSorts)) && !selectAllButton) {\n return null;\n }\n\n const sortValues =\n sort.length === 0\n ? undefined\n : sort.map(\n ({field, order}) =>\n (attributeDetailsById?.[field]?.label ?? field) +\n ' ' +\n (order === SortOrder.asc ? t('explorer.sort-ascending') : t('explorer.sort-descending')),\n );\n\n const _handleClickOnSort: ComponentProps<typeof FilterStyled>['onClick'] = () =>\n isMassSelectionAll ? undefined : openSettingsPanel('sort-items');\n\n if (!Object.keys(attributeDetailsById).length) {\n return <></>;\n }\n\n return (\n <>\n {selectAllButton && (\n <>\n <li>{selectAllButton}</li>\n {((showFilters && filtersProps.length !== 0) || (showSorts && sort.length > 0)) && (\n <DividerStyled type=\"vertical\" />\n )}\n </>\n )}\n {(showFilters || showSorts) && (\n <>\n {filtersProps.length > 0 &&\n filtersProps.map(filterProps => (\n <li key={filterProps.key}>\n <CommonFilterItem\n filter={filterProps.filter as UIFilter}\n isPinned={filterProps.isPinned}\n disabled={isMassSelectionAll}\n />\n </li>\n ))}\n {showSorts && sort.length > 0 && (\n <li>\n <FilterStyled\n label={t('explorer.sort-items')}\n values={sortValues}\n disabled={isMassSelectionAll}\n onClick={_handleClickOnSort}\n />\n </li>\n )}\n </>\n )}\n </>\n );\n};\n"]}
@@ -173,5 +173,6 @@ export const TableCell = ({ values, attributeProperties }) => {
173
173
  }
174
174
  return _jsx(StyledCenteringWrapper, { children: content });
175
175
  }
176
+ return null;
176
177
  };
177
178
  //# sourceMappingURL=TableCell.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"TableCell.js","sourceRoot":"","sources":["../../../src/components/Explorer/TableCell.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAyC,WAAW,EAAC,MAAM,OAAO,CAAC;AAC1E,OAAO,EACH,eAAe,EAEf,aAAa,EAKb,kBAAkB,GACrB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AACpE,OAAO,SAAS,MAAM,WAAW,CAAC;AAClC,OAAO,EAAC,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,aAAa,EAAC,MAAM,YAAY,CAAC;AAEhF,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,EAAC,MAAM,EAAC,MAAM,UAAU,CAAC;AAChC,OAAO,EAAC,4BAA4B,EAAE,aAAa,EAAC,MAAM,iBAAiB,CAAC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7D,mBAAmB,CAAC,EAAE,CAA2C,CACjF,CAAC,CAAC,CAAC,IAAI,CAAC;QACb,CAAC;QAED,IAAI,WAAW,CAAC,KAAK,EAAE,mBAAmB,CAAC,EAAE,CAAC;YAC1C,OAAO,GAAG,KAAK,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC,CAAC,CAClC,KAAC,MAAM,IAA8B,IAAI,EAAE,KAAK,CAAC,WAAW,CAAC,MAAM,IAAtD,mBAAmB,CAAC,EAAE,CAAoC,CAC1E,CAAC,CAAC,CAAC,IAAI,CAAC;QACb,CAAC;QAED,OAAO,KAAC,sBAAsB,cAAE,OAAO,GAA0B,CAAC;IACtE,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 {type FunctionComponent, type ReactNode, useCallback} from 'react';\nimport {\n AttributeFormat,\n type AttributePropertiesFragment,\n AttributeType,\n type PropertyValueFragment,\n type PropertyValueLinkValueFragment,\n type PropertyValueTreeValueFragment,\n type PropertyValueValueFragment,\n MultiDisplayOption,\n} from '_ui/_gqlTypes';\nimport {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\nimport DOMPurify from 'dompurify';\nimport {KitAvatar, KitBadge, KitSpace, KitTag, KitTypography} from 'aristid-ds';\nimport {type IKitTag, type IKitTagConfig} from 'aristid-ds/dist/Kit/DataDisplay/Tag/types';\nimport styled from 'styled-components';\nimport {IdCard} from './IdCard';\nimport {multiColorTagAvatarClassName, TableTagGroup} from './TableTagGroup';\nimport {AggregationColor} from 'antd/es/color-picker/color';\nimport {FontAwesomeIcon} from '@fortawesome/react-fontawesome';\nimport {faArrowRight, faCalendar, faListAlt} from '@fortawesome/free-solid-svg-icons';\n\nconst isStandardValue = (\n v: PropertyValueFragment,\n attribute: AttributePropertiesFragment,\n): v is PropertyValueValueFragment => [AttributeType.simple, AttributeType.advanced].includes(attribute.type);\nconst isStandardValues = (\n values: PropertyValueFragment[],\n attribute: AttributePropertiesFragment,\n): values is PropertyValueValueFragment[] => values.every(value => isStandardValue(value, attribute));\n\nconst isLinkValue = (\n v: PropertyValueFragment,\n attribute: AttributePropertiesFragment,\n): v is PropertyValueLinkValueFragment =>\n [AttributeType.simple_link, AttributeType.advanced_link].includes(attribute.type);\nconst isLinkValues = (\n values: PropertyValueFragment[],\n attribute: AttributePropertiesFragment,\n): values is PropertyValueLinkValueFragment[] => values.every(value => isLinkValue(value, attribute));\n\nconst isTreeValue = (\n v: PropertyValueFragment,\n attribute: AttributePropertiesFragment,\n): v is PropertyValueTreeValueFragment => [AttributeType.tree].includes(attribute.type);\nconst isTreeValues = (\n values: PropertyValueFragment[],\n attribute: AttributePropertiesFragment,\n): values is PropertyValueTreeValueFragment[] => values.every(value => isTreeValue(value, attribute));\n\nconst isDateRangeValue = (v: PropertyValueValueFragment['valuePayload']): v is {from: string; to: string} =>\n 'from' in v && 'to' in v;\n\nconst StyledCenteringWrapper = styled.div`\n display: flex;\n align-items: center;\n gap: calc(var(--general-spacing-xs) * 1px);\n`;\n\nconst StyledColorChip = styled.div<{$colorTextContent: string}>`\n height: calc(var(--general-spacing-s) * 1px);\n width: calc(var(--general-spacing-s) * 1px);\n border-radius: calc(var(--general-border-radius-xs) * 1px);\n background-color: ${props => props.$colorTextContent};\n`;\n\nconst RightIcon = styled(FontAwesomeIcon)`\n flex-shrink: 0;\n`;\n\ninterface ITableCellProps {\n values: PropertyValueFragment[];\n attributeProperties: AttributePropertiesFragment;\n}\n\nexport const TableCell: FunctionComponent<ITableCellProps> = ({values, attributeProperties}) => {\n const {t} = useSharedTranslation();\n\n const _getDateRangeValueContent = useCallback((value: PropertyValueValueFragment['valuePayload']) => {\n if (!isDateRangeValue(value)) {\n return t('explorer.invalid-value');\n }\n\n return (\n <KitSpace size=\"xxs\">\n <RightIcon icon={faCalendar} />\n {value.from} <FontAwesomeIcon icon={faArrowRight} /> {value.to}\n </KitSpace>\n );\n }, []);\n\n const _getFirstValue = useCallback(\n (value: PropertyValueValueFragment['valuePayload'], attribute: AttributePropertiesFragment) => {\n if (isStandardValue(value, attribute) && attribute.format === AttributeFormat.boolean) {\n if (!value || value.valuePayload === null) {\n return {valuePayload: false};\n }\n }\n return value;\n },\n [],\n );\n\n if (attributeProperties.multiple_values) {\n if (isStandardValues(values, attributeProperties)) {\n const tags = values.map<IKitTagConfig>(value => {\n switch (attributeProperties.format) {\n case AttributeFormat.boolean:\n return {\n idCardProps: {\n description: value.valuePayload ? String(t('global.yes')) : String(t('global.no')),\n },\n type: value.valuePayload ? 'primary' : ('neutral' as IKitTag['type']),\n };\n case AttributeFormat.color:\n const color = new AggregationColor(value.valueRawPayload);\n return {\n idCardProps: {\n description: value.valuePayload,\n avatarProps: {\n color: color.toHexString(),\n shape: 'square',\n className: multiColorTagAvatarClassName,\n },\n },\n };\n case AttributeFormat.date_range:\n return {\n idCardProps: {\n description: _getDateRangeValueContent(value.valuePayload),\n },\n type: 'primary',\n };\n default:\n const valueContent =\n attributeProperties.format === AttributeFormat.encrypted\n ? '●●●●●●●●●●●●'\n : value.valuePayload;\n return {\n idCardProps: {description: valueContent},\n type: 'primary',\n };\n }\n });\n return <TableTagGroup tags={tags} />;\n } else if (isLinkValues(values, attributeProperties)) {\n switch (attributeProperties.multi_link_display_option) {\n case MultiDisplayOption.tag:\n return (\n <TableTagGroup\n tags={values.map(value => ({\n type: 'primary',\n idCardProps: {description: value.linkPayload?.whoAmI.label ?? undefined},\n }))}\n />\n );\n\n case MultiDisplayOption.badge_qty:\n return <KitBadge overflowCount={Infinity} count={values.length} color=\"primary\" />;\n\n case MultiDisplayOption.avatar:\n default:\n return (\n <KitAvatar.Group max={{count: 5}}>\n {values.map((value, index) => {\n if (!isLinkValue(value, attributeProperties)) {\n return null;\n }\n\n return (\n <KitAvatar\n key={index}\n label={String(value.linkPayload?.whoAmI.label)}\n src={value.linkPayload?.whoAmI.preview?.small}\n color=\"primary\"\n secondaryColorInvert\n />\n );\n })}\n </KitAvatar.Group>\n );\n }\n } else if (isTreeValues(values, attributeProperties)) {\n switch (attributeProperties.multi_tree_display_option) {\n case MultiDisplayOption.tag:\n return (\n <TableTagGroup\n tags={values.map(value => ({\n type: 'primary',\n idCardProps: {description: value.treePayload?.record.whoAmI.label ?? undefined},\n }))}\n />\n );\n case MultiDisplayOption.badge_qty:\n return <KitBadge overflowCount={Infinity} count={values.length} color=\"primary\" />;\n case MultiDisplayOption.avatar:\n default:\n return (\n <KitAvatar.Group max={{count: 5}}>\n {values.map((value, index) => {\n if (!isTreeValue(value, attributeProperties)) {\n return null;\n }\n\n return (\n <KitAvatar\n key={index}\n label={String(value.treePayload?.record.whoAmI.label)}\n src={value.treePayload?.record.whoAmI.preview?.small}\n color=\"primary\"\n secondaryColorInvert\n />\n );\n })}\n </KitAvatar.Group>\n );\n }\n }\n } else {\n const value = _getFirstValue(values[0], attributeProperties); // Not multiple_values attribute should not have more than one value\n if (!value) {\n return null;\n }\n\n let content: ReactNode = null;\n if (isStandardValue(value, attributeProperties)) {\n if (value.valuePayload === null) {\n return null;\n }\n\n switch (attributeProperties.format) {\n case AttributeFormat.boolean:\n const valueToDisplay = value.valuePayload ? t('global.yes') : t('global.no');\n content = (\n <KitTag\n key={attributeProperties.id}\n type={!!value.valuePayload ? 'primary' : 'neutral'}\n idCardProps={{description: valueToDisplay}}\n />\n );\n break;\n case AttributeFormat.rich_text:\n const tmp = document.createElement('div');\n tmp.innerHTML = DOMPurify.sanitize(value.valuePayload);\n const textContent = tmp.textContent;\n content = (\n <>\n <RightIcon icon={faListAlt} />\n <KitTypography.AdvancedText key={attributeProperties.id} ellipsis={{tooltip: textContent}}>\n {textContent}\n </KitTypography.AdvancedText>\n </>\n );\n break;\n case AttributeFormat.color:\n const color = new AggregationColor(value.valueRawPayload);\n content = (\n <>\n <StyledColorChip $colorTextContent={color.toHexString()} />\n <KitTypography.AdvancedText\n key={attributeProperties.id}\n ellipsis={{tooltip: value.valuePayload}}\n >\n {value.valuePayload}\n </KitTypography.AdvancedText>\n </>\n );\n break;\n case AttributeFormat.date_range:\n content = _getDateRangeValueContent(value.valuePayload);\n break;\n default:\n const valueContent =\n attributeProperties.format === AttributeFormat.encrypted ? '●●●●●●●●●●●●' : value.valuePayload;\n content = (\n <KitTypography.AdvancedText key={attributeProperties.id} ellipsis={{tooltip: valueContent}}>\n {valueContent}\n </KitTypography.AdvancedText>\n );\n break;\n }\n }\n\n if (isTreeValue(value, attributeProperties)) {\n content = value.treePayload?.record.whoAmI.label ? (\n <IdCard key={attributeProperties.id} item={value.treePayload.record.whoAmI} />\n ) : null;\n }\n\n if (isLinkValue(value, attributeProperties)) {\n content = value.linkPayload?.whoAmI ? (\n <IdCard key={attributeProperties.id} item={value.linkPayload.whoAmI} />\n ) : null;\n }\n\n return <StyledCenteringWrapper>{content}</StyledCenteringWrapper>;\n }\n};\n"]}
1
+ {"version":3,"file":"TableCell.js","sourceRoot":"","sources":["../../../src/components/Explorer/TableCell.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAyC,WAAW,EAAC,MAAM,OAAO,CAAC;AAC1E,OAAO,EACH,eAAe,EAEf,aAAa,EAKb,kBAAkB,GACrB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AACpE,OAAO,SAAS,MAAM,WAAW,CAAC;AAClC,OAAO,EAAC,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,aAAa,EAAC,MAAM,YAAY,CAAC;AAEhF,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,EAAC,MAAM,EAAC,MAAM,UAAU,CAAC;AAChC,OAAO,EAAC,4BAA4B,EAAE,aAAa,EAAC,MAAM,iBAAiB,CAAC;AAC5E,OAAO,EAAC,gBAAgB,EAAC,MAAM,4BAA4B,CAAC;AAC5D,OAAO,E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CAAC;QAED,IAAI,WAAW,CAAC,KAAK,EAAE,mBAAmB,CAAC,EAAE,CAAC;YAC1C,OAAO,GAAG,KAAK,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC,CAAC,CAClC,KAAC,MAAM,IAA8B,IAAI,EAAE,KAAK,CAAC,WAAW,CAAC,MAAM,IAAtD,mBAAmB,CAAC,EAAE,CAAoC,CAC1E,CAAC,CAAC,CAAC,IAAI,CAAC;QACb,CAAC;QAED,OAAO,KAAC,sBAAsB,cAAE,OAAO,GAA0B,CAAC;IACtE,CAAC;IAED,OAAO,IAAI,CAAC;AAChB,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 ReactNode, useCallback} from 'react';\nimport {\n AttributeFormat,\n type AttributePropertiesFragment,\n AttributeType,\n type PropertyValueFragment,\n type PropertyValueLinkValueFragment,\n type PropertyValueTreeValueFragment,\n type PropertyValueValueFragment,\n MultiDisplayOption,\n} from '_ui/_gqlTypes';\nimport {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\nimport DOMPurify from 'dompurify';\nimport {KitAvatar, KitBadge, KitSpace, KitTag, KitTypography} from 'aristid-ds';\nimport {type IKitTag} from 'aristid-ds/dist/Kit/DataDisplay/Tag/types';\nimport styled from 'styled-components';\nimport {IdCard} from './IdCard';\nimport {multiColorTagAvatarClassName, TableTagGroup} from './TableTagGroup';\nimport {AggregationColor} from 'antd/es/color-picker/color';\nimport {FontAwesomeIcon} from '@fortawesome/react-fontawesome';\nimport {faArrowRight, faCalendar, faListAlt} from '@fortawesome/free-solid-svg-icons';\n\nconst isStandardValue = (\n v: PropertyValueFragment,\n attribute: AttributePropertiesFragment,\n): v is PropertyValueValueFragment => [AttributeType.simple, AttributeType.advanced].includes(attribute.type);\nconst isStandardValues = (\n values: PropertyValueFragment[],\n attribute: AttributePropertiesFragment,\n): values is PropertyValueValueFragment[] => values.every(value => isStandardValue(value, attribute));\n\nconst isLinkValue = (\n v: PropertyValueFragment,\n attribute: AttributePropertiesFragment,\n): v is PropertyValueLinkValueFragment =>\n [AttributeType.simple_link, AttributeType.advanced_link].includes(attribute.type);\nconst isLinkValues = (\n values: PropertyValueFragment[],\n attribute: AttributePropertiesFragment,\n): values is PropertyValueLinkValueFragment[] => values.every(value => isLinkValue(value, attribute));\n\nconst isTreeValue = (\n v: PropertyValueFragment,\n attribute: AttributePropertiesFragment,\n): v is PropertyValueTreeValueFragment => [AttributeType.tree].includes(attribute.type);\nconst isTreeValues = (\n values: PropertyValueFragment[],\n attribute: AttributePropertiesFragment,\n): values is PropertyValueTreeValueFragment[] => values.every(value => isTreeValue(value, attribute));\n\nconst isDateRangeValue = (v: PropertyValueValueFragment['valuePayload']): v is {from: string; to: string} =>\n 'from' in v && 'to' in v;\n\nconst StyledCenteringWrapper = styled.div`\n display: flex;\n align-items: center;\n gap: calc(var(--general-spacing-xs) * 1px);\n`;\n\nconst StyledColorChip = styled.div<{$colorTextContent: string}>`\n height: calc(var(--general-spacing-s) * 1px);\n width: calc(var(--general-spacing-s) * 1px);\n border-radius: calc(var(--general-border-radius-xs) * 1px);\n background-color: ${props => props.$colorTextContent};\n`;\n\nconst RightIcon = styled(FontAwesomeIcon)`\n flex-shrink: 0;\n`;\n\ninterface ITableCellProps {\n values: PropertyValueFragment[];\n attributeProperties: AttributePropertiesFragment;\n}\n\nexport const TableCell: FunctionComponent<ITableCellProps> = ({values, attributeProperties}) => {\n const {t} = useSharedTranslation();\n\n const _getDateRangeValueContent = useCallback((value: PropertyValueValueFragment['valuePayload']) => {\n if (!isDateRangeValue(value)) {\n return t('explorer.invalid-value');\n }\n\n return (\n <KitSpace size=\"xxs\">\n <RightIcon icon={faCalendar} />\n {value.from} <FontAwesomeIcon icon={faArrowRight} /> {value.to}\n </KitSpace>\n );\n }, []);\n\n const _getFirstValue = useCallback(\n (value: PropertyValueValueFragment['valuePayload'], attribute: AttributePropertiesFragment) => {\n if (isStandardValue(value, attribute) && attribute.format === AttributeFormat.boolean) {\n if (!value || value.valuePayload === null) {\n return {valuePayload: false};\n }\n }\n return value;\n },\n [],\n );\n\n if (attributeProperties.multiple_values) {\n if (isStandardValues(values, attributeProperties)) {\n const tags = values.map<IKitTag>(value => {\n switch (attributeProperties.format) {\n case AttributeFormat.boolean:\n return {\n idCardProps: {\n description: value.valuePayload ? String(t('global.yes')) : String(t('global.no')),\n },\n type: value.valuePayload ? 'primary' : ('neutral' as IKitTag['type']),\n };\n case AttributeFormat.color:\n const color = new AggregationColor(value.valueRawPayload);\n return {\n idCardProps: {\n description: value.valuePayload,\n avatarProps: {\n color: color.toHexString(),\n shape: 'square',\n className: multiColorTagAvatarClassName,\n },\n },\n };\n case AttributeFormat.date_range:\n return {\n idCardProps: {\n description: _getDateRangeValueContent(value.valuePayload),\n },\n type: 'primary',\n };\n default:\n const valueContent =\n attributeProperties.format === AttributeFormat.encrypted\n ? '●●●●●●●●●●●●'\n : value.valuePayload;\n return {\n idCardProps: {description: valueContent},\n type: 'primary',\n };\n }\n });\n return <TableTagGroup tags={tags} />;\n } else if (isLinkValues(values, attributeProperties)) {\n switch (attributeProperties.multi_link_display_option) {\n case MultiDisplayOption.tag:\n return (\n <TableTagGroup\n tags={values.map(value => ({\n type: 'primary',\n idCardProps: {description: value.linkPayload?.whoAmI.label ?? undefined},\n }))}\n />\n );\n\n case MultiDisplayOption.badge_qty:\n return <KitBadge overflowCount={Infinity} count={values.length} color=\"primary\" />;\n\n case MultiDisplayOption.avatar:\n default:\n return (\n <KitAvatar.Group max={{count: 5}}>\n {values.map((value, index) => {\n if (!isLinkValue(value, attributeProperties)) {\n return null;\n }\n\n return (\n <KitAvatar\n key={index}\n label={String(value.linkPayload?.whoAmI.label)}\n src={value.linkPayload?.whoAmI.preview?.small}\n color=\"primary\"\n secondaryColorInvert\n />\n );\n })}\n </KitAvatar.Group>\n );\n }\n } else if (isTreeValues(values, attributeProperties)) {\n switch (attributeProperties.multi_tree_display_option) {\n case MultiDisplayOption.tag:\n return (\n <TableTagGroup\n tags={values.map(value => ({\n type: 'primary',\n idCardProps: {description: value.treePayload?.record.whoAmI.label ?? undefined},\n }))}\n />\n );\n case MultiDisplayOption.badge_qty:\n return <KitBadge overflowCount={Infinity} count={values.length} color=\"primary\" />;\n case MultiDisplayOption.avatar:\n default:\n return (\n <KitAvatar.Group max={{count: 5}}>\n {values.map((value, index) => {\n if (!isTreeValue(value, attributeProperties)) {\n return null;\n }\n\n return (\n <KitAvatar\n key={index}\n label={String(value.treePayload?.record.whoAmI.label)}\n src={value.treePayload?.record.whoAmI.preview?.small}\n color=\"primary\"\n secondaryColorInvert\n />\n );\n })}\n </KitAvatar.Group>\n );\n }\n }\n } else {\n const value = _getFirstValue(values[0], attributeProperties); // Not multiple_values attribute should not have more than one value\n if (!value) {\n return null;\n }\n\n let content: ReactNode = null;\n if (isStandardValue(value, attributeProperties)) {\n if (value.valuePayload === null) {\n return null;\n }\n\n switch (attributeProperties.format) {\n case AttributeFormat.boolean:\n const valueToDisplay = value.valuePayload ? t('global.yes') : t('global.no');\n content = (\n <KitTag\n key={attributeProperties.id}\n type={!!value.valuePayload ? 'primary' : 'neutral'}\n idCardProps={{description: valueToDisplay}}\n />\n );\n break;\n case AttributeFormat.rich_text:\n const tmp = document.createElement('div');\n tmp.innerHTML = DOMPurify.sanitize(value.valuePayload);\n const textContent = tmp.textContent;\n content = (\n <>\n <RightIcon icon={faListAlt} />\n <KitTypography.AdvancedText key={attributeProperties.id} ellipsis={{tooltip: textContent}}>\n {textContent}\n </KitTypography.AdvancedText>\n </>\n );\n break;\n case AttributeFormat.color:\n const color = new AggregationColor(value.valueRawPayload);\n content = (\n <>\n <StyledColorChip $colorTextContent={color.toHexString()} />\n <KitTypography.AdvancedText\n key={attributeProperties.id}\n ellipsis={{tooltip: value.valuePayload}}\n >\n {value.valuePayload}\n </KitTypography.AdvancedText>\n </>\n );\n break;\n case AttributeFormat.date_range:\n content = _getDateRangeValueContent(value.valuePayload);\n break;\n default:\n const valueContent =\n attributeProperties.format === AttributeFormat.encrypted ? '●●●●●●●●●●●●' : value.valuePayload;\n content = (\n <KitTypography.AdvancedText key={attributeProperties.id} ellipsis={{tooltip: valueContent}}>\n {valueContent}\n </KitTypography.AdvancedText>\n );\n break;\n }\n }\n\n if (isTreeValue(value, attributeProperties)) {\n content = value.treePayload?.record.whoAmI.label ? (\n <IdCard key={attributeProperties.id} item={value.treePayload.record.whoAmI} />\n ) : null;\n }\n\n if (isLinkValue(value, attributeProperties)) {\n content = value.linkPayload?.whoAmI ? (\n <IdCard key={attributeProperties.id} item={value.linkPayload.whoAmI} />\n ) : null;\n }\n\n return <StyledCenteringWrapper>{content}</StyledCenteringWrapper>;\n }\n\n return null;\n};\n"]}
@@ -12,10 +12,11 @@ import { type ISubmitMultipleResult } from '../../../components/RecordEdition/Ed
12
12
  * @param onReplace - callback to let outside world know about replacing feedback
13
13
  * @param canReplaceLinkValues - check permission to delete link values
14
14
  */
15
- export declare const useReplaceItemAction: ({ isEnabled, onReplace, isMultivalue, canReplaceLinkValues, }: FeatureHook<{
15
+ export declare const useReplaceItemAction: ({ isEnabled, onReplace, isMultivalue, canReplaceLinkValues, columnsToDisplay, }: FeatureHook<{
16
16
  isMultivalue: boolean;
17
17
  onReplace?: (replaceValuesResult: ISubmitMultipleResult) => void;
18
18
  canReplaceLinkValues: boolean;
19
+ columnsToDisplay: string[];
19
20
  }>) => {
20
21
  replaceItemAction: IItemAction;
21
22
  replaceItemModal: JSX.Element;
@@ -19,7 +19,7 @@ import { faExchangeAlt } from '@fortawesome/free-solid-svg-icons';
19
19
  * @param onReplace - callback to let outside world know about replacing feedback
20
20
  * @param canReplaceLinkValues - check permission to delete link values
21
21
  */
22
- export const useReplaceItemAction = ({ isEnabled, onReplace, isMultivalue, canReplaceLinkValues, }) => {
22
+ export const useReplaceItemAction = ({ isEnabled, onReplace, isMultivalue, canReplaceLinkValues, columnsToDisplay, }) => {
23
23
  const { t } = useSharedTranslation();
24
24
  const [isReplaceModalOpen, setIsReplaceModalOpen] = useState(false);
25
25
  const [linkIdSelected, setLinkIdSelected] = useState();
@@ -36,7 +36,7 @@ export const useReplaceItemAction = ({ isEnabled, onReplace, isMultivalue, canRe
36
36
  replaceItemAction: isEnabled ? _replaceItemAction : null,
37
37
  replaceItemModal: isEnabled && isReplaceModalOpen ? (_jsx(LinkModal, { open: true, linkId: linkIdSelected, isMultivalue: isMultivalue, onReplace: onReplace, onClose: () => {
38
38
  setIsReplaceModalOpen(false);
39
- } })) : null,
39
+ }, columnsToDisplay: columnsToDisplay })) : null,
40
40
  }), [isEnabled, isReplaceModalOpen, _replaceItemAction]);
41
41
  return replaceAction;
42
42
  };
@@ -1 +1 @@
1
- {"version":3,"file":"useReplaceItemAction.js","sourceRoot":"","sources":["../../../../src/components/Explorer/actions-item/useReplaceItemAction.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAC,OAAO,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AACxC,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AAEpE,OAAO,EAAC,SAAS,EAAC,MAAM,wBAAwB,CAAC;AAEjD,OAAO,EAAC,eAAe,EAAC,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAC,aAAa,EAAC,MAAM,mCAAmC,CAAC;AAEhE;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,EACjC,SAAS,EACT,SAAS,EACT,YAAY,EACZ,oBAAoB,GAKtB,EAAE,EAAE;IACF,MAAM,EAAC,CAAC,EAAC,GAAG,oBAAoB,EAAE,CAAC;IACnC,MAAM,CAAC,kBAAkB,EAAE,qBAAqB,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IACpE,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,QAAQ,EAAsB,CAAC;IAE3E,MAAM,kBAAkB,GAAgB,OAAO,CAC3C,GAAG,EAAE,CAAC,CAAC;QACH,KAAK,EAAE,CAAC,CAAC,uBAAuB,CAAE;QAClC,IAAI,EAAE,KAAC,eAAe,IAAC,IAAI,EAAE,aAAa,GAAI;QAC9C,QAAQ,EAAE,CAAC,oBAAoB;QAC/B,QAAQ,EAAE,IAAI,CAAC,EAAE;YACb,iBAAiB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YACjC,qBAAqB,CAAC,CAAC,kBAAkB,CAAC,CAAC;QAC/C,CAAC;KACJ,CAAC,EACF,CAAC,oBAAoB,CAAC,CACzB,CAAC;IAEF,MAAM,aAAa,GAAG,OAAO,CACzB,GAAG,EAAE,CAAC,CAAC;QACH,iBAAiB,EAAE,SAAS,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,IAAI;QACxD,gBAAgB,EACZ,SAAS,IAAI,kBAAkB,CAAC,CAAC,CAAC,CAC9B,KAAC,SAAS,IACN,IAAI,QACJ,MAAM,EAAE,cAAc,EACtB,YAAY,EAAE,YAAY,EAC1B,SAAS,EAAE,SAAS,EACpB,OAAO,EAAE,GAAG,EAAE;gBACV,qBAAqB,CAAC,KAAK,CAAC,CAAC;YACjC,CAAC,GACH,CACL,CAAC,CAAC,CAAC,IAAI;KACf,CAAC,EACF,CAAC,SAAS,EAAE,kBAAkB,EAAE,kBAAkB,CAAC,CACtD,CAAC;IAEF,OAAO,aAAa,CAAC;AACzB,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 {useMemo, useState} from 'react';\nimport {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\nimport {type FeatureHook, type IItemAction} from '../_types';\nimport {LinkModal} from '../link-item/LinkModal';\nimport {type ISubmitMultipleResult} from '_ui/components/RecordEdition/EditRecordContent/_types';\nimport {FontAwesomeIcon} from '@fortawesome/react-fontawesome';\nimport {faExchangeAlt} from '@fortawesome/free-solid-svg-icons';\n\n/**\n * Hook used to get the action for `<DataView />` component.\n *\n * When the mutation for replaceing is done, the Apollo cache will be refreshed (`Record` and `RecordIdentity`)\n * from only replaceed record.\n *\n * It returns also two parts : one for the action button call - one for displaying the modal required by the action.\n *\n * @param isEnabled - whether the action is present\n * @param onReplace - callback to let outside world know about replacing feedback\n * @param canReplaceLinkValues - check permission to delete link values\n */\nexport const useReplaceItemAction = ({\n isEnabled,\n onReplace,\n isMultivalue,\n canReplaceLinkValues,\n}: FeatureHook<{\n isMultivalue: boolean;\n onReplace?: (replaceValuesResult: ISubmitMultipleResult) => void;\n canReplaceLinkValues: boolean;\n}>) => {\n const {t} = useSharedTranslation();\n const [isReplaceModalOpen, setIsReplaceModalOpen] = useState(false);\n const [linkIdSelected, setLinkIdSelected] = useState<string | undefined>();\n\n const _replaceItemAction: IItemAction = useMemo(\n () => ({\n label: t('explorer.replace-item')!,\n icon: <FontAwesomeIcon icon={faExchangeAlt} />,\n disabled: !canReplaceLinkValues,\n callback: item => {\n setLinkIdSelected(item.id_value);\n setIsReplaceModalOpen(!isReplaceModalOpen);\n },\n }),\n [canReplaceLinkValues],\n );\n\n const replaceAction = useMemo(\n () => ({\n replaceItemAction: isEnabled ? _replaceItemAction : null,\n replaceItemModal:\n isEnabled && isReplaceModalOpen ? (\n <LinkModal\n open\n linkId={linkIdSelected}\n isMultivalue={isMultivalue}\n onReplace={onReplace}\n onClose={() => {\n setIsReplaceModalOpen(false);\n }}\n />\n ) : null,\n }),\n [isEnabled, isReplaceModalOpen, _replaceItemAction],\n );\n\n return replaceAction;\n};\n"]}
1
+ {"version":3,"file":"useReplaceItemAction.js","sourceRoot":"","sources":["../../../../src/components/Explorer/actions-item/useReplaceItemAction.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EA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,IACN,IAAI,QACJ,MAAM,EAAE,cAAc,EACtB,YAAY,EAAE,YAAY,EAC1B,SAAS,EAAE,SAAS,EACpB,OAAO,EAAE,GAAG,EAAE;gBACV,qBAAqB,CAAC,KAAK,CAAC,CAAC;YACjC,CAAC,EACD,gBAAgB,EAAE,gBAAgB,GACpC,CACL,CAAC,CAAC,CAAC,IAAI;KACf,CAAC,EACF,CAAC,SAAS,EAAE,kBAAkB,EAAE,kBAAkB,CAAC,CACtD,CAAC;IAEF,OAAO,aAAa,CAAC;AACzB,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 {useMemo, useState} from 'react';\nimport {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\nimport {type FeatureHook, type IItemAction} from '../_types';\nimport {LinkModal} from '../link-item/LinkModal';\nimport {type ISubmitMultipleResult} from '_ui/components/RecordEdition/EditRecordContent/_types';\nimport {FontAwesomeIcon} from '@fortawesome/react-fontawesome';\nimport {faExchangeAlt} from '@fortawesome/free-solid-svg-icons';\n\n/**\n * Hook used to get the action for `<DataView />` component.\n *\n * When the mutation for replaceing is done, the Apollo cache will be refreshed (`Record` and `RecordIdentity`)\n * from only replaceed record.\n *\n * It returns also two parts : one for the action button call - one for displaying the modal required by the action.\n *\n * @param isEnabled - whether the action is present\n * @param onReplace - callback to let outside world know about replacing feedback\n * @param canReplaceLinkValues - check permission to delete link values\n */\nexport const useReplaceItemAction = ({\n isEnabled,\n onReplace,\n isMultivalue,\n canReplaceLinkValues,\n columnsToDisplay,\n}: FeatureHook<{\n isMultivalue: boolean;\n onReplace?: (replaceValuesResult: ISubmitMultipleResult) => void;\n canReplaceLinkValues: boolean;\n columnsToDisplay: string[];\n}>) => {\n const {t} = useSharedTranslation();\n const [isReplaceModalOpen, setIsReplaceModalOpen] = useState(false);\n const [linkIdSelected, setLinkIdSelected] = useState<string | undefined>();\n\n const _replaceItemAction: IItemAction = useMemo(\n () => ({\n label: t('explorer.replace-item')!,\n icon: <FontAwesomeIcon icon={faExchangeAlt} />,\n disabled: !canReplaceLinkValues,\n callback: item => {\n setLinkIdSelected(item.id_value);\n setIsReplaceModalOpen(!isReplaceModalOpen);\n },\n }),\n [canReplaceLinkValues],\n );\n\n const replaceAction = useMemo(\n () => ({\n replaceItemAction: isEnabled ? _replaceItemAction : null,\n replaceItemModal:\n isEnabled && isReplaceModalOpen ? (\n <LinkModal\n open\n linkId={linkIdSelected}\n isMultivalue={isMultivalue}\n onReplace={onReplace}\n onClose={() => {\n setIsReplaceModalOpen(false);\n }}\n columnsToDisplay={columnsToDisplay}\n />\n ) : null,\n }),\n [isEnabled, isReplaceModalOpen, _replaceItemAction],\n );\n\n return replaceAction;\n};\n"]}
@@ -13,13 +13,14 @@ import { type JoinLibraryContextFragment } from '../../../_gqlTypes';
13
13
  * @param maxItemsLeft - the number of items that can be added
14
14
  * @param onLink - callback to let outside world know about linking feedback
15
15
  */
16
- export declare const useLinkPrimaryAction: ({ isEnabled, isVisible, maxItemsLeft, linkId, canAddLinkValue, joinLibraryContext, isMultivalue, onLink, }: FeatureHook<{
16
+ export declare const useLinkPrimaryAction: ({ isEnabled, isVisible, maxItemsLeft, linkId, canAddLinkValue, joinLibraryContext, isMultivalue, onLink, columnsToDisplay, }: FeatureHook<{
17
17
  linkId?: string;
18
18
  maxItemsLeft: number | null;
19
19
  canAddLinkValue: boolean;
20
20
  joinLibraryContext?: JoinLibraryContextFragment;
21
21
  isMultivalue: boolean;
22
22
  onLink?: (saveValuesResult: ISubmitMultipleResult) => void;
23
+ columnsToDisplay: string[];
23
24
  }>) => {
24
25
  linkPrimaryAction: IPrimaryAction;
25
26
  linkModal: JSX.Element;
@@ -19,7 +19,7 @@ import { faPlus } from '@fortawesome/free-solid-svg-icons';
19
19
  * @param maxItemsLeft - the number of items that can be added
20
20
  * @param onLink - callback to let outside world know about linking feedback
21
21
  */
22
- export const useLinkPrimaryAction = ({ isEnabled, isVisible, maxItemsLeft, linkId, canAddLinkValue, joinLibraryContext, isMultivalue, onLink, }) => {
22
+ export const useLinkPrimaryAction = ({ isEnabled, isVisible, maxItemsLeft, linkId, canAddLinkValue, joinLibraryContext, isMultivalue, onLink, columnsToDisplay, }) => {
23
23
  const { t } = useSharedTranslation();
24
24
  const [isLinkModalVisible, setIsLinkModalVisible] = useState(false);
25
25
  const disableAddItemAction = maxItemsLeft === 0 || !canAddLinkValue;
@@ -36,7 +36,7 @@ export const useLinkPrimaryAction = ({ isEnabled, isVisible, maxItemsLeft, linkI
36
36
  linkPrimaryAction: isEnabled && isVisible ? _linkPrimaryAction : null,
37
37
  linkModal: isLinkModalVisible ? (_jsx(LinkModal, { open: true, onLink: onLink, joinLibraryContext: joinLibraryContext, isMultivalue: isMultivalue, linkId: replacementMode ? linkId : undefined, onClose: () => {
38
38
  setIsLinkModalVisible(false);
39
- } })) : null,
39
+ }, columnsToDisplay: columnsToDisplay })) : null,
40
40
  };
41
41
  };
42
42
  //# sourceMappingURL=useLinkPrimaryAction.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useLinkPrimaryAction.js","sourceRoot":"","sources":["../../../../src/components/Explorer/actions-primary/useLinkPrimaryAction.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAC,QAAQ,EAAC,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AAGpE,OAAO,EAAC,SAAS,EAAC,MAAM,wBAAwB,CAAC;AAEjD,OAAO,EAAC,eAAe,EAAC,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAC,MAAM,EAAC,MAAM,mCAAmC,CAAC;AAEzD;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,EACjC,SAAS,EACT,SAAS,EACT,YAAY,EACZ,MAAM,EACN,eAAe,EACf,kBAAkB,EAClB,YAAY,EACZ,MAAM,GAQR,EAAE,EAAE;IACF,MAAM,EAAC,CAAC,EAAC,GAAG,oBAAoB,EAAE,CAAC;IAEnC,MAAM,CAAC,kBAAkB,EAAE,qBAAqB,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAEpE,MAAM,oBAAoB,GAAG,YAAY,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC;IAEpE,MAAM,eAAe,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC;IAEhD,MAAM,kBAAkB,GAAmB;QACvC,QAAQ,EAAE,GAAG,EAAE;YACX,qBAAqB,CAAC,IAAI,CAAC,CAAC;QAChC,CAAC;QACD,IAAI,EAAE,KAAC,eAAe,IAAC,IAAI,EAAE,MAAM,GAAI;QACvC,QAAQ,EAAE,oBAAoB;QAC9B,KAAK,EAAE,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC,yCAAyC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,4BAA4B,CAAC;KAC1G,CAAC;IAEF,OAAO;QACH,iBAAiB,EAAE,SAAS,IAAI,SAAS,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,IAAI;QACrE,SAAS,EAAE,kBAAkB,CAAC,CAAC,CAAC,CAC5B,KAAC,SAAS,IACN,IAAI,QACJ,MAAM,EAAE,MAAM,EACd,kBAAkB,EAAE,kBAAkB,EACtC,YAAY,EAAE,YAAY,EAC1B,MAAM,EAAE,eAAe,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,EAC5C,OAAO,EAAE,GAAG,EAAE;gBACV,qBAAqB,CAAC,KAAK,CAAC,CAAC;YACjC,CAAC,GACH,CACL,CAAC,CAAC,CAAC,IAAI;KACX,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 {useState} from 'react';\nimport {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\nimport {type ISubmitMultipleResult} from '_ui/components/RecordEdition/EditRecordContent/_types';\nimport {type FeatureHook, type IPrimaryAction} from '../_types';\nimport {LinkModal} from '../link-item/LinkModal';\nimport {type JoinLibraryContextFragment} from '_ui/_gqlTypes';\nimport {FontAwesomeIcon} from '@fortawesome/react-fontawesome';\nimport {faPlus} from '@fortawesome/free-solid-svg-icons';\n\n/**\n * Hook used to get the action for `<DataView />` component.\n *\n * When items are linked, the view is refreshed\n *\n * It returns also two parts : one for the call action button - one for displaying the modal required by the action.\n *\n * @param isEnabled - whether the action is present\n * @param isVisible - wether the button should be visible or not\n * @param maxItemsLeft - the number of items that can be added\n * @param onLink - callback to let outside world know about linking feedback\n */\nexport const useLinkPrimaryAction = ({\n isEnabled,\n isVisible,\n maxItemsLeft,\n linkId,\n canAddLinkValue,\n joinLibraryContext,\n isMultivalue,\n onLink,\n}: FeatureHook<{\n linkId?: string;\n maxItemsLeft: number | null;\n canAddLinkValue: boolean;\n joinLibraryContext?: JoinLibraryContextFragment;\n isMultivalue: boolean;\n onLink?: (saveValuesResult: ISubmitMultipleResult) => void;\n}>) => {\n const {t} = useSharedTranslation();\n\n const [isLinkModalVisible, setIsLinkModalVisible] = useState(false);\n\n const disableAddItemAction = maxItemsLeft === 0 || !canAddLinkValue;\n\n const replacementMode = linkId && !isMultivalue;\n\n const _linkPrimaryAction: IPrimaryAction = {\n callback: () => {\n setIsLinkModalVisible(true);\n },\n icon: <FontAwesomeIcon icon={faPlus} />,\n disabled: disableAddItemAction,\n label: replacementMode ? t('record_edition.replace-by-existing-item') : t('explorer.add-existing-item'),\n };\n\n return {\n linkPrimaryAction: isEnabled && isVisible ? _linkPrimaryAction : null,\n linkModal: isLinkModalVisible ? (\n <LinkModal\n open\n onLink={onLink}\n joinLibraryContext={joinLibraryContext}\n isMultivalue={isMultivalue}\n linkId={replacementMode ? linkId : undefined}\n onClose={() => {\n setIsLinkModalVisible(false);\n }}\n />\n ) : null,\n };\n};\n"]}
1
+ {"version":3,"file":"useLinkPrimaryAction.js","sourceRoot":"","sources":["../../../../src/components/Explorer/actions-primary/useLinkPrimaryAction.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAC,QAAQ,EAAC,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AAGpE,OAAO,EAAC,SAAS,EAAC,MAAM,wBAAwB,CAAC;AAEjD,OAAO,EAAC,eAAe,EAAC,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAC,MAAM,EAAC,MAAM,mCAAmC,CAAC;AAEzD;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,EACjC,SAAS,EACT,SAAS,EACT,YAAY,EACZ,MAAM,EACN,eAAe,EACf,kBAAkB,EAClB,YAAY,EACZ,MAAM,EACN,gBAAgB,GASlB,EAAE,EAAE;IACF,MAAM,EAAC,CAAC,EAAC,GAAG,oBAAoB,EAAE,CAAC;IAEnC,MAAM,CAAC,kBAAkB,EAAE,qBAAqB,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAEpE,MAAM,oBAAoB,GAAG,YAAY,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC;IAEpE,MAAM,eAAe,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC;IAEhD,MAAM,kBAAkB,GAAmB;QACvC,QAAQ,EAAE,GAAG,EAAE;YACX,qBAAqB,CAAC,IAAI,CAAC,CAAC;QAChC,CAAC;QACD,IAAI,EAAE,KAAC,eAAe,IAAC,IAAI,EAAE,MAAM,GAAI;QACvC,QAAQ,EAAE,oBAAoB;QAC9B,KAAK,EAAE,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC,yCAAyC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,4BAA4B,CAAC;KAC1G,CAAC;IAEF,OAAO;QACH,iBAAiB,EAAE,SAAS,IAAI,SAAS,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,IAAI;QACrE,SAAS,EAAE,kBAAkB,CAAC,CAAC,CAAC,CAC5B,KAAC,SAAS,IACN,IAAI,QACJ,MAAM,EAAE,MAAM,EACd,kBAAkB,EAAE,kBAAkB,EACtC,YAAY,EAAE,YAAY,EAC1B,MAAM,EAAE,eAAe,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,EAC5C,OAAO,EAAE,GAAG,EAAE;gBACV,qBAAqB,CAAC,KAAK,CAAC,CAAC;YACjC,CAAC,EACD,gBAAgB,EAAE,gBAAgB,GACpC,CACL,CAAC,CAAC,CAAC,IAAI;KACX,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 {useState} from 'react';\nimport {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\nimport {type ISubmitMultipleResult} from '_ui/components/RecordEdition/EditRecordContent/_types';\nimport {type FeatureHook, type IPrimaryAction} from '../_types';\nimport {LinkModal} from '../link-item/LinkModal';\nimport {type JoinLibraryContextFragment} from '_ui/_gqlTypes';\nimport {FontAwesomeIcon} from '@fortawesome/react-fontawesome';\nimport {faPlus} from '@fortawesome/free-solid-svg-icons';\n\n/**\n * Hook used to get the action for `<DataView />` component.\n *\n * When items are linked, the view is refreshed\n *\n * It returns also two parts : one for the call action button - one for displaying the modal required by the action.\n *\n * @param isEnabled - whether the action is present\n * @param isVisible - wether the button should be visible or not\n * @param maxItemsLeft - the number of items that can be added\n * @param onLink - callback to let outside world know about linking feedback\n */\nexport const useLinkPrimaryAction = ({\n isEnabled,\n isVisible,\n maxItemsLeft,\n linkId,\n canAddLinkValue,\n joinLibraryContext,\n isMultivalue,\n onLink,\n columnsToDisplay,\n}: FeatureHook<{\n linkId?: string;\n maxItemsLeft: number | null;\n canAddLinkValue: boolean;\n joinLibraryContext?: JoinLibraryContextFragment;\n isMultivalue: boolean;\n onLink?: (saveValuesResult: ISubmitMultipleResult) => void;\n columnsToDisplay: string[];\n}>) => {\n const {t} = useSharedTranslation();\n\n const [isLinkModalVisible, setIsLinkModalVisible] = useState(false);\n\n const disableAddItemAction = maxItemsLeft === 0 || !canAddLinkValue;\n\n const replacementMode = linkId && !isMultivalue;\n\n const _linkPrimaryAction: IPrimaryAction = {\n callback: () => {\n setIsLinkModalVisible(true);\n },\n icon: <FontAwesomeIcon icon={faPlus} />,\n disabled: disableAddItemAction,\n label: replacementMode ? t('record_edition.replace-by-existing-item') : t('explorer.add-existing-item'),\n };\n\n return {\n linkPrimaryAction: isEnabled && isVisible ? _linkPrimaryAction : null,\n linkModal: isLinkModalVisible ? (\n <LinkModal\n open\n onLink={onLink}\n joinLibraryContext={joinLibraryContext}\n isMultivalue={isMultivalue}\n linkId={replacementMode ? linkId : undefined}\n onClose={() => {\n setIsLinkModalVisible(false);\n }}\n columnsToDisplay={columnsToDisplay}\n />\n ) : null,\n };\n};\n"]}
@@ -9,6 +9,7 @@ interface ILinkModalProps {
9
9
  onClose: () => void;
10
10
  onLink?: (saveValuesResult: ISubmitMultipleResult) => void;
11
11
  onReplace?: (replaceValuesResult: ISubmitMultipleResult) => void;
12
+ columnsToDisplay: string[];
12
13
  }
13
14
  export declare const LinkModal: FunctionComponent<ILinkModalProps>;
14
15
  export {};
@@ -11,7 +11,7 @@ import { useReplaceLinkMassAction } from './useReplaceLinkMassAction';
11
11
  import { LINK_RECORDS_MODAL_CLASSNAME } from '../_constants';
12
12
  import { SelectTreeNodeModal } from '../../../components';
13
13
  import { useSharedTranslation } from '../../../hooks/useSharedTranslation';
14
- export const LinkModal = ({ open, linkId, joinLibraryContext, isMultivalue, onLink, onReplace, onClose, }) => {
14
+ export const LinkModal = ({ open, linkId, joinLibraryContext, isMultivalue, onLink, onReplace, onClose, columnsToDisplay, }) => {
15
15
  const { t } = useSharedTranslation();
16
16
  const { view } = useViewSettingsContext();
17
17
  const linkedLibraryId = joinLibraryContext &&
@@ -68,6 +68,6 @@ export const LinkModal = ({ open, linkId, joinLibraryContext, isMultivalue, onLi
68
68
  },
69
69
  });
70
70
  }
71
- } })) : (_jsx(SelectRecordForLinkModal, { className: LINK_RECORDS_MODAL_CLASSNAME, open: open, childLibraryId: linkedLibraryId || view.libraryId, onSelectionCompleted: isReplacement ? replaceLink : createLinks, replacementMode: isReplacement, selectionMode: isReplacement || !isMultivalue ? 'simple' : 'multiple', hideSelectAllAction: (isReplacement || !isMultivalue) && view.entrypoint.type === 'link', valuesList: valuesList, allowFreeEntry: allowFreeEntry, isMultivalue: isMultivalue, onClose: onClose }));
71
+ } })) : (_jsx(SelectRecordForLinkModal, { className: LINK_RECORDS_MODAL_CLASSNAME, open: open, childLibraryId: linkedLibraryId || view.libraryId, onSelectionCompleted: isReplacement ? replaceLink : createLinks, replacementMode: isReplacement, selectionMode: isReplacement || !isMultivalue ? 'simple' : 'multiple', hideSelectAllAction: (isReplacement || !isMultivalue) && view.entrypoint.type === 'link', valuesList: valuesList, allowFreeEntry: allowFreeEntry, isMultivalue: isMultivalue, onClose: onClose, columnsToDisplay: columnsToDisplay }));
72
72
  };
73
73
  //# sourceMappingURL=LinkModal.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"LinkModal.js","sourceRoot":"","sources":["../../../../src/components/Explorer/link-item/LinkModal.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAyB,OAAO,EAAC,MAAM,OAAO,CAAC;AACtD,OAAO,EAAkC,6BAA6B,EAAC,MAAM,eAAe,CAAC;AAE7F,OAAO,EAAC,wBAAwB,EAAC,MAAM,yCAAyC,CAAC;AAEjF,OAAO,EAAC,oBAAoB,EAAC,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAC,sBAAsB,EAAC,MAAM,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,MAAM,OAAO,GAAG,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;YACnD,IAAI,aAAa,EAAE,CAAC;gBAChB,WAAW,CAAC;oBACR,OAAO,EAAE;wBACL,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAC,EAAE,EAAC,CAAC,CAAC;qBAClC;iBACJ,CAAC,CAAC;YACP,CAAC;iBAAM,CAAC;gBACJ,WAAW,CAAC;oBACR,OAAO,EAAE;wBACL,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAC,EAAE,EAAC,CAAC,CAAC;qBAClC;iBACJ,CAAC,CAAC;YACP,CAAC;QACL,CAAC,GACH,CACL,CAAC,CAAC,CAAC,CACA,KAAC,wBAAwB,IACrB,SAAS,EAAE,4BAA4B,EACvC,IAAI,EAAE,IAAI,EACV,cAAc,EAAE,eAAe,IAAI,IAAI,CAAC,SAAS,EACjD,oBAAoB,EAAE,aAAa,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,WAAW,EAC/D,eAAe,EAAE,aAAa,EAC9B,aAAa,EAAE,aAAa,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAU,EACrE,mBAAmB,EAAE,CAAC,aAAa,IAAI,CAAC,YAAY,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC,IAAI,KAAK,MAAM,EACxF,UAAU,EAAE,UAAU,EACtB,cAAc,EAAE,cAAc,EAC9B,YAAY,EAAE,YAAY,EAC1B,OAAO,EAAE,OAAO,GAClB,CACL,CAAC;AACN,CAAC,CAAC","sourcesContent":["// Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06\n// This file is released under LGPL V3\n// License text available at https://www.gnu.org/licenses/lgpl-3.0.txt\nimport {type FunctionComponent, useMemo} from 'react';\nimport {type JoinLibraryContextFragment, useExplorerLinkAttributeQuery} from '_ui/_gqlTypes';\nimport {type ISubmitMultipleResult} from '_ui/components/RecordEdition/EditRecordContent/_types';\nimport {SelectRecordForLinkModal} from '_ui/components/SelectRecordForLinkModal';\nimport {type IEntrypointLink} from '../_types';\nimport {useAddLinkMassAction} from './useAddLinkMassAction';\nimport {useViewSettingsContext} from '../manage-view-settings/store-view-settings/useViewSettingsContext';\nimport {useReplaceLinkMassAction} from './useReplaceLinkMassAction';\nimport {LINK_RECORDS_MODAL_CLASSNAME} from '../_constants';\nimport {SelectTreeNodeModal} from '_ui/components';\nimport {ITreeNodeWithRecord} from '_ui/types';\nimport {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\n\ninterface ILinkModalProps {\n open: boolean;\n linkId?: string;\n joinLibraryContext?: JoinLibraryContextFragment;\n isMultivalue: boolean;\n onClose: () => void;\n onLink?: (saveValuesResult: ISubmitMultipleResult) => void;\n onReplace?: (replaceValuesResult: ISubmitMultipleResult) => void;\n}\n\nexport const LinkModal: FunctionComponent<ILinkModalProps> = ({\n open,\n linkId,\n joinLibraryContext,\n isMultivalue,\n onLink,\n onReplace,\n onClose,\n}) => {\n const {t} = useSharedTranslation();\n const {view} = useViewSettingsContext();\n const linkedLibraryId =\n joinLibraryContext &&\n 'linked_library' in joinLibraryContext.mandatoryAttribute &&\n joinLibraryContext.mandatoryAttribute.linked_library?.id;\n const linkedTreeId =\n joinLibraryContext &&\n 'linked_tree' in joinLibraryContext.mandatoryAttribute &&\n joinLibraryContext.mandatoryAttribute.linked_tree?.id;\n\n const isReplacement = !!linkId;\n\n const {data: attributeData} = useExplorerLinkAttributeQuery({\n skip: view.entrypoint.type !== 'link',\n variables: {\n id: (view.entrypoint as IEntrypointLink).linkAttributeId,\n },\n });\n\n const {createLinks} = useAddLinkMassAction({\n store: {view},\n linkAttributeId: (view.entrypoint as IEntrypointLink).linkAttributeId,\n onLink,\n closeModal: onClose,\n });\n\n const {replaceLink} = useReplaceLinkMassAction({\n store: {view},\n linkAttributeId: (view.entrypoint as IEntrypointLink).linkAttributeId,\n linkId,\n onReplace,\n closeModal: onClose,\n });\n\n const linkAttributeData = attributeData?.attributes?.list[0];\n const isValuesListEnabled =\n linkAttributeData && 'valuesList' in linkAttributeData && linkAttributeData.valuesList?.enable;\n\n const valuesList = useMemo(\n () => (isValuesListEnabled ? linkAttributeData.valuesList?.linkedValues?.map(value => value.id) : undefined),\n [isValuesListEnabled, linkAttributeData],\n );\n const allowFreeEntry = useMemo(\n () => (isValuesListEnabled ? Boolean(linkAttributeData.valuesList?.allowFreeEntry) : true),\n [isValuesListEnabled, linkAttributeData],\n );\n\n return linkedTreeId ? (\n <SelectTreeNodeModal\n open\n attribute={{\n multiple_values: isMultivalue,\n linked_tree: {\n id: linkedTreeId,\n },\n }}\n title={t(isMultivalue ? 'tree-node-selection.title_many' : 'tree-node-selection.title')}\n // We can select new node(s), ignoring current value(s).\n // Selected element might be duplicated in link attribute in backend for now.\n backendValues={[]}\n onClose={onClose}\n onConfirm={selectedNodes => {\n const nodeIds = selectedNodes.map(node => node.id);\n if (isReplacement) {\n replaceLink({\n records: {\n list: nodeIds.map(id => ({id})),\n },\n });\n } else {\n createLinks({\n records: {\n list: nodeIds.map(id => ({id})),\n },\n });\n }\n }}\n />\n ) : (\n <SelectRecordForLinkModal\n className={LINK_RECORDS_MODAL_CLASSNAME}\n open={open}\n childLibraryId={linkedLibraryId || view.libraryId}\n onSelectionCompleted={isReplacement ? replaceLink : createLinks}\n replacementMode={isReplacement}\n selectionMode={isReplacement || !isMultivalue ? 'simple' : 'multiple'}\n hideSelectAllAction={(isReplacement || !isMultivalue) && view.entrypoint.type === 'link'}\n valuesList={valuesList}\n allowFreeEntry={allowFreeEntry}\n isMultivalue={isMultivalue}\n onClose={onClose}\n />\n );\n};\n"]}
1
+ {"version":3,"file":"LinkModal.js","sourceRoot":"","sources":["../../../../src/components/Explorer/link-item/LinkModal.tsx"],"names":[],"mappings":";AAAA,oFAAoF;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MAAM,EACxF,UAAU,EAAE,UAAU,EACtB,cAAc,EAAE,cAAc,EAC9B,YAAY,EAAE,YAAY,EAC1B,OAAO,EAAE,OAAO,EAChB,gBAAgB,EAAE,gBAAgB,GACpC,CACL,CAAC;AACN,CAAC,CAAC","sourcesContent":["// Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06\n// This file is released under LGPL V3\n// License text available at https://www.gnu.org/licenses/lgpl-3.0.txt\nimport {type FunctionComponent, useMemo} from 'react';\nimport {type JoinLibraryContextFragment, useExplorerLinkAttributeQuery} from '_ui/_gqlTypes';\nimport {type ISubmitMultipleResult} from '_ui/components/RecordEdition/EditRecordContent/_types';\nimport {SelectRecordForLinkModal} from '_ui/components/SelectRecordForLinkModal';\nimport {type IEntrypointLink} from '../_types';\nimport {useAddLinkMassAction} from './useAddLinkMassAction';\nimport {useViewSettingsContext} from '../manage-view-settings/store-view-settings/useViewSettingsContext';\nimport {useReplaceLinkMassAction} from './useReplaceLinkMassAction';\nimport {LINK_RECORDS_MODAL_CLASSNAME} from '../_constants';\nimport {SelectTreeNodeModal} from '_ui/components';\nimport {ITreeNodeWithRecord} from '_ui/types';\nimport {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\n\ninterface ILinkModalProps {\n open: boolean;\n linkId?: string;\n joinLibraryContext?: JoinLibraryContextFragment;\n isMultivalue: boolean;\n onClose: () => void;\n onLink?: (saveValuesResult: ISubmitMultipleResult) => void;\n onReplace?: (replaceValuesResult: ISubmitMultipleResult) => void;\n columnsToDisplay: string[];\n}\n\nexport const LinkModal: FunctionComponent<ILinkModalProps> = ({\n open,\n linkId,\n joinLibraryContext,\n isMultivalue,\n onLink,\n onReplace,\n onClose,\n columnsToDisplay,\n}) => {\n const {t} = useSharedTranslation();\n const {view} = useViewSettingsContext();\n const linkedLibraryId =\n joinLibraryContext &&\n 'linked_library' in joinLibraryContext.mandatoryAttribute &&\n joinLibraryContext.mandatoryAttribute.linked_library?.id;\n const linkedTreeId =\n joinLibraryContext &&\n 'linked_tree' in joinLibraryContext.mandatoryAttribute &&\n joinLibraryContext.mandatoryAttribute.linked_tree?.id;\n\n const isReplacement = !!linkId;\n\n const {data: attributeData} = useExplorerLinkAttributeQuery({\n skip: view.entrypoint.type !== 'link',\n variables: {\n id: (view.entrypoint as IEntrypointLink).linkAttributeId,\n },\n });\n\n const {createLinks} = useAddLinkMassAction({\n store: {view},\n linkAttributeId: (view.entrypoint as IEntrypointLink).linkAttributeId,\n onLink,\n closeModal: onClose,\n });\n\n const {replaceLink} = useReplaceLinkMassAction({\n store: {view},\n linkAttributeId: (view.entrypoint as IEntrypointLink).linkAttributeId,\n linkId,\n onReplace,\n closeModal: onClose,\n });\n\n const linkAttributeData = attributeData?.attributes?.list[0];\n const isValuesListEnabled =\n linkAttributeData && 'valuesList' in linkAttributeData && linkAttributeData.valuesList?.enable;\n\n const valuesList = useMemo(\n () => (isValuesListEnabled ? linkAttributeData.valuesList?.linkedValues?.map(value => value.id) : undefined),\n [isValuesListEnabled, linkAttributeData],\n );\n const allowFreeEntry = useMemo(\n () => (isValuesListEnabled ? Boolean(linkAttributeData.valuesList?.allowFreeEntry) : true),\n [isValuesListEnabled, linkAttributeData],\n );\n\n return linkedTreeId ? (\n <SelectTreeNodeModal\n open\n attribute={{\n multiple_values: isMultivalue,\n linked_tree: {\n id: linkedTreeId,\n },\n }}\n title={t(isMultivalue ? 'tree-node-selection.title_many' : 'tree-node-selection.title')}\n // We can select new node(s), ignoring current value(s).\n // Selected element might be duplicated in link attribute in backend for now.\n backendValues={[]}\n onClose={onClose}\n onConfirm={selectedNodes => {\n const nodeIds = selectedNodes.map(node => node.id);\n if (isReplacement) {\n replaceLink({\n records: {\n list: nodeIds.map(id => ({id})),\n },\n });\n } else {\n createLinks({\n records: {\n list: nodeIds.map(id => ({id})),\n },\n });\n }\n }}\n />\n ) : (\n <SelectRecordForLinkModal\n className={LINK_RECORDS_MODAL_CLASSNAME}\n open={open}\n childLibraryId={linkedLibraryId || view.libraryId}\n onSelectionCompleted={isReplacement ? replaceLink : createLinks}\n replacementMode={isReplacement}\n selectionMode={isReplacement || !isMultivalue ? 'simple' : 'multiple'}\n hideSelectAllAction={(isReplacement || !isMultivalue) && view.entrypoint.type === 'link'}\n valuesList={valuesList}\n allowFreeEntry={allowFreeEntry}\n isMultivalue={isMultivalue}\n onClose={onClose}\n columnsToDisplay={columnsToDisplay}\n />\n );\n};\n"]}
@@ -14,6 +14,7 @@ export const prepareViewForRequest = (view, filters, label) => ({
14
14
  // TODO : save filter values as string[] when tree filter and handle fields with libraries
15
15
  value: filter.value?.[0],
16
16
  condition: filter.condition,
17
+ withEmptyValues: filter.withEmptyValues,
17
18
  };
18
19
  }
19
20
  if (isUIFilterThrough(filter)) {
@@ -30,12 +31,14 @@ export const prepareViewForRequest = (view, filters, label) => ({
30
31
  // TODO : save filter values as string[] when filter and handle fields with libraries
31
32
  value: filter.value?.[0],
32
33
  condition: filter.condition,
34
+ withEmptyValues: filter.withEmptyValues,
33
35
  };
34
36
  }
35
37
  return {
36
38
  field: filter.field,
37
39
  value: filter.value,
38
40
  condition: filter.condition,
41
+ withEmptyValues: filter.withEmptyValues,
39
42
  };
40
43
  }),
41
44
  sort: view.sort.map(({ field, order }) => ({ field, order })),
@@ -1 +1 @@
1
- {"version":3,"file":"prepareViewForRequest.js","sourceRoot":"","sources":["../../../../../src/components/Explorer/manage-view-settings/save-view/prepareViewForRequest.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,+BAA+B,EAAC,MAAM,kBAAkB,CAAC;AAEjE,OAAO,EAAC,cAAc,EAAE,iBAAiB,EAAE,mBAAmB,EAAgB,MAAM,+BAA+B,CAAC;AAEpH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CACjC,IAAwB,EACxB,OAAmB,EACnB,KAA6B,EACpB,EAAE,CAAC,CAAC;IACb,OAAO,EAAE,IAAI,CAAC,SAAS;IACvB,MAAM,EAAE,KAAK;IACb,OAAO,EAAE;QACL,IAAI,E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AK;CACR,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 RecordFilterInput, type ViewInput} from '_ui/_gqlTypes';\nimport {mapViewTypeFromExplorerToLegacy} from '../../_constants';\nimport {type IViewSettingsState} from '../store-view-settings/viewSettingsReducer';\nimport {isUIFilterTree, isUIFilterThrough, isUIFilterValueList, type UIFilter} from '_ui/components/Filters/_types';\n\nexport const prepareViewForRequest = (\n view: IViewSettingsState,\n filters: UIFilter[],\n label: Record<string, string>,\n): ViewInput => ({\n library: view.libraryId,\n shared: false,\n display: {\n type: mapViewTypeFromExplorerToLegacy[view.viewType],\n },\n filters: filters.map((filter): RecordFilterInput => {\n if (isUIFilterTree(filter)) {\n return {\n // TODO save filter.field, but need to handle Through an other way in useTransformFilters.toValidFilters to keep that field as saved\n field: filter.attribute.id,\n // TODO : save filter values as string[] when tree filter and handle fields with libraries\n value: filter.value?.[0],\n condition: filter.condition,\n };\n }\n if (isUIFilterThrough(filter)) {\n return {\n field: `${filter.field}.${filter.subField}`,\n value: filter.value,\n condition: filter.subCondition,\n };\n }\n\n if (isUIFilterValueList(filter)) {\n return {\n // TODO save filter.field, but need to handle Through an other way in useTransformFilters.toValidFilters to keep that field as saved\n field: filter.attribute.id,\n // TODO : save filter values as string[] when filter and handle fields with libraries\n value: filter.value?.[0],\n condition: filter.condition,\n };\n }\n\n return {\n field: filter.field,\n value: filter.value,\n condition: filter.condition,\n };\n }),\n sort: view.sort.map(({field, order}) => ({field, order})),\n attributes: view.attributesIds,\n label,\n});\n"]}
1
+ {"version":3,"file":"prepareViewForRequest.js","sourceRoot":"","sources":["../../../../../src/components/Explorer/manage-view-settings/save-view/prepareViewForRequest.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,+BAA+B,EAAC,MAAM,kBAAkB,CAAC;AAEjE,OAAO,EAAC,cAAc,EAAE,iB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,CAAC,KAAK;YACnB,KAAK,EAAE,MAAM,CAAC,KAAK;YACnB,SAAS,EAAE,MAAM,CAAC,SAAS;YAC3B,eAAe,EAAE,MAAM,CAAC,eAAe;SAC1C,CAAC;IACN,CAAC,CAAC;IACF,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAC,KAAK,EAAE,KAAK,EAAC,EAAE,EAAE,CAAC,CAAC,EAAC,KAAK,EAAE,KAAK,EAAC,CAAC,CAAC;IACzD,UAAU,EAAE,IAAI,CAAC,aAAa;IAC9B,KAAK;CACR,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 RecordFilterInput, type ViewInput} from '_ui/_gqlTypes';\nimport {mapViewTypeFromExplorerToLegacy} from '../../_constants';\nimport {type IViewSettingsState} from '../store-view-settings/viewSettingsReducer';\nimport {isUIFilterTree, isUIFilterThrough, isUIFilterValueList, type UIFilter} from '_ui/components/Filters/_types';\n\nexport const prepareViewForRequest = (\n view: IViewSettingsState,\n filters: UIFilter[],\n label: Record<string, string>,\n): ViewInput => ({\n library: view.libraryId,\n shared: false,\n display: {\n type: mapViewTypeFromExplorerToLegacy[view.viewType],\n },\n filters: filters.map((filter): RecordFilterInput => {\n if (isUIFilterTree(filter)) {\n return {\n // TODO save filter.field, but need to handle Through an other way in useTransformFilters.toValidFilters to keep that field as saved\n field: filter.attribute.id,\n // TODO : save filter values as string[] when tree filter and handle fields with libraries\n value: filter.value?.[0],\n condition: filter.condition,\n withEmptyValues: filter.withEmptyValues,\n };\n }\n if (isUIFilterThrough(filter)) {\n return {\n field: `${filter.field}.${filter.subField}`,\n value: filter.value,\n condition: filter.subCondition,\n };\n }\n\n if (isUIFilterValueList(filter)) {\n return {\n // TODO save filter.field, but need to handle Through an other way in useTransformFilters.toValidFilters to keep that field as saved\n field: filter.attribute.id,\n // TODO : save filter values as string[] when filter and handle fields with libraries\n value: filter.value?.[0],\n condition: filter.condition,\n withEmptyValues: filter.withEmptyValues,\n };\n }\n\n return {\n field: filter.field,\n value: filter.value,\n condition: filter.condition,\n withEmptyValues: filter.withEmptyValues,\n };\n }),\n sort: view.sort.map(({field, order}) => ({field, order})),\n attributes: view.attributesIds,\n label,\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"]}
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;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 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"]}
@@ -19,7 +19,7 @@ export const FiltersActionTypes = {
19
19
  UPDATE_VIEWS: 'UPDATE_VIEWS',
20
20
  };
21
21
  const addFilter = (state, payload) => {
22
- const hasValueList = payload.attribute.valuesList;
22
+ const hasValueList = payload.attribute.valuesList?.enable;
23
23
  let condition = hasOnlyNoValueConditions(payload.attribute.format)
24
24
  ? null
25
25
  : (conditionsByFormat[payload.attribute.format][0] ?? null);
@@ -82,6 +82,7 @@ const resetFilter = (state, payload) => ({
82
82
  ? null
83
83
  : conditionsByFormat[filter.attribute.format][0],
84
84
  value: null,
85
+ formattedValue: null,
85
86
  };
86
87
  }
87
88
  if (isUIFilterThrough(filter)) {
@@ -89,6 +90,7 @@ const resetFilter = (state, payload) => ({
89
90
  ...filter,
90
91
  condition: ThroughConditionFilter.THROUGH,
91
92
  value: null,
93
+ formattedValue: null,
92
94
  };
93
95
  }
94
96
  if (isUIFilterLink(filter)) {
@@ -96,6 +98,7 @@ const resetFilter = (state, payload) => ({
96
98
  ...filter,
97
99
  condition: conditionsByFormat[AttributeFormat.text][0],
98
100
  value: null,
101
+ formattedValue: null,
99
102
  };
100
103
  }
101
104
  if (isUIFilterTree(filter)) {
@@ -103,6 +106,7 @@ const resetFilter = (state, payload) => ({
103
106
  ...filter,
104
107
  condition: null,
105
108
  value: null,
109
+ formattedValue: null,
106
110
  };
107
111
  }
108
112
  }