@leav/ui 1.6.0-a91c4173 → 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 (97) hide show
  1. package/dist/_gqlTypes/index.d.ts +16 -0
  2. package/dist/_gqlTypes/index.js +4 -1
  3. package/dist/_gqlTypes/index.js.map +1 -1
  4. package/dist/_queries/trees/treeNodeChildrenQuery.js +2 -0
  5. package/dist/_queries/trees/treeNodeChildrenQuery.js.map +1 -1
  6. package/dist/_queries/views/viewDetailsFragment.js +1 -0
  7. package/dist/_queries/views/viewDetailsFragment.js.map +1 -1
  8. package/dist/components/AttributesSelectionList/sharedComponents.d.ts +159 -153
  9. package/dist/components/Explorer/Explorer.js +3 -1
  10. package/dist/components/Explorer/Explorer.js.map +1 -1
  11. package/dist/components/Explorer/ExplorerFiltersAndSorts.js +1 -1
  12. package/dist/components/Explorer/ExplorerFiltersAndSorts.js.map +1 -1
  13. package/dist/components/Explorer/TableCell.js +1 -0
  14. package/dist/components/Explorer/TableCell.js.map +1 -1
  15. package/dist/components/Explorer/actions-item/useReplaceItemAction.d.ts +2 -1
  16. package/dist/components/Explorer/actions-item/useReplaceItemAction.js +2 -2
  17. package/dist/components/Explorer/actions-item/useReplaceItemAction.js.map +1 -1
  18. package/dist/components/Explorer/actions-mass/useExportMassAction.js +2 -1
  19. package/dist/components/Explorer/actions-mass/useExportMassAction.js.map +1 -1
  20. package/dist/components/Explorer/actions-primary/useLinkPrimaryAction.d.ts +2 -1
  21. package/dist/components/Explorer/actions-primary/useLinkPrimaryAction.js +2 -2
  22. package/dist/components/Explorer/actions-primary/useLinkPrimaryAction.js.map +1 -1
  23. package/dist/components/Explorer/link-item/LinkModal.d.ts +1 -0
  24. package/dist/components/Explorer/link-item/LinkModal.js +2 -2
  25. package/dist/components/Explorer/link-item/LinkModal.js.map +1 -1
  26. package/dist/components/Explorer/manage-view-settings/save-view/prepareViewForRequest.js +3 -0
  27. package/dist/components/Explorer/manage-view-settings/save-view/prepareViewForRequest.js.map +1 -1
  28. package/dist/components/Filters/FiltersProvider.d.ts +2 -2
  29. package/dist/components/Filters/FiltersProvider.js.map +1 -1
  30. package/dist/components/Filters/_types.d.ts +3 -0
  31. package/dist/components/Filters/_types.js.map +1 -1
  32. package/dist/components/Filters/context/filtersReducer.js +5 -1
  33. package/dist/components/Filters/context/filtersReducer.js.map +1 -1
  34. package/dist/components/Filters/filter-items/CommonFilterItem.d.ts +1 -0
  35. package/dist/components/Filters/filter-items/CommonFilterItem.js +28 -8
  36. package/dist/components/Filters/filter-items/CommonFilterItem.js.map +1 -1
  37. package/dist/components/Filters/filter-items/EmptyValueCheckbox.d.ts +8 -0
  38. package/dist/components/Filters/filter-items/EmptyValueCheckbox.js +16 -0
  39. package/dist/components/Filters/filter-items/EmptyValueCheckbox.js.map +1 -0
  40. package/dist/components/Filters/filter-items/filter-type/ColorAttributeDropDown.js +9 -8
  41. package/dist/components/Filters/filter-items/filter-type/ColorAttributeDropDown.js.map +1 -1
  42. package/dist/components/Filters/filter-items/filter-type/FilterDropDown.js +2 -2
  43. package/dist/components/Filters/filter-items/filter-type/FilterDropDown.js.map +1 -1
  44. package/dist/components/Filters/filter-items/filter-type/FilterDropdownContent.js +1 -1
  45. package/dist/components/Filters/filter-items/filter-type/FilterDropdownContent.js.map +1 -1
  46. package/dist/components/Filters/filter-items/filter-type/FilterValueListDropDown.d.ts +0 -1
  47. package/dist/components/Filters/filter-items/filter-type/FilterValueListDropDown.js +14 -21
  48. package/dist/components/Filters/filter-items/filter-type/FilterValueListDropDown.js.map +1 -1
  49. package/dist/components/Filters/filter-items/filter-type/TreeAttributeDropDown.js +10 -12
  50. package/dist/components/Filters/filter-items/filter-type/TreeAttributeDropDown.js.map +1 -1
  51. package/dist/components/Filters/filter-items/filter-type/useConditionOptionsByType.js +3 -13
  52. package/dist/components/Filters/filter-items/filter-type/useConditionOptionsByType.js.map +1 -1
  53. package/dist/components/Filters/prepareFiltersForRequest.js +36 -3
  54. package/dist/components/Filters/prepareFiltersForRequest.js.map +1 -1
  55. package/dist/components/Filters/useFilters.d.ts +5 -0
  56. package/dist/components/Filters/useTransformFilters.js +4 -0
  57. package/dist/components/Filters/useTransformFilters.js.map +1 -1
  58. package/dist/components/LibraryItemsList/FiltersPanel/FiltersOptions.js +1 -8
  59. package/dist/components/LibraryItemsList/FiltersPanel/FiltersOptions.js.map +1 -1
  60. package/dist/components/RecordEdition/EditRecordContent/uiElements/LinkField/shared/ExplorerWrapper.d.ts +53 -51
  61. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/TreeField.js +6 -0
  62. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/TreeField.js.map +1 -1
  63. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/display-tree-node/TreeFieldWrapper.d.ts +53 -51
  64. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/manage-tree-node-selection/SelectTreeNodeModal.d.ts +2 -1
  65. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/manage-tree-node-selection/SelectTreeNodeModal.js +2 -2
  66. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/manage-tree-node-selection/SelectTreeNodeModal.js.map +1 -1
  67. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/manage-tree-node-selection/useManageTreeNodeSelection.d.ts +3 -2
  68. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/manage-tree-node-selection/useManageTreeNodeSelection.js +2 -2
  69. package/dist/components/RecordEdition/EditRecordContent/uiElements/TreeField/manage-tree-node-selection/useManageTreeNodeSelection.js.map +1 -1
  70. package/dist/components/SelectRecordForLinkModal/SelectRecordForLinkModal.d.ts +1 -0
  71. package/dist/components/SelectRecordForLinkModal/SelectRecordForLinkModal.js +4 -2
  72. package/dist/components/SelectRecordForLinkModal/SelectRecordForLinkModal.js.map +1 -1
  73. package/dist/components/SelectTreeNode/SelectTreeNode.d.ts +2 -1
  74. package/dist/components/SelectTreeNode/SelectTreeNode.js +3 -3
  75. package/dist/components/SelectTreeNode/SelectTreeNode.js.map +1 -1
  76. package/dist/components/SelectTreeNode/SelectTreeNodeContent.d.ts +2 -1
  77. package/dist/components/SelectTreeNode/SelectTreeNodeContent.js +6 -2
  78. package/dist/components/SelectTreeNode/SelectTreeNodeContent.js.map +1 -1
  79. package/dist/constants.d.ts +1 -0
  80. package/dist/constants.js +1 -0
  81. package/dist/constants.js.map +1 -1
  82. package/dist/hooks/useIFrameMessenger/messageHandlers.d.ts +2 -1
  83. package/dist/hooks/useIFrameMessenger/messageHandlers.js +8 -0
  84. package/dist/hooks/useIFrameMessenger/messageHandlers.js.map +1 -1
  85. package/dist/hooks/useIFrameMessenger/schema.d.ts +3 -0
  86. package/dist/hooks/useIFrameMessenger/schema.js +1 -0
  87. package/dist/hooks/useIFrameMessenger/schema.js.map +1 -1
  88. package/dist/hooks/useIFrameMessenger/types.d.ts +12 -2
  89. package/dist/hooks/useIFrameMessenger/types.js.map +1 -1
  90. package/dist/hooks/useIFrameMessenger/useIFrameMessenger.d.ts +1 -0
  91. package/dist/hooks/useIFrameMessenger/useIFrameMessenger.js +15 -0
  92. package/dist/hooks/useIFrameMessenger/useIFrameMessenger.js.map +1 -1
  93. package/dist/hooks/useIFrameMessengerClient/iFrameMessengerClientContext.d.ts +1 -0
  94. package/dist/hooks/useIFrameMessengerClient/useIFrameMessengerClient.d.ts +1 -0
  95. package/dist/locales/en/shared.json +2 -1
  96. package/dist/locales/fr/shared.json +2 -1
  97. package/package.json +3 -5
