@reltio/components 1.4.701 → 1.4.702
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/HOCs/index.js +10 -0
- package/HOCs/withAsyncMount/withAsyncMount.js +44 -0
- package/HOCs/withTooltip/propTypes.js +11 -0
- package/HOCs/withTooltip/withTooltip.js +71 -0
- package/components/ArrowExpandButton/ArrowExpandButton.js +39 -0
- package/components/ArrowExpandButton/styles.js +17 -0
- package/components/AttributeListItem/AttrTypeIcon.js +29 -0
- package/components/AttributeListItem/AttributeListItem.js +70 -0
- package/components/AttributeListItem/styles.js +97 -0
- package/components/AutoSizeList/AutoSizeList.js +70 -0
- package/components/AvatarWithFallback/AvatarWithFallback.js +79 -0
- package/components/BasicTableView/BasicTable/BasicTable.js +106 -0
- package/components/BasicTableView/BasicTable/HOCs/withFilter.js +38 -0
- package/components/BasicTableView/BasicTable/HOCs/withFilterAtBottom.js +43 -0
- package/components/BasicTableView/BasicTable/HOCs/withTableContext.js +47 -0
- package/components/BasicTableView/BasicTable/cell-value-renderers/BlobRenderer.js +20 -0
- package/components/BasicTableView/BasicTable/cell-value-renderers/DefaultCellValueRenderer.js +43 -0
- package/components/BasicTableView/BasicTable/cell-value-renderers/index.js +8 -0
- package/components/BasicTableView/BasicTable/cell-value-renderers/styles.js +22 -0
- package/components/BasicTableView/BasicTable/contexts/RowCollapseContext.js +9 -0
- package/components/BasicTableView/BasicTable/contexts/TableContext.js +9 -0
- package/components/BasicTableView/BasicTable/contexts/index.js +5 -0
- package/components/BasicTableView/BasicTable/helpers/dataHelpers.js +122 -0
- package/components/BasicTableView/BasicTable/helpers/defaultGetRowCellHeight.js +20 -0
- package/components/BasicTableView/BasicTable/helpers/defaultRenderRowCell.js +33 -0
- package/components/BasicTableView/BasicTable/helpers/nestedHelpers.js +80 -0
- package/components/BasicTableView/BasicTable/hooks/index.js +10 -0
- package/components/BasicTableView/BasicTable/hooks/useBasicTableCellRenderer.js +94 -0
- package/components/BasicTableView/BasicTable/hooks/useCollapsibleTableRows.js +43 -0
- package/components/BasicTableView/BasicTable/hooks/useDynamicRowCellHeight.js +37 -0
- package/components/BasicTableView/BasicTableHeader/ColumnsSettings/ColumnListItem.js +30 -0
- package/components/BasicTableView/BasicTableHeader/ColumnsSettings/ColumnsSettings.js +91 -0
- package/components/BasicTableView/BasicTableHeader/ColumnsSettings/columnHelpers.js +86 -0
- package/components/BasicTableView/BasicTableHeader/ColumnsSettings/styles.js +12 -0
- package/components/BasicTableView/BasicTableHeader/FilterButton/FilterButton.js +26 -0
- package/components/BasicTableView/BasicTableHeader/FilterButton/styles.js +18 -0
- package/components/BasicTableView/BasicTablePagination/BasicTablePagination.js +80 -0
- package/components/BasicTableView/BasicTablePagination/styles.js +32 -0
- package/components/BasicTableView/CollapseRowButton/CollapseRowButton.js +48 -0
- package/components/BasicTableView/CollapseRowButton/styles.js +9 -0
- package/components/BasicTableView/ColumnFilter/ColumnFilter.js +113 -0
- package/components/BasicTableView/ColumnFilter/FilterChip/FilterChip.js +40 -0
- package/components/BasicTableView/ColumnFilter/FilterChip/styles.js +27 -0
- package/components/BasicTableView/ColumnFilter/helpers.js +18 -0
- package/components/BasicTableView/ColumnFilter/styles.js +30 -0
- package/components/BasicTableView/RowCellAutoSizer/RowCellAutoSizer.js +56 -0
- package/components/BasicTableView/index.js +45 -0
- package/components/BasicTableView/viewState/basicTableViewState.js +82 -0
- package/components/BasicView/BasicView.js +61 -0
- package/components/BasicView/styles.js +13 -0
- package/components/BasicViewContent/BasicViewContent.js +36 -0
- package/components/BasicViewContent/styles.js +13 -0
- package/components/BasicViewHeader/BasicViewHeader.js +39 -0
- package/components/BasicViewHeader/styles.js +19 -0
- package/components/ClickAwayProvider/ClickAwayProvider.js +22 -0
- package/components/CollaborationItem/Avatar/Avatar.js +39 -0
- package/components/CollaborationItem/Avatar/styles.js +13 -0
- package/components/CollaborationItem/CollaborationItem.js +48 -0
- package/components/CollaborationItem/Comment/Comment.js +78 -0
- package/components/CollaborationItem/Comment/styles.js +51 -0
- package/components/CollaborationItem/CommentContent/CommentContent.js +42 -0
- package/components/CollaborationItem/CommentContent/styles.js +12 -0
- package/components/CollaborationItem/CommentTarget/CommentTarget.js +98 -0
- package/components/CollaborationItem/CommentTarget/styles.js +23 -0
- package/components/CollaborationItem/RepliedComment/RepliedComment.js +30 -0
- package/components/CollaborationItem/RepliedComment/styles.js +44 -0
- package/components/CollaborationItem/SendMessageArea/SendMessageArea.js +113 -0
- package/components/CollaborationItem/SendMessageArea/styles.js +33 -0
- package/components/CollaborationItem/TextFieldWithMentions/TextFieldWithMentions.js +70 -0
- package/components/CollaborationItem/TextFieldWithMentions/styles.js +54 -0
- package/components/CollaborationItem/styles.js +21 -0
- package/components/CollaborationItem/utils/index.js +53 -0
- package/components/CollaborationPopup/CollaborationPopup.js +68 -0
- package/components/CollaborationPopup/styles.js +69 -0
- package/components/CollapseButton/CollapseButton.js +47 -0
- package/components/CollapseButton/styles.js +12 -0
- package/components/ColorBar/ColorBar.js +38 -0
- package/components/ColorBar/styles.js +17 -0
- package/components/CommentsContainer/CommentsContainer.js +70 -0
- package/components/CommentsContainer/buttons/AddCommentButton.js +19 -0
- package/components/CommentsContainer/buttons/CommentButton.js +20 -0
- package/components/CommentsContainer/buttons/styles.js +36 -0
- package/components/CommentsContainer/styles.js +25 -0
- package/components/ConfigureColumnsPopup/ConfigureColumnsPopup.js +121 -0
- package/components/ConfigureColumnsPopup/styles.js +13 -0
- package/components/ConfirmationDialog/ConfirmationDialog.js +28 -0
- package/components/ConfirmationDialog/styles.js +40 -0
- package/components/ConnectionRelationTypeSelector/ConnectionRelationTypeSelector.js +83 -0
- package/components/DataTypeValue/DataTypeValue.js +28 -0
- package/components/DateRangePicker/DateRangePicker.js +87 -0
- package/components/DateRangePicker/styles.js +43 -0
- package/components/Drawer/Drawer.js +72 -0
- package/components/DropDownMenuButton/DropDownMenuButton.js +74 -0
- package/components/DropDownMenuButton/MenuItemRenderer.js +44 -0
- package/components/DropDownMenuButton/styles.js +28 -0
- package/components/DropDownSelector/DropDownSelector.js +97 -0
- package/components/DropDownSelector/components/Menu.js +36 -0
- package/components/DropDownSelector/components/SingleValue.js +30 -0
- package/components/DropDownSelector/components/styles.js +36 -0
- package/components/DropDownSelector/styles.js +69 -0
- package/components/EmptySearchResult/NoData.js +25 -0
- package/components/EmptySearchResult/NoMessageComponent.js +39 -0
- package/components/EmptySearchResult/NoResults.js +24 -0
- package/components/EmptySearchResult/index.js +7 -0
- package/components/EmptySearchResult/styles.js +26 -0
- package/components/EmptyState/EmptyState.js +36 -0
- package/components/EmptyState/styles.js +68 -0
- package/components/EntityAvatar/EntityAvatar.js +26 -0
- package/components/EntityAvatar/no-photo.svg.js +4 -0
- package/components/EntityTypeBadge/EntityTypeBadge.js +25 -0
- package/components/EntityTypeBadge/styles.js +23 -0
- package/components/EntityTypeIcon/EntityTypeIcon.js +26 -0
- package/components/EntityTypesSelector/EntityTypesSelector.js +141 -0
- package/components/EntityTypesSelector/ListLabel/ListLabel.js +51 -0
- package/components/EntityTypesSelector/ListLabel/helpers.js +49 -0
- package/components/EntityTypesSelector/ListLabel/styles.js +36 -0
- package/components/EntityTypesSelector/SelectEntityTypesList.js +70 -0
- package/components/EntityTypesSelector/styles.js +72 -0
- package/components/EntityUriLink/EntityUriLink.js +43 -0
- package/components/ErrorBoundary/ErrorBoundary.js +46 -0
- package/components/ErrorPopup/ErrorPopup.js +32 -0
- package/components/ErrorPopup/styles.js +11 -0
- package/components/ErrorWrapper/ErrorMessage.js +17 -0
- package/components/ErrorWrapper/ErrorWrapper.js +62 -0
- package/components/ErrorWrapper/styles.js +18 -0
- package/components/ExpandableSearchInput/ExpandableSearchInput.js +50 -0
- package/components/ExpandableSearchInput/styles.js +23 -0
- package/components/ExpandedValueTooltip/ExpandedValueTooltip.js +88 -0
- package/components/FacetViewHeader/FacetViewHeader.js +15 -0
- package/components/FacetViewHeader/styles.js +17 -0
- package/components/FlipCard/FlipCard.js +41 -0
- package/components/FlipCard/styles.js +55 -0
- package/components/FlipCard/types/index.js +2 -0
- package/components/HideOnShrink/HideOnShrink.js +21 -0
- package/components/HierarchicalAttributeTooltip/HierarchicalAttributeTooltip.js +45 -0
- package/components/HierarchicalAttributeTooltip/styles.js +54 -0
- package/components/Highlighter/Highlighter.js +18 -0
- package/components/Highlighter/styles.js +9 -0
- package/components/Image/CheckedIcon/CheckedIcon.js +18 -0
- package/components/Image/CheckedIcon/styles.js +10 -0
- package/components/Image/Image.js +104 -0
- package/components/Image/ImageActionsOverlay/ImageActionsOverlay.js +81 -0
- package/components/Image/ImageActionsOverlay/styles.js +61 -0
- package/components/Image/styles.js +33 -0
- package/components/ImageAttributesGallery/GalleryView/GalleryView.js +45 -0
- package/components/ImageAttributesGallery/GalleryView/styles.js +14 -0
- package/components/ImageAttributesGallery/HeaderLeft/HeaderLeft.js +17 -0
- package/components/ImageAttributesGallery/HeaderLeft/styles.js +12 -0
- package/components/ImageAttributesGallery/HeaderRight/HeaderRight.js +26 -0
- package/components/ImageAttributesGallery/HeaderRight/styles.js +27 -0
- package/components/ImageAttributesGallery/ImageAttributesGallery.js +121 -0
- package/components/ImageDetailsView/ImageDetailsView.js +52 -0
- package/components/ImageDetailsView/ImageDetailsViewCarousel/ImageDetailsViewCarousel.js +53 -0
- package/components/ImageDetailsView/ImageDetailsViewCarousel/Thumbnails/Thumbnails.js +72 -0
- package/components/ImageDetailsView/ImageDetailsViewCarousel/Thumbnails/styles.js +26 -0
- package/components/ImageDetailsView/ImageDetailsViewCarousel/styles.js +47 -0
- package/components/ImageDetailsView/ImageDetailsViewSidebar/ImageDetailsViewSidebar.js +61 -0
- package/components/ImageDetailsView/ImageDetailsViewSidebar/styles.js +45 -0
- package/components/ImageDetailsView/MetaInfo/MetaInfo.js +29 -0
- package/components/ImageDetailsView/MetaInfoForm/MetaInfoForm.js +32 -0
- package/components/ImageDetailsView/MetaInfoForm/styles.js +24 -0
- package/components/ImageDetailsView/MetaInfoHeader/MetaInfoHeader.js +52 -0
- package/components/ImageDetailsView/MetaInfoHeader/styles.js +21 -0
- package/components/ImageDetailsView/MetaInfoList/MetaInfoItem/MetaInfoItem.js +17 -0
- package/components/ImageDetailsView/MetaInfoList/MetaInfoItem/styles.js +25 -0
- package/components/ImageDetailsView/MetaInfoList/MetaInfoList.js +32 -0
- package/components/ImageDetailsView/MetaInfoList/styles.js +17 -0
- package/components/ImageDetailsView/constants/index.js +42 -0
- package/components/ImageDetailsView/helpers/index.js +97 -0
- package/components/ImageDetailsView/hooks/useEditMetaInfo.js +70 -0
- package/components/ImageDetailsView/styles.js +18 -0
- package/components/ImageDetailsView/theme/index.js +12 -0
- package/components/ImageDetailsView/types/index.js +2 -0
- package/components/ImageGalleryDialog/ImageGalleryDialog.js +70 -0
- package/components/ImageGalleryDialog/styles.js +49 -0
- package/components/ImportButton/ImportButton.js +40 -0
- package/components/ImportButton/styles.js +16 -0
- package/components/LightArrowTooltip/LightArrowTooltip.js +24 -0
- package/components/LightArrowTooltip/styles.js +15 -0
- package/components/LinearLoadIndicator/LinearLoadIndicator.js +17 -0
- package/components/LinearLoadIndicator/styles.js +19 -0
- package/components/Link/Link.js +19 -0
- package/components/Link/styles.js +14 -0
- package/components/LoadingSpinner/LoadingSpinner.js +15 -0
- package/components/LoadingSpinner/SpinnerSmall.gif.js +4 -0
- package/components/Marginator/Marginator.js +16 -0
- package/components/MatchRulesBlock/MatchRulesBadge/MatchRulesBadge.js +59 -0
- package/components/MatchRulesBlock/MatchRulesBadge/styles.js +23 -0
- package/components/MatchRulesBlock/MatchRulesBlock.js +24 -0
- package/components/MatchRulesBlock/MatchRulesTitle.js +12 -0
- package/components/MatchRulesBlock/MatchRulesTooltip/MatchRulesTooltip.js +18 -0
- package/components/MatchRulesBlock/MatchRulesTooltip/styles.js +19 -0
- package/components/MatchRulesBlock/SimpleMatchRules/SimpleMatchRules.js +18 -0
- package/components/MatchRulesBlock/SimpleMatchRules/styles.js +18 -0
- package/components/MatchRulesBlock/SimpleMatchRulesBlock/SimpleMatchRulesBlock.js +46 -0
- package/components/MatchRulesBlock/SimpleMatchRulesBlock/styles.js +19 -0
- package/components/MatchRulesBlock/SimpleMatchRulesBuilder/SimpleMatchRulesBuilder.js +43 -0
- package/components/MatchRulesBlock/TransitiveMatchBlock/TransitiveMatchBlock.js +58 -0
- package/components/MatchRulesBlock/TransitiveMatchBlock/styles.js +14 -0
- package/components/MatchRulesBlock/TransitiveMatchRules/TransitiveMatchRule.js +41 -0
- package/components/MatchRulesBlock/TransitiveMatchRules/styles.js +23 -0
- package/components/MatchRulesBlock/TransitiveMatchRulesTooltip/TransitiveMatchRulesTooltip.js +19 -0
- package/components/MatchRulesBlock/TransitiveMatchRulesTooltip/styles.js +13 -0
- package/components/MatchRulesBlock/types/index.js +2 -0
- package/components/ModeSwitcher/ModeSwitcher.js +25 -0
- package/components/ModeSwitcher/styles.js +36 -0
- package/components/ModeSwitcherSelect/ModeSwitcherSelect.js +87 -0
- package/components/ModeSwitcherSelect/index.js +5 -0
- package/components/ModeSwitcherSelect/styles.js +70 -0
- package/components/MultipleInput/MultipleInput.js +113 -0
- package/components/MultipleInput/styles.js +22 -0
- package/components/MultipliableSelect/MultipliableSelect.js +59 -0
- package/components/MultipliableSelect/styles.js +14 -0
- package/components/Popper/Popper.js +94 -0
- package/components/Popper/styles.js +17 -0
- package/components/Popper/utils.js +45 -0
- package/components/PopupWithArrow/PopupWithArrow.js +34 -0
- package/components/PopupWithArrow/styles.js +75 -0
- package/components/PotentialMatchReviewCard/PotentialMatchReviewCard.js +65 -0
- package/components/PotentialMatchReviewCard/styles.js +65 -0
- package/components/ProfileBand/ProfileBand.js +96 -0
- package/components/ProfileBand/styles.js +92 -0
- package/components/ProfileCard/ProfileCard.js +89 -0
- package/components/ProfileCard/styles.js +64 -0
- package/components/QueryBuilderRow/QueryBuilderRow.js +78 -0
- package/components/QueryBuilderRow/components/ReadOnlyFilter.js +21 -0
- package/components/QueryBuilderRow/components/ReadOnlyLogicOperator.js +21 -0
- package/components/QueryBuilderRow/components/styles.js +25 -0
- package/components/QueryBuilderRow/styles.js +22 -0
- package/components/QueryBuilderRowsGroup/QueryBuilderRowsGroup.js +88 -0
- package/components/ReactSelect/AsyncSelect.js +8 -0
- package/components/ReactSelect/CreatableSelect.js +8 -0
- package/components/ReactSelect/MultiSelect/MultiSelect.js +233 -0
- package/components/ReactSelect/MultiSelect/components/Option.js +57 -0
- package/components/ReactSelect/MultiSelect/components/index.js +10 -0
- package/components/ReactSelect/MultiSelect/index.js +7 -0
- package/components/ReactSelect/Select.js +8 -0
- package/components/ReactSelect/commonComponents/ClearIndicator.js +36 -0
- package/components/ReactSelect/commonComponents/Control.js +66 -0
- package/components/ReactSelect/commonComponents/DropdownIndicator.js +36 -0
- package/components/ReactSelect/commonComponents/GroupHeading.js +22 -0
- package/components/ReactSelect/commonComponents/Menu.js +37 -0
- package/components/ReactSelect/commonComponents/MultiValue.js +37 -0
- package/components/ReactSelect/commonComponents/NoOptionsMessage.js +17 -0
- package/components/ReactSelect/commonComponents/Option.js +56 -0
- package/components/ReactSelect/commonComponents/Placeholder.js +29 -0
- package/components/ReactSelect/commonComponents/SingleValue.js +29 -0
- package/components/ReactSelect/commonComponents/ValueContainer.js +19 -0
- package/components/ReactSelect/commonComponents/index.js +30 -0
- package/components/ReactSelect/optionFilters.js +9 -0
- package/components/ReactSelect/styles.js +69 -0
- package/components/ReactSelect/withMuiSkin.js +97 -0
- package/components/ReactSortableTree/index.js +30 -0
- package/components/ReactSortableTree/node-renderer-default.js +148 -0
- package/components/ReactSortableTree/nodeRendererDefaultStyle.js +278 -0
- package/components/ReactSortableTree/placeholder-renderer-default.js +23 -0
- package/components/ReactSortableTree/placeholderRendererDefaultStyle.js +46 -0
- package/components/ReactSortableTree/react-sortable-tree.js +809 -0
- package/components/ReactSortableTree/reactSortableTreeStyles.js +23 -0
- package/components/ReactSortableTree/tree-node.js +200 -0
- package/components/ReactSortableTree/tree-placeholder.js +92 -0
- package/components/ReactSortableTree/treeNodeStyle.js +236 -0
- package/components/ReactSortableTree/utils/classnames.js +28 -0
- package/components/ReactSortableTree/utils/default-handlers.js +45 -0
- package/components/ReactSortableTree/utils/dnd-manager.js +326 -0
- package/components/ReactSortableTree/utils/generic-utils.js +15 -0
- package/components/ReactSortableTree/utils/memoized-tree-data-utils.js +26 -0
- package/components/ReactSortableTree/utils/tree-data-utils.js +960 -0
- package/components/ReltioGridLayout/ReltioGridLayout.js +79 -0
- package/components/ReltioGridLayout/helpers.js +52 -0
- package/components/ReltioGridLayout/icons/ResizeIcon.svg.js +4 -0
- package/components/ReltioGridLayout/styles.js +71 -0
- package/components/RequiredMark/RequiredMark.js +12 -0
- package/components/RequiredMark/styles.js +9 -0
- package/components/ResizablePanes/ResizablePanes.js +75 -0
- package/components/ResizablePanes/styles.js +48 -0
- package/components/Score/DQLabel.js +14 -0
- package/components/Score/Score.js +26 -0
- package/components/Score/ScoreLabel.js +29 -0
- package/components/Score/styles.js +36 -0
- package/components/ScrollableTabs/ScrollableTabs.js +51 -0
- package/components/ScrollableTabs/styles.js +32 -0
- package/components/SearchInput/SearchInput.js +68 -0
- package/components/SearchInput/WhiteSearchInput.js +36 -0
- package/components/SearchInput/styles.js +32 -0
- package/components/SelectionPopup/SelectionPopup.js +70 -0
- package/components/SelectionPopup/SelectionPopupPopper/SelectionPopupPopper.js +60 -0
- package/components/SelectionPopup/helpers.js +70 -0
- package/components/SelectionPopup/styles.js +41 -0
- package/components/SelectorWithOnlyOptionAutoSelect/SelectorWithOnlyOptionAutoSelect.js +74 -0
- package/components/SelectorWithOnlyOptionAutoSelect/styles.js +31 -0
- package/components/SideIconPanel/SideButtonsPanel.js +42 -0
- package/components/SideIconPanel/styles.js +41 -0
- package/components/SidePanel/SidePanel.js +16 -0
- package/components/SidePanel/SidePanelContentHeader/SidePanelContentHeader.js +24 -0
- package/components/SidePanel/SidePanelContentHeader/styles.js +23 -0
- package/components/SidePanel/styles.js +16 -0
- package/components/SimpleDropDownSelector/DropDownPlaceholder.js +31 -0
- package/components/SimpleDropDownSelector/DropDownValue.js +23 -0
- package/components/SimpleDropDownSelector/SimpleDropDownSelector.js +59 -0
- package/components/SimpleDropDownSelector/styles.js +13 -0
- package/components/SimpleInput/SimpleInput.js +77 -0
- package/components/SmallIconButton/SmallIconButton.js +109 -0
- package/components/SmallIconButton/index.js +11 -0
- package/components/SourceIcon/SourceIcon.js +18 -0
- package/components/Spacer/Spacer.js +8 -0
- package/components/Title/Title.js +27 -0
- package/components/Title/styles.js +11 -0
- package/components/UploadFileButton/UploadFileButton.js +122 -0
- package/components/UploadFileButton/styles.js +20 -0
- package/components/UploadImageDialog/DividerWithText/DividerWithText.js +20 -0
- package/components/UploadImageDialog/DividerWithText/styles.js +24 -0
- package/components/UploadImageDialog/ErrorSnackbar/ErrorSnackbar.js +18 -0
- package/components/UploadImageDialog/ErrorSnackbar/styles.js +9 -0
- package/components/UploadImageDialog/ImageByUrlField/ImageByUrlField.js +63 -0
- package/components/UploadImageDialog/ImageByUrlField/styles.js +32 -0
- package/components/UploadImageDialog/SelectImageButton/SelectImageButton.js +23 -0
- package/components/UploadImageDialog/TargetBox/TargetBox.js +45 -0
- package/components/UploadImageDialog/TargetBox/styles.js +30 -0
- package/components/UploadImageDialog/UploadImageDialog.js +87 -0
- package/components/UploadImageDialog/constants/index.js +5 -0
- package/components/UploadImageDialog/styles.js +32 -0
- package/components/ValueChip/ValueChip.js +48 -0
- package/components/ValueChip/styles.js +37 -0
- package/components/VerticalDivider/VerticalDivider.js +22 -0
- package/components/VerticalHeadingsTable/VerticalHeadingsTable.js +72 -0
- package/components/ViewMoreToggle/ViewMoreToggle.js +26 -0
- package/components/ViewMoreToggle/styles.js +20 -0
- package/components/VirtualGroupedList/VirtualGroupedList.js +223 -0
- package/components/VirtualGroupedList/helpers.js +43 -0
- package/components/VirtualGroupedList/styles.js +17 -0
- package/components/activityLog/ActivityExportButton/ActivityExportButton.js +80 -0
- package/components/activityLog/ActivityExportButton/styles.js +15 -0
- package/components/activityLog/ActivityFilterEditor/ActivityDateRangeEditor.js +85 -0
- package/components/activityLog/ActivityFilterEditor/ActivityFilterEditor.js +89 -0
- package/components/activityLog/ActivityFilterEditor/ActivitySelector.js +30 -0
- package/components/activityLog/ActivityFilterEditor/AttributeSelector.js +103 -0
- package/components/activityLog/ActivityFilterEditor/DateRangeSelector.js +114 -0
- package/components/activityLog/ActivityFilterEditor/IntervalSelector.js +51 -0
- package/components/activityLog/ActivityFilterEditor/SourceSelector.js +30 -0
- package/components/activityLog/ActivityFilterEditor/UserSelector.js +62 -0
- package/components/activityLog/ActivityFilterEditor/styles.js +103 -0
- package/components/activityLog/ActivityFilterEditor/utils/getSelectorActivityTypes.js +35 -0
- package/components/activityLog/ActivityLog/ActivityLog.js +67 -0
- package/components/activityLog/ActivityLog/helpers.js +33 -0
- package/components/activityLog/ActivityLog/items/ActivityItem/ActivityItem.js +30 -0
- package/components/activityLog/ActivityLog/items/ActivityItem/styles.js +56 -0
- package/components/activityLog/ActivityLog/items/GroupItem/GroupItem.js +22 -0
- package/components/activityLog/ActivityLog/items/GroupItem/styles.js +27 -0
- package/components/activityLog/ActivityLog/styles.js +39 -0
- package/components/activityLog/ActivityLogFilter/ActivityLogFilter.js +63 -0
- package/components/activityLog/ActivityLogFilter/ActivityLogFilterHeader.js +26 -0
- package/components/activityLog/ActivityLogFilter/helpers.js +42 -0
- package/components/activityLog/ActivityLogFilter/styles.js +21 -0
- package/components/activityLog/activities/ActivitiesFactory.js +121 -0
- package/components/activityLog/activities/ActivityTitle/ActivityTitle.js +16 -0
- package/components/activityLog/activities/ActivityTitle/styles.js +20 -0
- package/components/activityLog/activities/CommentActivity.js +12 -0
- package/components/activityLog/activities/EntityObject/EntityObject.js +19 -0
- package/components/activityLog/activities/EntityObject/styles.js +17 -0
- package/components/activityLog/activities/GroupActivity.js +21 -0
- package/components/activityLog/activities/MergeActivity.js +19 -0
- package/components/activityLog/activities/MoreItemsLink/MoreItemsLink.js +40 -0
- package/components/activityLog/activities/PotentialMatchActivity.js +16 -0
- package/components/activityLog/activities/ProfileActivity.js +19 -0
- package/components/activityLog/activities/RelationActivity.js +19 -0
- package/components/activityLog/activities/RelationObject/RelationObject.js +20 -0
- package/components/activityLog/activities/RelationObject/styles.js +20 -0
- package/components/activityLog/activities/SearchActivity.js +47 -0
- package/components/activityLog/activities/SimpleActivity.js +22 -0
- package/components/activityLog/activities/fields/DeltaField.js +39 -0
- package/components/activityLog/activities/fields/PotentialMatchField.js +51 -0
- package/components/activityLog/activities/fields/commonStyles.js +22 -0
- package/components/activityLog/activities/fields/styles.js +42 -0
- package/components/activityLog/activities/records/CollapsibleActivityRecords.js +21 -0
- package/components/activityLog/activities/records/EntityRecord.js +25 -0
- package/components/activityLog/activities/records/PotentialMatchRecord.js +19 -0
- package/components/activityLog/activities/records/RecordUpdates.js +23 -0
- package/components/activityLog/activities/records/RelationRecord.js +23 -0
- package/components/activityLog/activities/records/styles.js +38 -0
- package/components/activityLog/activities/styles.js +17 -0
- package/components/activityLog/contexts/CollapsibleItemsContext/index.js +51 -0
- package/components/activityLog/hooks/useActivitiesLoader.js +62 -0
- package/components/activityLog/hooks/useProfileActivitiesLoader.js +62 -0
- package/components/activityLog/hooks/useReadableSearchState.js +48 -0
- package/components/activityLog/index.js +25 -0
- package/components/activityLog/types/ActivitiesFilter.js +2 -0
- package/components/activityLog/types/ActivityData.js +2 -0
- package/components/activityLog/types/ActivityDelta.js +2 -0
- package/components/activityLog/types/ActivityItem.js +2 -0
- package/components/activityLog/types/ActivityTypes.js +33 -0
- package/components/activityLog/types/AttributeOption.js +2 -0
- package/components/activityLog/types/DateRangeTypes.js +9 -0
- package/components/activityLog/types/DeltaTypes.js +9 -0
- package/components/activityLog/types/DeltaValue.js +2 -0
- package/components/activityLog/types/index.js +9 -0
- package/components/activityLog/utils/activities.js +89 -0
- package/components/activityLog/utils/filters.js +80 -0
- package/components/attributes/AttributesView/AttributesView.js +36 -0
- package/components/attributes/AttributesView/index.js +15 -0
- package/components/attributes/BranchDecorator/BranchDecorator.js +16 -0
- package/components/attributes/BranchDecorator/styles.js +39 -0
- package/components/attributes/ImageAttributesLine/ImageAttributesLine.js +123 -0
- package/components/attributes/ImageAttributesLine/constants.js +9 -0
- package/components/attributes/ImageAttributesLine/index.js +8 -0
- package/components/attributes/ImageAttributesLine/styles.js +49 -0
- package/components/attributes/OvIcon/OvIcon.js +33 -0
- package/components/attributes/OvIcon/index.js +8 -0
- package/components/attributes/OvIcon/styles.js +17 -0
- package/components/attributes/PivotingAttributes/PivotingTooltip.js +62 -0
- package/components/attributes/PivotingAttributes/PivotingTooltipContent.js +82 -0
- package/components/attributes/PivotingAttributes/helpers.js +118 -0
- package/components/attributes/PivotingAttributes/styles.js +95 -0
- package/components/attributes/editMode/AttributesFactory/Attribute.js +11 -0
- package/components/attributes/editMode/AttributesFactory/AttributesFactory.js +50 -0
- package/components/attributes/editMode/AttributesList/AttributesList.js +89 -0
- package/components/attributes/editMode/AttributesList/helpers.js +43 -0
- package/components/attributes/editMode/AttributesList/index.js +8 -0
- package/components/attributes/editMode/AttributesPager/AttributeRenderer.js +99 -0
- package/components/attributes/editMode/AttributesPager/AttributesPager.js +88 -0
- package/components/attributes/editMode/AttributesPager/CardinalityMessage.js +72 -0
- package/components/attributes/editMode/AttributesPager/SpecialRenderer.js +86 -0
- package/components/attributes/editMode/AttributesPager/index.js +54 -0
- package/components/attributes/editMode/AttributesPager/styles.js +33 -0
- package/components/attributes/editMode/AttributesPager/utils.js +7 -0
- package/components/attributes/editMode/AttributesView/AttributesView.js +67 -0
- package/components/attributes/editMode/AttributesView/index.js +14 -0
- package/components/attributes/editMode/AttributesView/styles.js +15 -0
- package/components/attributes/editMode/ComplexAttribute/ComplexAttribute.js +91 -0
- package/components/attributes/editMode/ComplexAttribute/styles.js +31 -0
- package/components/attributes/editMode/EntityCreator/EntityCreator.js +49 -0
- package/components/attributes/editMode/EntityCreator/index.js +38 -0
- package/components/attributes/editMode/EntitySelector/EntitySelector.js +146 -0
- package/components/attributes/editMode/EntitySelector/components/ClearIndicator.js +20 -0
- package/components/attributes/editMode/EntitySelector/components/EntityOption.js +58 -0
- package/components/attributes/editMode/EntitySelector/components/EntityTypeOption.js +45 -0
- package/components/attributes/editMode/EntitySelector/components/Group.js +40 -0
- package/components/attributes/editMode/EntitySelector/components/SingleValue.js +80 -0
- package/components/attributes/editMode/EntitySelector/components/styles.js +89 -0
- package/components/attributes/editMode/EntitySelector/styles.js +9 -0
- package/components/attributes/editMode/ImageAttributesLine/ImageAttributesLine.js +107 -0
- package/components/attributes/editMode/ImageAttributesLine/index.js +7 -0
- package/components/attributes/editMode/ImageAttributesLine/styles.js +43 -0
- package/components/attributes/editMode/MoreAttributesButton/MoreAttributesButton.js +111 -0
- package/components/attributes/editMode/MoreAttributesButton/index.js +8 -0
- package/components/attributes/editMode/MoreAttributesButton/styles.js +31 -0
- package/components/attributes/editMode/NestedAttribute/NestedAttribute.js +45 -0
- package/components/attributes/editMode/ReferenceAttribute/ReferenceAttribute.js +152 -0
- package/components/attributes/editMode/ReferenceAttribute/index.js +44 -0
- package/components/attributes/editMode/ReferenceAttribute/styles.js +12 -0
- package/components/attributes/editMode/RelationTypeSelector/RelationTypeSelector.js +72 -0
- package/components/attributes/editMode/RelationTypeSelector/components/RelationOption.js +57 -0
- package/components/attributes/editMode/RelationTypeSelector/components/styles.js +55 -0
- package/components/attributes/editMode/SimpleAttributeEditor/SimpleAttributeEditor.js +125 -0
- package/components/attributes/editMode/SimpleAttributeEditor/selectors/getDependentLookupEditorContext.js +36 -0
- package/components/attributes/editMode/SimpleAttributeEditor/selectors/helpers/cache.js +19 -0
- package/components/attributes/editMode/SimpleAttributeEditor/selectors/helpers/missedParentsMessage.js +20 -0
- package/components/attributes/editMode/SimpleAttributeEditor/selectors/helpers/parents.js +59 -0
- package/components/attributes/editMode/SimpleAttributeEditor/selectors/types.js +2 -0
- package/components/attributes/editMode/SimpleAttributeEditor/styles.js +33 -0
- package/components/attributes/editMode/SimpleAttributeEditor/utils.js +65 -0
- package/components/attributes/helpers/attributesView.js +22 -0
- package/components/attributes/helpers/imageAttributes.js +37 -0
- package/components/attributes/inline/AttributesList/AttributesList.js +42 -0
- package/components/attributes/inline/AttributesList/styles.js +13 -0
- package/components/attributes/inline/AttributesPager/AttributesPager.js +96 -0
- package/components/attributes/inline/AttributesPager/styles.js +14 -0
- package/components/attributes/inline/ComplexAttribute/ComplexAttribute.js +72 -0
- package/components/attributes/inline/ComplexAttribute/styles.js +24 -0
- package/components/attributes/inline/ImageAttribute/ImageAttribute.js +39 -0
- package/components/attributes/inline/ImageAttribute/styles.js +17 -0
- package/components/attributes/inline/ImageAttributesBlock/ImageAttributesBlock.js +34 -0
- package/components/attributes/inline/NestedAttribute/NestedAttribute.js +37 -0
- package/components/attributes/inline/NestedAttributesBlock/NestedAttributesBlock.js +43 -0
- package/components/attributes/inline/ReferenceAttribute/ReferenceAttribute.js +48 -0
- package/components/attributes/inline/ReferenceAttribute/styles.js +14 -0
- package/components/attributes/inline/ReferenceAttributesBlock/ReferenceAttributesBlock.js +34 -0
- package/components/attributes/inline/SimpleAttribute/CrosswalkMenuItem/CrosswalkMenuItem.js +50 -0
- package/components/attributes/inline/SimpleAttribute/CrosswalkMenuItem/styles.js +23 -0
- package/components/attributes/inline/SimpleAttribute/SimpleAttribute.js +99 -0
- package/components/attributes/inline/SimpleAttribute/index.js +8 -0
- package/components/attributes/inline/SimpleAttribute/styles.js +32 -0
- package/components/attributes/inline/SimpleAttributeEditor/SimpleAttributeEditor.js +88 -0
- package/components/attributes/inline/SimpleAttributeEditor/styles.js +24 -0
- package/components/attributes/inline/SimpleAttributesBlock/SimpleAttributesBlock.js +61 -0
- package/components/attributes/inline/SimpleAttributesBlock/styles.js +24 -0
- package/components/attributes/inline/common/ComplexAttributeLabel.js +15 -0
- package/components/attributes/inline/common/CrosswalkIcon.js +20 -0
- package/components/attributes/inline/common/DeleteButton.js +13 -0
- package/components/attributes/inline/common/IgnoreButton.js +14 -0
- package/components/attributes/inline/common/PinButton.js +14 -0
- package/components/attributes/inline/common/SourceItem.js +27 -0
- package/components/attributes/inline/common/__test__/CrosswalkIcon.spec.js +75 -0
- package/components/attributes/inline/common/__test__/IgnoreButton.spec.js +28 -0
- package/components/attributes/inline/common/__test__/PinButton.spec.js +28 -0
- package/components/attributes/inline/common/__test__/SourceItem.spec.js +70 -0
- package/components/attributes/inline/common/styles.js +61 -0
- package/components/attributes/inline/hooks/useAttributeState.js +43 -0
- package/components/attributes/inline/index.js +25 -0
- package/components/attributes/inline/types/AddAttributeEvent.js +2 -0
- package/components/attributes/inline/types/CrosswalksMap.js +2 -0
- package/components/attributes/inline/types/DeleteAttributeEvent.js +2 -0
- package/components/attributes/inline/types/EditAttributeEvent.js +2 -0
- package/components/attributes/inline/types/IgnoreAttributeEvent.js +2 -0
- package/components/attributes/inline/types/PinAttributeEvent.js +2 -0
- package/components/attributes/inline/types/index.js +2 -0
- package/components/attributes/pagersCommon/ShowLess.js +18 -0
- package/components/attributes/pagersCommon/ShowMore.js +20 -0
- package/components/attributes/pagersCommon/styles.js +13 -0
- package/components/attributes/readMode/AttributeValuesBlock/AttributeValuesBlock.js +73 -0
- package/components/attributes/readMode/AttributesFactory/Attribute.js +11 -0
- package/components/attributes/readMode/AttributesFactory/AttributesFactory.js +38 -0
- package/components/attributes/readMode/AttributesList/AttributesList.js +71 -0
- package/components/attributes/readMode/AttributesList/index.js +8 -0
- package/components/attributes/readMode/AttributesPager/AttributesPager.js +76 -0
- package/components/attributes/readMode/AttributesPager/MultiLineRenderer.js +67 -0
- package/components/attributes/readMode/AttributesPager/OneLineRenderer.js +28 -0
- package/components/attributes/readMode/AttributesPager/SpecialRenderer.js +41 -0
- package/components/attributes/readMode/AttributesPager/index.js +15 -0
- package/components/attributes/readMode/AttributesPager/styles.js +92 -0
- package/components/attributes/readMode/AttributesView/AttributesView.js +60 -0
- package/components/attributes/readMode/AttributesView/index.js +14 -0
- package/components/attributes/readMode/AttributesView/styles.js +19 -0
- package/components/attributes/readMode/ComplexAttribute/ComplexAttribute.js +65 -0
- package/components/attributes/readMode/ComplexAttribute/styles.js +23 -0
- package/components/attributes/readMode/ImageAttributesLine/ImageAttributesLine.js +55 -0
- package/components/attributes/readMode/ImageAttributesLine/cross.inline.svg.js +4 -0
- package/components/attributes/readMode/ImageAttributesLine/index.js +8 -0
- package/components/attributes/readMode/ImageAttributesLine/styles.js +90 -0
- package/components/attributes/readMode/NestedAttribute/NestedAttribute.js +72 -0
- package/components/attributes/readMode/NestedAttribute/index.js +8 -0
- package/components/attributes/readMode/NestedAttribute/styles.js +28 -0
- package/components/attributes/readMode/ReferenceAttribute/ReferenceAttribute.js +81 -0
- package/components/attributes/readMode/ReferenceAttribute/index.js +17 -0
- package/components/attributes/readMode/ReferenceAttribute/styles.js +30 -0
- package/components/attributes/readMode/SimpleAttribute/SimpleAttribute.js +52 -0
- package/components/attributes/readMode/SimpleAttribute/index.js +8 -0
- package/components/attributes/readMode/SimpleAttribute/styles.js +37 -0
- package/components/attributes/readMode/SpecialAttributes/Roles/Role.js +41 -0
- package/components/attributes/readMode/SpecialAttributes/Roles/Roles.js +13 -0
- package/components/attributes/readMode/SpecialAttributes/Roles/index.js +8 -0
- package/components/attributes/readMode/SpecialAttributes/SpecialAttributesArray.js +29 -0
- package/components/attributes/readMode/SpecialAttributes/Tags/Tag.js +43 -0
- package/components/attributes/readMode/SpecialAttributes/Tags/Tags.js +13 -0
- package/components/attributes/readMode/SpecialAttributes/Tags/index.js +8 -0
- package/components/attributes/readMode/SpecialAttributes/styles.js +20 -0
- package/components/attributes/readMode/helpers/historyAppearance.js +65 -0
- package/components/attributes/types/attributesView.js +2 -0
- package/components/attributes/types/index.js +13 -0
- package/components/charts/ActiveShape/ActiveShape.js +52 -0
- package/components/charts/BarChart/BarChart.js +37 -0
- package/components/charts/BarChart/getBarChartSettings.js +52 -0
- package/components/charts/BubbleChart/BubbleChart.js +84 -0
- package/components/charts/BubbleChart/helpers.js +28 -0
- package/components/charts/BubbleChart/styles.js +10 -0
- package/components/charts/BubbleChart/useBubbles.js +18 -0
- package/components/charts/ChartsFactory.js +57 -0
- package/components/charts/CloudChart/CloudChart.js +72 -0
- package/components/charts/CloudChart/styles.js +34 -0
- package/components/charts/CloudChart/useCloud.js +36 -0
- package/components/charts/CustomLegend/CustomLegend.js +17 -0
- package/components/charts/CustomLegend/getLegendProps.js +23 -0
- package/components/charts/CustomLegend/styles.js +41 -0
- package/components/charts/CustomTooltip/CustomTooltip.js +29 -0
- package/components/charts/CustomTooltip/styles.js +31 -0
- package/components/charts/HOCs/withPercents.js +60 -0
- package/components/charts/LineChart/LineChart.js +48 -0
- package/components/charts/LineChart/getLineChartSettings.js +60 -0
- package/components/charts/MapChart/Legend/Legend.js +22 -0
- package/components/charts/MapChart/Legend/styles.js +49 -0
- package/components/charts/MapChart/MapChart.js +115 -0
- package/components/charts/MapChart/styles.js +16 -0
- package/components/charts/MapChart/useGeography.js +23 -0
- package/components/charts/PieChart/PieChart.js +67 -0
- package/components/charts/TableWithBars/TableWithBars.js +71 -0
- package/components/charts/TableWithBars/cell-renderers/AttributeCellRenderer.js +30 -0
- package/components/charts/TableWithBars/cell-renderers/HeadCellRenderer.js +40 -0
- package/components/charts/TableWithBars/cell-renderers/NumberCellValueRenderer.js +20 -0
- package/components/charts/TableWithBars/cell-renderers/styles.js +71 -0
- package/components/charts/TableWithBars/styles.js +19 -0
- package/components/charts/TreeChart/TreeChart.js +66 -0
- package/components/charts/TreeChart/styles.js +16 -0
- package/components/charts/hooks/useClickableStyle.js +14 -0
- package/components/charts/hooks/useTooltipState.js +30 -0
- package/components/charts/index.js +18 -0
- package/components/charts/types/BarChartOptions.js +2 -0
- package/components/charts/types/ChartData.js +2 -0
- package/components/charts/types/ChartProps.js +2 -0
- package/components/charts/types/LineChartOptions.js +2 -0
- package/components/charts/types/TableWithBarsOptions.js +2 -0
- package/components/charts/types/index.js +2 -0
- package/components/commonReactSelectComponents/DropdownIndicator.js +38 -0
- package/components/commonReactSelectComponents/DropdownIndicatorWithIconButton.js +38 -0
- package/components/commonReactSelectComponents/MenuWithPopper.js +79 -0
- package/components/commonReactSelectComponents/arrowIndicatorStyles.js +12 -0
- package/components/commonReactSelectComponents/menuStyles.js +13 -0
- package/components/editors/BooleanEditor/BooleanEditor.js +41 -0
- package/components/editors/BooleanRadioEditor/BooleanRadioEditor.js +24 -0
- package/components/editors/BooleanRadioEditor/styles.js +12 -0
- package/components/editors/DataTypeValueEditor/DataTypeValueEditor.js +54 -0
- package/components/editors/DataTypeValueEditor/useEditorContext.js +108 -0
- package/components/editors/DateEditor/DateEditor.js +94 -0
- package/components/editors/DateEditor/styles.js +31 -0
- package/components/editors/DateRangeEditor/DateRangeEditor.js +146 -0
- package/components/editors/DateRangeEditor/styles.js +39 -0
- package/components/editors/DependentLookupEditor/DependentLookupEditor.js +129 -0
- package/components/editors/DependentLookupEditor/OptionWithCheckIcon.js +33 -0
- package/components/editors/DependentLookupEditor/helpers.js +25 -0
- package/components/editors/DependentLookupEditor/styles.js +25 -0
- package/components/editors/DependentLookupEditor/useAutopopulation.js +25 -0
- package/components/editors/DependentLookupEditor/useDefaultOptions.js +25 -0
- package/components/editors/DependentLookupEditor/useLookupsResolver.js +29 -0
- package/components/editors/DropDownEditor/DropDownEditor.js +47 -0
- package/components/editors/EditorsFactory.js +97 -0
- package/components/editors/FileTypeEditor/FileTypeEditor.js +52 -0
- package/components/editors/FileTypeEditor/styles.js +9 -0
- package/components/editors/FilterEditor/FilterEditor.js +46 -0
- package/components/editors/FilterEditor/FilterValueEditor.js +84 -0
- package/components/editors/GroupedDropDownEditor/GroupedDropDownEditor.js +64 -0
- package/components/editors/GroupedDropDownEditor/entriesHelpers.js +32 -0
- package/components/editors/GroupedDropDownEditor/styles.js +14 -0
- package/components/editors/LookupEditor/LookupEditor.js +78 -0
- package/components/editors/LookupEditor/entriesHelpers.js +28 -0
- package/components/editors/NumberEditor/NumberEditor.js +70 -0
- package/components/editors/RangeDataTypeValueEditor/RangeDataTypeValueEditor.js +87 -0
- package/components/editors/RangeDataTypeValueEditor/styles.js +24 -0
- package/components/editors/SelectEditor/SelectEditor.js +44 -0
- package/components/editors/TextEditor/TextEditor.js +47 -0
- package/components/editors/TimestampEditor/TimestampEditor.js +100 -0
- package/components/editors/TimestampEditor/styles.js +25 -0
- package/components/editors/TypeaheadEditor/TypeaheadEditor.js +151 -0
- package/components/editors/TypeaheadEditor/styles.js +55 -0
- package/components/editors/commonComponents/MultiValueChip/MultiValueChip.js +39 -0
- package/components/editors/constants.js +27 -0
- package/components/editors/index.js +24 -0
- package/components/index.js +242 -0
- package/constants/attributes.js +5 -0
- package/constants/classnames.js +4 -0
- package/constants/index.js +13 -0
- package/constants/prop-types.js +82 -0
- package/contexts/AsyncMountContext/index.js +19 -0
- package/contexts/BlockImageGalleryDialogContext/index.js +9 -0
- package/contexts/CollaborationContext/index.js +21 -0
- package/contexts/CrosswalksDisplayContext/index.js +70 -0
- package/contexts/EntitiesMapContext/index.js +9 -0
- package/contexts/HistoryAppearanceContext/index.js +12 -0
- package/contexts/IdContext/index.js +9 -0
- package/contexts/PivotingAttributeContext/index.js +8 -0
- package/contexts/PopupBoundariesContext/index.js +16 -0
- package/contexts/ProfilePerspectiveViewContext/index.js +9 -0
- package/contexts/UsersContext/index.js +9 -0
- package/contexts/ViewIdContext/index.js +9 -0
- package/contexts/index.js +30 -0
- package/core/index.js +13 -0
- package/core/utils.js +54 -0
- package/hooks/index.js +29 -0
- package/hooks/useActions.js +27 -0
- package/hooks/useAsyncMount.js +27 -0
- package/hooks/useCollaboration.js +151 -0
- package/hooks/useConfigPermissions.js +20 -0
- package/hooks/useDidUpdateEffect.js +14 -0
- package/hooks/usePrevious.js +12 -0
- package/hooks/useRelationTypeSelector.js +53 -0
- package/hooks/useRelationsLoader.js +111 -0
- package/hooks/useRunOnceAfterValueInitialization.js +14 -0
- package/hooks/useSafePromise.js +34 -0
- package/hooks/useSavedState.js +18 -0
- package/hooks/useUsers.js +29 -0
- package/hooks/useWhyDidYouUpdate.js +46 -0
- package/icons/Add.js +11 -0
- package/icons/AddComment.js +11 -0
- package/icons/Calendar.js +11 -0
- package/icons/Comment.js +11 -0
- package/icons/CommentBubble.js +11 -0
- package/icons/Create.js +11 -0
- package/icons/DefaultImage.js +13 -0
- package/icons/Details.js +16 -0
- package/icons/Download.js +16 -0
- package/icons/EmptySearchResults.js +73 -0
- package/icons/Eye.js +16 -0
- package/icons/Filter.js +11 -0
- package/icons/Ignored.js +11 -0
- package/icons/IgnoredOutlined.js +11 -0
- package/icons/LogIn.js +12 -0
- package/icons/LogOut.js +12 -0
- package/icons/Merge.js +11 -0
- package/icons/MlMatch.js +51 -0
- package/icons/NestedAttribute.js +11 -0
- package/icons/NoData.js +73 -0
- package/icons/NoDataSearch.js +14 -0
- package/icons/NoMatches.js +11 -0
- package/icons/Pin.js +11 -0
- package/icons/PinOutlined.js +11 -0
- package/icons/PivotingIcon.js +11 -0
- package/icons/PmIcon.js +11 -0
- package/icons/PotentialMatch.js +11 -0
- package/icons/Profile.js +11 -0
- package/icons/Recommended.js +16 -0
- package/icons/ReferenceAttribute.js +11 -0
- package/icons/Remove.js +11 -0
- package/icons/ResizeIconInline.js +11 -0
- package/icons/Search.js +11 -0
- package/icons/SelectAttributes.js +46 -0
- package/icons/SimpleAttribute.js +11 -0
- package/icons/Table.js +11 -0
- package/icons/UnMerge.js +11 -0
- package/icons/UploadIcon.js +35 -0
- package/icons/index.js +82 -0
- package/index.js +19 -0
- package/package.json +8 -5
- package/types/index.js +2 -0
- package/bundle.js +0 -2
- package/bundle.js.LICENSE.txt +0 -25
|
@@ -0,0 +1,960 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from) {
|
|
14
|
+
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
|
|
15
|
+
to[j] = from[i];
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
+
exports.find = exports.getDepth = exports.isDescendant = exports.getTreeFromFlatData = exports.getFlatDataFromTree = exports.insertNode = exports.addNodeUnderParent = exports.getNodeAtPath = exports.removeNode = exports.removeNodeAtPath = exports.changeNodeAtPath = exports.RESULT_MISS_ERROR_MESSAGE = exports.toggleExpandedForAll = exports.map = exports.walk = exports.getVisibleNodeInfoAtIndex = exports.getVisibleNodeCount = exports.getDescendantCount = void 0;
|
|
20
|
+
/**
|
|
21
|
+
* Performs a depth-first traversal over all of the node descendants,
|
|
22
|
+
* incrementing currentIndex by 1 for each
|
|
23
|
+
*/
|
|
24
|
+
function getNodeDataAtTreeIndexOrNextIndex(_a) {
|
|
25
|
+
var targetIndex = _a.targetIndex, node = _a.node, currentIndex = _a.currentIndex, getNodeKey = _a.getNodeKey, _b = _a.path, path = _b === void 0 ? [] : _b, _c = _a.lowerSiblingCounts, lowerSiblingCounts = _c === void 0 ? [] : _c, _d = _a.ignoreCollapsed, ignoreCollapsed = _d === void 0 ? true : _d, _e = _a.isPseudoRoot, isPseudoRoot = _e === void 0 ? false : _e;
|
|
26
|
+
// The pseudo-root is not considered in the path
|
|
27
|
+
var selfPath = !isPseudoRoot ? __spreadArray(__spreadArray([], path), [getNodeKey({ node: node, treeIndex: currentIndex })]) : [];
|
|
28
|
+
// Return target node when found
|
|
29
|
+
if (currentIndex === targetIndex) {
|
|
30
|
+
return {
|
|
31
|
+
node: node,
|
|
32
|
+
lowerSiblingCounts: lowerSiblingCounts,
|
|
33
|
+
path: selfPath
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
// Add one and continue for nodes with no children or hidden children
|
|
37
|
+
if (!node.children || (ignoreCollapsed && node.expanded !== true)) {
|
|
38
|
+
return { nextIndex: currentIndex + 1 };
|
|
39
|
+
}
|
|
40
|
+
// Iterate over each child and their descendants and return the
|
|
41
|
+
// target node if childIndex reaches the targetIndex
|
|
42
|
+
var childIndex = currentIndex + 1;
|
|
43
|
+
var childCount = node.children.length;
|
|
44
|
+
for (var i = 0; i < childCount; i += 1) {
|
|
45
|
+
var result = getNodeDataAtTreeIndexOrNextIndex({
|
|
46
|
+
ignoreCollapsed: ignoreCollapsed,
|
|
47
|
+
getNodeKey: getNodeKey,
|
|
48
|
+
targetIndex: targetIndex,
|
|
49
|
+
node: node.children[i],
|
|
50
|
+
currentIndex: childIndex,
|
|
51
|
+
lowerSiblingCounts: __spreadArray(__spreadArray([], lowerSiblingCounts), [childCount - i - 1]),
|
|
52
|
+
path: selfPath
|
|
53
|
+
});
|
|
54
|
+
if (result.node) {
|
|
55
|
+
return result;
|
|
56
|
+
}
|
|
57
|
+
childIndex = result.nextIndex;
|
|
58
|
+
}
|
|
59
|
+
// If the target node is not found, return the farthest traversed index
|
|
60
|
+
return { nextIndex: childIndex };
|
|
61
|
+
}
|
|
62
|
+
function getDescendantCount(_a) {
|
|
63
|
+
var node = _a.node, _b = _a.ignoreCollapsed, ignoreCollapsed = _b === void 0 ? true : _b;
|
|
64
|
+
return (getNodeDataAtTreeIndexOrNextIndex({
|
|
65
|
+
getNodeKey: function () { },
|
|
66
|
+
ignoreCollapsed: ignoreCollapsed,
|
|
67
|
+
node: node,
|
|
68
|
+
currentIndex: 0,
|
|
69
|
+
targetIndex: -1
|
|
70
|
+
}).nextIndex - 1);
|
|
71
|
+
}
|
|
72
|
+
exports.getDescendantCount = getDescendantCount;
|
|
73
|
+
/**
|
|
74
|
+
* Walk all descendants of the given node, depth-first
|
|
75
|
+
*
|
|
76
|
+
* @param {Object} args - Function parameters
|
|
77
|
+
* @param {function} args.callback - Function to call on each node
|
|
78
|
+
* @param {function} args.getNodeKey - Function to get the key from the nodeData and tree index
|
|
79
|
+
* @param {boolean} args.ignoreCollapsed - Ignore children of nodes without `expanded` set to `true`
|
|
80
|
+
* @param {boolean=} args.isPseudoRoot - If true, this node has no real data, and only serves
|
|
81
|
+
* as the parent of all the nodes in the tree
|
|
82
|
+
* @param {Object} args.node - A tree node
|
|
83
|
+
* @param {Object=} args.parentNode - The parent node of `node`
|
|
84
|
+
* @param {number} args.currentIndex - The treeIndex of `node`
|
|
85
|
+
* @param {number[]|string[]} args.path - Array of keys leading up to node to be changed
|
|
86
|
+
* @param {number[]} args.lowerSiblingCounts - An array containing the count of siblings beneath the
|
|
87
|
+
* previous nodes in this path
|
|
88
|
+
*
|
|
89
|
+
* @return {number|false} nextIndex - Index of the next sibling of `node`,
|
|
90
|
+
* or false if the walk should be terminated
|
|
91
|
+
*/
|
|
92
|
+
function walkDescendants(_a) {
|
|
93
|
+
var callback = _a.callback, getNodeKey = _a.getNodeKey, ignoreCollapsed = _a.ignoreCollapsed, _b = _a.isPseudoRoot, isPseudoRoot = _b === void 0 ? false : _b, node = _a.node, _c = _a.parentNode, parentNode = _c === void 0 ? null : _c, currentIndex = _a.currentIndex, _d = _a.path, path = _d === void 0 ? [] : _d, _e = _a.lowerSiblingCounts, lowerSiblingCounts = _e === void 0 ? [] : _e;
|
|
94
|
+
// The pseudo-root is not considered in the path
|
|
95
|
+
var selfPath = isPseudoRoot ? [] : __spreadArray(__spreadArray([], path), [getNodeKey({ node: node, treeIndex: currentIndex })]);
|
|
96
|
+
var selfInfo = isPseudoRoot
|
|
97
|
+
? null
|
|
98
|
+
: {
|
|
99
|
+
node: node,
|
|
100
|
+
parentNode: parentNode,
|
|
101
|
+
path: selfPath,
|
|
102
|
+
lowerSiblingCounts: lowerSiblingCounts,
|
|
103
|
+
treeIndex: currentIndex
|
|
104
|
+
};
|
|
105
|
+
if (!isPseudoRoot) {
|
|
106
|
+
var callbackResult = callback(selfInfo);
|
|
107
|
+
// Cut walk short if the callback returned false
|
|
108
|
+
if (callbackResult === false) {
|
|
109
|
+
return false;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
// Return self on nodes with no children or hidden children
|
|
113
|
+
if (!node.children || (node.expanded !== true && ignoreCollapsed && !isPseudoRoot)) {
|
|
114
|
+
return currentIndex;
|
|
115
|
+
}
|
|
116
|
+
// Get all descendants
|
|
117
|
+
var childIndex = currentIndex;
|
|
118
|
+
var childCount = node.children.length;
|
|
119
|
+
if (typeof node.children !== 'function') {
|
|
120
|
+
for (var i = 0; i < childCount; i += 1) {
|
|
121
|
+
childIndex = walkDescendants({
|
|
122
|
+
callback: callback,
|
|
123
|
+
getNodeKey: getNodeKey,
|
|
124
|
+
ignoreCollapsed: ignoreCollapsed,
|
|
125
|
+
node: node.children[i],
|
|
126
|
+
parentNode: isPseudoRoot ? null : node,
|
|
127
|
+
currentIndex: childIndex + 1,
|
|
128
|
+
lowerSiblingCounts: __spreadArray(__spreadArray([], lowerSiblingCounts), [childCount - i - 1]),
|
|
129
|
+
path: selfPath
|
|
130
|
+
});
|
|
131
|
+
// Cut walk short if the callback returned false
|
|
132
|
+
if (childIndex === false) {
|
|
133
|
+
return false;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
return childIndex;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Perform a change on the given node and all its descendants, traversing the tree depth-first
|
|
141
|
+
*
|
|
142
|
+
* @param {Object} args - Function parameters
|
|
143
|
+
* @param {function} args.callback - Function to call on each node
|
|
144
|
+
* @param {function} args.getNodeKey - Function to get the key from the nodeData and tree index
|
|
145
|
+
* @param {boolean} args.ignoreCollapsed - Ignore children of nodes without `expanded` set to `true`
|
|
146
|
+
* @param {boolean=} args.isPseudoRoot - If true, this node has no real data, and only serves
|
|
147
|
+
* as the parent of all the nodes in the tree
|
|
148
|
+
* @param {Object} args.node - A tree node
|
|
149
|
+
* @param {Object=} args.parentNode - The parent node of `node`
|
|
150
|
+
* @param {number} args.currentIndex - The treeIndex of `node`
|
|
151
|
+
* @param {number[]|string[]} args.path - Array of keys leading up to node to be changed
|
|
152
|
+
* @param {number[]} args.lowerSiblingCounts - An array containing the count of siblings beneath the
|
|
153
|
+
* previous nodes in this path
|
|
154
|
+
*
|
|
155
|
+
* @return {number|false} nextIndex - Index of the next sibling of `node`,
|
|
156
|
+
* or false if the walk should be terminated
|
|
157
|
+
*/
|
|
158
|
+
function mapDescendants(_a) {
|
|
159
|
+
var callback = _a.callback, getNodeKey = _a.getNodeKey, ignoreCollapsed = _a.ignoreCollapsed, _b = _a.isPseudoRoot, isPseudoRoot = _b === void 0 ? false : _b, node = _a.node, _c = _a.parentNode, parentNode = _c === void 0 ? null : _c, currentIndex = _a.currentIndex, _d = _a.path, path = _d === void 0 ? [] : _d, _e = _a.lowerSiblingCounts, lowerSiblingCounts = _e === void 0 ? [] : _e;
|
|
160
|
+
var nextNode = __assign({}, node);
|
|
161
|
+
// The pseudo-root is not considered in the path
|
|
162
|
+
var selfPath = isPseudoRoot ? [] : __spreadArray(__spreadArray([], path), [getNodeKey({ node: nextNode, treeIndex: currentIndex })]);
|
|
163
|
+
var selfInfo = {
|
|
164
|
+
node: nextNode,
|
|
165
|
+
parentNode: parentNode,
|
|
166
|
+
path: selfPath,
|
|
167
|
+
lowerSiblingCounts: lowerSiblingCounts,
|
|
168
|
+
treeIndex: currentIndex
|
|
169
|
+
};
|
|
170
|
+
// Return self on nodes with no children or hidden children
|
|
171
|
+
if (!nextNode.children || (nextNode.expanded !== true && ignoreCollapsed && !isPseudoRoot)) {
|
|
172
|
+
return {
|
|
173
|
+
treeIndex: currentIndex,
|
|
174
|
+
node: callback(selfInfo)
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
// Get all descendants
|
|
178
|
+
var childIndex = currentIndex;
|
|
179
|
+
var childCount = nextNode.children.length;
|
|
180
|
+
if (typeof nextNode.children !== 'function') {
|
|
181
|
+
nextNode.children = nextNode.children.map(function (child, i) {
|
|
182
|
+
var mapResult = mapDescendants({
|
|
183
|
+
callback: callback,
|
|
184
|
+
getNodeKey: getNodeKey,
|
|
185
|
+
ignoreCollapsed: ignoreCollapsed,
|
|
186
|
+
node: child,
|
|
187
|
+
parentNode: isPseudoRoot ? null : nextNode,
|
|
188
|
+
currentIndex: childIndex + 1,
|
|
189
|
+
lowerSiblingCounts: __spreadArray(__spreadArray([], lowerSiblingCounts), [childCount - i - 1]),
|
|
190
|
+
path: selfPath
|
|
191
|
+
});
|
|
192
|
+
childIndex = mapResult.treeIndex;
|
|
193
|
+
return mapResult.node;
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
return {
|
|
197
|
+
node: callback(selfInfo),
|
|
198
|
+
treeIndex: childIndex
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Count all the visible (expanded) descendants in the tree data.
|
|
203
|
+
*
|
|
204
|
+
* @param {!Object[]} treeData - Tree data
|
|
205
|
+
*
|
|
206
|
+
* @return {number} count
|
|
207
|
+
*/
|
|
208
|
+
function getVisibleNodeCount(_a) {
|
|
209
|
+
var treeData = _a.treeData;
|
|
210
|
+
var traverse = function (node) {
|
|
211
|
+
if (!node.children || node.expanded !== true || typeof node.children === 'function') {
|
|
212
|
+
return 1;
|
|
213
|
+
}
|
|
214
|
+
return 1 + node.children.reduce(function (total, currentNode) { return total + traverse(currentNode); }, 0);
|
|
215
|
+
};
|
|
216
|
+
return treeData.reduce(function (total, currentNode) { return total + traverse(currentNode); }, 0);
|
|
217
|
+
}
|
|
218
|
+
exports.getVisibleNodeCount = getVisibleNodeCount;
|
|
219
|
+
/**
|
|
220
|
+
* Get the <targetIndex>th visible node in the tree data.
|
|
221
|
+
*
|
|
222
|
+
* @param {!Object[]} treeData - Tree data
|
|
223
|
+
* @param {!number} targetIndex - The index of the node to search for
|
|
224
|
+
* @param {!function} getNodeKey - Function to get the key from the nodeData and tree index
|
|
225
|
+
*
|
|
226
|
+
* @return {{
|
|
227
|
+
* node: Object,
|
|
228
|
+
* path: []string|[]number,
|
|
229
|
+
* lowerSiblingCounts: []number
|
|
230
|
+
* }|null} node - The node at targetIndex, or null if not found
|
|
231
|
+
*/
|
|
232
|
+
function getVisibleNodeInfoAtIndex(_a) {
|
|
233
|
+
var treeData = _a.treeData, targetIndex = _a.index, getNodeKey = _a.getNodeKey;
|
|
234
|
+
if (!treeData || treeData.length < 1) {
|
|
235
|
+
return null;
|
|
236
|
+
}
|
|
237
|
+
// Call the tree traversal with a pseudo-root node
|
|
238
|
+
var result = getNodeDataAtTreeIndexOrNextIndex({
|
|
239
|
+
targetIndex: targetIndex,
|
|
240
|
+
getNodeKey: getNodeKey,
|
|
241
|
+
node: {
|
|
242
|
+
children: treeData,
|
|
243
|
+
expanded: true
|
|
244
|
+
},
|
|
245
|
+
currentIndex: -1,
|
|
246
|
+
path: [],
|
|
247
|
+
lowerSiblingCounts: [],
|
|
248
|
+
isPseudoRoot: true
|
|
249
|
+
});
|
|
250
|
+
if (result.node) {
|
|
251
|
+
return result;
|
|
252
|
+
}
|
|
253
|
+
return null;
|
|
254
|
+
}
|
|
255
|
+
exports.getVisibleNodeInfoAtIndex = getVisibleNodeInfoAtIndex;
|
|
256
|
+
/**
|
|
257
|
+
* Walk descendants depth-first and call a callback on each
|
|
258
|
+
*
|
|
259
|
+
* @param {!Object[]} treeData - Tree data
|
|
260
|
+
* @param {!function} getNodeKey - Function to get the key from the nodeData and tree index
|
|
261
|
+
* @param {function} callback - Function to call on each node
|
|
262
|
+
* @param {boolean=} ignoreCollapsed - Ignore children of nodes without `expanded` set to `true`
|
|
263
|
+
*
|
|
264
|
+
* @return void
|
|
265
|
+
*/
|
|
266
|
+
function walk(_a) {
|
|
267
|
+
var treeData = _a.treeData, getNodeKey = _a.getNodeKey, callback = _a.callback, _b = _a.ignoreCollapsed, ignoreCollapsed = _b === void 0 ? true : _b;
|
|
268
|
+
if (!treeData || treeData.length < 1) {
|
|
269
|
+
return;
|
|
270
|
+
}
|
|
271
|
+
walkDescendants({
|
|
272
|
+
callback: callback,
|
|
273
|
+
getNodeKey: getNodeKey,
|
|
274
|
+
ignoreCollapsed: ignoreCollapsed,
|
|
275
|
+
isPseudoRoot: true,
|
|
276
|
+
node: { children: treeData },
|
|
277
|
+
currentIndex: -1,
|
|
278
|
+
path: [],
|
|
279
|
+
lowerSiblingCounts: []
|
|
280
|
+
});
|
|
281
|
+
}
|
|
282
|
+
exports.walk = walk;
|
|
283
|
+
/**
|
|
284
|
+
* Perform a depth-first transversal of the descendants and
|
|
285
|
+
* make a change to every node in the tree
|
|
286
|
+
*
|
|
287
|
+
* @param {!Object[]} treeData - Tree data
|
|
288
|
+
* @param {!function} getNodeKey - Function to get the key from the nodeData and tree index
|
|
289
|
+
* @param {function} callback - Function to call on each node
|
|
290
|
+
* @param {boolean=} ignoreCollapsed - Ignore children of nodes without `expanded` set to `true`
|
|
291
|
+
*
|
|
292
|
+
* @return {Object[]} changedTreeData - The changed tree data
|
|
293
|
+
*/
|
|
294
|
+
function map(_a) {
|
|
295
|
+
var treeData = _a.treeData, getNodeKey = _a.getNodeKey, callback = _a.callback, _b = _a.ignoreCollapsed, ignoreCollapsed = _b === void 0 ? true : _b;
|
|
296
|
+
if (!treeData || treeData.length < 1) {
|
|
297
|
+
return [];
|
|
298
|
+
}
|
|
299
|
+
return mapDescendants({
|
|
300
|
+
callback: callback,
|
|
301
|
+
getNodeKey: getNodeKey,
|
|
302
|
+
ignoreCollapsed: ignoreCollapsed,
|
|
303
|
+
isPseudoRoot: true,
|
|
304
|
+
node: { children: treeData },
|
|
305
|
+
currentIndex: -1,
|
|
306
|
+
path: [],
|
|
307
|
+
lowerSiblingCounts: []
|
|
308
|
+
}).node.children;
|
|
309
|
+
}
|
|
310
|
+
exports.map = map;
|
|
311
|
+
/**
|
|
312
|
+
* Expand or close every node in the tree
|
|
313
|
+
*
|
|
314
|
+
* @param {!Object[]} treeData - Tree data
|
|
315
|
+
* @param {?boolean} expanded - Whether the node is expanded or not
|
|
316
|
+
*
|
|
317
|
+
* @return {Object[]} changedTreeData - The changed tree data
|
|
318
|
+
*/
|
|
319
|
+
function toggleExpandedForAll(_a) {
|
|
320
|
+
var treeData = _a.treeData, _b = _a.expanded, expanded = _b === void 0 ? true : _b;
|
|
321
|
+
return map({
|
|
322
|
+
treeData: treeData,
|
|
323
|
+
callback: function (_a) {
|
|
324
|
+
var node = _a.node;
|
|
325
|
+
return (__assign(__assign({}, node), { expanded: expanded }));
|
|
326
|
+
},
|
|
327
|
+
getNodeKey: function (_a) {
|
|
328
|
+
var treeIndex = _a.treeIndex;
|
|
329
|
+
return treeIndex;
|
|
330
|
+
},
|
|
331
|
+
ignoreCollapsed: false
|
|
332
|
+
});
|
|
333
|
+
}
|
|
334
|
+
exports.toggleExpandedForAll = toggleExpandedForAll;
|
|
335
|
+
exports.RESULT_MISS_ERROR_MESSAGE = 'No node found at the given path.';
|
|
336
|
+
/**
|
|
337
|
+
* Replaces node at path with object, or callback-defined object
|
|
338
|
+
*
|
|
339
|
+
* @param {!Object[]} treeData
|
|
340
|
+
* @param {number[]|string[]} path - Array of keys leading up to node to be changed
|
|
341
|
+
* @param {function|any} newNode - Node to replace the node at the path with, or a function producing the new node
|
|
342
|
+
* @param {!function} getNodeKey - Function to get the key from the nodeData and tree index
|
|
343
|
+
* @param {boolean=} ignoreCollapsed - Ignore children of nodes without `expanded` set to `true`
|
|
344
|
+
*
|
|
345
|
+
* @return {Object[]} changedTreeData - The changed tree data
|
|
346
|
+
*/
|
|
347
|
+
function changeNodeAtPath(_a) {
|
|
348
|
+
var treeData = _a.treeData, path = _a.path, newNode = _a.newNode, getNodeKey = _a.getNodeKey, _b = _a.ignoreCollapsed, ignoreCollapsed = _b === void 0 ? true : _b;
|
|
349
|
+
var RESULT_MISS = 'RESULT_MISS';
|
|
350
|
+
var traverse = function (_a) {
|
|
351
|
+
var _b = _a.isPseudoRoot, isPseudoRoot = _b === void 0 ? false : _b, node = _a.node, currentTreeIndex = _a.currentTreeIndex, pathIndex = _a.pathIndex;
|
|
352
|
+
if (!isPseudoRoot && getNodeKey({ node: node, treeIndex: currentTreeIndex }) !== path[pathIndex]) {
|
|
353
|
+
return RESULT_MISS;
|
|
354
|
+
}
|
|
355
|
+
if (pathIndex >= path.length - 1) {
|
|
356
|
+
// If this is the final location in the path, return its changed form
|
|
357
|
+
return typeof newNode === 'function' ? newNode({ node: node, treeIndex: currentTreeIndex }) : newNode;
|
|
358
|
+
}
|
|
359
|
+
if (!node.children) {
|
|
360
|
+
// If this node is part of the path, but has no children, return the unchanged node
|
|
361
|
+
throw new Error('Path referenced children of node with no children.');
|
|
362
|
+
}
|
|
363
|
+
var nextTreeIndex = currentTreeIndex + 1;
|
|
364
|
+
for (var i = 0; i < node.children.length; i += 1) {
|
|
365
|
+
var result_1 = traverse({
|
|
366
|
+
node: node.children[i],
|
|
367
|
+
currentTreeIndex: nextTreeIndex,
|
|
368
|
+
pathIndex: pathIndex + 1
|
|
369
|
+
});
|
|
370
|
+
// If the result went down the correct path
|
|
371
|
+
if (result_1 !== RESULT_MISS) {
|
|
372
|
+
if (result_1) {
|
|
373
|
+
// If the result was truthy (in this case, an object),
|
|
374
|
+
// pass it to the next level of recursion up
|
|
375
|
+
return __assign(__assign({}, node), { children: __spreadArray(__spreadArray(__spreadArray([], node.children.slice(0, i)), [result_1]), node.children.slice(i + 1)) });
|
|
376
|
+
}
|
|
377
|
+
// If the result was falsy (returned from the newNode function), then
|
|
378
|
+
// delete the node from the array.
|
|
379
|
+
return __assign(__assign({}, node), { children: __spreadArray(__spreadArray([], node.children.slice(0, i)), node.children.slice(i + 1)) });
|
|
380
|
+
}
|
|
381
|
+
nextTreeIndex += 1 + getDescendantCount({ node: node.children[i], ignoreCollapsed: ignoreCollapsed });
|
|
382
|
+
}
|
|
383
|
+
return RESULT_MISS;
|
|
384
|
+
};
|
|
385
|
+
// Use a pseudo-root node in the beginning traversal
|
|
386
|
+
var result = traverse({
|
|
387
|
+
node: { children: treeData },
|
|
388
|
+
currentTreeIndex: -1,
|
|
389
|
+
pathIndex: -1,
|
|
390
|
+
isPseudoRoot: true
|
|
391
|
+
});
|
|
392
|
+
if (result === RESULT_MISS) {
|
|
393
|
+
throw new Error(exports.RESULT_MISS_ERROR_MESSAGE);
|
|
394
|
+
}
|
|
395
|
+
return result.children;
|
|
396
|
+
}
|
|
397
|
+
exports.changeNodeAtPath = changeNodeAtPath;
|
|
398
|
+
/**
|
|
399
|
+
* Removes the node at the specified path and returns the resulting treeData.
|
|
400
|
+
*
|
|
401
|
+
* @param {!Object[]} treeData
|
|
402
|
+
* @param {number[]|string[]} path - Array of keys leading up to node to be deleted
|
|
403
|
+
* @param {!function} getNodeKey - Function to get the key from the nodeData and tree index
|
|
404
|
+
* @param {boolean=} ignoreCollapsed - Ignore children of nodes without `expanded` set to `true`
|
|
405
|
+
*
|
|
406
|
+
* @return {Object[]} changedTreeData - The tree data with the node removed
|
|
407
|
+
*/
|
|
408
|
+
function removeNodeAtPath(_a) {
|
|
409
|
+
var treeData = _a.treeData, path = _a.path, getNodeKey = _a.getNodeKey, _b = _a.ignoreCollapsed, ignoreCollapsed = _b === void 0 ? true : _b;
|
|
410
|
+
return changeNodeAtPath({
|
|
411
|
+
treeData: treeData,
|
|
412
|
+
path: path,
|
|
413
|
+
getNodeKey: getNodeKey,
|
|
414
|
+
ignoreCollapsed: ignoreCollapsed,
|
|
415
|
+
newNode: null // Delete the node
|
|
416
|
+
});
|
|
417
|
+
}
|
|
418
|
+
exports.removeNodeAtPath = removeNodeAtPath;
|
|
419
|
+
/**
|
|
420
|
+
* Removes the node at the specified path and returns the resulting treeData.
|
|
421
|
+
*
|
|
422
|
+
* @param {!Object[]} treeData
|
|
423
|
+
* @param {number[]|string[]} path - Array of keys leading up to node to be deleted
|
|
424
|
+
* @param {!function} getNodeKey - Function to get the key from the nodeData and tree index
|
|
425
|
+
* @param {boolean=} ignoreCollapsed - Ignore children of nodes without `expanded` set to `true`
|
|
426
|
+
*
|
|
427
|
+
* @return {Object} result
|
|
428
|
+
* @return {Object[]} result.treeData - The tree data with the node removed
|
|
429
|
+
* @return {Object} result.node - The node that was removed
|
|
430
|
+
* @return {number} result.treeIndex - The previous treeIndex of the removed node
|
|
431
|
+
*/
|
|
432
|
+
function removeNode(_a) {
|
|
433
|
+
var treeData = _a.treeData, path = _a.path, getNodeKey = _a.getNodeKey, _b = _a.ignoreCollapsed, ignoreCollapsed = _b === void 0 ? true : _b;
|
|
434
|
+
var removedNode = null;
|
|
435
|
+
var removedTreeIndex = null;
|
|
436
|
+
var nextTreeData = changeNodeAtPath({
|
|
437
|
+
treeData: treeData,
|
|
438
|
+
path: path,
|
|
439
|
+
getNodeKey: getNodeKey,
|
|
440
|
+
ignoreCollapsed: ignoreCollapsed,
|
|
441
|
+
newNode: function (_a) {
|
|
442
|
+
var node = _a.node, treeIndex = _a.treeIndex;
|
|
443
|
+
// Store the target node and delete it from the tree
|
|
444
|
+
removedNode = node;
|
|
445
|
+
removedTreeIndex = treeIndex;
|
|
446
|
+
return null;
|
|
447
|
+
}
|
|
448
|
+
});
|
|
449
|
+
return {
|
|
450
|
+
treeData: nextTreeData,
|
|
451
|
+
node: removedNode,
|
|
452
|
+
treeIndex: removedTreeIndex
|
|
453
|
+
};
|
|
454
|
+
}
|
|
455
|
+
exports.removeNode = removeNode;
|
|
456
|
+
/**
|
|
457
|
+
* Gets the node at the specified path
|
|
458
|
+
*
|
|
459
|
+
* @param {!Object[]} treeData
|
|
460
|
+
* @param {number[]|string[]} path - Array of keys leading up to node to be deleted
|
|
461
|
+
* @param {!function} getNodeKey - Function to get the key from the nodeData and tree index
|
|
462
|
+
* @param {boolean=} ignoreCollapsed - Ignore children of nodes without `expanded` set to `true`
|
|
463
|
+
*
|
|
464
|
+
* @return {Object|null} nodeInfo - The node info at the given path, or null if not found
|
|
465
|
+
*/
|
|
466
|
+
function getNodeAtPath(_a) {
|
|
467
|
+
var treeData = _a.treeData, path = _a.path, getNodeKey = _a.getNodeKey, _b = _a.ignoreCollapsed, ignoreCollapsed = _b === void 0 ? true : _b;
|
|
468
|
+
var foundNodeInfo = null;
|
|
469
|
+
try {
|
|
470
|
+
changeNodeAtPath({
|
|
471
|
+
treeData: treeData,
|
|
472
|
+
path: path,
|
|
473
|
+
getNodeKey: getNodeKey,
|
|
474
|
+
ignoreCollapsed: ignoreCollapsed,
|
|
475
|
+
newNode: function (_a) {
|
|
476
|
+
var node = _a.node, treeIndex = _a.treeIndex;
|
|
477
|
+
foundNodeInfo = { node: node, treeIndex: treeIndex };
|
|
478
|
+
return node;
|
|
479
|
+
}
|
|
480
|
+
});
|
|
481
|
+
}
|
|
482
|
+
catch (err) {
|
|
483
|
+
// Ignore the error -- the null return will be explanation enough
|
|
484
|
+
}
|
|
485
|
+
return foundNodeInfo;
|
|
486
|
+
}
|
|
487
|
+
exports.getNodeAtPath = getNodeAtPath;
|
|
488
|
+
/**
|
|
489
|
+
* Adds the node to the specified parent and returns the resulting treeData.
|
|
490
|
+
*
|
|
491
|
+
* @param {!Object[]} treeData
|
|
492
|
+
* @param {!Object} newNode - The node to insert
|
|
493
|
+
* @param {number|string} parentKey - The key of the to-be parentNode of the node
|
|
494
|
+
* @param {!function} getNodeKey - Function to get the key from the nodeData and tree index
|
|
495
|
+
* @param {boolean=} ignoreCollapsed - Ignore children of nodes without `expanded` set to `true`
|
|
496
|
+
* @param {boolean=} expandParent - If true, expands the parentNode specified by parentPath
|
|
497
|
+
* @param {boolean=} addAsFirstChild - If true, adds new node as first child of tree
|
|
498
|
+
*
|
|
499
|
+
* @return {Object} result
|
|
500
|
+
* @return {Object[]} result.treeData - The updated tree data
|
|
501
|
+
* @return {number} result.treeIndex - The tree index at which the node was inserted
|
|
502
|
+
*/
|
|
503
|
+
function addNodeUnderParent(_a) {
|
|
504
|
+
var treeData = _a.treeData, newNode = _a.newNode, _b = _a.parentKey, parentKey = _b === void 0 ? null : _b, getNodeKey = _a.getNodeKey, _c = _a.ignoreCollapsed, ignoreCollapsed = _c === void 0 ? true : _c, _d = _a.expandParent, expandParent = _d === void 0 ? false : _d, _e = _a.addAsFirstChild, addAsFirstChild = _e === void 0 ? false : _e;
|
|
505
|
+
if (parentKey === null) {
|
|
506
|
+
return addAsFirstChild
|
|
507
|
+
? {
|
|
508
|
+
treeData: __spreadArray([newNode], (treeData || [])),
|
|
509
|
+
treeIndex: 0
|
|
510
|
+
}
|
|
511
|
+
: {
|
|
512
|
+
treeData: __spreadArray(__spreadArray([], (treeData || [])), [newNode]),
|
|
513
|
+
treeIndex: (treeData || []).length
|
|
514
|
+
};
|
|
515
|
+
}
|
|
516
|
+
var insertedTreeIndex = null;
|
|
517
|
+
var hasBeenAdded = false;
|
|
518
|
+
var changedTreeData = map({
|
|
519
|
+
treeData: treeData,
|
|
520
|
+
getNodeKey: getNodeKey,
|
|
521
|
+
ignoreCollapsed: ignoreCollapsed,
|
|
522
|
+
callback: function (_a) {
|
|
523
|
+
var node = _a.node, treeIndex = _a.treeIndex, path = _a.path;
|
|
524
|
+
var key = path ? path[path.length - 1] : null;
|
|
525
|
+
// Return nodes that are not the parent as-is
|
|
526
|
+
if (hasBeenAdded || key !== parentKey) {
|
|
527
|
+
return node;
|
|
528
|
+
}
|
|
529
|
+
hasBeenAdded = true;
|
|
530
|
+
var parentNode = __assign({}, node);
|
|
531
|
+
if (expandParent) {
|
|
532
|
+
parentNode.expanded = true;
|
|
533
|
+
}
|
|
534
|
+
// If no children exist yet, just add the single newNode
|
|
535
|
+
if (!parentNode.children) {
|
|
536
|
+
insertedTreeIndex = treeIndex + 1;
|
|
537
|
+
return __assign(__assign({}, parentNode), { children: [newNode] });
|
|
538
|
+
}
|
|
539
|
+
if (typeof parentNode.children === 'function') {
|
|
540
|
+
throw new Error('Cannot add to children defined by a function');
|
|
541
|
+
}
|
|
542
|
+
var nextTreeIndex = treeIndex + 1;
|
|
543
|
+
for (var i = 0; i < parentNode.children.length; i += 1) {
|
|
544
|
+
nextTreeIndex += 1 + getDescendantCount({ node: parentNode.children[i], ignoreCollapsed: ignoreCollapsed });
|
|
545
|
+
}
|
|
546
|
+
insertedTreeIndex = nextTreeIndex;
|
|
547
|
+
var children = addAsFirstChild ? __spreadArray([newNode], parentNode.children) : __spreadArray(__spreadArray([], parentNode.children), [newNode]);
|
|
548
|
+
return __assign(__assign({}, parentNode), { children: children });
|
|
549
|
+
}
|
|
550
|
+
});
|
|
551
|
+
if (!hasBeenAdded) {
|
|
552
|
+
throw new Error('No node found with the given key.');
|
|
553
|
+
}
|
|
554
|
+
return {
|
|
555
|
+
treeData: changedTreeData,
|
|
556
|
+
treeIndex: insertedTreeIndex
|
|
557
|
+
};
|
|
558
|
+
}
|
|
559
|
+
exports.addNodeUnderParent = addNodeUnderParent;
|
|
560
|
+
function addNodeAtDepthAndIndex(_a) {
|
|
561
|
+
var targetDepth = _a.targetDepth, minimumTreeIndex = _a.minimumTreeIndex, newNode = _a.newNode, ignoreCollapsed = _a.ignoreCollapsed, expandParent = _a.expandParent, _b = _a.isPseudoRoot, isPseudoRoot = _b === void 0 ? false : _b, isLastChild = _a.isLastChild, node = _a.node, currentIndex = _a.currentIndex, currentDepth = _a.currentDepth, getNodeKey = _a.getNodeKey, _c = _a.path, path = _c === void 0 ? [] : _c;
|
|
562
|
+
var selfPath = function (n) { return (isPseudoRoot ? [] : __spreadArray(__spreadArray([], path), [getNodeKey({ node: n, treeIndex: currentIndex })])); };
|
|
563
|
+
// If the current position is the only possible place to add, add it
|
|
564
|
+
if (currentIndex >= minimumTreeIndex - 1 || (isLastChild && !(node.children && node.children.length))) {
|
|
565
|
+
if (typeof node.children === 'function') {
|
|
566
|
+
throw new Error('Cannot add to children defined by a function');
|
|
567
|
+
}
|
|
568
|
+
else {
|
|
569
|
+
var extraNodeProps = expandParent ? { expanded: true } : {};
|
|
570
|
+
var nextNode_1 = __assign(__assign(__assign({}, node), extraNodeProps), { children: node.children ? __spreadArray([newNode], node.children) : [newNode] });
|
|
571
|
+
return {
|
|
572
|
+
node: nextNode_1,
|
|
573
|
+
nextIndex: currentIndex + 2,
|
|
574
|
+
insertedTreeIndex: currentIndex + 1,
|
|
575
|
+
parentPath: selfPath(nextNode_1),
|
|
576
|
+
parentNode: isPseudoRoot ? null : nextNode_1
|
|
577
|
+
};
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
// If this is the target depth for the insertion,
|
|
581
|
+
// i.e., where the newNode can be added to the current node's children
|
|
582
|
+
if (currentDepth >= targetDepth - 1) {
|
|
583
|
+
// Skip over nodes with no children or hidden children
|
|
584
|
+
if (!node.children ||
|
|
585
|
+
typeof node.children === 'function' ||
|
|
586
|
+
(node.expanded !== true && ignoreCollapsed && !isPseudoRoot)) {
|
|
587
|
+
return { node: node, nextIndex: currentIndex + 1 };
|
|
588
|
+
}
|
|
589
|
+
// Scan over the children to see if there's a place among them that fulfills
|
|
590
|
+
// the minimumTreeIndex requirement
|
|
591
|
+
var childIndex_1 = currentIndex + 1;
|
|
592
|
+
var insertedTreeIndex_1 = null;
|
|
593
|
+
var insertIndex = null;
|
|
594
|
+
for (var i = 0; i < node.children.length; i += 1) {
|
|
595
|
+
// If a valid location is found, mark it as the insertion location and
|
|
596
|
+
// break out of the loop
|
|
597
|
+
if (childIndex_1 >= minimumTreeIndex) {
|
|
598
|
+
insertedTreeIndex_1 = childIndex_1;
|
|
599
|
+
insertIndex = i;
|
|
600
|
+
break;
|
|
601
|
+
}
|
|
602
|
+
// Increment the index by the child itself plus the number of descendants it has
|
|
603
|
+
childIndex_1 += 1 + getDescendantCount({ node: node.children[i], ignoreCollapsed: ignoreCollapsed });
|
|
604
|
+
}
|
|
605
|
+
// If no valid indices to add the node were found
|
|
606
|
+
if (insertIndex === null) {
|
|
607
|
+
// If the last position in this node's children is less than the minimum index
|
|
608
|
+
// and there are more children on the level of this node, return without insertion
|
|
609
|
+
if (childIndex_1 < minimumTreeIndex && !isLastChild) {
|
|
610
|
+
return { node: node, nextIndex: childIndex_1 };
|
|
611
|
+
}
|
|
612
|
+
// Use the last position in the children array to insert the newNode
|
|
613
|
+
insertedTreeIndex_1 = childIndex_1;
|
|
614
|
+
insertIndex = node.children.length;
|
|
615
|
+
}
|
|
616
|
+
// Insert the newNode at the insertIndex
|
|
617
|
+
var nextNode_2 = __assign(__assign({}, node), { children: __spreadArray(__spreadArray(__spreadArray([], node.children.slice(0, insertIndex)), [newNode]), node.children.slice(insertIndex)) });
|
|
618
|
+
// Return node with successful insert result
|
|
619
|
+
return {
|
|
620
|
+
node: nextNode_2,
|
|
621
|
+
nextIndex: childIndex_1,
|
|
622
|
+
insertedTreeIndex: insertedTreeIndex_1,
|
|
623
|
+
parentPath: selfPath(nextNode_2),
|
|
624
|
+
parentNode: isPseudoRoot ? null : nextNode_2
|
|
625
|
+
};
|
|
626
|
+
}
|
|
627
|
+
// Skip over nodes with no children or hidden children
|
|
628
|
+
if (!node.children ||
|
|
629
|
+
typeof node.children === 'function' ||
|
|
630
|
+
(node.expanded !== true && ignoreCollapsed && !isPseudoRoot)) {
|
|
631
|
+
return { node: node, nextIndex: currentIndex + 1 };
|
|
632
|
+
}
|
|
633
|
+
// Get all descendants
|
|
634
|
+
var insertedTreeIndex = null;
|
|
635
|
+
var pathFragment = null;
|
|
636
|
+
var parentNode = null;
|
|
637
|
+
var childIndex = currentIndex + 1;
|
|
638
|
+
var newChildren = node.children;
|
|
639
|
+
if (typeof newChildren !== 'function') {
|
|
640
|
+
newChildren = newChildren.map(function (child, i) {
|
|
641
|
+
if (insertedTreeIndex !== null) {
|
|
642
|
+
return child;
|
|
643
|
+
}
|
|
644
|
+
var mapResult = addNodeAtDepthAndIndex({
|
|
645
|
+
targetDepth: targetDepth,
|
|
646
|
+
minimumTreeIndex: minimumTreeIndex,
|
|
647
|
+
newNode: newNode,
|
|
648
|
+
ignoreCollapsed: ignoreCollapsed,
|
|
649
|
+
expandParent: expandParent,
|
|
650
|
+
isLastChild: isLastChild && i === newChildren.length - 1,
|
|
651
|
+
node: child,
|
|
652
|
+
currentIndex: childIndex,
|
|
653
|
+
currentDepth: currentDepth + 1,
|
|
654
|
+
getNodeKey: getNodeKey,
|
|
655
|
+
path: [] // Cannot determine the parent path until the children have been processed
|
|
656
|
+
});
|
|
657
|
+
if ('insertedTreeIndex' in mapResult) {
|
|
658
|
+
(insertedTreeIndex = mapResult.insertedTreeIndex, parentNode = mapResult.parentNode, pathFragment = mapResult.parentPath);
|
|
659
|
+
}
|
|
660
|
+
childIndex = mapResult.nextIndex;
|
|
661
|
+
return mapResult.node;
|
|
662
|
+
});
|
|
663
|
+
}
|
|
664
|
+
var nextNode = __assign(__assign({}, node), { children: newChildren });
|
|
665
|
+
var result = {
|
|
666
|
+
node: nextNode,
|
|
667
|
+
nextIndex: childIndex
|
|
668
|
+
};
|
|
669
|
+
if (insertedTreeIndex !== null) {
|
|
670
|
+
result.insertedTreeIndex = insertedTreeIndex;
|
|
671
|
+
result.parentPath = __spreadArray(__spreadArray([], selfPath(nextNode)), pathFragment);
|
|
672
|
+
result.parentNode = parentNode;
|
|
673
|
+
}
|
|
674
|
+
return result;
|
|
675
|
+
}
|
|
676
|
+
/**
|
|
677
|
+
* Insert a node into the tree at the given depth, after the minimum index
|
|
678
|
+
*
|
|
679
|
+
* @param {!Object[]} treeData - Tree data
|
|
680
|
+
* @param {!number} depth - The depth to insert the node at (the first level of the array being depth 0)
|
|
681
|
+
* @param {!number} minimumTreeIndex - The lowest possible treeIndex to insert the node at
|
|
682
|
+
* @param {!Object} newNode - The node to insert into the tree
|
|
683
|
+
* @param {boolean=} ignoreCollapsed - Ignore children of nodes without `expanded` set to `true`
|
|
684
|
+
* @param {boolean=} expandParent - If true, expands the parent of the inserted node
|
|
685
|
+
* @param {!function} getNodeKey - Function to get the key from the nodeData and tree index
|
|
686
|
+
*
|
|
687
|
+
* @return {Object} result
|
|
688
|
+
* @return {Object[]} result.treeData - The tree data with the node added
|
|
689
|
+
* @return {number} result.treeIndex - The tree index at which the node was inserted
|
|
690
|
+
* @return {number[]|string[]} result.path - Array of keys leading to the node location after insertion
|
|
691
|
+
* @return {Object} result.parentNode - The parent node of the inserted node
|
|
692
|
+
*/
|
|
693
|
+
function insertNode(_a) {
|
|
694
|
+
var treeData = _a.treeData, targetDepth = _a.depth, minimumTreeIndex = _a.minimumTreeIndex, newNode = _a.newNode, _b = _a.getNodeKey, getNodeKey = _b === void 0 ? function () { } : _b, _c = _a.ignoreCollapsed, ignoreCollapsed = _c === void 0 ? true : _c, _d = _a.expandParent, expandParent = _d === void 0 ? false : _d;
|
|
695
|
+
if (!treeData && targetDepth === 0) {
|
|
696
|
+
return {
|
|
697
|
+
treeData: [newNode],
|
|
698
|
+
treeIndex: 0,
|
|
699
|
+
path: [getNodeKey({ node: newNode, treeIndex: 0 })],
|
|
700
|
+
parentNode: null
|
|
701
|
+
};
|
|
702
|
+
}
|
|
703
|
+
var insertResult = addNodeAtDepthAndIndex({
|
|
704
|
+
targetDepth: targetDepth,
|
|
705
|
+
minimumTreeIndex: minimumTreeIndex,
|
|
706
|
+
newNode: newNode,
|
|
707
|
+
ignoreCollapsed: ignoreCollapsed,
|
|
708
|
+
expandParent: expandParent,
|
|
709
|
+
getNodeKey: getNodeKey,
|
|
710
|
+
isPseudoRoot: true,
|
|
711
|
+
isLastChild: true,
|
|
712
|
+
node: { children: treeData },
|
|
713
|
+
currentIndex: -1,
|
|
714
|
+
currentDepth: -1
|
|
715
|
+
});
|
|
716
|
+
if (!('insertedTreeIndex' in insertResult)) {
|
|
717
|
+
throw new Error('No suitable position found to insert.');
|
|
718
|
+
}
|
|
719
|
+
var treeIndex = insertResult.insertedTreeIndex;
|
|
720
|
+
return {
|
|
721
|
+
treeData: insertResult.node.children,
|
|
722
|
+
treeIndex: treeIndex,
|
|
723
|
+
path: __spreadArray(__spreadArray([], insertResult.parentPath), [getNodeKey({ node: newNode, treeIndex: treeIndex })]),
|
|
724
|
+
parentNode: insertResult.parentNode
|
|
725
|
+
};
|
|
726
|
+
}
|
|
727
|
+
exports.insertNode = insertNode;
|
|
728
|
+
/**
|
|
729
|
+
* Get tree data flattened.
|
|
730
|
+
*
|
|
731
|
+
* @param {!Object[]} treeData - Tree data
|
|
732
|
+
* @param {!function} getNodeKey - Function to get the key from the nodeData and tree index
|
|
733
|
+
* @param {boolean=} ignoreCollapsed - Ignore children of nodes without `expanded` set to `true`
|
|
734
|
+
*
|
|
735
|
+
* @return {{
|
|
736
|
+
* node: Object,
|
|
737
|
+
* path: []string|[]number,
|
|
738
|
+
* lowerSiblingCounts: []number
|
|
739
|
+
* }}[] nodes - The node array
|
|
740
|
+
*/
|
|
741
|
+
function getFlatDataFromTree(_a) {
|
|
742
|
+
var treeData = _a.treeData, getNodeKey = _a.getNodeKey, _b = _a.ignoreCollapsed, ignoreCollapsed = _b === void 0 ? true : _b;
|
|
743
|
+
if (!treeData || treeData.length < 1) {
|
|
744
|
+
return [];
|
|
745
|
+
}
|
|
746
|
+
var flattened = [];
|
|
747
|
+
walk({
|
|
748
|
+
treeData: treeData,
|
|
749
|
+
getNodeKey: getNodeKey,
|
|
750
|
+
ignoreCollapsed: ignoreCollapsed,
|
|
751
|
+
callback: function (nodeInfo) {
|
|
752
|
+
flattened.push(nodeInfo);
|
|
753
|
+
}
|
|
754
|
+
});
|
|
755
|
+
return flattened;
|
|
756
|
+
}
|
|
757
|
+
exports.getFlatDataFromTree = getFlatDataFromTree;
|
|
758
|
+
/**
|
|
759
|
+
* Generate a tree structure from flat data.
|
|
760
|
+
*
|
|
761
|
+
* @param {!Object[]} flatData
|
|
762
|
+
* @param {!function=} getKey - Function to get the key from the nodeData
|
|
763
|
+
* @param {!function=} getParentKey - Function to get the parent key from the nodeData
|
|
764
|
+
* @param {string|number=} rootKey - The value returned by `getParentKey` that corresponds to the root node.
|
|
765
|
+
* For example, if your nodes have id 1-99, you might use rootKey = 0
|
|
766
|
+
*
|
|
767
|
+
* @return {Object[]} treeData - The flat data represented as a tree
|
|
768
|
+
*/
|
|
769
|
+
function getTreeFromFlatData(_a) {
|
|
770
|
+
var flatData = _a.flatData, _b = _a.getKey, getKey = _b === void 0 ? function (node) { return node.id; } : _b, _c = _a.getParentKey, getParentKey = _c === void 0 ? function (node) { return node.parentId; } : _c, _d = _a.rootKey, rootKey = _d === void 0 ? '0' : _d;
|
|
771
|
+
if (!flatData) {
|
|
772
|
+
return [];
|
|
773
|
+
}
|
|
774
|
+
var childrenToParents = {};
|
|
775
|
+
flatData.forEach(function (child) {
|
|
776
|
+
var parentKey = getParentKey(child);
|
|
777
|
+
if (parentKey in childrenToParents) {
|
|
778
|
+
childrenToParents[parentKey].push(child);
|
|
779
|
+
}
|
|
780
|
+
else {
|
|
781
|
+
childrenToParents[parentKey] = [child];
|
|
782
|
+
}
|
|
783
|
+
});
|
|
784
|
+
if (!(rootKey in childrenToParents)) {
|
|
785
|
+
return [];
|
|
786
|
+
}
|
|
787
|
+
var trav = function (parent) {
|
|
788
|
+
var parentKey = getKey(parent);
|
|
789
|
+
if (parentKey in childrenToParents) {
|
|
790
|
+
return __assign(__assign({}, parent), { children: childrenToParents[parentKey].map(function (child) { return trav(child); }) });
|
|
791
|
+
}
|
|
792
|
+
return __assign({}, parent);
|
|
793
|
+
};
|
|
794
|
+
return childrenToParents[rootKey].map(function (child) { return trav(child); });
|
|
795
|
+
}
|
|
796
|
+
exports.getTreeFromFlatData = getTreeFromFlatData;
|
|
797
|
+
/**
|
|
798
|
+
* Check if a node is a descendant of another node.
|
|
799
|
+
*
|
|
800
|
+
* @param {!Object} older - Potential ancestor of younger node
|
|
801
|
+
* @param {!Object} younger - Potential descendant of older node
|
|
802
|
+
*
|
|
803
|
+
* @return {boolean}
|
|
804
|
+
*/
|
|
805
|
+
function isDescendant(older, younger) {
|
|
806
|
+
return (!!older.children &&
|
|
807
|
+
typeof older.children !== 'function' &&
|
|
808
|
+
older.children.some(function (child) { return child === younger || isDescendant(child, younger); }));
|
|
809
|
+
}
|
|
810
|
+
exports.isDescendant = isDescendant;
|
|
811
|
+
/**
|
|
812
|
+
* Get the maximum depth of the children (the depth of the root node is 0).
|
|
813
|
+
*
|
|
814
|
+
* @param {!Object} node - Node in the tree
|
|
815
|
+
* @param {?number} depth - The current depth
|
|
816
|
+
*
|
|
817
|
+
* @return {number} maxDepth - The deepest depth in the tree
|
|
818
|
+
*/
|
|
819
|
+
function getDepth(node, depth) {
|
|
820
|
+
if (depth === void 0) { depth = 0; }
|
|
821
|
+
if (!node.children) {
|
|
822
|
+
return depth;
|
|
823
|
+
}
|
|
824
|
+
if (typeof node.children === 'function') {
|
|
825
|
+
return depth + 1;
|
|
826
|
+
}
|
|
827
|
+
return node.children.reduce(function (deepest, child) { return Math.max(deepest, getDepth(child, depth + 1)); }, depth);
|
|
828
|
+
}
|
|
829
|
+
exports.getDepth = getDepth;
|
|
830
|
+
/**
|
|
831
|
+
* Find nodes matching a search query in the tree,
|
|
832
|
+
*
|
|
833
|
+
* @param {!function} getNodeKey - Function to get the key from the nodeData and tree index
|
|
834
|
+
* @param {!Object[]} treeData - Tree data
|
|
835
|
+
* @param {?string|number} searchQuery - Function returning a boolean to indicate whether the node is a match or not
|
|
836
|
+
* @param {!function} searchMethod - Function returning a boolean to indicate whether the node is a match or not
|
|
837
|
+
* @param {?number} searchFocusOffset - The offset of the match to focus on
|
|
838
|
+
* (e.g., 0 focuses on the first match, 1 on the second)
|
|
839
|
+
* @param {boolean=} expandAllMatchPaths - If true, expands the paths to any matched node
|
|
840
|
+
* @param {boolean=} expandFocusMatchPaths - If true, expands the path to the focused node
|
|
841
|
+
*
|
|
842
|
+
* @return {Object[]} matches - An array of objects containing the matching `node`s, their `path`s and `treeIndex`s
|
|
843
|
+
* @return {Object[]} treeData - The original tree data with all relevant nodes expanded.
|
|
844
|
+
* If expandAllMatchPaths and expandFocusMatchPaths are both false,
|
|
845
|
+
* it will be the same as the original tree data.
|
|
846
|
+
*/
|
|
847
|
+
function find(_a) {
|
|
848
|
+
var getNodeKey = _a.getNodeKey, treeData = _a.treeData, searchQuery = _a.searchQuery, searchMethod = _a.searchMethod, searchFocusOffset = _a.searchFocusOffset, _b = _a.expandAllMatchPaths, expandAllMatchPaths = _b === void 0 ? false : _b, _c = _a.expandFocusMatchPaths, expandFocusMatchPaths = _c === void 0 ? true : _c;
|
|
849
|
+
var matchCount = 0;
|
|
850
|
+
var trav = function (_a) {
|
|
851
|
+
var _b = _a.isPseudoRoot, isPseudoRoot = _b === void 0 ? false : _b, node = _a.node, currentIndex = _a.currentIndex, _c = _a.path, path = _c === void 0 ? [] : _c;
|
|
852
|
+
var matches = [];
|
|
853
|
+
var isSelfMatch = false;
|
|
854
|
+
var hasFocusMatch = false;
|
|
855
|
+
// The pseudo-root is not considered in the path
|
|
856
|
+
var selfPath = isPseudoRoot ? [] : __spreadArray(__spreadArray([], path), [getNodeKey({ node: node, treeIndex: currentIndex })]);
|
|
857
|
+
var extraInfo = isPseudoRoot
|
|
858
|
+
? null
|
|
859
|
+
: {
|
|
860
|
+
path: selfPath,
|
|
861
|
+
treeIndex: currentIndex
|
|
862
|
+
};
|
|
863
|
+
// Nodes with with children that aren't lazy
|
|
864
|
+
var hasChildren = node.children && typeof node.children !== 'function' && node.children.length > 0;
|
|
865
|
+
// Examine the current node to see if it is a match
|
|
866
|
+
if (!isPseudoRoot && searchMethod(__assign(__assign({}, extraInfo), { node: node, searchQuery: searchQuery }))) {
|
|
867
|
+
if (matchCount === searchFocusOffset) {
|
|
868
|
+
hasFocusMatch = true;
|
|
869
|
+
}
|
|
870
|
+
// Keep track of the number of matching nodes, so we know when the searchFocusOffset
|
|
871
|
+
// is reached
|
|
872
|
+
matchCount += 1;
|
|
873
|
+
// We cannot add this node to the matches right away, as it may be changed
|
|
874
|
+
// during the search of the descendants. The entire node is used in
|
|
875
|
+
// comparisons between nodes inside the `matches` and `treeData` results
|
|
876
|
+
// of this method (`find`)
|
|
877
|
+
isSelfMatch = true;
|
|
878
|
+
}
|
|
879
|
+
var childIndex = currentIndex;
|
|
880
|
+
var newNode = __assign({}, node);
|
|
881
|
+
if (hasChildren) {
|
|
882
|
+
// Get all descendants
|
|
883
|
+
newNode.children = newNode.children.map(function (child) {
|
|
884
|
+
var mapResult = trav({
|
|
885
|
+
node: child,
|
|
886
|
+
currentIndex: childIndex + 1,
|
|
887
|
+
path: selfPath
|
|
888
|
+
});
|
|
889
|
+
// Ignore hidden nodes by only advancing the index counter to the returned treeIndex
|
|
890
|
+
// if the child is expanded.
|
|
891
|
+
//
|
|
892
|
+
// The child could have been expanded from the start,
|
|
893
|
+
// or expanded due to a matching node being found in its descendants
|
|
894
|
+
if (mapResult.node.expanded) {
|
|
895
|
+
childIndex = mapResult.treeIndex;
|
|
896
|
+
}
|
|
897
|
+
else {
|
|
898
|
+
childIndex += 1;
|
|
899
|
+
}
|
|
900
|
+
if (mapResult.matches.length > 0 || mapResult.hasFocusMatch) {
|
|
901
|
+
matches = __spreadArray(__spreadArray([], matches), mapResult.matches);
|
|
902
|
+
if (mapResult.hasFocusMatch) {
|
|
903
|
+
hasFocusMatch = true;
|
|
904
|
+
}
|
|
905
|
+
// Expand the current node if it has descendants matching the search
|
|
906
|
+
// and the settings are set to do so.
|
|
907
|
+
if ((expandAllMatchPaths && mapResult.matches.length > 0) ||
|
|
908
|
+
((expandAllMatchPaths || expandFocusMatchPaths) && mapResult.hasFocusMatch)) {
|
|
909
|
+
newNode.expanded = true;
|
|
910
|
+
}
|
|
911
|
+
}
|
|
912
|
+
return mapResult.node;
|
|
913
|
+
});
|
|
914
|
+
}
|
|
915
|
+
// Cannot assign a treeIndex to hidden nodes
|
|
916
|
+
if (!isPseudoRoot && !newNode.expanded) {
|
|
917
|
+
matches = matches.map(function (match) { return (__assign(__assign({}, match), { treeIndex: null })); });
|
|
918
|
+
}
|
|
919
|
+
// Add this node to the matches if it fits the search criteria.
|
|
920
|
+
// This is performed at the last minute so newNode can be sent in its final form.
|
|
921
|
+
if (isSelfMatch) {
|
|
922
|
+
matches = __spreadArray([__assign(__assign({}, extraInfo), { node: newNode })], matches);
|
|
923
|
+
}
|
|
924
|
+
return {
|
|
925
|
+
node: matches.length > 0 ? newNode : node,
|
|
926
|
+
matches: matches,
|
|
927
|
+
hasFocusMatch: hasFocusMatch,
|
|
928
|
+
treeIndex: childIndex
|
|
929
|
+
};
|
|
930
|
+
};
|
|
931
|
+
var result = trav({
|
|
932
|
+
node: { children: treeData },
|
|
933
|
+
isPseudoRoot: true,
|
|
934
|
+
currentIndex: -1
|
|
935
|
+
});
|
|
936
|
+
return {
|
|
937
|
+
matches: result.matches,
|
|
938
|
+
treeData: result.node.children
|
|
939
|
+
};
|
|
940
|
+
}
|
|
941
|
+
exports.find = find;
|
|
942
|
+
exports.default = {
|
|
943
|
+
find: find,
|
|
944
|
+
getDepth: getDepth,
|
|
945
|
+
isDescendant: isDescendant,
|
|
946
|
+
getTreeFromFlatData: getTreeFromFlatData,
|
|
947
|
+
getFlatDataFromTree: getFlatDataFromTree,
|
|
948
|
+
insertNode: insertNode,
|
|
949
|
+
addNodeUnderParent: addNodeUnderParent,
|
|
950
|
+
getNodeAtPath: getNodeAtPath,
|
|
951
|
+
removeNode: removeNode,
|
|
952
|
+
removeNodeAtPath: removeNodeAtPath,
|
|
953
|
+
changeNodeAtPath: changeNodeAtPath,
|
|
954
|
+
toggleExpandedForAll: toggleExpandedForAll,
|
|
955
|
+
map: map,
|
|
956
|
+
walk: walk,
|
|
957
|
+
getVisibleNodeInfoAtIndex: getVisibleNodeInfoAtIndex,
|
|
958
|
+
getVisibleNodeCount: getVisibleNodeCount,
|
|
959
|
+
getDescendantCount: getDescendantCount
|
|
960
|
+
};
|