@@ -1 +1 @@
1
- {"version":3,"file":"FiltersOptions.js","sourceRoot":"","sources":["../../../../src/components/LibraryItemsList/FiltersPanel/FiltersOptions.tsx"],"names":[],"mappings":"AAIA,OAAO,EACH,wBAAwB,EAExB,UAAU,EAGV,cAAc,EACd,mBAAmB,GACtB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAC,eAAe,EAA6B,MAAM,eAAe,CAAC;AAQ1E,MAAM,wBA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E,MAAM;gBAC3C,wBAAwB,CAAC,eAAe,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,QAAQ,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;gBAChG,CAAC,eAAe,CAAC,SAAS,CAAC,UAAU,IAAI,uBAAuB,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC,EAC1F,CAAC;gBACC,OAAO,IAAI,CAAC;YAChB,CAAC;QACL,CAAC;QAED,OAAO,KAAK,CAAC;IACjB,CAAC,CAAC,CAAC;IAEH,OAAO,sBAAsB,CAAC;AAClC,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 TFunction} from 'i18next';\nimport {\n AttributeConditionFilter,\n type AttributeConditionType,\n FilterType,\n type IFilter,\n type IFilterAttribute,\n OperatorFilter,\n TreeConditionFilter,\n} from '_ui/types/search';\nimport {AttributeFormat, type RecordFilterCondition} from '_ui/_gqlTypes';\n\nexport interface IFilterConditionOption<T> {\n text: string;\n value: T;\n textByFormat?: {[key in AttributeFormat]?: string};\n}\n\nconst allowedConditionByFormat: {[format in AttributeFormat]: AttributeConditionType[]} = {\n [AttributeFormat.text]: [\n AttributeConditionFilter.CONTAINS,\n AttributeConditionFilter.NOT_CONTAINS,\n AttributeConditionFilter.EQUAL,\n AttributeConditionFilter.NOT_EQUAL,\n AttributeConditionFilter.BEGIN_WITH,\n AttributeConditionFilter.END_WITH,\n AttributeConditionFilter.IS_EMPTY,\n AttributeConditionFilter.IS_NOT_EMPTY,\n ],\n [AttributeFormat.extended]: [\n AttributeConditionFilter.CONTAINS,\n AttributeConditionFilter.NOT_CONTAINS,\n AttributeConditionFilter.EQUAL,\n AttributeConditionFilter.NOT_EQUAL,\n AttributeConditionFilter.BEGIN_WITH,\n AttributeConditionFilter.END_WITH,\n AttributeConditionFilter.IS_EMPTY,\n AttributeConditionFilter.IS_NOT_EMPTY,\n ],\n [AttributeFormat.encrypted]: [AttributeConditionFilter.IS_EMPTY, AttributeConditionFilter.IS_NOT_EMPTY],\n [AttributeFormat.numeric]: [\n AttributeConditionFilter.EQUAL,\n AttributeConditionFilter.NOT_EQUAL,\n AttributeConditionFilter.GREATER_THAN,\n AttributeConditionFilter.LESS_THAN,\n AttributeConditionFilter.IS_EMPTY,\n AttributeConditionFilter.IS_NOT_EMPTY,\n ],\n [AttributeFormat.boolean]: [AttributeConditionFilter.EQUAL, AttributeConditionFilter.NOT_EQUAL],\n [AttributeFormat.date]: [\n AttributeConditionFilter.EQUAL,\n AttributeConditionFilter.NOT_EQUAL,\n AttributeConditionFilter.GREATER_THAN,\n AttributeConditionFilter.LESS_THAN,\n AttributeConditionFilter.IS_EMPTY,\n AttributeConditionFilter.IS_NOT_EMPTY,\n AttributeConditionFilter.TODAY,\n AttributeConditionFilter.TOMORROW,\n AttributeConditionFilter.YESTERDAY,\n AttributeConditionFilter.LAST_MONTH,\n AttributeConditionFilter.NEXT_MONTH,\n AttributeConditionFilter.BETWEEN,\n ],\n [AttributeFormat.date_range]: [\n AttributeConditionFilter.CONTAINS,\n AttributeConditionFilter.START_ON,\n AttributeConditionFilter.START_AFTER,\n AttributeConditionFilter.START_BEFORE,\n AttributeConditionFilter.END_ON,\n AttributeConditionFilter.END_AFTER,\n AttributeConditionFilter.END_BEFORE,\n AttributeConditionFilter.IS_EMPTY,\n AttributeConditionFilter.IS_NOT_EMPTY,\n ],\n [AttributeFormat.color]: [\n AttributeConditionFilter.CONTAINS,\n AttributeConditionFilter.NOT_CONTAINS,\n AttributeConditionFilter.EQUAL,\n AttributeConditionFilter.NOT_EQUAL,\n AttributeConditionFilter.IS_EMPTY,\n AttributeConditionFilter.IS_NOT_EMPTY,\n ],\n [AttributeFormat.rich_text]: [\n AttributeConditionFilter.CONTAINS,\n AttributeConditionFilter.NOT_CONTAINS,\n AttributeConditionFilter.IS_EMPTY,\n AttributeConditionFilter.IS_NOT_EMPTY,\n ],\n};\n\nexport function getAttributeConditionOptions(t: TFunction): Array<IFilterConditionOption<AttributeConditionType>> {\n return [\n {text: t('filters.contains'), value: AttributeConditionFilter.CONTAINS},\n {text: t('filters.not-contains'), value: AttributeConditionFilter.NOT_CONTAINS},\n {text: t('filters.equal'), value: AttributeConditionFilter.EQUAL},\n {text: t('filters.not-equal'), value: AttributeConditionFilter.NOT_EQUAL},\n {text: t('filters.begin-with'), value: AttributeConditionFilter.BEGIN_WITH},\n {text: t('filters.end-with'), value: AttributeConditionFilter.END_WITH},\n {\n text: t('filters.less-than'),\n textByFormat: {[AttributeFormat.date]: t('filters.before')},\n value: AttributeConditionFilter.LESS_THAN,\n },\n {\n text: t('filters.greater-than'),\n textByFormat: {[AttributeFormat.date]: t('filters.after')},\n value: AttributeConditionFilter.GREATER_THAN,\n },\n {text: t('filters.today'), value: AttributeConditionFilter.TODAY},\n {text: t('filters.tomorrow'), value: AttributeConditionFilter.TOMORROW},\n {text: t('filters.yesterday'), value: AttributeConditionFilter.YESTERDAY},\n {text: t('filters.last-month'), value: AttributeConditionFilter.LAST_MONTH},\n {text: t('filters.next-month'), value: AttributeConditionFilter.NEXT_MONTH},\n {text: t('filters.between'), value: AttributeConditionFilter.BETWEEN},\n {text: t('filters.start-on'), value: AttributeConditionFilter.START_ON},\n {text: t('filters.start-after'), value: AttributeConditionFilter.START_AFTER},\n {text: t('filters.start-before'), value: AttributeConditionFilter.START_BEFORE},\n {text: t('filters.end-on'), value: AttributeConditionFilter.END_ON},\n {text: t('filters.end-after'), value: AttributeConditionFilter.END_AFTER},\n {text: t('filters.end-before'), value: AttributeConditionFilter.END_BEFORE},\n {text: t('filters.is-empty'), value: AttributeConditionFilter.IS_EMPTY},\n {text: t('filters.is-not-empty'), value: AttributeConditionFilter.IS_NOT_EMPTY},\n {text: t('filters.values-count-equal'), value: AttributeConditionFilter.VALUES_COUNT_EQUAL},\n {text: t('filters.values-count-greater-than'), value: AttributeConditionFilter.VALUES_COUNT_GREATER_THAN},\n {text: t('filters.values-count-lower-than'), value: AttributeConditionFilter.VALUES_COUNT_LOWER_THAN},\n {text: t('filters.through'), value: AttributeConditionFilter.THROUGH},\n ];\n}\n\nexport function getTreeConditionOptions(t: TFunction): Array<IFilterConditionOption<TreeConditionFilter>> {\n return [\n {text: t('filters.classified-in'), value: TreeConditionFilter.CLASSIFIED_IN},\n {text: t('filters.not-classified-in'), value: TreeConditionFilter.NOT_CLASSIFIED_IN},\n ];\n}\n\nexport function getOperatorOptions(t: TFunction): Array<IFilterConditionOption<OperatorFilter>> {\n return [\n {text: t('filters.and'), value: OperatorFilter.AND},\n {text: t('filters.or'), value: OperatorFilter.OR},\n ];\n}\n\nexport const getConditionOptionsByType = (\n filter: IFilter,\n showThroughCondition: boolean,\n t: TFunction,\n): Array<IFilterConditionOption<AttributeConditionType>> => {\n const _isValuesCountCondition = (condition: AttributeConditionType): boolean =>\n [\n AttributeConditionFilter.VALUES_COUNT_EQUAL,\n AttributeConditionFilter.VALUES_COUNT_GREATER_THAN,\n AttributeConditionFilter.VALUES_COUNT_LOWER_THAN,\n ].includes(condition as RecordFilterCondition);\n\n const attributeConditionOptions = getAttributeConditionOptions(t);\n\n const conditionOptionsByType = attributeConditionOptions.filter(conditionOption => {\n // \"Through\" condition\n if (conditionOption.value === AttributeConditionFilter.THROUGH && showThroughCondition) {\n return true;\n }\n\n // Filter on library (applied to tree attribute only) => show condition for text attribute\n if (\n filter.type === FilterType.LIBRARY &&\n allowedConditionByFormat[AttributeFormat.text].includes(conditionOption.value)\n ) {\n return true;\n }\n\n // Regular attribute filter => show condition based on format + values count if multiple values is allowed\n if (filter.type === FilterType.ATTRIBUTE) {\n const attributeFilter = filter as IFilterAttribute;\n if (\n ((filter as IFilterAttribute).attribute?.format &&\n allowedConditionByFormat[attributeFilter.attribute.format]?.includes(conditionOption.value)) ||\n (attributeFilter.attribute.isMultiple && _isValuesCountCondition(conditionOption.value))\n ) {\n return true;\n }\n }\n\n return false;\n });\n\n return conditionOptionsByType;\n};\n"]}
1
+ {"version":3,"file":"FiltersOptions.js","sourceRoot":"","sources":["../../../../src/components/LibraryItemsList/FiltersPanel/FiltersOptions.tsx"],"names":[],"mappings":"AAIA,OAAO,EACH,wBAAwB,EAExB,UAAU,EAGV,cAAc,EACd,mBAAmB,GACtB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAC,eAAe,EAA6B,MAAM,eAAe,CAAC;AAQ1E,MAAM,wBAAwB,GAA4D;IACtF,CAAC,eAAe,CAAC,IAAI,CAAC,EAAE;QACpB,wBAAwB,CAAC,QAAQ;QACjC,wBAAwB,CAAC,YAAY;QACrC,wBAAwB,CAAC,KAAK;QAC9B,wBAAwB,CAAC,SAAS;QAClC,wBAAwB,CAAC,UAAU;QACnC,wBAAwB,CAAC,QAAQ;QACjC,wBAAwB,CAAC,QAAQ;QACjC,wBAAwB,CAAC,YAAY;KACxC;IACD,CAAC,eAAe,CAAC,QAAQ,CAAC,EAAE;QACxB,wBAAwB,CAAC,QAAQ;QACjC,wBAAwB,CAAC,YAAY;QACrC,wBAAwB,CAAC,KAAK;QAC9B,wBAAwB,CAAC,SAAS;QAClC,wBAAwB,CAAC,UAAU;QACnC,wBAAwB,CAAC,QAAQ;QACjC,wBAAwB,CAAC,QAAQ;QACjC,wBAAwB,CAAC,YAAY;KACxC;IACD,CAAC,eAAe,CAAC,SAAS,CAAC,EAAE,CAAC,wBAAwB,CAAC,QAAQ,EAAE,wBAAwB,CAAC,YAAY,CAAC;IACvG,CAAC,eAAe,CAAC,OAAO,CAAC,EAAE;QACvB,wBAAwB,CAAC,KAAK;QAC9B,wBAAwB,CAAC,SAAS;QAClC,wBAAwB,CAAC,YAAY;QACrC,wBAAwB,CAAC,SAAS;QAClC,wBAAwB,CAAC,QAAQ;QACjC,wBAAwB,CAAC,YAAY;KACxC;IACD,CAAC,eAAe,CAAC,OAAO,CAAC,EAAE,CAAC,wBAAwB,CAAC,KAAK,EAAE,wBAAwB,CAAC,SA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AAM,CAAC,IAAI,KAAK,UAAU,CAAC,SAAS,EAAE,CAAC;YACvC,MAAM,eAAe,GAAG,MAA0B,CAAC;YACnD,IACI,CAAE,MAA2B,CAAC,SAAS,EAAE,MAAM;gBAC3C,wBAAwB,CAAC,eAAe,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,QAAQ,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;gBAChG,CAAC,eAAe,CAAC,SAAS,CAAC,UAAU,IAAI,uBAAuB,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC,EAC1F,CAAC;gBACC,OAAO,IAAI,CAAC;YAChB,CAAC;QACL,CAAC;QAED,OAAO,KAAK,CAAC;IACjB,CAAC,CAAC,CAAC;IAEH,OAAO,sBAAsB,CAAC;AAClC,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 TFunction} from 'i18next';\nimport {\n AttributeConditionFilter,\n type AttributeConditionType,\n FilterType,\n type IFilter,\n type IFilterAttribute,\n OperatorFilter,\n TreeConditionFilter,\n} from '_ui/types/search';\nimport {AttributeFormat, type RecordFilterCondition} from '_ui/_gqlTypes';\n\nexport interface IFilterConditionOption<T> {\n text: string;\n value: T;\n textByFormat?: {[key in AttributeFormat]?: string};\n}\n\nconst allowedConditionByFormat: {[format in AttributeFormat]: AttributeConditionType[]} = {\n [AttributeFormat.text]: [\n AttributeConditionFilter.CONTAINS,\n AttributeConditionFilter.NOT_CONTAINS,\n AttributeConditionFilter.EQUAL,\n AttributeConditionFilter.NOT_EQUAL,\n AttributeConditionFilter.BEGIN_WITH,\n AttributeConditionFilter.END_WITH,\n AttributeConditionFilter.IS_EMPTY,\n AttributeConditionFilter.IS_NOT_EMPTY,\n ],\n [AttributeFormat.extended]: [\n AttributeConditionFilter.CONTAINS,\n AttributeConditionFilter.NOT_CONTAINS,\n AttributeConditionFilter.EQUAL,\n AttributeConditionFilter.NOT_EQUAL,\n AttributeConditionFilter.BEGIN_WITH,\n AttributeConditionFilter.END_WITH,\n AttributeConditionFilter.IS_EMPTY,\n AttributeConditionFilter.IS_NOT_EMPTY,\n ],\n [AttributeFormat.encrypted]: [AttributeConditionFilter.IS_EMPTY, AttributeConditionFilter.IS_NOT_EMPTY],\n [AttributeFormat.numeric]: [\n AttributeConditionFilter.EQUAL,\n AttributeConditionFilter.NOT_EQUAL,\n AttributeConditionFilter.GREATER_THAN,\n AttributeConditionFilter.LESS_THAN,\n AttributeConditionFilter.IS_EMPTY,\n AttributeConditionFilter.IS_NOT_EMPTY,\n ],\n [AttributeFormat.boolean]: [AttributeConditionFilter.EQUAL, AttributeConditionFilter.NOT_EQUAL],\n [AttributeFormat.date]: [\n AttributeConditionFilter.EQUAL,\n AttributeConditionFilter.NOT_EQUAL,\n AttributeConditionFilter.GREATER_THAN,\n AttributeConditionFilter.LESS_THAN,\n AttributeConditionFilter.IS_EMPTY,\n AttributeConditionFilter.IS_NOT_EMPTY,\n AttributeConditionFilter.TODAY,\n AttributeConditionFilter.TOMORROW,\n AttributeConditionFilter.YESTERDAY,\n AttributeConditionFilter.LAST_MONTH,\n AttributeConditionFilter.NEXT_MONTH,\n AttributeConditionFilter.BETWEEN,\n ],\n [AttributeFormat.date_range]: [\n AttributeConditionFilter.CONTAINS,\n AttributeConditionFilter.START_ON,\n AttributeConditionFilter.START_AFTER,\n AttributeConditionFilter.START_BEFORE,\n AttributeConditionFilter.END_ON,\n AttributeConditionFilter.END_AFTER,\n AttributeConditionFilter.END_BEFORE,\n AttributeConditionFilter.IS_EMPTY,\n AttributeConditionFilter.IS_NOT_EMPTY,\n ],\n [AttributeFormat.color]: [],\n [AttributeFormat.rich_text]: [\n AttributeConditionFilter.CONTAINS,\n AttributeConditionFilter.NOT_CONTAINS,\n AttributeConditionFilter.IS_EMPTY,\n AttributeConditionFilter.IS_NOT_EMPTY,\n ],\n};\n\nexport function getAttributeConditionOptions(t: TFunction): Array<IFilterConditionOption<AttributeConditionType>> {\n return [\n {text: t('filters.contains'), value: AttributeConditionFilter.CONTAINS},\n {text: t('filters.not-contains'), value: AttributeConditionFilter.NOT_CONTAINS},\n {text: t('filters.equal'), value: AttributeConditionFilter.EQUAL},\n {text: t('filters.not-equal'), value: AttributeConditionFilter.NOT_EQUAL},\n {text: t('filters.begin-with'), value: AttributeConditionFilter.BEGIN_WITH},\n {text: t('filters.end-with'), value: AttributeConditionFilter.END_WITH},\n {\n text: t('filters.less-than'),\n textByFormat: {[AttributeFormat.date]: t('filters.before')},\n value: AttributeConditionFilter.LESS_THAN,\n },\n {\n text: t('filters.greater-than'),\n textByFormat: {[AttributeFormat.date]: t('filters.after')},\n value: AttributeConditionFilter.GREATER_THAN,\n },\n {text: t('filters.today'), value: AttributeConditionFilter.TODAY},\n {text: t('filters.tomorrow'), value: AttributeConditionFilter.TOMORROW},\n {text: t('filters.yesterday'), value: AttributeConditionFilter.YESTERDAY},\n {text: t('filters.last-month'), value: AttributeConditionFilter.LAST_MONTH},\n {text: t('filters.next-month'), value: AttributeConditionFilter.NEXT_MONTH},\n {text: t('filters.between'), value: AttributeConditionFilter.BETWEEN},\n {text: t('filters.start-on'), value: AttributeConditionFilter.START_ON},\n {text: t('filters.start-after'), value: AttributeConditionFilter.START_AFTER},\n {text: t('filters.start-before'), value: AttributeConditionFilter.START_BEFORE},\n {text: t('filters.end-on'), value: AttributeConditionFilter.END_ON},\n {text: t('filters.end-after'), value: AttributeConditionFilter.END_AFTER},\n {text: t('filters.end-before'), value: AttributeConditionFilter.END_BEFORE},\n {text: t('filters.is-empty'), value: AttributeConditionFilter.IS_EMPTY},\n {text: t('filters.is-not-empty'), value: AttributeConditionFilter.IS_NOT_EMPTY},\n {text: t('filters.values-count-equal'), value: AttributeConditionFilter.VALUES_COUNT_EQUAL},\n {text: t('filters.values-count-greater-than'), value: AttributeConditionFilter.VALUES_COUNT_GREATER_THAN},\n {text: t('filters.values-count-lower-than'), value: AttributeConditionFilter.VALUES_COUNT_LOWER_THAN},\n {text: t('filters.through'), value: AttributeConditionFilter.THROUGH},\n ];\n}\n\nexport function getTreeConditionOptions(t: TFunction): Array<IFilterConditionOption<TreeConditionFilter>> {\n return [\n {text: t('filters.classified-in'), value: TreeConditionFilter.CLASSIFIED_IN},\n {text: t('filters.not-classified-in'), value: TreeConditionFilter.NOT_CLASSIFIED_IN},\n ];\n}\n\nexport function getOperatorOptions(t: TFunction): Array<IFilterConditionOption<OperatorFilter>> {\n return [\n {text: t('filters.and'), value: OperatorFilter.AND},\n {text: t('filters.or'), value: OperatorFilter.OR},\n ];\n}\n\nexport const getConditionOptionsByType = (\n filter: IFilter,\n showThroughCondition: boolean,\n t: TFunction,\n): Array<IFilterConditionOption<AttributeConditionType>> => {\n const _isValuesCountCondition = (condition: AttributeConditionType): boolean =>\n [\n AttributeConditionFilter.VALUES_COUNT_EQUAL,\n AttributeConditionFilter.VALUES_COUNT_GREATER_THAN,\n AttributeConditionFilter.VALUES_COUNT_LOWER_THAN,\n ].includes(condition as RecordFilterCondition);\n\n const attributeConditionOptions = getAttributeConditionOptions(t);\n\n const conditionOptionsByType = attributeConditionOptions.filter(conditionOption => {\n // \"Through\" condition\n if (conditionOption.value === AttributeConditionFilter.THROUGH && showThroughCondition) {\n return true;\n }\n\n // Filter on library (applied to tree attribute only) => show condition for text attribute\n if (\n filter.type === FilterType.LIBRARY &&\n allowedConditionByFormat[AttributeFormat.text].includes(conditionOption.value)\n ) {\n return true;\n }\n\n // Regular attribute filter => show condition based on format + values count if multiple values is allowed\n if (filter.type === FilterType.ATTRIBUTE) {\n const attributeFilter = filter as IFilterAttribute;\n if (\n ((filter as IFilterAttribute).attribute?.format &&\n allowedConditionByFormat[attributeFilter.attribute.format]?.includes(conditionOption.value)) ||\n (attributeFilter.attribute.isMultiple && _isValuesCountCondition(conditionOption.value))\n ) {\n return true;\n }\n }\n\n return false;\n });\n\n return conditionOptionsByType;\n};\n"]}
@@ -2,10 +2,11 @@ export declare const ExplorerWrapper: import("styled-components").IStyledCompone
2
2
  ref?: import("react").LegacyRef<HTMLDivElement>;
3
3
  key?: import("react").Key | null | undefined;
4
4
  defaultChecked?: boolean | undefined;
5
- defaultValue?: string | number | ReadonlyArray<string> | undefined;
5
+ defaultValue?: string | number | readonly string[] | undefined;
6
6
  suppressContentEditableWarning?: boolean | undefined;
7
7
  suppressHydrationWarning?: boolean | undefined;
8
8
  accessKey?: string | undefined;
9
+ autoCapitalize?: "off" | "none" | "on" | "sentences" | "words" | "characters" | undefined | (string & {});
9
10
  autoFocus?: boolean | undefined;
10
11
  className?: string | undefined;
11
12
  contentEditable?: (boolean | "true" | "false") | "inherit" | undefined;
@@ -36,7 +37,6 @@ export declare const ExplorerWrapper: import("styled-components").IStyledCompone
36
37
  rev?: string | undefined;
37
38
  typeof?: string | undefined;
38
39
  vocab?: string | undefined;
39
- autoCapitalize?: string | undefined;
40
40
  autoCorrect?: string | undefined;
41
41
  autoSave?: string | undefined;
42
42
  color?: string | undefined;
@@ -50,55 +50,57 @@ export declare const ExplorerWrapper: import("styled-components").IStyledCompone
50
50
  unselectable?: "on" | "off" | undefined;
51
51
  inputMode?: "none" | "text" | "tel" | "url" | "email" | "numeric" | "decimal" | "search" | undefined;
52
52
  is?: string | undefined;
53
+ exportparts?: string | undefined;
54
+ part?: string | undefined;
53
55
  children?: import("react").ReactNode;
54
- 'aria-activedescendant'?: string | undefined;
55
- 'aria-atomic'?: boolean | "false" | "true" | undefined;
56
- 'aria-autocomplete'?: "none" | "inline" | "list" | "both" | undefined;
57
- 'aria-busy'?: boolean | "false" | "true" | undefined;
58
- 'aria-checked'?: boolean | "false" | "mixed" | "true" | undefined;
59
- 'aria-colcount'?: number | undefined;
60
- 'aria-colindex'?: number | undefined;
61
- 'aria-colspan'?: number | undefined;
62
- 'aria-controls'?: string | undefined;
63
- 'aria-current'?: boolean | "false" | "true" | "page" | "step" | "location" | "date" | "time" | undefined;
64
- 'aria-describedby'?: string | undefined;
65
- 'aria-details'?: string | undefined;
66
- 'aria-disabled'?: boolean | "false" | "true" | undefined;
67
- 'aria-dropeffect'?: "none" | "copy" | "execute" | "link" | "move" | "popup" | undefined;
68
- 'aria-errormessage'?: string | undefined;
69
- 'aria-expanded'?: boolean | "false" | "true" | undefined;
70
- 'aria-flowto'?: string | undefined;
71
- 'aria-grabbed'?: boolean | "false" | "true" | undefined;
72
- 'aria-haspopup'?: boolean | "false" | "true" | "menu" | "listbox" | "tree" | "grid" | "dialog" | undefined;
73
- 'aria-hidden'?: boolean | "false" | "true" | undefined;
74
- 'aria-invalid'?: boolean | "false" | "true" | "grammar" | "spelling" | undefined;
75
- 'aria-keyshortcuts'?: string | undefined;
76
- 'aria-label'?: string | undefined;
77
- 'aria-labelledby'?: string | undefined;
78
- 'aria-level'?: number | undefined;
79
- 'aria-live'?: "off" | "assertive" | "polite" | undefined;
80
- 'aria-modal'?: boolean | "false" | "true" | undefined;
81
- 'aria-multiline'?: boolean | "false" | "true" | undefined;
82
- 'aria-multiselectable'?: boolean | "false" | "true" | undefined;
83
- 'aria-orientation'?: "horizontal" | "vertical" | undefined;
84
- 'aria-owns'?: string | undefined;
85
- 'aria-placeholder'?: string | undefined;
86
- 'aria-posinset'?: number | undefined;
87
- 'aria-pressed'?: boolean | "false" | "mixed" | "true" | undefined;
88
- 'aria-readonly'?: boolean | "false" | "true" | undefined;
89
- 'aria-relevant'?: "additions" | "additions removals" | "additions text" | "all" | "removals" | "removals additions" | "removals text" | "text" | "text additions" | "text removals" | undefined;
90
- 'aria-required'?: boolean | "false" | "true" | undefined;
91
- 'aria-roledescription'?: string | undefined;
92
- 'aria-rowcount'?: number | undefined;
93
- 'aria-rowindex'?: number | undefined;
94
- 'aria-rowspan'?: number | undefined;
95
- 'aria-selected'?: boolean | "false" | "true" | undefined;
96
- 'aria-setsize'?: number | undefined;
97
- 'aria-sort'?: "none" | "ascending" | "descending" | "other" | undefined;
98
- 'aria-valuemax'?: number | undefined;
99
- 'aria-valuemin'?: number | undefined;
100
- 'aria-valuenow'?: number | undefined;
101
- 'aria-valuetext'?: string | undefined;
56
+ "aria-activedescendant"?: string | undefined;
57
+ "aria-atomic"?: boolean | "false" | "true" | undefined;
58
+ "aria-autocomplete"?: "none" | "inline" | "list" | "both" | undefined;
59
+ "aria-busy"?: boolean | "false" | "true" | undefined;
60
+ "aria-checked"?: boolean | "false" | "mixed" | "true" | undefined;
61
+ "aria-colcount"?: number | undefined;
62
+ "aria-colindex"?: number | undefined;
63
+ "aria-colspan"?: number | undefined;
64
+ "aria-controls"?: string | undefined;
65
+ "aria-current"?: boolean | "false" | "true" | "page" | "step" | "location" | "date" | "time" | undefined;
66
+ "aria-describedby"?: string | undefined;
67
+ "aria-details"?: string | undefined;
68
+ "aria-disabled"?: boolean | "false" | "true" | undefined;
69
+ "aria-dropeffect"?: "none" | "copy" | "execute" | "link" | "move" | "popup" | undefined;
70
+ "aria-errormessage"?: string | undefined;
71
+ "aria-expanded"?: boolean | "false" | "true" | undefined;
72
+ "aria-flowto"?: string | undefined;
73
+ "aria-grabbed"?: boolean | "false" | "true" | undefined;
74
+ "aria-haspopup"?: boolean | "false" | "true" | "menu" | "listbox" | "tree" | "grid" | "dialog" | undefined;
75
+ "aria-hidden"?: boolean | "false" | "true" | undefined;
76
+ "aria-invalid"?: boolean | "false" | "true" | "grammar" | "spelling" | undefined;
77
+ "aria-keyshortcuts"?: string | undefined;
78
+ "aria-label"?: string | undefined;
79
+ "aria-labelledby"?: string | undefined;
80
+ "aria-level"?: number | undefined;
81
+ "aria-live"?: "off" | "assertive" | "polite" | undefined;
82
+ "aria-modal"?: boolean | "false" | "true" | undefined;
83
+ "aria-multiline"?: boolean | "false" | "true" | undefined;
84
+ "aria-multiselectable"?: boolean | "false" | "true" | undefined;
85
+ "aria-orientation"?: "horizontal" | "vertical" | undefined;
86
+ "aria-owns"?: string | undefined;
87
+ "aria-placeholder"?: string | undefined;
88
+ "aria-posinset"?: number | undefined;
89
+ "aria-pressed"?: boolean | "false" | "mixed" | "true" | undefined;
90
+ "aria-readonly"?: boolean | "false" | "true" | undefined;
91
+ "aria-relevant"?: "additions" | "additions removals" | "additions text" | "all" | "removals" | "removals additions" | "removals text" | "text" | "text additions" | "text removals" | undefined;
92
+ "aria-required"?: boolean | "false" | "true" | undefined;
93
+ "aria-roledescription"?: string | undefined;
94
+ "aria-rowcount"?: number | undefined;
95
+ "aria-rowindex"?: number | undefined;
96
+ "aria-rowspan"?: number | undefined;
97
+ "aria-selected"?: boolean | "false" | "true" | undefined;
98
+ "aria-setsize"?: number | undefined;
99
+ "aria-sort"?: "none" | "ascending" | "descending" | "other" | undefined;
100
+ "aria-valuemax"?: number | undefined;
101
+ "aria-valuemin"?: number | undefined;
102
+ "aria-valuenow"?: number | undefined;
103
+ "aria-valuetext"?: string | undefined;
102
104
  dangerouslySetInnerHTML?: {
103
105
  __html: string | TrustedHTML;
104
106
  } | undefined;
@@ -120,7 +122,7 @@ export declare const ExplorerWrapper: import("styled-components").IStyledCompone
120
122
  onBlurCapture?: import("react").FocusEventHandler<HTMLDivElement>;
121
123
  onChange?: import("react").FormEventHandler<HTMLDivElement>;
122
124
  onChangeCapture?: import("react").FormEventHandler<HTMLDivElement>;
123
- onBeforeInput?: import("react").FormEventHandler<HTMLDivElement>;
125
+ onBeforeInput?: import("react").InputEventHandler<HTMLDivElement>;
124
126
  onBeforeInputCapture?: import("react").FormEventHandler<HTMLDivElement>;
125
127
  onInput?: import("react").FormEventHandler<HTMLDivElement>;
126
128
  onInputCapture?: import("react").FormEventHandler<HTMLDivElement>;
@@ -76,6 +76,11 @@ const TreeField = ({ element, readonly, isFormCreationMode, onDeleteMultipleValu
76
76
  attributeId: state.activeAttribute?.attribute?.id,
77
77
  action: RecordPermissionsActions.create_record,
78
78
  };
79
+ const dependentValuesPermissionFilter = {
80
+ libraryId: state.libraryId,
81
+ attributeId: state.activeAttribute?.attribute?.id,
82
+ recordId: state.record?.id,
83
+ };
79
84
  const { openModal, removeTreeNode, actionButtonLabel, SelectTreeNodeModal, RemoveAllTreeNodes } = useManageTreeNodeSelection({
80
85
  modaleTitle: label,
81
86
  attribute,
@@ -88,6 +93,7 @@ const TreeField = ({ element, readonly, isFormCreationMode, onDeleteMultipleValu
88
93
  isReadOnly,
89
94
  isFieldInError,
90
95
  childrenAsRecordValuePermissionFilter,
96
+ dependentValuesPermissionFilter,
91
97
  });
92
98
  return (_jsx(StyledWrapperDiv, { "$metadataEdit": metadataEdit, children: _jsx(AntForm.Item, { name: attribute.id, noStyle: true, children: _jsxs(KitInputWrapperStyled, { id: TREE_FIELD_ID_PREFIX + attribute.id, "data-testid": "tree-field", label: label, required: attribute.required, bordered: true, status: isFieldInError ? 'error' : undefined, helper: isFieldInError ? String(fieldErrors[0]) : undefined, "$readonlyBackground": isReadOnly, extra: _jsxs(_Fragment, { children: [_jsx(KitInputExtraAlignLeftDiv, { children: _jsx(ComputeIndicator, { calculatedFlags: calculatedFlags, inheritedFlags: inheritedFlags }) }), RemoveAllTreeNodes] }), children: [_jsx(TreeNodeList, { attribute: attribute, backendValues: backendValues, removeTreeNode: removeTreeNode, isReadOnly: isReadOnly }), !isReadOnly && (_jsx(StyledFieldFooterKitButton, { icon: _jsx(FontAwesomeIcon, { icon: faList }), onClick: openModal, size: "m", "$hasNoValue": !backendValues?.length, children: actionButtonLabel })), SelectTreeNodeModal] }) }) }));
93
99
  };
@@ -1 +1 @@
1
- {"version":3,"file":"TreeField.js","sourceRoot":"","sources":["../../../../../../src/components/RecordEdition/EditRecordContent/uiElements/TreeField/TreeField.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAyB,SAAS,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AAClE,OAAO,MAAM,EAAE,EAAC,GAAG,EAAC,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAA6B,oBAAoB,EAAC,MAAM,aAAa,CAAC;AAC7E,OAAO,EAAC,OAA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,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,yBACtC,UAAU,EAC/B,KAAK,EACD,8BACI,KAAC,yBAAyB,cACtB,KAAC,gBAAgB,IAAC,eAAe,EAAE,eAAe,EAAE,cAAc,EAAE,cAAc,GAAI,GAC9D,EAC3B,kBAAkB,IACpB,aAGP,KAAC,YAAY,IACT,SAAS,EAAE,SAAS,EACpB,aAAa,EAAE,aAAa,EAC5B,cAAc,EAAE,cAAc,EAC9B,UAAU,EAAE,UAAU,GACxB,EACD,CAAC,UAAU,IAAI,CACZ,KAAC,0BAA0B,IACvB,IAAI,EAAE,KAAC,eAAe,IAAC,IAAI,EAAE,MAAM,GAAI,EACvC,OAAO,EAAE,SAAS,EAClB,IAAI,EAAC,GAAG,iBACK,CAAC,aAAa,EAAE,MAAM,YAElC,iBAAiB,GACO,CAChC,EACA,mBAAmB,IACA,GACb,GACA,CACtB,CAAC;AACN,CAAC,CAAC;AAEF,eAAe,SAAS,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, useEffect, useState} from 'react';\nimport styled, {css} from 'styled-components';\nimport {type ICommonFieldsSettings, localizedTranslation} from '@leav/utils';\nimport {AntForm, KitButton, KitInputWrapper} from 'aristid-ds';\nimport {FontAwesomeIcon} from '@fortawesome/react-fontawesome';\nimport {faList} from '@fortawesome/free-solid-svg-icons';\nimport {useLang} from '_ui/hooks';\nimport {type IFormElementProps} from '../../_types';\nimport {\n type ChildrenAsRecordValuePermissionFilterInput,\n type RecordFormAttributeTreeAttributeFragment,\n RecordPermissionsActions,\n} from '_ui/_gqlTypes';\nimport {TREE_FIELD_ID_PREFIX} from '_ui/constants';\nimport {type RecordFormElementsValueTreeValue} from '_ui/hooks/useGetRecordForm';\nimport {TreeNodeList} from './display-tree-node/TreeNodeList';\nimport {useManageTreeNodeSelection} from './manage-tree-node-selection/useManageTreeNodeSelection';\nimport {useOutsideInteractionDetector} from '../shared/useOutsideInteractionDetector';\nimport {useEditRecordReducer} from '_ui/components/RecordEdition/editRecordReducer/useEditRecordReducer';\nimport {EditRecordReducerActionsTypes} from '_ui/components/RecordEdition/editRecordReducer/editRecordReducer';\nimport {computeCalculatedFlags, computeInheritedFlags} from '../shared/calculatedInheritedFlags';\nimport {ComputeIndicator} from '../shared/ComputeIndicator';\n\nconst StyledWrapperDiv = styled.div<{$metadataEdit: boolean}>`\n margin-bottom: ${props => (props.$metadataEdit ? 0 : '1.5em')};\n`;\n\nconst KitInputExtraAlignLeftDiv = styled.div`\n margin-right: auto;\n line-height: 12px;\n`;\n\nconst StyledFieldFooterKitButton = styled(KitButton)<{$hasNoValue: boolean}>`\n margin-top: ${props => (props.$hasNoValue ? 0 : 'calc((var(--general-spacing-xs)) * 1px)')};\n`;\n\nconst KitInputWrapperStyled = styled(KitInputWrapper)<{$readonlyBackground: boolean}>`\n .kit-input-wrapper-content {\n min-height: 48px;\n }\n\n ${props =>\n props.$readonlyBackground &&\n css`\n .kit-input-wrapper-content {\n background-color: var(--general-utilities-neutral-light);\n }\n `}\n`;\n\ntype TreeFieldProps = IFormElementProps<ICommonFieldsSettings>;\n\nconst TreeField: FunctionComponent<TreeFieldProps> = ({\n element,\n readonly,\n isFormCreationMode,\n onDeleteMultipleValues,\n onValueSubmit,\n onValueDelete,\n metadataEdit = false,\n}) => {\n const {state, dispatch} = useEditRecordReducer();\n const {lang} = useLang();\n const {\n settings,\n attribute,\n values,\n }: {\n settings: typeof element.settings;\n attribute?: RecordFormAttributeTreeAttributeFragment;\n values?: RecordFormElementsValueTreeValue[];\n } = element;\n\n const [backendValues, setBackendValues] = useState<RecordFormElementsValueTreeValue[]>(values);\n\n const calculatedFlags = computeCalculatedFlags(backendValues);\n const inheritedFlags = computeInheritedFlags(backendValues);\n const label = localizedTranslation(settings.label, lang);\n const form = AntForm.useFormInstance();\n const fieldErrors = form.getFieldError(attribute.id);\n\n // TODO: Temporary const that should be removed (and all it's usages) when we will have a proper way to override multiple values\n const tmpCantOverrideValues =\n attribute.multiple_values &&\n (calculatedFlags.calculatedValues?.length > 1 || inheritedFlags.inheritedValues?.length > 1);\n\n const isReadOnly = attribute.readonly || !attribute.permissions.edit_value || readonly || tmpCantOverrideValues;\n const isFieldInError = fieldErrors.length > 0;\n\n useEffect(() => {\n if (state.activeAttribute?.attribute.id === attribute.id) {\n dispatch({\n type: EditRecordReducerActionsTypes.SET_ACTIVE_VALUE,\n values: backendValues,\n });\n }\n }, [backendValues]);\n\n useOutsideInteractionDetector({\n attribute,\n activeAttribute: state.activeAttribute,\n attributePrefix: TREE_FIELD_ID_PREFIX,\n dispatch,\n backendValues,\n allowedSelectors: ['.kit-modal-wrapper'],\n });\n\n const childrenAsRecordValuePermissionFilter: ChildrenAsRecordValuePermissionFilterInput = {\n libraryId: state.libraryId,\n attributeId: state.activeAttribute?.attribute?.id,\n action: RecordPermissionsActions.create_record,\n };\n\n const {openModal, removeTreeNode, actionButtonLabel, SelectTreeNodeModal, RemoveAllTreeNodes} =\n useManageTreeNodeSelection({\n modaleTitle: label,\n attribute,\n isFormCreationMode,\n backendValues,\n setBackendValues,\n onValueSubmit,\n onValueDelete,\n onDeleteMultipleValues,\n isReadOnly,\n isFieldInError,\n childrenAsRecordValuePermissionFilter,\n });\n\n return (\n <StyledWrapperDiv $metadataEdit={metadataEdit}>\n <AntForm.Item name={attribute.id} noStyle>\n <KitInputWrapperStyled\n id={TREE_FIELD_ID_PREFIX + attribute.id}\n data-testid=\"tree-field\"\n label={label}\n required={attribute.required}\n bordered\n status={isFieldInError ? 'error' : undefined}\n helper={isFieldInError ? String(fieldErrors[0]) : undefined}\n $readonlyBackground={isReadOnly}\n extra={\n <>\n <KitInputExtraAlignLeftDiv>\n <ComputeIndicator calculatedFlags={calculatedFlags} inheritedFlags={inheritedFlags} />\n </KitInputExtraAlignLeftDiv>\n {RemoveAllTreeNodes}\n </>\n }\n >\n <TreeNodeList\n attribute={attribute}\n backendValues={backendValues}\n removeTreeNode={removeTreeNode}\n isReadOnly={isReadOnly}\n />\n {!isReadOnly && (\n <StyledFieldFooterKitButton\n icon={<FontAwesomeIcon icon={faList} />}\n onClick={openModal}\n size=\"m\"\n $hasNoValue={!backendValues?.length}\n >\n {actionButtonLabel}\n </StyledFieldFooterKitButton>\n )}\n {SelectTreeNodeModal}\n </KitInputWrapperStyled>\n </AntForm.Item>\n </StyledWrapperDiv>\n );\n};\n\nexport default TreeField;\n"]}
1
+ {"version":3,"file":"TreeField.js","sourceRoot":"","sources":["../../../../../../src/components/RecordEdition/EditRecordContent/uiElements/TreeField/TreeField.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAyB,SAAS,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AAClE,OAAO,MAAM,EAAE,EAAC,GAAG,EAAC,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAA6B,oBAAoB,EAAC,MAAM,aAAa,CAAC;AAC7E,OAAO,EAAC,OAAO,EAAE,SAAS,EAAE,eAAe,EAAC,MAAM,YAAY,CAAC;AAC/D,OAAO,EAAC,eAAe,EAAC,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAC,MAAM,EAAC,MAAM,mCAAmC,CAAC;AACzD,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAC;AAElC,OAAO,EAIH,wBAAwB,GAC3B,MAAM,eAAe,CAAC;AACvB,OAAO,EAAC,oBAAoB,EAAC,MAAM,eAAe,CAAC;AAEnD,OAAO,EAAC,YAAY,EAAC,MAAM,kCAAkC,CAAC;AAC9D,OAAO,EAAC,0BAA0B,EAAC,MAAM,yDAAyD,CAAC;AACnG,OAAO,EAAC,6BAA6B,EAAC,MAAM,yCAAyC,CAAC;AACtF,OAAO,EAAC,oBAAoB,EAAC,MAAM,qEAAqE,CAAC;AACzG,OAAO,EAAC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B,EACD,CAAC,UAAU,IAAI,CACZ,KAAC,0BAA0B,IACvB,IAAI,EAAE,KAAC,eAAe,IAAC,IAAI,EAAE,MAAM,GAAI,EACvC,OAAO,EAAE,SAAS,EAClB,IAAI,EAAC,GAAG,iBACK,CAAC,aAAa,EAAE,MAAM,YAElC,iBAAiB,GACO,CAChC,EACA,mBAAmB,IACA,GACb,GACA,CACtB,CAAC;AACN,CAAC,CAAC;AAEF,eAAe,SAAS,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, useEffect, useState} from 'react';\nimport styled, {css} from 'styled-components';\nimport {type ICommonFieldsSettings, localizedTranslation} from '@leav/utils';\nimport {AntForm, KitButton, KitInputWrapper} from 'aristid-ds';\nimport {FontAwesomeIcon} from '@fortawesome/react-fontawesome';\nimport {faList} from '@fortawesome/free-solid-svg-icons';\nimport {useLang} from '_ui/hooks';\nimport {type IFormElementProps} from '../../_types';\nimport {\n type ChildrenAsRecordValuePermissionFilterInput,\n type DependentValuesPermissionFilterInput,\n type RecordFormAttributeTreeAttributeFragment,\n RecordPermissionsActions,\n} from '_ui/_gqlTypes';\nimport {TREE_FIELD_ID_PREFIX} from '_ui/constants';\nimport {type RecordFormElementsValueTreeValue} from '_ui/hooks/useGetRecordForm';\nimport {TreeNodeList} from './display-tree-node/TreeNodeList';\nimport {useManageTreeNodeSelection} from './manage-tree-node-selection/useManageTreeNodeSelection';\nimport {useOutsideInteractionDetector} from '../shared/useOutsideInteractionDetector';\nimport {useEditRecordReducer} from '_ui/components/RecordEdition/editRecordReducer/useEditRecordReducer';\nimport {EditRecordReducerActionsTypes} from '_ui/components/RecordEdition/editRecordReducer/editRecordReducer';\nimport {computeCalculatedFlags, computeInheritedFlags} from '../shared/calculatedInheritedFlags';\nimport {ComputeIndicator} from '../shared/ComputeIndicator';\n\nconst StyledWrapperDiv = styled.div<{$metadataEdit: boolean}>`\n margin-bottom: ${props => (props.$metadataEdit ? 0 : '1.5em')};\n`;\n\nconst KitInputExtraAlignLeftDiv = styled.div`\n margin-right: auto;\n line-height: 12px;\n`;\n\nconst StyledFieldFooterKitButton = styled(KitButton)<{$hasNoValue: boolean}>`\n margin-top: ${props => (props.$hasNoValue ? 0 : 'calc((var(--general-spacing-xs)) * 1px)')};\n`;\n\nconst KitInputWrapperStyled = styled(KitInputWrapper)<{$readonlyBackground: boolean}>`\n .kit-input-wrapper-content {\n min-height: 48px;\n }\n\n ${props =>\n props.$readonlyBackground &&\n css`\n .kit-input-wrapper-content {\n background-color: var(--general-utilities-neutral-light);\n }\n `}\n`;\n\ntype TreeFieldProps = IFormElementProps<ICommonFieldsSettings>;\n\nconst TreeField: FunctionComponent<TreeFieldProps> = ({\n element,\n readonly,\n isFormCreationMode,\n onDeleteMultipleValues,\n onValueSubmit,\n onValueDelete,\n metadataEdit = false,\n}) => {\n const {state, dispatch} = useEditRecordReducer();\n const {lang} = useLang();\n const {\n settings,\n attribute,\n values,\n }: {\n settings: typeof element.settings;\n attribute?: RecordFormAttributeTreeAttributeFragment;\n values?: RecordFormElementsValueTreeValue[];\n } = element;\n\n const [backendValues, setBackendValues] = useState<RecordFormElementsValueTreeValue[]>(values);\n\n const calculatedFlags = computeCalculatedFlags(backendValues);\n const inheritedFlags = computeInheritedFlags(backendValues);\n const label = localizedTranslation(settings.label, lang);\n const form = AntForm.useFormInstance();\n const fieldErrors = form.getFieldError(attribute.id);\n\n // TODO: Temporary const that should be removed (and all it's usages) when we will have a proper way to override multiple values\n const tmpCantOverrideValues =\n attribute.multiple_values &&\n (calculatedFlags.calculatedValues?.length > 1 || inheritedFlags.inheritedValues?.length > 1);\n\n const isReadOnly = attribute.readonly || !attribute.permissions.edit_value || readonly || tmpCantOverrideValues;\n const isFieldInError = fieldErrors.length > 0;\n\n useEffect(() => {\n if (state.activeAttribute?.attribute.id === attribute.id) {\n dispatch({\n type: EditRecordReducerActionsTypes.SET_ACTIVE_VALUE,\n values: backendValues,\n });\n }\n }, [backendValues]);\n\n useOutsideInteractionDetector({\n attribute,\n activeAttribute: state.activeAttribute,\n attributePrefix: TREE_FIELD_ID_PREFIX,\n dispatch,\n backendValues,\n allowedSelectors: ['.kit-modal-wrapper'],\n });\n\n const childrenAsRecordValuePermissionFilter: ChildrenAsRecordValuePermissionFilterInput = {\n libraryId: state.libraryId,\n attributeId: state.activeAttribute?.attribute?.id,\n action: RecordPermissionsActions.create_record,\n };\n\n const dependentValuesPermissionFilter: DependentValuesPermissionFilterInput = {\n libraryId: state.libraryId,\n attributeId: state.activeAttribute?.attribute?.id,\n recordId: state.record?.id,\n };\n\n const {openModal, removeTreeNode, actionButtonLabel, SelectTreeNodeModal, RemoveAllTreeNodes} =\n useManageTreeNodeSelection({\n modaleTitle: label,\n attribute,\n isFormCreationMode,\n backendValues,\n setBackendValues,\n onValueSubmit,\n onValueDelete,\n onDeleteMultipleValues,\n isReadOnly,\n isFieldInError,\n childrenAsRecordValuePermissionFilter,\n dependentValuesPermissionFilter,\n });\n\n return (\n <StyledWrapperDiv $metadataEdit={metadataEdit}>\n <AntForm.Item name={attribute.id} noStyle>\n <KitInputWrapperStyled\n id={TREE_FIELD_ID_PREFIX + attribute.id}\n data-testid=\"tree-field\"\n label={label}\n required={attribute.required}\n bordered\n status={isFieldInError ? 'error' : undefined}\n helper={isFieldInError ? String(fieldErrors[0]) : undefined}\n $readonlyBackground={isReadOnly}\n extra={\n <>\n <KitInputExtraAlignLeftDiv>\n <ComputeIndicator calculatedFlags={calculatedFlags} inheritedFlags={inheritedFlags} />\n </KitInputExtraAlignLeftDiv>\n {RemoveAllTreeNodes}\n </>\n }\n >\n <TreeNodeList\n attribute={attribute}\n backendValues={backendValues}\n removeTreeNode={removeTreeNode}\n isReadOnly={isReadOnly}\n />\n {!isReadOnly && (\n <StyledFieldFooterKitButton\n icon={<FontAwesomeIcon icon={faList} />}\n onClick={openModal}\n size=\"m\"\n $hasNoValue={!backendValues?.length}\n >\n {actionButtonLabel}\n </StyledFieldFooterKitButton>\n )}\n {SelectTreeNodeModal}\n </KitInputWrapperStyled>\n </AntForm.Item>\n </StyledWrapperDiv>\n );\n};\n\nexport default TreeField;\n"]}
@@ -2,10 +2,11 @@ export declare const TreeFieldWrapper: import("styled-components").IStyledCompon
2
2
  ref?: import("react").LegacyRef<HTMLDivElement>;
3
3
  key?: import("react").Key | null | undefined;
4
4
  defaultChecked?: boolean | undefined;
5
- defaultValue?: string | number | ReadonlyArray<string> | undefined;
5
+ defaultValue?: string | number | readonly string[] | undefined;
6
6
  suppressContentEditableWarning?: boolean | undefined;
7
7
  suppressHydrationWarning?: boolean | undefined;
8
8
  accessKey?: string | undefined;
9
+ autoCapitalize?: "off" | "none" | "on" | "sentences" | "words" | "characters" | undefined | (string & {});
9
10
  autoFocus?: boolean | undefined;
10
11
  className?: string | undefined;
11
12
  contentEditable?: (boolean | "true" | "false") | "inherit" | undefined;
@@ -36,7 +37,6 @@ export declare const TreeFieldWrapper: import("styled-components").IStyledCompon
36
37
  rev?: string | undefined;
37
38
  typeof?: string | undefined;
38
39
  vocab?: string | undefined;
39
- autoCapitalize?: string | undefined;
40
40
  autoCorrect?: string | undefined;
41
41
  autoSave?: string | undefined;
42
42
  color?: string | undefined;
@@ -50,55 +50,57 @@ export declare const TreeFieldWrapper: import("styled-components").IStyledCompon
50
50
  unselectable?: "on" | "off" | undefined;
51
51
  inputMode?: "none" | "text" | "tel" | "url" | "email" | "numeric" | "decimal" | "search" | undefined;
52
52
  is?: string | undefined;
53
+ exportparts?: string | undefined;
54
+ part?: string | undefined;
53
55
  children?: import("react").ReactNode;
54
- 'aria-activedescendant'?: string | undefined;
55
- 'aria-atomic'?: boolean | "false" | "true" | undefined;
56
- 'aria-autocomplete'?: "none" | "inline" | "list" | "both" | undefined;
57
- 'aria-busy'?: boolean | "false" | "true" | undefined;
58
- 'aria-checked'?: boolean | "false" | "mixed" | "true" | undefined;
59
- 'aria-colcount'?: number | undefined;
60
- 'aria-colindex'?: number | undefined;
61
- 'aria-colspan'?: number | undefined;
62
- 'aria-controls'?: string | undefined;
63
- 'aria-current'?: boolean | "false" | "true" | "page" | "step" | "location" | "date" | "time" | undefined;
64
- 'aria-describedby'?: string | undefined;
65
- 'aria-details'?: string | undefined;
66
- 'aria-disabled'?: boolean | "false" | "true" | undefined;
67
- 'aria-dropeffect'?: "none" | "copy" | "execute" | "link" | "move" | "popup" | undefined;
68
- 'aria-errormessage'?: string | undefined;
69
- 'aria-expanded'?: boolean | "false" | "true" | undefined;
70
- 'aria-flowto'?: string | undefined;
71
- 'aria-grabbed'?: boolean | "false" | "true" | undefined;
72
- 'aria-haspopup'?: boolean | "false" | "true" | "menu" | "listbox" | "tree" | "grid" | "dialog" | undefined;
73
- 'aria-hidden'?: boolean | "false" | "true" | undefined;
74
- 'aria-invalid'?: boolean | "false" | "true" | "grammar" | "spelling" | undefined;
75
- 'aria-keyshortcuts'?: string | undefined;
76
- 'aria-label'?: string | undefined;
77
- 'aria-labelledby'?: string | undefined;
78
- 'aria-level'?: number | undefined;
79
- 'aria-live'?: "off" | "assertive" | "polite" | undefined;
80
- 'aria-modal'?: boolean | "false" | "true" | undefined;
81
- 'aria-multiline'?: boolean | "false" | "true" | undefined;
82
- 'aria-multiselectable'?: boolean | "false" | "true" | undefined;
83
- 'aria-orientation'?: "horizontal" | "vertical" | undefined;
84
- 'aria-owns'?: string | undefined;
85
- 'aria-placeholder'?: string | undefined;
86
- 'aria-posinset'?: number | undefined;
87
- 'aria-pressed'?: boolean | "false" | "mixed" | "true" | undefined;
88
- 'aria-readonly'?: boolean | "false" | "true" | undefined;
89
- 'aria-relevant'?: "additions" | "additions removals" | "additions text" | "all" | "removals" | "removals additions" | "removals text" | "text" | "text additions" | "text removals" | undefined;
90
- 'aria-required'?: boolean | "false" | "true" | undefined;
91
- 'aria-roledescription'?: string | undefined;
92
- 'aria-rowcount'?: number | undefined;
93
- 'aria-rowindex'?: number | undefined;
94
- 'aria-rowspan'?: number | undefined;
95
- 'aria-selected'?: boolean | "false" | "true" | undefined;
96
- 'aria-setsize'?: number | undefined;
97
- 'aria-sort'?: "none" | "ascending" | "descending" | "other" | undefined;
98
- 'aria-valuemax'?: number | undefined;
99
- 'aria-valuemin'?: number | undefined;
100
- 'aria-valuenow'?: number | undefined;
101
- 'aria-valuetext'?: string | undefined;
56
+ "aria-activedescendant"?: string | undefined;
57
+ "aria-atomic"?: boolean | "false" | "true" | undefined;
58
+ "aria-autocomplete"?: "none" | "inline" | "list" | "both" | undefined;
59
+ "aria-busy"?: boolean | "false" | "true" | undefined;
60
+ "aria-checked"?: boolean | "false" | "mixed" | "true" | undefined;
61
+ "aria-colcount"?: number | undefined;
62
+ "aria-colindex"?: number | undefined;
63
+ "aria-colspan"?: number | undefined;
64
+ "aria-controls"?: string | undefined;
65
+ "aria-current"?: boolean | "false" | "true" | "page" | "step" | "location" | "date" | "time" | undefined;
66
+ "aria-describedby"?: string | undefined;
67
+ "aria-details"?: string | undefined;
68
+ "aria-disabled"?: boolean | "false" | "true" | undefined;
69
+ "aria-dropeffect"?: "none" | "copy" | "execute" | "link" | "move" | "popup" | undefined;
70
+ "aria-errormessage"?: string | undefined;
71
+ "aria-expanded"?: boolean | "false" | "true" | undefined;
72
+ "aria-flowto"?: string | undefined;
73
+ "aria-grabbed"?: boolean | "false" | "true" | undefined;
74
+ "aria-haspopup"?: boolean | "false" | "true" | "menu" | "listbox" | "tree" | "grid" | "dialog" | undefined;
75
+ "aria-hidden"?: boolean | "false" | "true" | undefined;
76
+ "aria-invalid"?: boolean | "false" | "true" | "grammar" | "spelling" | undefined;
77
+ "aria-keyshortcuts"?: string | undefined;
78
+ "aria-label"?: string | undefined;
79
+ "aria-labelledby"?: string | undefined;
80
+ "aria-level"?: number | undefined;
81
+ "aria-live"?: "off" | "assertive" | "polite" | undefined;
82
+ "aria-modal"?: boolean | "false" | "true" | undefined;
83
+ "aria-multiline"?: boolean | "false" | "true" | undefined;
84
+ "aria-multiselectable"?: boolean | "false" | "true" | undefined;
85
+ "aria-orientation"?: "horizontal" | "vertical" | undefined;
86
+ "aria-owns"?: string | undefined;
87
+ "aria-placeholder"?: string | undefined;
88
+ "aria-posinset"?: number | undefined;
89
+ "aria-pressed"?: boolean | "false" | "mixed" | "true" | undefined;
90
+ "aria-readonly"?: boolean | "false" | "true" | undefined;
91
+ "aria-relevant"?: "additions" | "additions removals" | "additions text" | "all" | "removals" | "removals additions" | "removals text" | "text" | "text additions" | "text removals" | undefined;
92
+ "aria-required"?: boolean | "false" | "true" | undefined;
93
+ "aria-roledescription"?: string | undefined;
94
+ "aria-rowcount"?: number | undefined;
95
+ "aria-rowindex"?: number | undefined;
96
+ "aria-rowspan"?: number | undefined;
97
+ "aria-selected"?: boolean | "false" | "true" | undefined;
98
+ "aria-setsize"?: number | undefined;
99
+ "aria-sort"?: "none" | "ascending" | "descending" | "other" | undefined;
100
+ "aria-valuemax"?: number | undefined;
101
+ "aria-valuemin"?: number | undefined;
102
+ "aria-valuenow"?: number | undefined;
103
+ "aria-valuetext"?: string | undefined;
102
104
  dangerouslySetInnerHTML?: {
103
105
  __html: string | TrustedHTML;
104
106
  } | undefined;
@@ -120,7 +122,7 @@ export declare const TreeFieldWrapper: import("styled-components").IStyledCompon
120
122
  onBlurCapture?: import("react").FocusEventHandler<HTMLDivElement>;
121
123
  onChange?: import("react").FormEventHandler<HTMLDivElement>;
122
124
  onChangeCapture?: import("react").FormEventHandler<HTMLDivElement>;
123
- onBeforeInput?: import("react").FormEventHandler<HTMLDivElement>;
125
+ onBeforeInput?: import("react").InputEventHandler<HTMLDivElement>;
124
126
  onBeforeInputCapture?: import("react").FormEventHandler<HTMLDivElement>;
125
127
  onInput?: import("react").FormEventHandler<HTMLDivElement>;
126
128
  onInputCapture?: import("react").FormEventHandler<HTMLDivElement>;
@@ -1,5 +1,5 @@
1
1
  import { type FunctionComponent } from 'react';
2
- import { type ChildrenAsRecordValuePermissionFilterInput, type RecordFormAttributeTreeAttributeFragment } from '../../../../../../_gqlTypes';
2
+ import { type DependentValuesPermissionFilterInput, type ChildrenAsRecordValuePermissionFilterInput, type RecordFormAttributeTreeAttributeFragment } from '../../../../../../_gqlTypes';
3
3
  import { type RecordFormElementsValueTreeValue } from '../../../../../../hooks/useGetRecordForm';
4
4
  import { type ITreeNodeWithRecord } from '../../../../../../types';
5
5
  type SelectTreeNodeModalBackendValue = RecordFormElementsValueTreeValue | {
@@ -21,6 +21,7 @@ interface ISelectTreeNodeModalProps {
21
21
  onConfirm: (selectedNodes: ITreeNodeWithRecord[]) => void;
22
22
  onClose: () => void;
23
23
  childrenAsRecordValuePermissionFilter?: ChildrenAsRecordValuePermissionFilterInput;
24
+ dependentValuesPermissionFilter?: DependentValuesPermissionFilterInput;
24
25
  className?: string;
25
26
  }
26
27
  export declare const SelectTreeNodeModal: FunctionComponent<ISelectTreeNodeModalProps>;
@@ -10,7 +10,7 @@ import { SelectTreeNode } from '../../../../../../components/SelectTreeNode';
10
10
  import { useSharedTranslation } from '../../../../../../hooks/useSharedTranslation';
11
11
  const SELECT_TREE_NODE_MODAL_HEIGHT = '563px';
12
12
  const SELECT_TREE_NODE_MODAL_WIDTH = '656px';
13
- export const SelectTreeNodeModal = ({ title, open, attribute, backendValues, onConfirm, onClose, childrenAsRecordValuePermissionFilter, className, }) => {
13
+ export const SelectTreeNodeModal = ({ title, open, attribute, backendValues, onConfirm, onClose, childrenAsRecordValuePermissionFilter, dependentValuesPermissionFilter, className, }) => {
14
14
  const { t } = useSharedTranslation();
15
15
  const [selectedNodes, setSelectedNodes] = useState([]);
16
16
  const _handleOnSelect = (node, selected) => {
@@ -34,6 +34,6 @@ export const SelectTreeNodeModal = ({ title, open, attribute, backendValues, onC
34
34
  : true, selectedNodes: [
35
35
  ...selectedNodes.map(node => node.id),
36
36
  ...backendValues.map(value => value.treeValue.id),
37
- ], childrenAsRecordValuePermissionFilter: childrenAsRecordValuePermissionFilter, disabledNodes: backendValues.map(value => value.treeValue.id).concat(attribute.linked_tree.id), onSelect: _handleOnSelect }) }));
37
+ ], childrenAsRecordValuePermissionFilter: childrenAsRecordValuePermissionFilter, dependentValuesPermissionFilter: dependentValuesPermissionFilter, disabledNodes: backendValues.map(value => value.treeValue.id).concat(attribute.linked_tree.id), onSelect: _handleOnSelect }) }));
38
38
  };
39
39
  //# sourceMappingURL=SelectTreeNodeModal.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SelectTreeNodeModal.js","sourceRoot":"","sources":["../../../../../../../src/components/RecordEdition/EditRecordContent/uiElements/TreeField/manage-tree-node-selection/SelectTreeNodeModal.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAA8C,QAAQ,EAAC,MAAM,OAAO,CAAC;AAC5E,OAAO,EAAC,eAAe,EAAC,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAC,OAAO,EAAE,OAAO,EAAC,MAAM,mCAAmC,CAAC;AACnE,OAAO,EAAC,SAAS,EAAE,QAAQ,EAAC,MAAM,YAAY,CAAC;AAK/C,OAAO,EAAC,cAAc,EAAC,MAAM,+BAA+B,CAAC;AAE7D,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AAGpE,MAAM,6BAA6B,GAAG,OAAO,CAAC;AAC9C,MAAM,4BAA4B,GAAG,OAAO,CAAC;AA8B7C,MAAM,CAAC,MAAM,mBAAmB,GAAiD,CAAC,EAC9E,KAAK,EACL,IAAI,EACJ,SAAS,EACT,aAAa,EACb,SAAS,EACT,OAAO,EACP,qCAAqC,EACrC,SAAS,GACZ,EAAE,EAAE;IACD,MAAM,EAAC,CAAC,EAAC,GAAG,oBAAoB,EAAE,CAAC;IAEnC,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAG,QAAQ,CAAwB,EAAE,CAAC,CAAC;IAE9E,MAAM,eAAe,GAAsD,CAAC,IAAI,EAAE,QAAQ,EAAE,EAAE;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E,gBAAgB,YAExB,CAAC,CAAC,gBAAgB,CAAC,GACZ,CACf,IACF,YAGP,KAAC,cAAc,IACX,MAAM,EAAE,SAAS,CAAC,WAAW,CAAC,EAAE,EAChC,QAAQ,CAAC,2HAA2H;oBACpI,aAAa,EAAE;gBACX,GAAG,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;gBACrC,GAAG,aAAa,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE,CAAC;aACpD,EACD,qCAAqC,EAAE,qCAAqC,EAC5E,aAAa,EAAE,aAAa,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,WAAW,CAAC,EAAE,CAAC,EAC9F,QAAQ,EAAE,eAAe,GAC3B,GACK,CACd,CAAC;AACN,CAAC,CAAC","sourcesContent":["// Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06\n// This file is released under LGPL V3\n// License text available at https://www.gnu.org/licenses/lgpl-3.0.txt\nimport {type ComponentProps, type FunctionComponent, useState} from 'react';\nimport {FontAwesomeIcon} from '@fortawesome/react-fontawesome';\nimport {faCheck, faXmark} from '@fortawesome/free-solid-svg-icons';\nimport {KitButton, KitModal} from 'aristid-ds';\nimport {\n type ChildrenAsRecordValuePermissionFilterInput,\n type RecordFormAttributeTreeAttributeFragment,\n} from '_ui/_gqlTypes';\nimport {SelectTreeNode} from '_ui/components/SelectTreeNode';\nimport {type RecordFormElementsValueTreeValue} from '_ui/hooks/useGetRecordForm';\nimport {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\nimport {type ITreeNodeWithRecord} from '_ui/types';\n\nconst SELECT_TREE_NODE_MODAL_HEIGHT = '563px';\nconst SELECT_TREE_NODE_MODAL_WIDTH = '656px';\n\ntype SelectTreeNodeModalBackendValue =\n | RecordFormElementsValueTreeValue\n | {\n treeValue: {\n id: string;\n };\n };\n\ntype SelectTreeNodeModalAttribute =\n | RecordFormAttributeTreeAttributeFragment\n | {\n multiple_values: boolean;\n linked_tree: {\n id: string;\n };\n };\n\ninterface ISelectTreeNodeModalProps {\n title: string;\n open: boolean;\n attribute: SelectTreeNodeModalAttribute;\n backendValues: SelectTreeNodeModalBackendValue[];\n onConfirm: (selectedNodes: ITreeNodeWithRecord[]) => void;\n onClose: () => void;\n childrenAsRecordValuePermissionFilter?: ChildrenAsRecordValuePermissionFilterInput;\n className?: string;\n}\n\nexport const SelectTreeNodeModal: FunctionComponent<ISelectTreeNodeModalProps> = ({\n title,\n open,\n attribute,\n backendValues,\n onConfirm,\n onClose,\n childrenAsRecordValuePermissionFilter,\n className,\n}) => {\n const {t} = useSharedTranslation();\n\n const [selectedNodes, setSelectedNodes] = useState<ITreeNodeWithRecord[]>([]);\n\n const _handleOnSelect: ComponentProps<typeof SelectTreeNode>['onSelect'] = (node, selected) => {\n if (!attribute.multiple_values) {\n onConfirm(selected ? [node] : []);\n onClose();\n return;\n }\n\n if (selected) {\n setSelectedNodes(prev => [...prev, node]);\n } else {\n setSelectedNodes(prev => prev.filter(selectedValue => selectedValue.id !== node.id));\n }\n };\n\n const _handleOnConfirm: ComponentProps<typeof KitButton>['onClick'] = () => {\n onConfirm(selectedNodes);\n onClose();\n };\n\n return (\n <KitModal\n appElement={document.getElementById('root')}\n className={className}\n showCloseIcon\n width={SELECT_TREE_NODE_MODAL_WIDTH}\n height={SELECT_TREE_NODE_MODAL_HEIGHT}\n title={title}\n isOpen={open}\n close={onClose}\n footer={\n <>\n <KitButton icon={<FontAwesomeIcon icon={faXmark} />} onClick={onClose}>\n {t('global.close')}\n </KitButton>\n {attribute.multiple_values && (\n <KitButton\n type=\"primary\"\n icon={<FontAwesomeIcon icon={faCheck} />}\n disabled={selectedNodes.length === 0}\n onClick={_handleOnConfirm}\n >\n {t('global.confirm')}\n </KitButton>\n )}\n </>\n }\n >\n <SelectTreeNode\n treeId={attribute.linked_tree.id}\n multiple // We want to be able to set as selected in the tree components, the nodes that are already selected and the disabled nodes\n selectedNodes={[\n ...selectedNodes.map(node => node.id),\n ...backendValues.map(value => value.treeValue.id),\n ]}\n childrenAsRecordValuePermissionFilter={childrenAsRecordValuePermissionFilter}\n disabledNodes={backendValues.map(value => value.treeValue.id).concat(attribute.linked_tree.id)}\n onSelect={_handleOnSelect}\n />\n </KitModal>\n );\n};\n"]}
1
+ {"version":3,"file":"SelectTreeNodeModal.js","sourceRoot":"","sources":["../../../../../../../src/components/RecordEdition/EditRecordContent/uiElements/TreeField/manage-tree-node-selection/SelectTreeNodeModal.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAA8C,QAAQ,EAAC,MAAM,OAAO,CAAC;AAC5E,OAAO,EAAC,eAAe,EAAC,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAC,OAAO,EAAE,OAAO,EAAC,MAAM,mCAAmC,CAAC;AACnE,OAAO,EAAC,SAAS,EAAE,QAAQ,EAAC,MAAM,YAAY,CAAC;AAM/C,OAAO,EAAC,cAAc,EAAC,MAAM,+BAA+B,CAAC;AAE7D,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AAGpE,MAAM,6BAA6B,GAAG,OAAO,CAAC;AAC9C,MAAM,4BAA4B,GAAG,OAAO,CAAC;AA+B7C,MAAM,CAAC,MAAM,mBAAmB,GAAiD,CAAC,EAC9E,KAAK,EACL,IAAI,EACJ,SAAS,EACT,aAAa,EACb,SAAS,EACT,OAAO,EACP,qCAAqC,EACrC,+BAA+B,EAC/B,SAAS,GACZ,EAAE,EAAE;IACD,MAAM,EAAC,CAAC,EAAC,GAAG,oBAAoB,EAAE,CAAC;IAEnC,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAG,QAAQ,CAAwB,EAAE,CAAC,CAAC;IAE9E,MAAM,eAAe,GAA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,CAAC,MAAM,KAAK,CAAC,EACpC,OAAO,EAAE,gBAAgB,YAExB,CAAC,CAAC,gBAAgB,CAAC,GACZ,CACf,IACF,YAGP,KAAC,cAAc,IACX,MAAM,EAAE,SAAS,CAAC,WAAW,CAAC,EAAE,EAChC,QAAQ,CAAC,2HAA2H;oBACpI,aAAa,EAAE;gBACX,GAAG,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;gBACrC,GAAG,aAAa,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE,CAAC;aACpD,EACD,qCAAqC,EAAE,qCAAqC,EAC5E,+BAA+B,EAAE,+BAA+B,EAChE,aAAa,EAAE,aAAa,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,WAAW,CAAC,EAAE,CAAC,EAC9F,QAAQ,EAAE,eAAe,GAC3B,GACK,CACd,CAAC;AACN,CAAC,CAAC","sourcesContent":["// Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06\n// This file is released under LGPL V3\n// License text available at https://www.gnu.org/licenses/lgpl-3.0.txt\nimport {type ComponentProps, type FunctionComponent, useState} from 'react';\nimport {FontAwesomeIcon} from '@fortawesome/react-fontawesome';\nimport {faCheck, faXmark} from '@fortawesome/free-solid-svg-icons';\nimport {KitButton, KitModal} from 'aristid-ds';\nimport {\n type DependentValuesPermissionFilterInput,\n type ChildrenAsRecordValuePermissionFilterInput,\n type RecordFormAttributeTreeAttributeFragment,\n} from '_ui/_gqlTypes';\nimport {SelectTreeNode} from '_ui/components/SelectTreeNode';\nimport {type RecordFormElementsValueTreeValue} from '_ui/hooks/useGetRecordForm';\nimport {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\nimport {type ITreeNodeWithRecord} from '_ui/types';\n\nconst SELECT_TREE_NODE_MODAL_HEIGHT = '563px';\nconst SELECT_TREE_NODE_MODAL_WIDTH = '656px';\n\ntype SelectTreeNodeModalBackendValue =\n | RecordFormElementsValueTreeValue\n | {\n treeValue: {\n id: string;\n };\n };\n\ntype SelectTreeNodeModalAttribute =\n | RecordFormAttributeTreeAttributeFragment\n | {\n multiple_values: boolean;\n linked_tree: {\n id: string;\n };\n };\n\ninterface ISelectTreeNodeModalProps {\n title: string;\n open: boolean;\n attribute: SelectTreeNodeModalAttribute;\n backendValues: SelectTreeNodeModalBackendValue[];\n onConfirm: (selectedNodes: ITreeNodeWithRecord[]) => void;\n onClose: () => void;\n childrenAsRecordValuePermissionFilter?: ChildrenAsRecordValuePermissionFilterInput;\n dependentValuesPermissionFilter?: DependentValuesPermissionFilterInput;\n className?: string;\n}\n\nexport const SelectTreeNodeModal: FunctionComponent<ISelectTreeNodeModalProps> = ({\n title,\n open,\n attribute,\n backendValues,\n onConfirm,\n onClose,\n childrenAsRecordValuePermissionFilter,\n dependentValuesPermissionFilter,\n className,\n}) => {\n const {t} = useSharedTranslation();\n\n const [selectedNodes, setSelectedNodes] = useState<ITreeNodeWithRecord[]>([]);\n\n const _handleOnSelect: ComponentProps<typeof SelectTreeNode>['onSelect'] = (node, selected) => {\n if (!attribute.multiple_values) {\n onConfirm(selected ? [node] : []);\n onClose();\n return;\n }\n\n if (selected) {\n setSelectedNodes(prev => [...prev, node]);\n } else {\n setSelectedNodes(prev => prev.filter(selectedValue => selectedValue.id !== node.id));\n }\n };\n\n const _handleOnConfirm: ComponentProps<typeof KitButton>['onClick'] = () => {\n onConfirm(selectedNodes);\n onClose();\n };\n\n return (\n <KitModal\n appElement={document.getElementById('root')}\n className={className}\n showCloseIcon\n width={SELECT_TREE_NODE_MODAL_WIDTH}\n height={SELECT_TREE_NODE_MODAL_HEIGHT}\n title={title}\n isOpen={open}\n close={onClose}\n footer={\n <>\n <KitButton icon={<FontAwesomeIcon icon={faXmark} />} onClick={onClose}>\n {t('global.close')}\n </KitButton>\n {attribute.multiple_values && (\n <KitButton\n type=\"primary\"\n icon={<FontAwesomeIcon icon={faCheck} />}\n disabled={selectedNodes.length === 0}\n onClick={_handleOnConfirm}\n >\n {t('global.confirm')}\n </KitButton>\n )}\n </>\n }\n >\n <SelectTreeNode\n treeId={attribute.linked_tree.id}\n multiple // We want to be able to set as selected in the tree components, the nodes that are already selected and the disabled nodes\n selectedNodes={[\n ...selectedNodes.map(node => node.id),\n ...backendValues.map(value => value.treeValue.id),\n ]}\n childrenAsRecordValuePermissionFilter={childrenAsRecordValuePermissionFilter}\n dependentValuesPermissionFilter={dependentValuesPermissionFilter}\n disabledNodes={backendValues.map(value => value.treeValue.id).concat(attribute.linked_tree.id)}\n onSelect={_handleOnSelect}\n />\n </KitModal>\n );\n};\n"]}
@@ -1,5 +1,5 @@
1
1
  import { type Dispatch, type SetStateAction } from 'react';
2
- import { type ChildrenAsRecordValuePermissionFilterInput, type RecordFormAttributeTreeAttributeFragment } from '../../../../../../_gqlTypes';
2
+ import { type DependentValuesPermissionFilterInput, type ChildrenAsRecordValuePermissionFilterInput, type RecordFormAttributeTreeAttributeFragment } from '../../../../../../_gqlTypes';
3
3
  import { type RecordFormElementsValueTreeValue } from '../../../../../../hooks/useGetRecordForm';
4
4
  import { type DeleteMultipleValuesFunc, type DeleteValueFunc, type SubmitValueFunc } from '../../../_types';
5
5
  interface IUseManageTreeNodeSelectionProps {
@@ -14,8 +14,9 @@ interface IUseManageTreeNodeSelectionProps {
14
14
  isReadOnly: boolean;
15
15
  isFieldInError: boolean;
16
16
  childrenAsRecordValuePermissionFilter?: ChildrenAsRecordValuePermissionFilterInput;
17
+ dependentValuesPermissionFilter?: DependentValuesPermissionFilterInput;
17
18
  }
18
- export declare const useManageTreeNodeSelection: ({ modaleTitle, attribute, isFormCreationMode, backendValues, setBackendValues, onValueSubmit, onValueDelete, onDeleteMultipleValues, isReadOnly, isFieldInError, childrenAsRecordValuePermissionFilter, }: IUseManageTreeNodeSelectionProps) => {
19
+ export declare const useManageTreeNodeSelection: ({ modaleTitle, attribute, isFormCreationMode, backendValues, setBackendValues, onValueSubmit, onValueDelete, onDeleteMultipleValues, isReadOnly, isFieldInError, childrenAsRecordValuePermissionFilter, dependentValuesPermissionFilter, }: IUseManageTreeNodeSelectionProps) => {
19
20
  openModal: () => void;
20
21
  removeTreeNode: (nodeValue: RecordFormElementsValueTreeValue, skipAfterRemove?: boolean) => Promise<void>;
21
22
  actionButtonLabel: string;
@@ -9,7 +9,7 @@ import { useSharedTranslation } from '../../../../../../hooks/useSharedTranslati
9
9
  import { APICallStatus, } from '../../../_types';
10
10
  import { DeleteAllValuesButton } from '../../shared/DeleteAllValuesButton';
11
11
  import { SelectTreeNodeModal } from './SelectTreeNodeModal';
12
- export const useManageTreeNodeSelection = ({ modaleTitle, attribute, isFormCreationMode, backendValues, setBackendValues, onValueSubmit, onValueDelete, onDeleteMultipleValues, isReadOnly, isFieldInError, childrenAsRecordValuePermissionFilter, }) => {
12
+ export const useManageTreeNodeSelection = ({ modaleTitle, attribute, isFormCreationMode, backendValues, setBackendValues, onValueSubmit, onValueDelete, onDeleteMultipleValues, isReadOnly, isFieldInError, childrenAsRecordValuePermissionFilter, dependentValuesPermissionFilter, }) => {
13
13
  const { t } = useSharedTranslation();
14
14
  const form = AntForm.useFormInstance();
15
15
  const [isModalHidden, setIsModalHidden] = useState(true);
@@ -126,7 +126,7 @@ export const useManageTreeNodeSelection = ({ modaleTitle, attribute, isFormCreat
126
126
  }
127
127
  },
128
128
  actionButtonLabel: label,
129
- SelectTreeNodeModal: isModalHidden ? null : (_jsx(SelectTreeNodeModal, { open: true, title: label, attribute: attribute, backendValues: backendValues, onConfirm: _addTreeNodes, onClose: _closeModal, childrenAsRecordValuePermissionFilter: childrenAsRecordValuePermissionFilter })),
129
+ SelectTreeNodeModal: isModalHidden ? null : (_jsx(SelectTreeNodeModal, { open: true, title: label, attribute: attribute, backendValues: backendValues, onConfirm: _addTreeNodes, onClose: _closeModal, childrenAsRecordValuePermissionFilter: childrenAsRecordValuePermissionFilter, dependentValuesPermissionFilter: dependentValuesPermissionFilter })),
130
130
  RemoveAllTreeNodes: !isReadOnly && backendValues.length > 1 && attribute.multiple_values && !attribute.required ? (_jsx(DeleteAllValuesButton, { handleDelete: _removeAllTreeNodes, disabled: isReadOnly, danger: isFieldInError })) : null,
131
131
  };
132
132
  };