@openui5/sap.m 1.123.1 → 1.124.0
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/package.json +4 -4
- package/src/sap/m/.library +6 -1
- package/src/sap/m/AccButton.js +1 -1
- package/src/sap/m/ActionListItem.js +1 -1
- package/src/sap/m/ActionSelect.js +2 -2
- package/src/sap/m/ActionSheet.js +1 -1
- package/src/sap/m/ActionTile.js +33 -11
- package/src/sap/m/ActionTileContent.js +9 -4
- package/src/sap/m/AdditionalTextButton.js +1 -1
- package/src/sap/m/App.js +1 -1
- package/src/sap/m/AssociativeOverflowToolbar.js +1 -1
- package/src/sap/m/Avatar.js +53 -13
- package/src/sap/m/AvatarColor.js +3 -1
- package/src/sap/m/AvatarImageFitType.js +3 -1
- package/src/sap/m/AvatarRenderer.js +4 -3
- package/src/sap/m/AvatarShape.js +3 -1
- package/src/sap/m/AvatarSize.js +3 -1
- package/src/sap/m/AvatarType.js +3 -1
- package/src/sap/m/Bar.js +1 -1
- package/src/sap/m/Breadcrumbs.js +1 -1
- package/src/sap/m/BusyDialog.js +1 -1
- package/src/sap/m/BusyIndicator.js +1 -1
- package/src/sap/m/Button.js +1 -1
- package/src/sap/m/Carousel.js +1 -1
- package/src/sap/m/CarouselLayout.js +1 -1
- package/src/sap/m/CheckBox.js +1 -1
- package/src/sap/m/ColorPalette.js +1 -1
- package/src/sap/m/ColorPalettePopover.js +1 -1
- package/src/sap/m/Column.js +1 -1
- package/src/sap/m/ColumnHeaderPopover.js +1 -1
- package/src/sap/m/ColumnListItem.js +1 -1
- package/src/sap/m/ColumnPopoverActionItem.js +1 -1
- package/src/sap/m/ColumnPopoverCustomItem.js +1 -1
- package/src/sap/m/ColumnPopoverItem.js +1 -1
- package/src/sap/m/ColumnPopoverSelectListItem.js +1 -1
- package/src/sap/m/ColumnPopoverSortItem.js +1 -1
- package/src/sap/m/ComboBox.js +1 -1
- package/src/sap/m/ComboBoxBase.js +2 -1
- package/src/sap/m/ComboBoxTextField.js +1 -1
- package/src/sap/m/ContentConfig.js +1 -1
- package/src/sap/m/CustomListItem.js +1 -1
- package/src/sap/m/CustomTile.js +1 -1
- package/src/sap/m/CustomTreeItem.js +1 -1
- package/src/sap/m/DatePicker.js +1 -1
- package/src/sap/m/DateRangeSelection.js +2 -2
- package/src/sap/m/DateTimeField.js +1 -1
- package/src/sap/m/DateTimeInput.js +1 -1
- package/src/sap/m/DateTimePicker.js +1 -3
- package/src/sap/m/Dialog.js +1 -1
- package/src/sap/m/DisplayListItem.js +1 -1
- package/src/sap/m/DraftIndicator.js +1 -1
- package/src/sap/m/DynamicDate.js +1 -1
- package/src/sap/m/DynamicDateOption.js +1 -1
- package/src/sap/m/DynamicDateRange.js +2 -6
- package/src/sap/m/DynamicDateValueHelpUIType.js +1 -1
- package/src/sap/m/ExpandableText.js +1 -1
- package/src/sap/m/FacetFilter.js +1 -1
- package/src/sap/m/FacetFilterItem.js +1 -1
- package/src/sap/m/FacetFilterList.js +1 -1
- package/src/sap/m/FeedContent.js +1 -1
- package/src/sap/m/FeedInput.js +1 -1
- package/src/sap/m/FeedListItem.js +1 -1
- package/src/sap/m/FeedListItemAction.js +1 -1
- package/src/sap/m/Fiori20Adapter.js +2 -2
- package/src/sap/m/FlexBox.js +1 -1
- package/src/sap/m/FlexItemData.js +1 -1
- package/src/sap/m/FormattedText.js +1 -1
- package/src/sap/m/GenericTag.js +1 -1
- package/src/sap/m/GenericTile.js +40 -17
- package/src/sap/m/GenericTileRenderer.js +103 -11
- package/src/sap/m/GroupHeaderListItem.js +1 -1
- package/src/sap/m/GrowingList.js +1 -1
- package/src/sap/m/HBox.js +1 -1
- package/src/sap/m/HeaderContainer.js +8 -2
- package/src/sap/m/HeaderContainerItemNavigator.js +1 -1
- package/src/sap/m/HeaderContainerRenderer.js +3 -0
- package/src/sap/m/IconTabBar.js +1 -1
- package/src/sap/m/IconTabBarSelectList.js +1 -1
- package/src/sap/m/IconTabFilter.js +2 -2
- package/src/sap/m/IconTabFilterExpandButtonBadge.js +1 -1
- package/src/sap/m/IconTabHeader.js +1 -1
- package/src/sap/m/IconTabSeparator.js +1 -1
- package/src/sap/m/IllustratedMessage.js +19 -3
- package/src/sap/m/IllustratedMessageSize.js +3 -1
- package/src/sap/m/IllustratedMessageType.js +3 -1
- package/src/sap/m/Illustration.js +1 -1
- package/src/sap/m/Image.js +1 -1
- package/src/sap/m/ImageContent.js +1 -1
- package/src/sap/m/Input.js +53 -34
- package/src/sap/m/InputBase.js +5 -9
- package/src/sap/m/InputListItem.js +1 -1
- package/src/sap/m/InputRenderer.js +6 -9
- package/src/sap/m/Label.js +1 -1
- package/src/sap/m/LightBox.js +1 -1
- package/src/sap/m/LightBoxItem.js +1 -1
- package/src/sap/m/Link.js +1 -1
- package/src/sap/m/LinkTileContent.js +1 -1
- package/src/sap/m/List.js +1 -1
- package/src/sap/m/ListBase.js +6 -6
- package/src/sap/m/ListItemBase.js +3 -6
- package/src/sap/m/MaskEnabler.js +1 -1
- package/src/sap/m/MaskInput.js +1 -1
- package/src/sap/m/MaskInputRule.js +1 -1
- package/src/sap/m/Menu.js +1 -1
- package/src/sap/m/MenuButton.js +1 -1
- package/src/sap/m/MenuItem.js +1 -1
- package/src/sap/m/MenuListItem.js +1 -1
- package/src/sap/m/MessageBox.js +25 -7
- package/src/sap/m/MessageItem.js +1 -1
- package/src/sap/m/MessageListItem.js +3 -6
- package/src/sap/m/MessagePage.js +1 -1
- package/src/sap/m/MessagePopover.js +1 -1
- package/src/sap/m/MessagePopoverItem.js +1 -1
- package/src/sap/m/MessageStrip.js +4 -4
- package/src/sap/m/MessageToast.js +1 -1
- package/src/sap/m/MessageView.js +3 -4
- package/src/sap/m/MultiComboBox.js +1 -6
- package/src/sap/m/MultiEditField.js +1 -1
- package/src/sap/m/MultiInput.js +36 -3
- package/src/sap/m/NavContainer.js +1 -1
- package/src/sap/m/NewsContent.js +1 -1
- package/src/sap/m/NotificationList.js +1 -1
- package/src/sap/m/NotificationListBase.js +1 -1
- package/src/sap/m/NotificationListGroup.js +1 -1
- package/src/sap/m/NotificationListItem.js +1 -1
- package/src/sap/m/NumericContent.js +1 -1
- package/src/sap/m/NumericInput.js +1 -1
- package/src/sap/m/ObjectAttribute.js +1 -1
- package/src/sap/m/ObjectHeader.js +1 -1
- package/src/sap/m/ObjectIdentifier.js +1 -1
- package/src/sap/m/ObjectListItem.js +1 -1
- package/src/sap/m/ObjectMarker.js +1 -1
- package/src/sap/m/ObjectNumber.js +1 -1
- package/src/sap/m/ObjectStatus.js +1 -1
- package/src/sap/m/OverflowToolbar.js +1 -1
- package/src/sap/m/OverflowToolbarAssociativePopover.js +1 -1
- package/src/sap/m/OverflowToolbarAssociativePopoverControls.js +1 -1
- package/src/sap/m/OverflowToolbarButton.js +1 -1
- package/src/sap/m/OverflowToolbarLayoutData.js +1 -1
- package/src/sap/m/OverflowToolbarMenuButton.js +1 -1
- package/src/sap/m/OverflowToolbarToggleButton.js +1 -1
- package/src/sap/m/P13nAnyFilterItem.js +2 -1
- package/src/sap/m/P13nColumnsItem.js +2 -2
- package/src/sap/m/P13nColumnsPanel.js +2 -2
- package/src/sap/m/P13nConditionPanel.js +2 -1
- package/src/sap/m/P13nDialog.js +4 -7
- package/src/sap/m/P13nDimMeasureItem.js +2 -2
- package/src/sap/m/P13nDimMeasurePanel.js +2 -2
- package/src/sap/m/P13nFilterItem.js +2 -1
- package/src/sap/m/P13nFilterPanel.js +3 -1
- package/src/sap/m/P13nGroupItem.js +2 -2
- package/src/sap/m/P13nGroupPanel.js +2 -2
- package/src/sap/m/P13nItem.js +2 -1
- package/src/sap/m/P13nOperationsHelper.js +2 -0
- package/src/sap/m/P13nPanel.js +2 -1
- package/src/sap/m/P13nSelectionItem.js +2 -1
- package/src/sap/m/P13nSelectionPanel.js +2 -1
- package/src/sap/m/P13nSortItem.js +2 -2
- package/src/sap/m/P13nSortPanel.js +2 -2
- package/src/sap/m/PDFViewer.js +1 -1
- package/src/sap/m/Page.js +12 -6
- package/src/sap/m/PageAccessibleLandmarkInfo.js +1 -1
- package/src/sap/m/PagingButton.js +1 -1
- package/src/sap/m/Panel.js +1 -1
- package/src/sap/m/PlanningCalendar.js +1 -1
- package/src/sap/m/PlanningCalendarHeader.js +1 -1
- package/src/sap/m/PlanningCalendarLegend.js +1 -1
- package/src/sap/m/PlanningCalendarRow.js +1 -1
- package/src/sap/m/PlanningCalendarView.js +1 -1
- package/src/sap/m/Popover.js +1 -1
- package/src/sap/m/ProgressIndicator.js +1 -1
- package/src/sap/m/PullToRefresh.js +1 -1
- package/src/sap/m/QuickView.js +1 -1
- package/src/sap/m/QuickViewBase.js +1 -1
- package/src/sap/m/QuickViewCard.js +1 -1
- package/src/sap/m/QuickViewGroup.js +1 -1
- package/src/sap/m/QuickViewGroupElement.js +1 -1
- package/src/sap/m/QuickViewPage.js +1 -1
- package/src/sap/m/RadioButton.js +1 -1
- package/src/sap/m/RadioButtonGroup.js +1 -1
- package/src/sap/m/RangeSlider.js +1 -1
- package/src/sap/m/RatingIndicator.js +1 -1
- package/src/sap/m/ResponsivePopover.js +1 -1
- package/src/sap/m/ResponsiveScale.js +1 -1
- package/src/sap/m/ScrollBar.js +1 -1
- package/src/sap/m/ScrollContainer.js +1 -1
- package/src/sap/m/SearchField.js +1 -1
- package/src/sap/m/SegmentedButton.js +1 -1
- package/src/sap/m/SegmentedButtonItem.js +1 -1
- package/src/sap/m/Select.js +1 -1
- package/src/sap/m/SelectDialog.js +1 -1
- package/src/sap/m/SelectDialogBase.js +1 -1
- package/src/sap/m/SelectList.js +1 -1
- package/src/sap/m/SelectionDetails.js +1 -1
- package/src/sap/m/SelectionDetailsFacade.js +2 -2
- package/src/sap/m/SelectionDetailsItem.js +1 -1
- package/src/sap/m/SelectionDetailsItemLine.js +1 -1
- package/src/sap/m/Shell.js +1 -1
- package/src/sap/m/SimpleFixFlex.js +1 -1
- package/src/sap/m/SinglePlanningCalendar.js +1 -1
- package/src/sap/m/SinglePlanningCalendarDayView.js +1 -1
- package/src/sap/m/SinglePlanningCalendarGrid.js +1 -3
- package/src/sap/m/SinglePlanningCalendarMonthGrid.js +1 -1
- package/src/sap/m/SinglePlanningCalendarMonthView.js +1 -1
- package/src/sap/m/SinglePlanningCalendarView.js +1 -1
- package/src/sap/m/SinglePlanningCalendarWeekView.js +1 -1
- package/src/sap/m/SinglePlanningCalendarWorkWeekView.js +1 -1
- package/src/sap/m/SlideTile.js +1 -1
- package/src/sap/m/Slider.js +1 -1
- package/src/sap/m/SliderTooltip.js +1 -1
- package/src/sap/m/SliderTooltipBase.js +1 -1
- package/src/sap/m/SliderTooltipContainer.js +1 -1
- package/src/sap/m/SplitApp.js +1 -1
- package/src/sap/m/SplitButton.js +1 -1
- package/src/sap/m/SplitContainer.js +1 -1
- package/src/sap/m/StandardDynamicDateOption.js +1 -1
- package/src/sap/m/StandardListItem.js +1 -1
- package/src/sap/m/StandardTile.js +1 -1
- package/src/sap/m/StandardTreeItem.js +1 -1
- package/src/sap/m/StepInput.js +1 -1
- package/src/sap/m/SuggestionItem.js +1 -1
- package/src/sap/m/SuggestionsPopover.js +1 -1
- package/src/sap/m/Switch.js +1 -1
- package/src/sap/m/TabContainer.js +16 -1
- package/src/sap/m/TabContainerItem.js +1 -1
- package/src/sap/m/TabStrip.js +1 -1
- package/src/sap/m/TabStripItem.js +1 -1
- package/src/sap/m/Table.js +3 -3
- package/src/sap/m/TablePersoController.js +1 -1
- package/src/sap/m/TablePersoDialog.js +1 -1
- package/src/sap/m/TablePersoProvider.js +1 -1
- package/src/sap/m/TableSelectDialog.js +1 -1
- package/src/sap/m/Text.js +1 -1
- package/src/sap/m/TextArea.js +1 -1
- package/src/sap/m/Tile.js +1 -1
- package/src/sap/m/TileContainer.js +1 -1
- package/src/sap/m/TileContent.js +1 -1
- package/src/sap/m/TileInfo.js +65 -0
- package/src/sap/m/TimePicker.js +1 -1
- package/src/sap/m/TimePickerClock.js +5 -3
- package/src/sap/m/TimePickerClocks.js +1 -1
- package/src/sap/m/TimePickerInputs.js +1 -1
- package/src/sap/m/TimePickerInternals.js +1 -1
- package/src/sap/m/TimePickerSlider.js +1 -1
- package/src/sap/m/TimePickerSliders.js +1 -1
- package/src/sap/m/Title.js +1 -1
- package/src/sap/m/TitlePropagationSupport.js +1 -1
- package/src/sap/m/ToggleButton.js +1 -1
- package/src/sap/m/Token.js +1 -1
- package/src/sap/m/Tokenizer.js +1 -3
- package/src/sap/m/Toolbar.js +1 -1
- package/src/sap/m/ToolbarLayoutData.js +1 -1
- package/src/sap/m/ToolbarSeparator.js +1 -1
- package/src/sap/m/ToolbarSpacer.js +1 -1
- package/src/sap/m/Tree.js +1 -1
- package/src/sap/m/TreeItemBase.js +1 -1
- package/src/sap/m/UploadCollection.js +1 -1
- package/src/sap/m/UploadCollectionItem.js +1 -1
- package/src/sap/m/UploadCollectionParameter.js +1 -1
- package/src/sap/m/UploadCollectionToolbarPlaceholder.js +1 -1
- package/src/sap/m/VBox.js +1 -1
- package/src/sap/m/ValueStateHeader.js +1 -1
- package/src/sap/m/VariantManagement.js +1 -2
- package/src/sap/m/ViewSettingsCustomItem.js +1 -1
- package/src/sap/m/ViewSettingsCustomTab.js +1 -1
- package/src/sap/m/ViewSettingsDialog.js +1 -1
- package/src/sap/m/ViewSettingsFilterItem.js +1 -1
- package/src/sap/m/ViewSettingsItem.js +1 -1
- package/src/sap/m/VisibleItem.js +1 -1
- package/src/sap/m/WheelSlider.js +1 -1
- package/src/sap/m/WheelSliderContainer.js +1 -1
- package/src/sap/m/Wizard.js +1 -1
- package/src/sap/m/WizardProgressNavigator.js +1 -1
- package/src/sap/m/WizardStep.js +1 -1
- package/src/sap/m/changeHandler/AddTableColumn.js +1 -2
- package/src/sap/m/changeHandler/ChangeLinkTarget.js +1 -1
- package/src/sap/m/changeHandler/CombineButtons.js +1 -1
- package/src/sap/m/changeHandler/MoveTableColumns.js +1 -1
- package/src/sap/m/changeHandler/SelectIconTabBarFilter.js +1 -1
- package/src/sap/m/changeHandler/SplitMenuButton.js +1 -1
- package/src/sap/m/designtime/Table.designtime.js +1 -2
- package/src/sap/m/designtime/messagebundle_sh.properties +5 -5
- package/src/sap/m/flexibility/Table.flexibility.js +14 -2
- package/src/sap/m/library.js +252 -3
- package/src/sap/m/messagebundle.properties +3 -0
- package/src/sap/m/messagebundle_ar.properties +2 -0
- package/src/sap/m/messagebundle_bg.properties +2 -0
- package/src/sap/m/messagebundle_ca.properties +2 -0
- package/src/sap/m/messagebundle_cnr.properties +2 -0
- package/src/sap/m/messagebundle_cs.properties +2 -0
- package/src/sap/m/messagebundle_cy.properties +2 -0
- package/src/sap/m/messagebundle_da.properties +2 -0
- package/src/sap/m/messagebundle_de.properties +2 -0
- package/src/sap/m/messagebundle_el.properties +2 -0
- package/src/sap/m/messagebundle_en.properties +2 -0
- package/src/sap/m/messagebundle_en_GB.properties +2 -0
- package/src/sap/m/messagebundle_en_US_saprigi.properties +2 -0
- package/src/sap/m/messagebundle_es.properties +2 -0
- package/src/sap/m/messagebundle_es_MX.properties +2 -0
- package/src/sap/m/messagebundle_et.properties +2 -0
- package/src/sap/m/messagebundle_fi.properties +2 -0
- package/src/sap/m/messagebundle_fr.properties +3 -1
- package/src/sap/m/messagebundle_fr_CA.properties +2 -0
- package/src/sap/m/messagebundle_hi.properties +2 -0
- package/src/sap/m/messagebundle_hr.properties +2 -0
- package/src/sap/m/messagebundle_hu.properties +2 -0
- package/src/sap/m/messagebundle_id.properties +2 -0
- package/src/sap/m/messagebundle_it.properties +2 -0
- package/src/sap/m/messagebundle_iw.properties +2 -0
- package/src/sap/m/messagebundle_ja.properties +2 -0
- package/src/sap/m/messagebundle_kk.properties +2 -0
- package/src/sap/m/messagebundle_ko.properties +2 -0
- package/src/sap/m/messagebundle_lt.properties +2 -0
- package/src/sap/m/messagebundle_lv.properties +2 -0
- package/src/sap/m/messagebundle_mk.properties +2 -0
- package/src/sap/m/messagebundle_ms.properties +2 -0
- package/src/sap/m/messagebundle_nl.properties +2 -0
- package/src/sap/m/messagebundle_no.properties +2 -0
- package/src/sap/m/messagebundle_pl.properties +2 -0
- package/src/sap/m/messagebundle_pt.properties +2 -0
- package/src/sap/m/messagebundle_pt_PT.properties +2 -0
- package/src/sap/m/messagebundle_ro.properties +2 -0
- package/src/sap/m/messagebundle_ru.properties +2 -0
- package/src/sap/m/messagebundle_sh.properties +259 -257
- package/src/sap/m/messagebundle_sk.properties +2 -0
- package/src/sap/m/messagebundle_sl.properties +2 -0
- package/src/sap/m/messagebundle_sr.properties +2 -0
- package/src/sap/m/messagebundle_sv.properties +2 -0
- package/src/sap/m/messagebundle_th.properties +2 -0
- package/src/sap/m/messagebundle_tr.properties +2 -0
- package/src/sap/m/messagebundle_uk.properties +2 -0
- package/src/sap/m/messagebundle_vi.properties +2 -0
- package/src/sap/m/messagebundle_zh_CN.properties +3 -1
- package/src/sap/m/messagebundle_zh_TW.properties +2 -0
- package/src/sap/m/p13n/AbstractContainer.js +2 -2
- package/src/sap/m/p13n/AbstractContainerItem.js +2 -2
- package/src/sap/m/p13n/BasePanel.js +1 -1
- package/src/sap/m/p13n/Container.js +1 -1
- package/src/sap/m/p13n/Engine.js +3 -6
- package/src/sap/m/p13n/FilterController.js +1 -1
- package/src/sap/m/p13n/FilterPanel.js +1 -1
- package/src/sap/m/p13n/GroupController.js +1 -1
- package/src/sap/m/p13n/GroupPanel.js +2 -1
- package/src/sap/m/p13n/Popup.js +10 -3
- package/src/sap/m/p13n/QueryPanel.js +1 -1
- package/src/sap/m/p13n/SelectionController.js +13 -8
- package/src/sap/m/p13n/SelectionPanel.js +1 -1
- package/src/sap/m/p13n/SortController.js +1 -1
- package/src/sap/m/p13n/SortPanel.js +1 -1
- package/src/sap/m/p13n/handler/xConfigHandler.js +6 -10
- package/src/sap/m/p13n/modules/DefaultProviderRegistry.js +1 -1
- package/src/sap/m/p13n/modules/StateHandlerRegistry.js +1 -1
- package/src/sap/m/p13n/modules/UIManager.js +7 -1
- package/src/sap/m/p13n/modules/xConfigAPI.js +67 -4
- package/src/sap/m/plugins/CellSelector.js +238 -133
- package/src/sap/m/plugins/ColumnResizer.js +1 -1
- package/src/sap/m/plugins/ContextMenuSetting.js +1 -1
- package/src/sap/m/plugins/CopyProvider.js +6 -4
- package/src/sap/m/plugins/DataStateIndicator.js +1 -1
- package/src/sap/m/plugins/PasteProvider.js +1 -1
- package/src/sap/m/plugins/PluginBase.js +1 -1
- package/src/sap/m/plugins/UploadSetwithTable.js +2067 -0
- package/src/sap/m/rules/Table.support.js +2 -3
- package/src/sap/m/semantic/AddAction.js +1 -1
- package/src/sap/m/semantic/CancelAction.js +1 -1
- package/src/sap/m/semantic/DeleteAction.js +1 -1
- package/src/sap/m/semantic/DetailPage.js +1 -1
- package/src/sap/m/semantic/DiscussInJamAction.js +1 -1
- package/src/sap/m/semantic/EditAction.js +1 -1
- package/src/sap/m/semantic/FavoriteAction.js +1 -1
- package/src/sap/m/semantic/FilterAction.js +1 -1
- package/src/sap/m/semantic/FilterSelect.js +1 -1
- package/src/sap/m/semantic/FlagAction.js +1 -1
- package/src/sap/m/semantic/ForwardAction.js +1 -1
- package/src/sap/m/semantic/FullscreenPage.js +1 -1
- package/src/sap/m/semantic/GroupAction.js +1 -1
- package/src/sap/m/semantic/GroupSelect.js +1 -1
- package/src/sap/m/semantic/MainAction.js +1 -1
- package/src/sap/m/semantic/MasterPage.js +1 -1
- package/src/sap/m/semantic/MessagesIndicator.js +1 -1
- package/src/sap/m/semantic/MultiSelectAction.js +1 -1
- package/src/sap/m/semantic/NegativeAction.js +1 -1
- package/src/sap/m/semantic/OpenInAction.js +1 -1
- package/src/sap/m/semantic/PositiveAction.js +1 -1
- package/src/sap/m/semantic/PrintAction.js +1 -1
- package/src/sap/m/semantic/SaveAction.js +1 -1
- package/src/sap/m/semantic/Segment.js +1 -1
- package/src/sap/m/semantic/SegmentedContainer.js +1 -1
- package/src/sap/m/semantic/SemanticButton.js +1 -1
- package/src/sap/m/semantic/SemanticConfiguration.js +1 -1
- package/src/sap/m/semantic/SemanticControl.js +1 -1
- package/src/sap/m/semantic/SemanticOverflowToolbarButton.js +1 -1
- package/src/sap/m/semantic/SemanticOverflowToolbarToggleButton.js +1 -1
- package/src/sap/m/semantic/SemanticPage.js +1 -1
- package/src/sap/m/semantic/SemanticSelect.js +1 -1
- package/src/sap/m/semantic/SemanticToggleButton.js +1 -1
- package/src/sap/m/semantic/SendEmailAction.js +1 -1
- package/src/sap/m/semantic/SendMessageAction.js +1 -1
- package/src/sap/m/semantic/ShareInJamAction.js +1 -1
- package/src/sap/m/semantic/ShareMenu.js +1 -1
- package/src/sap/m/semantic/ShareMenuPage.js +1 -1
- package/src/sap/m/semantic/SortAction.js +1 -1
- package/src/sap/m/semantic/SortSelect.js +1 -1
- package/src/sap/m/table/ColumnWidthController.js +1 -1
- package/src/sap/m/table/Util.js +1 -1
- package/src/sap/m/table/columnmenu/ActionItem.js +1 -1
- package/src/sap/m/table/columnmenu/Entry.js +1 -1
- package/src/sap/m/table/columnmenu/Item.js +1 -1
- package/src/sap/m/table/columnmenu/ItemBase.js +1 -1
- package/src/sap/m/table/columnmenu/Menu.js +1 -1
- package/src/sap/m/table/columnmenu/QuickAction.js +1 -1
- package/src/sap/m/table/columnmenu/QuickActionBase.js +1 -1
- package/src/sap/m/table/columnmenu/QuickActionItem.js +1 -1
- package/src/sap/m/table/columnmenu/QuickGroup.js +1 -1
- package/src/sap/m/table/columnmenu/QuickGroupItem.js +1 -1
- package/src/sap/m/table/columnmenu/QuickSort.js +1 -1
- package/src/sap/m/table/columnmenu/QuickSortItem.js +1 -1
- package/src/sap/m/table/columnmenu/QuickTotal.js +1 -1
- package/src/sap/m/table/columnmenu/QuickTotalItem.js +1 -1
- package/src/sap/m/themes/base/ActionTile.less +171 -152
- package/src/sap/m/themes/base/ActionTileContent.less +62 -0
- package/src/sap/m/themes/base/CellSelector.less +77 -5
- package/src/sap/m/themes/base/Dialog.less +0 -4
- package/src/sap/m/themes/base/GenericTile.less +397 -12
- package/src/sap/m/themes/base/HeaderContainer.less +8 -0
- package/src/sap/m/themes/base/IconTabBar.less +18 -0
- package/src/sap/m/themes/base/ObjectNumber.less +7 -1
- package/src/sap/m/themes/base/ObjectStatus.less +5 -0
- package/src/sap/m/themes/base/Title.less +1 -1
- package/src/sap/m/themes/base/Toolbar.less +4 -0
- package/src/sap/m/themes/base/UploadSetwithTable.less +20 -0
- package/src/sap/m/themes/base/VariantManagement.less +3 -0
- package/src/sap/m/themes/base/library.source.less +1 -0
- package/src/sap/m/upload/ActionsPlaceholder.js +12 -2
- package/src/sap/m/upload/Column.js +1 -1
- package/src/sap/m/upload/FilePreviewDialog.js +6 -6
- package/src/sap/m/upload/UploadItem.js +322 -0
- package/src/sap/m/upload/UploadItemConfiguration.js +191 -0
- package/src/sap/m/upload/UploadSet.js +1 -1
- package/src/sap/m/upload/UploadSetItem.js +4 -5
- package/src/sap/m/upload/UploadSetToolbarPlaceholder.js +1 -1
- package/src/sap/m/upload/UploadSetwithTable.js +4 -3
- package/src/sap/m/upload/UploadSetwithTableItem.js +2 -3
- package/src/sap/m/upload/UploaderTableItem.js +19 -12
- package/src/sap/m/upload/p13n/PersManager.js +1 -1
- package/src/sap/m/upload/p13n/mediator/BaseMediator.js +4 -4
- package/src/sap/m/upload/p13n/mediator/ColumnsMediator.js +1 -1
- package/src/sap/m/upload/p13n/mediator/FilterMediator.js +1 -1
- package/src/sap/m/upload/p13n/mediator/GroupMediator.js +1 -1
- package/src/sap/m/upload/p13n/mediator/SortMediator.js +1 -1
- package/src/sap/m/upload/p13n/modules/PersPopupManager.js +3 -3
|
@@ -0,0 +1,2067 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* OpenUI5
|
|
3
|
+
* (c) Copyright 2009-2024 SAP SE or an SAP affiliate company.
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
|
|
5
|
+
*/
|
|
6
|
+
sap.ui.define([
|
|
7
|
+
"./PluginBase",
|
|
8
|
+
"sap/ui/core/Element",
|
|
9
|
+
"sap/base/Log",
|
|
10
|
+
"sap/ui/core/Lib",
|
|
11
|
+
"sap/ui/unified/FileUploader",
|
|
12
|
+
"sap/m/upload/UploaderHttpRequestMethod",
|
|
13
|
+
"sap/m/upload/UploadItem",
|
|
14
|
+
"sap/base/util/deepEqual",
|
|
15
|
+
"sap/m/library",
|
|
16
|
+
"sap/m/IllustratedMessageType",
|
|
17
|
+
"sap/m/IllustratedMessage",
|
|
18
|
+
"sap/m/IllustratedMessageSize",
|
|
19
|
+
"sap/m/upload/UploaderTableItem",
|
|
20
|
+
"sap/ui/core/dnd/DragDropInfo",
|
|
21
|
+
"sap/ui/core/dnd/DropInfo",
|
|
22
|
+
"sap/m/upload/FilePreviewDialog",
|
|
23
|
+
"sap/ui/base/Event",
|
|
24
|
+
"sap/m/Dialog",
|
|
25
|
+
"sap/m/Label",
|
|
26
|
+
"sap/m/Input",
|
|
27
|
+
"sap/m/MessageBox",
|
|
28
|
+
"sap/m/Button",
|
|
29
|
+
"sap/ui/core/Core"
|
|
30
|
+
], function (PluginBase, Element, Log, Library1, FileUploader, UploaderHttpRequestMethod, UploadItem, deepEqual, Library, IllustratedMessageType, IllustratedMessage, IllustratedMessageSize, Uploader, DragDropInfo, DropInfo, FilePreviewDialog, EventBase, Dialog, Label, Input, MessageBox, Button, Core) {
|
|
31
|
+
"use strict";
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Constructor for a new UploadSetwithTable plugin.
|
|
35
|
+
*
|
|
36
|
+
* @param {string} [sId] ID for the new <code>UploadSetwithTable</code>, generated automatically if no id is given
|
|
37
|
+
* @param {object} [mSettings] Initial settings for the new <code>UploadSetwithTable</code>
|
|
38
|
+
*
|
|
39
|
+
* @class
|
|
40
|
+
* The <code>UploadSetwithTable</code> plugin enables uploading within a table when it is added as a dependent to the table control.
|
|
41
|
+
* <br> This plugin provides an Upload button to upload files from the local file system. To do so, the user of the plugin must place {@link sap.m.upload.ActionsPlaceholder Actions Placeholder} control at the desired table area and then associate the actions of the plugin with the placeholder.
|
|
42
|
+
* <br> The plugin provides the ability to upload files from the local system as well as from cloud file picker and includes other notable features such as validation, file preview, download.
|
|
43
|
+
*
|
|
44
|
+
* <br> The following controls support this plugin:
|
|
45
|
+
* <ul>
|
|
46
|
+
* <li>{@link sap.ui.mdc.Table MDC Table}</li>
|
|
47
|
+
* <li>{@link sap.m.Table Responsive Table}</li>
|
|
48
|
+
* <li>{@link sap.m.GridTable Grid Table}</li>
|
|
49
|
+
* </ul>
|
|
50
|
+
*
|
|
51
|
+
* <caption>Consider the following before using the plugin: </caption>
|
|
52
|
+
* <ul>
|
|
53
|
+
* <li>It gets activated when it is added as a dependent to the table control. It gets deactivated when it is removed from the table control or when the table control is destroyed.</li>
|
|
54
|
+
* <li>It fires onActivated and onDeactivated events when it is activated and deactivated, respectively.</li>
|
|
55
|
+
* <li>Configuring the rowConfiguration aggregation (type {@link sap.m.upload.UploadItemConfiguration UploadItemConfiguration}) of this plugin is mandatory to use the features such as file preview, download etc.</li>
|
|
56
|
+
* <li>It works only with the table control when the table is bound to the model to perform the operations such as rename, download etc.</li>
|
|
57
|
+
* </ul>
|
|
58
|
+
*
|
|
59
|
+
* @example <caption>Connecting the plugin to table control</caption>
|
|
60
|
+
* <pre>
|
|
61
|
+
* oTable.addDependent(new UploadSetwithTable({
|
|
62
|
+
* uploadUrl: "uploadUrl",
|
|
63
|
+
* fileTypes: ["jpg", "jpeg", "png"],
|
|
64
|
+
* actions: "uploadButton" // Associating the actions with the ID of the ActionPlaceholder control in the table, where the upload button should be rendered.
|
|
65
|
+
* }));
|
|
66
|
+
*
|
|
67
|
+
* // example of sap.m.upload.ActionsPlaceholder control placed in the table toolbar for rendering the upload button.
|
|
68
|
+
* new ActionPlaceHolder({
|
|
69
|
+
* id: "uploadButton", // ID of the ActionPlaceholder control to be associated with the plugin actions.
|
|
70
|
+
* placeholderFor: UploadSetwithTableActionPlaceHolder.UploadButtonPlaceholder
|
|
71
|
+
* });
|
|
72
|
+
* </pre>
|
|
73
|
+
*
|
|
74
|
+
* @extends sap.ui.core.Element
|
|
75
|
+
* @version 1.124.0
|
|
76
|
+
* @author SAP SE
|
|
77
|
+
* @experimental Since 1.124
|
|
78
|
+
* @public
|
|
79
|
+
* @since 1.124
|
|
80
|
+
* @alias sap.m.plugins.UploadSetwithTable
|
|
81
|
+
* @borrows sap.m.plugins.PluginBase.findOn as findOn
|
|
82
|
+
*/
|
|
83
|
+
var UploadSetwithTable = PluginBase.extend("sap.m.plugins.UploadSetwithTable", /** @lends sap.m.plugins.UploadSetwithTable.prototype */ {
|
|
84
|
+
metadata: {
|
|
85
|
+
library: "sap.m",
|
|
86
|
+
properties: {
|
|
87
|
+
/**
|
|
88
|
+
* File types that are allowed to be uploaded.
|
|
89
|
+
* <br>If this property is not set, any file can be uploaded.
|
|
90
|
+
*/
|
|
91
|
+
fileTypes: {type: "string[]", defaultValue: null},
|
|
92
|
+
/**
|
|
93
|
+
* Defined maximum length for a name of files that are to be uploaded.
|
|
94
|
+
* <br>If set to <code>null</code> or <code>0</code>, any file can be uploaded regardless length of its name.
|
|
95
|
+
*/
|
|
96
|
+
maxFileNameLength: {type: "int", defaultValue: null},
|
|
97
|
+
/**
|
|
98
|
+
* Defined size limit in megabytes for files that are to be uploaded.
|
|
99
|
+
* <br>If set to <code>null</code> or <code>0</code>, files of any size can be uploaded.
|
|
100
|
+
*/
|
|
101
|
+
maxFileSize: {type: "float", defaultValue: null},
|
|
102
|
+
/**
|
|
103
|
+
* Media types of files that are allowed to be uploaded.
|
|
104
|
+
* <br>If this property is not set, any file can be uploaded.
|
|
105
|
+
*/
|
|
106
|
+
mediaTypes: {type: "string[]", defaultValue: null},
|
|
107
|
+
/**
|
|
108
|
+
* Url where the uploaded files are stored.
|
|
109
|
+
*/
|
|
110
|
+
uploadUrl: {type: "string", defaultValue: null},
|
|
111
|
+
/**
|
|
112
|
+
* HTTP request method chosen for file upload.
|
|
113
|
+
*/
|
|
114
|
+
httpRequestMethod: {type: "sap.m.upload.UploaderHttpRequestMethod", defaultValue: UploaderHttpRequestMethod.Post},
|
|
115
|
+
/**
|
|
116
|
+
* Lets the user select multiple files from the same folder and then upload them.
|
|
117
|
+
*
|
|
118
|
+
* If multiple property is set to false, the plugin shows an error message if more than one file is chosen for drag & drop.
|
|
119
|
+
*/
|
|
120
|
+
multiple: {type: "boolean", group: "Behavior", defaultValue: false},
|
|
121
|
+
/**
|
|
122
|
+
* If set to true, the button used for uploading files becomes invisible.
|
|
123
|
+
*/
|
|
124
|
+
uploadButtonInvisible: {type: "boolean", group: "Appearance", defaultValue: false},
|
|
125
|
+
/**
|
|
126
|
+
* Defines whether the upload action is allowed.
|
|
127
|
+
*/
|
|
128
|
+
uploadEnabled: {type: "boolean", defaultValue: true},
|
|
129
|
+
/** Callback function to perform additional validations or configurations for the item queued up for upload and to finally trigger the upload.
|
|
130
|
+
* @callback sap.m.plugins.UploadSetwithTable.itemValidationHandler
|
|
131
|
+
* @param {sap.m.plugins.UploadSetwithTable.ItemInfo} oItemInfo The info of the item queued for upload.
|
|
132
|
+
* @returns {Promise<sap.m.upload.UploadItem>} oPromise, once resolved the UploadSetWithTable plugin initiates the upload.
|
|
133
|
+
* @public
|
|
134
|
+
**/
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* @typedef {object} sap.m.plugins.UploadSetwithTable.ItemInfo
|
|
138
|
+
* @description Item info object sent as paramter to {@link sap.m.plugins.UploadSetwithTable.itemValidationHandler itemValidationHandler callback}
|
|
139
|
+
* @property {sap.m.upload.UploadItem} oItem Current item queued for upload.
|
|
140
|
+
* @property {number} iTotalItemsForUpload Total count of items queued for upload.
|
|
141
|
+
* @property {sap.m.plugins.UploadSetwithTable} oSource Source on which the callback was invoked.
|
|
142
|
+
* @public
|
|
143
|
+
**/
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Defines a {@link sap.m.plugins.UploadSetwithTable.itemValidationHandler callback function} that is invoked when each UploadItem is queued up for upload.
|
|
147
|
+
* This callback is invoked with {@link sap.m.plugins.UploadSetwithTable.ItemInfo parameters} and the callback is expected to return a promise to the plugin. Once the promise is resolved, the plugin initiates the upload process.
|
|
148
|
+
* Configure this property only when any additional configuration or validations are to be performed before the upload of each item.
|
|
149
|
+
* The upload process is triggered manually by resolving the promise returned to the plugin.
|
|
150
|
+
**/
|
|
151
|
+
itemValidationHandler: {type: "function", defaultValue: null},
|
|
152
|
+
/**
|
|
153
|
+
* Lets the user upload entire files from directories and sub directories.
|
|
154
|
+
*/
|
|
155
|
+
directory: {type: "boolean", group: "Behavior", defaultValue: false},
|
|
156
|
+
/**
|
|
157
|
+
* Enables CloudFile picker feature to upload files from cloud.
|
|
158
|
+
* @experimental Since 1.120
|
|
159
|
+
*/
|
|
160
|
+
cloudFilePickerEnabled: { type: "boolean", group: "Behavior", defaultValue: false },
|
|
161
|
+
/**
|
|
162
|
+
* Url of the FileShare OData V4 service supplied for CloudFile picker control.
|
|
163
|
+
* @experimental Since 1.120.
|
|
164
|
+
*/
|
|
165
|
+
cloudFilePickerServiceUrl: { type: "sap.ui.core.URI", group: "Data", defaultValue: "" },
|
|
166
|
+
/**
|
|
167
|
+
* The text of the CloudFile picker button. The default text is "Upload from cloud" (translated to the respective language).
|
|
168
|
+
* @experimental Since 1.120.
|
|
169
|
+
*/
|
|
170
|
+
cloudFilePickerButtonText: { type: 'string', defaultValue: "" }
|
|
171
|
+
},
|
|
172
|
+
aggregations: {
|
|
173
|
+
/**
|
|
174
|
+
* Defines the uploader to be used. If not specified, the default implementation is used.
|
|
175
|
+
*/
|
|
176
|
+
uploader: {type: "sap.m.upload.UploaderTableItem", multiple: false},
|
|
177
|
+
/**
|
|
178
|
+
* Header fields to be included in the header section of an XHR request.
|
|
179
|
+
*/
|
|
180
|
+
headerFields: {type: "sap.ui.core.Item", multiple: true, singularName: "headerField"},
|
|
181
|
+
/**
|
|
182
|
+
* Row configuration information for each uploadItem in the model.
|
|
183
|
+
*/
|
|
184
|
+
rowConfiguration: {type: "sap.m.upload.UploadItemConfiguration", multiple: false},
|
|
185
|
+
/**
|
|
186
|
+
* An illustrated message is displayed when no data is loaded.
|
|
187
|
+
*/
|
|
188
|
+
noDataIllustration: { type: "sap.m.IllustratedMessage", multiple: false }
|
|
189
|
+
},
|
|
190
|
+
defaultAggregation: "rowConfiguration",
|
|
191
|
+
associations: {
|
|
192
|
+
/**
|
|
193
|
+
* Dialog with a carousel to preview files uploaded.
|
|
194
|
+
* <br>If it is not defined, the plugin creates and uses the instance of {@link sap.m.upload.FilePreviewDialog FilePreviewDialog}.
|
|
195
|
+
*/
|
|
196
|
+
previewDialog: {type: "sap.m.upload.FilePreviewDialog", multiple: false},
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* Actions provided by the plugin.
|
|
200
|
+
* <br> {@link sap.m.UploadSetwithTableActionPlaceHolder UploadSetwithTableActionPlaceHolder} enum is used to determine the action control to be rendered.
|
|
201
|
+
* <br> Action buttons are rendered instead of the placeholder.
|
|
202
|
+
* <br> For example, if the "placeholderFor" property is set to UploadButtonPlaceholder, the Upload button is rendered.
|
|
203
|
+
* <br> Note: The action buttons are rendered only when the association to the placeholder control is set.
|
|
204
|
+
*/
|
|
205
|
+
actions: {type: "sap.m.upload.ActionsPlaceholder", multiple: true}
|
|
206
|
+
},
|
|
207
|
+
events: {
|
|
208
|
+
/**
|
|
209
|
+
* The event is triggered when the file name is changed.
|
|
210
|
+
*/
|
|
211
|
+
itemRenamed: {
|
|
212
|
+
parameters: {
|
|
213
|
+
/**
|
|
214
|
+
* The renamed UI element is of UploadItem type.
|
|
215
|
+
*/
|
|
216
|
+
item: {type: "sap.m.upload.UploadItem"}
|
|
217
|
+
}
|
|
218
|
+
},
|
|
219
|
+
/**
|
|
220
|
+
* This event is fired right before the upload process begins.
|
|
221
|
+
*/
|
|
222
|
+
beforeUploadStarts: {
|
|
223
|
+
parameters: {
|
|
224
|
+
/**
|
|
225
|
+
* The file whose upload is just about to start.
|
|
226
|
+
*/
|
|
227
|
+
item: {type: "sap.m.upload.UploadItem"}
|
|
228
|
+
},
|
|
229
|
+
allowPreventDefault: true
|
|
230
|
+
},
|
|
231
|
+
/**
|
|
232
|
+
* This event is fired right after the upload process is finished.
|
|
233
|
+
* <br>Based on the backend response of the application, listeners can use the parameters to determine if the upload was successful or if it failed.
|
|
234
|
+
*/
|
|
235
|
+
uploadCompleted: {
|
|
236
|
+
parameters: {
|
|
237
|
+
/**
|
|
238
|
+
* The file whose upload has just been completed.
|
|
239
|
+
*/
|
|
240
|
+
item: {type: "sap.m.upload.UploadItem"},
|
|
241
|
+
/**
|
|
242
|
+
* Response message that comes from the server.
|
|
243
|
+
*
|
|
244
|
+
* On the server side this response has to be put within the "body" tags of the response
|
|
245
|
+
* document of the iFrame. It can consist of a return code and an optional message. This does not
|
|
246
|
+
* work in cross-domain scenarios.
|
|
247
|
+
*/
|
|
248
|
+
response : {type : "string"},
|
|
249
|
+
/**
|
|
250
|
+
* ReadyState of the XHR request.
|
|
251
|
+
*
|
|
252
|
+
* Required for receiving a <code>readyState</code> is to set the property <code>sendXHR</code>
|
|
253
|
+
* to true. This property is not supported by Internet Explorer 9.
|
|
254
|
+
*/
|
|
255
|
+
readyState : {type : "string"},
|
|
256
|
+
/**
|
|
257
|
+
* Status of the XHR request.
|
|
258
|
+
*
|
|
259
|
+
* Required for receiving a <code>status</code> is to set the property <code>sendXHR</code> to true.
|
|
260
|
+
* This property is not supported by Internet Explorer 9.
|
|
261
|
+
*/
|
|
262
|
+
status : {type : "string"},
|
|
263
|
+
/**
|
|
264
|
+
* Http-Response which comes from the server.
|
|
265
|
+
*
|
|
266
|
+
* Required for receiving <code>responseXML</code> is to set the property <code>sendXHR</code> to true.
|
|
267
|
+
*
|
|
268
|
+
* This property is not supported by Internet Explorer 9.
|
|
269
|
+
*/
|
|
270
|
+
responseXML : {type : "string"},
|
|
271
|
+
/**
|
|
272
|
+
* Http-Response which comes from the server.
|
|
273
|
+
*
|
|
274
|
+
* Required for receiving <code>responseText</code> is to set the property <code>sendXHR</code> to true.
|
|
275
|
+
*
|
|
276
|
+
* This property is not supported by Internet Explorer 9.
|
|
277
|
+
*/
|
|
278
|
+
responseText : {type : "string"},
|
|
279
|
+
/**
|
|
280
|
+
* Http-Response-Headers which come from the server.
|
|
281
|
+
*
|
|
282
|
+
* Provided as a JSON-map, i.e. each header-field is reflected by a property in the <code>headers</code>
|
|
283
|
+
* object, with the property value reflecting the header-field's content.
|
|
284
|
+
*
|
|
285
|
+
* Required for receiving <code>headers</code> is to set the property <code>sendXHR</code> to true.
|
|
286
|
+
* This property is not supported by Internet Explorer 9.
|
|
287
|
+
*/
|
|
288
|
+
headers : {type : "object"}
|
|
289
|
+
}
|
|
290
|
+
},
|
|
291
|
+
/**
|
|
292
|
+
* This event is fired in either of the following cases:
|
|
293
|
+
* <ul>
|
|
294
|
+
* <li>When a file that is selected to be uploaded fails to meet the file type restriction
|
|
295
|
+
* (<code>fileType</code> property).</li>
|
|
296
|
+
* <li>When the file type restriction changes, and the file to be uploaded fails to meet the new
|
|
297
|
+
* restriction.</li>
|
|
298
|
+
* </ul>
|
|
299
|
+
*/
|
|
300
|
+
fileTypeMismatch: {
|
|
301
|
+
parameters: {
|
|
302
|
+
/**
|
|
303
|
+
* The file that fails to meet the file type restriction specified in the
|
|
304
|
+
* <code>fileType</code> property.
|
|
305
|
+
*/
|
|
306
|
+
item: {type: "sap.m.upload.UploadItem"}
|
|
307
|
+
}
|
|
308
|
+
},
|
|
309
|
+
/**
|
|
310
|
+
* This event is fired in either of the following cases:
|
|
311
|
+
* <ul>
|
|
312
|
+
* <li>When a file that is selected to be uploaded fails to meet the file name length restriction specified in the
|
|
313
|
+
* <code>maxFileNameLength</code> property.</li>
|
|
314
|
+
* <li>When the file name length restriction changes, and the file to be uploaded fails to meet the new
|
|
315
|
+
* restriction.</li>
|
|
316
|
+
* </ul>
|
|
317
|
+
*/
|
|
318
|
+
fileNameLengthExceeded: {
|
|
319
|
+
parameters: {
|
|
320
|
+
/**
|
|
321
|
+
* The file that fails to meet the file name length restriction specified in the
|
|
322
|
+
* <code>maxFileNameLength</code> property.
|
|
323
|
+
*/
|
|
324
|
+
item: {type: "sap.m.upload.UploadItem"}
|
|
325
|
+
}
|
|
326
|
+
},
|
|
327
|
+
/**
|
|
328
|
+
* This event is fired in either of the following cases:
|
|
329
|
+
* <ul>
|
|
330
|
+
* <li>When a file that is selected to be uploaded fails to meet the file size restriction specified in the
|
|
331
|
+
* <code>maxFileSize</code> property.</li>
|
|
332
|
+
* <li>When the file size restriction changes, and the file to be uploaded fails to meet the new
|
|
333
|
+
* restriction.</li>
|
|
334
|
+
* </ul>
|
|
335
|
+
*/
|
|
336
|
+
fileSizeExceeded: {
|
|
337
|
+
parameters: {
|
|
338
|
+
/**
|
|
339
|
+
* The file that fails to meet the file size restriction specified in the
|
|
340
|
+
* <code>maxFileSize</code> property.
|
|
341
|
+
*/
|
|
342
|
+
item: {type: "sap.m.upload.UploadItem"}
|
|
343
|
+
}
|
|
344
|
+
},
|
|
345
|
+
/**
|
|
346
|
+
* This event is fired in either of the following cases:
|
|
347
|
+
* <ul>
|
|
348
|
+
* <li>When a file that is selected to be uploaded fails to meet the media type restriction specified in the
|
|
349
|
+
* <code>mediaTypes</code> property.</li>
|
|
350
|
+
* <li>When the media type restriction changes, and the file to be uploaded fails to meet the new
|
|
351
|
+
* restriction.</li>
|
|
352
|
+
* </ul>
|
|
353
|
+
*/
|
|
354
|
+
mediaTypeMismatch: {
|
|
355
|
+
parameters: {
|
|
356
|
+
/**
|
|
357
|
+
* The file that fails to meet the media type restriction specified in the
|
|
358
|
+
* <code>mediaTypes</code> property.
|
|
359
|
+
*/
|
|
360
|
+
item: {type: "sap.m.upload.UploadItem"}
|
|
361
|
+
}
|
|
362
|
+
},
|
|
363
|
+
/**
|
|
364
|
+
* This event is fired just before initiating the file upload process when a file is selected to be uploaded.
|
|
365
|
+
* Use this event to set additional info dynamically, specific for each item before upload process is initiated.
|
|
366
|
+
*/
|
|
367
|
+
beforeInitiatingItemUpload: {
|
|
368
|
+
parameters: {
|
|
369
|
+
/**
|
|
370
|
+
* Items in ready state for upload process
|
|
371
|
+
*/
|
|
372
|
+
item: {type: "sap.m.upload.UploadItem"}
|
|
373
|
+
}
|
|
374
|
+
},
|
|
375
|
+
/**
|
|
376
|
+
* This event is fired when plugin is activated.
|
|
377
|
+
*/
|
|
378
|
+
onActivated: {
|
|
379
|
+
parameters: {
|
|
380
|
+
/**
|
|
381
|
+
* The activated plugin instance.
|
|
382
|
+
*/
|
|
383
|
+
oPlugin: {type: "sap.m.plugins.UploadSetwithTable"}
|
|
384
|
+
}
|
|
385
|
+
},
|
|
386
|
+
/**
|
|
387
|
+
* This event is fired when plugin is deactivated.
|
|
388
|
+
*/
|
|
389
|
+
onDeactivated: {
|
|
390
|
+
parameters: {
|
|
391
|
+
/**
|
|
392
|
+
* Control to which the plugin was connected.
|
|
393
|
+
*/
|
|
394
|
+
control: {type: "sap.ui.core.Control"}
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
});
|
|
400
|
+
|
|
401
|
+
var UploadState = Library.UploadState;
|
|
402
|
+
var UploadSetwithTableActionPlaceHolder = Library.UploadSetwithTableActionPlaceHolder;
|
|
403
|
+
|
|
404
|
+
UploadSetwithTable.findOn = PluginBase.findOn;
|
|
405
|
+
|
|
406
|
+
/**
|
|
407
|
+
* Event Delegate that containts events, that need to be executed after control events.
|
|
408
|
+
*/
|
|
409
|
+
const EventDelegate = {
|
|
410
|
+
onAfterRendering: function() {
|
|
411
|
+
this.getConfig("setIsTableBound", this.getControl());
|
|
412
|
+
this.getConfig("setModelName", this.getControl());
|
|
413
|
+
}
|
|
414
|
+
};
|
|
415
|
+
|
|
416
|
+
UploadSetwithTable.prototype.onActivate = function (oControl) {
|
|
417
|
+
|
|
418
|
+
this._filesTobeUploaded = [];
|
|
419
|
+
this._filePreviewDialogControl = null;
|
|
420
|
+
this._oRb = Library1.getResourceBundleFor("sap.m");
|
|
421
|
+
|
|
422
|
+
oControl.addDelegate(EventDelegate, false, this);
|
|
423
|
+
|
|
424
|
+
this.getConfig("setPluginInstance", this);
|
|
425
|
+
this.getConfig("setControlInstance", this.getControl());
|
|
426
|
+
this.getConfig("setPluginDefaultSettings");
|
|
427
|
+
this._setActions();
|
|
428
|
+
|
|
429
|
+
this.fireOnActivated({oPlugin: this});
|
|
430
|
+
};
|
|
431
|
+
|
|
432
|
+
UploadSetwithTable.prototype.onDeactivate = function (oControl) {
|
|
433
|
+
this.getConfig("cleanupPluginInstanceSettings");
|
|
434
|
+
this.fireOnDeactivated({control: oControl});
|
|
435
|
+
};
|
|
436
|
+
|
|
437
|
+
UploadSetwithTable.prototype.exit = function() {
|
|
438
|
+
this.getConfig("cleanupPluginInstanceSettings");
|
|
439
|
+
PluginBase.prototype.exit.call(this);
|
|
440
|
+
};
|
|
441
|
+
|
|
442
|
+
UploadSetwithTable.prototype.setParent = function() {
|
|
443
|
+
PluginBase.prototype.setParent.apply(this, arguments);
|
|
444
|
+
};
|
|
445
|
+
|
|
446
|
+
// Overriden Setter methods
|
|
447
|
+
|
|
448
|
+
UploadSetwithTable.prototype.setFileTypes = function (aNewTypes) {
|
|
449
|
+
var aTypes = aNewTypes || null;
|
|
450
|
+
if (typeof aTypes === "string") {
|
|
451
|
+
aTypes = aTypes.split(",");
|
|
452
|
+
}
|
|
453
|
+
aTypes = (aTypes || []).map(function (s) {
|
|
454
|
+
return s ? s.toLowerCase() : "";
|
|
455
|
+
});
|
|
456
|
+
if (!deepEqual(this.getFileTypes(), aTypes)) {
|
|
457
|
+
this.setProperty("fileTypes", aTypes, true);
|
|
458
|
+
this.getDefaultFileUploader().setFileType(aTypes);
|
|
459
|
+
}
|
|
460
|
+
return this;
|
|
461
|
+
};
|
|
462
|
+
|
|
463
|
+
UploadSetwithTable.prototype.setMaxFileNameLength = function (iNewMax) {
|
|
464
|
+
if (this.getMaxFileNameLength() !== iNewMax) {
|
|
465
|
+
this.setProperty("maxFileNameLength", iNewMax, true);
|
|
466
|
+
this.getDefaultFileUploader().setMaximumFilenameLength(iNewMax);
|
|
467
|
+
}
|
|
468
|
+
return this;
|
|
469
|
+
};
|
|
470
|
+
|
|
471
|
+
UploadSetwithTable.prototype.setMaxFileSize = function (iNewMax) {
|
|
472
|
+
if (this.getMaxFileSize() !== iNewMax) {
|
|
473
|
+
this.setProperty("maxFileSize", iNewMax, true);
|
|
474
|
+
this.getDefaultFileUploader().setMaximumFileSize(iNewMax);
|
|
475
|
+
}
|
|
476
|
+
return this;
|
|
477
|
+
};
|
|
478
|
+
|
|
479
|
+
UploadSetwithTable.prototype.setMediaTypes = function (aNewTypes) {
|
|
480
|
+
var aTypes = aNewTypes || null;
|
|
481
|
+
if (typeof aTypes === "string") {
|
|
482
|
+
aTypes = aTypes.split(",");
|
|
483
|
+
}
|
|
484
|
+
aTypes = (aTypes || []).map(function (s) {
|
|
485
|
+
return s ? s.toLowerCase() : "";
|
|
486
|
+
});
|
|
487
|
+
if (!deepEqual(this.getMediaTypes(), aTypes)) {
|
|
488
|
+
this.setProperty("mediaTypes", aTypes, true);
|
|
489
|
+
this.getDefaultFileUploader().setMimeType(aTypes);
|
|
490
|
+
}
|
|
491
|
+
return this;
|
|
492
|
+
};
|
|
493
|
+
|
|
494
|
+
UploadSetwithTable.prototype.setUploadButtonInvisible = function (bUploadButtonInvisible) {
|
|
495
|
+
if (bUploadButtonInvisible !== this.getUploadButtonInvisible()) {
|
|
496
|
+
var bVisible = !bUploadButtonInvisible;
|
|
497
|
+
this.getDefaultFileUploader().setVisible(bVisible);
|
|
498
|
+
this.setProperty("uploadButtonInvisible", bUploadButtonInvisible, true);
|
|
499
|
+
}
|
|
500
|
+
return this;
|
|
501
|
+
};
|
|
502
|
+
|
|
503
|
+
UploadSetwithTable.prototype.setMultiple = function (bMultiple) {
|
|
504
|
+
if (this.getMultiple() !== bMultiple) {
|
|
505
|
+
this.setProperty("multiple", bMultiple);
|
|
506
|
+
this.getDefaultFileUploader().setMultiple(bMultiple);
|
|
507
|
+
}
|
|
508
|
+
return this;
|
|
509
|
+
};
|
|
510
|
+
|
|
511
|
+
UploadSetwithTable.prototype.setUploadEnabled = function (bEnable) {
|
|
512
|
+
if (bEnable !== this.getUploadEnabled()) {
|
|
513
|
+
this.getDefaultFileUploader().setEnabled(bEnable);
|
|
514
|
+
this.setProperty("uploadEnabled", bEnable, false);
|
|
515
|
+
}
|
|
516
|
+
return this;
|
|
517
|
+
};
|
|
518
|
+
|
|
519
|
+
UploadSetwithTable.prototype.setDirectory = function (bDirectory) {
|
|
520
|
+
if (this.getDirectory() !== bDirectory) {
|
|
521
|
+
this.setProperty("directory", bDirectory);
|
|
522
|
+
this.getDefaultFileUploader().setDirectory(bDirectory);
|
|
523
|
+
if (bDirectory) {
|
|
524
|
+
this.setProperty("multiple", false); // disable multiple files selection when directory selection is enabled.
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
return this;
|
|
528
|
+
};
|
|
529
|
+
|
|
530
|
+
UploadSetwithTable.prototype.setNoDataIllustration = function(oNoDatIllustration) {
|
|
531
|
+
this._vNoDataIllustration = oNoDatIllustration;
|
|
532
|
+
this.getConfig("setDefaultIllustrations");
|
|
533
|
+
return this;
|
|
534
|
+
};
|
|
535
|
+
|
|
536
|
+
UploadSetwithTable.prototype.getNoDataIllustration = function() {
|
|
537
|
+
return this._vNoDataIllustration;
|
|
538
|
+
};
|
|
539
|
+
|
|
540
|
+
// Public API's
|
|
541
|
+
|
|
542
|
+
/**
|
|
543
|
+
* Returns an instance of the default <code>sap.ui.unified.FileUploader</code> icon/button, used for adding files
|
|
544
|
+
* from the open file dialog of the operating system. It can be customized, for example made invisible or assigned a different icon.
|
|
545
|
+
* @return {sap.ui.unified.FileUploader} Instance of the default <code>sap.ui.unified.FileUploader</code>.
|
|
546
|
+
* @public
|
|
547
|
+
*/
|
|
548
|
+
UploadSetwithTable.prototype.getDefaultFileUploader = function () {
|
|
549
|
+
var sTooltip = "Upload";
|
|
550
|
+
if (!this._oFileUploader) {
|
|
551
|
+
this._oFileUploader = new FileUploader(this.getId() + "-uploader", {
|
|
552
|
+
buttonOnly: true,
|
|
553
|
+
buttonText: sTooltip,
|
|
554
|
+
tooltip: sTooltip,
|
|
555
|
+
iconOnly: false,
|
|
556
|
+
enabled: this.getUploadEnabled(),
|
|
557
|
+
icon: "",
|
|
558
|
+
iconFirst: false,
|
|
559
|
+
style: "Transparent",
|
|
560
|
+
name: "UploadSetwithTableFileUploader",
|
|
561
|
+
sameFilenameAllowed: true,
|
|
562
|
+
fileType: this.getFileTypes(),
|
|
563
|
+
mimeType: this.getMediaTypes(),
|
|
564
|
+
maximumFilenameLength: this.getMaxFileNameLength(),
|
|
565
|
+
maximumFileSize: this.getMaxFileSize(),
|
|
566
|
+
multiple: this.getDirectory() ? false : this.getMultiple(),
|
|
567
|
+
useMultipart: false,
|
|
568
|
+
sendXHR: true,
|
|
569
|
+
change: [this._onFileUploaderChange, this],
|
|
570
|
+
typeMissmatch: [this._fireFileTypeMismatch, this],
|
|
571
|
+
fileSizeExceed: [this._fireFileSizeExceed, this],
|
|
572
|
+
filenameLengthExceed: [this._fireFilenameLengthExceed, this],
|
|
573
|
+
visible: !this.getUploadButtonInvisible(),
|
|
574
|
+
directory: this.getDirectory()
|
|
575
|
+
});
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
return this._oFileUploader;
|
|
579
|
+
};
|
|
580
|
+
|
|
581
|
+
/**
|
|
582
|
+
* Returns sap icon based on the passed mediaType and filename
|
|
583
|
+
* @param {string} mediaType The media type of the selected file
|
|
584
|
+
* @param {string} fileName The name of the selected file
|
|
585
|
+
* @public
|
|
586
|
+
* @returns {string} sap icon.
|
|
587
|
+
*/
|
|
588
|
+
UploadSetwithTable.getIconForFileType = function (mediaType, fileName) {
|
|
589
|
+
return UploadItem._getIconByMimeType(mediaType, fileName);
|
|
590
|
+
};
|
|
591
|
+
|
|
592
|
+
/**
|
|
593
|
+
* Attaches all necessary handlers to the given uploader instance, so that the progress and status of the upload can be
|
|
594
|
+
* displayed and monitored.
|
|
595
|
+
* This is necessary in case when custom uploader is used.
|
|
596
|
+
* @param {sap.m.upload.UploaderTableItem} oUploader Instance of <code>sap.m.upload.UploaderTableItem</code> to which the default request handlers are attached.
|
|
597
|
+
* @public
|
|
598
|
+
*/
|
|
599
|
+
UploadSetwithTable.prototype.registerUploaderEvents = function (oUploader) {
|
|
600
|
+
oUploader.attachUploadStarted(this._onUploadStarted.bind(this));
|
|
601
|
+
oUploader.attachUploadCompleted(this._onUploadCompleted.bind(this));
|
|
602
|
+
};
|
|
603
|
+
|
|
604
|
+
/**
|
|
605
|
+
* Invokes native files selection handler.
|
|
606
|
+
* @public
|
|
607
|
+
*/
|
|
608
|
+
UploadSetwithTable.prototype.fileSelectionHandler = function() {
|
|
609
|
+
var oUploaderInstance = this.getDefaultFileUploader();
|
|
610
|
+
if (oUploaderInstance && oUploaderInstance.oFileUpload && oUploaderInstance.oFileUpload.click) {
|
|
611
|
+
oUploaderInstance.oFileUpload.click();
|
|
612
|
+
}
|
|
613
|
+
};
|
|
614
|
+
|
|
615
|
+
/**
|
|
616
|
+
* API to determine the unit for file size in KB/MB/GB.
|
|
617
|
+
* API recommended for file size formatting purpose.
|
|
618
|
+
* @param {int} iFileSize fileSize to determine units
|
|
619
|
+
* @public
|
|
620
|
+
* @returns {string} sFileSizeWithUnit file size in KB/MB/GB default unit is KB
|
|
621
|
+
*/
|
|
622
|
+
UploadSetwithTable.getFileSizeWithUnits = function(iFileSize) {
|
|
623
|
+
var iKilobyte = 1024;
|
|
624
|
+
var iMegabyte = iKilobyte * 1024;
|
|
625
|
+
var iGigabyte = iMegabyte * 1024;
|
|
626
|
+
if (typeof iFileSize === "number") {
|
|
627
|
+
if (iFileSize < iMegabyte) {
|
|
628
|
+
return (iFileSize / iKilobyte).toFixed(2) + " KB";
|
|
629
|
+
} else if (iFileSize < iGigabyte) {
|
|
630
|
+
return (iFileSize / iMegabyte).toFixed(2) + " MB";
|
|
631
|
+
} else {
|
|
632
|
+
return (iFileSize / iGigabyte).toFixed(2) + " GB";
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
return iFileSize;
|
|
636
|
+
};
|
|
637
|
+
|
|
638
|
+
/**
|
|
639
|
+
* API to upload file using URL
|
|
640
|
+
* @param {string} sName file name to be set for the file that is to be uploaded.
|
|
641
|
+
* @param {string} sUrl Url for the file.
|
|
642
|
+
* @param {Promise} oPromise Promise when resolved, the control initiates the upload process.
|
|
643
|
+
* @returns {sap.m.upload.UploadItem} oItem, UploadItem instance created with the file object.
|
|
644
|
+
* @public
|
|
645
|
+
*/
|
|
646
|
+
UploadSetwithTable.prototype.uploadItemViaUrl = function (sName, sUrl, oPromise) {
|
|
647
|
+
var oFileObject = new File([new Blob([])], sName);
|
|
648
|
+
|
|
649
|
+
var oItem = new UploadItem({
|
|
650
|
+
uploadState: UploadState.Ready
|
|
651
|
+
});
|
|
652
|
+
oItem._setFileObject(oFileObject);
|
|
653
|
+
oItem.setFileName(oFileObject.name);
|
|
654
|
+
oItem.setUrl(sUrl);
|
|
655
|
+
|
|
656
|
+
oPromise
|
|
657
|
+
.then(() => this._initateItemUpload(oItem).bind(this))
|
|
658
|
+
.catch(() => oItem.destroy()); // cancelling the upload.
|
|
659
|
+
|
|
660
|
+
return oItem;
|
|
661
|
+
};
|
|
662
|
+
|
|
663
|
+
/**
|
|
664
|
+
* API to upload Item without file
|
|
665
|
+
* @param {Promise} oPromise Promise when resolved, control initiates the upload process.
|
|
666
|
+
* @return {sap.m.upload.UploadItem} oItem, UploadItem instance created with the file object.
|
|
667
|
+
* @public
|
|
668
|
+
*/
|
|
669
|
+
UploadSetwithTable.prototype.uploadItemWithoutFile = function (oPromise) {
|
|
670
|
+
var oFileObject = new File([new Blob([])], '-');
|
|
671
|
+
var oItem = new UploadItem({
|
|
672
|
+
uploadState: UploadState.Ready
|
|
673
|
+
});
|
|
674
|
+
oItem._setFileObject(oFileObject);
|
|
675
|
+
oItem.setFileName(oFileObject.name);
|
|
676
|
+
|
|
677
|
+
oPromise
|
|
678
|
+
.then(() => this._initateItemUpload(oItem))
|
|
679
|
+
.catch(() => oItem.destroy()); // cancelling the upload.
|
|
680
|
+
|
|
681
|
+
return oItem;
|
|
682
|
+
};
|
|
683
|
+
|
|
684
|
+
/**
|
|
685
|
+
* Previews file.
|
|
686
|
+
* @param {sap.ui.model.Context} oBindingContext Context of the row containing the file to be previewed.
|
|
687
|
+
* @public
|
|
688
|
+
*/
|
|
689
|
+
UploadSetwithTable.prototype.openFilePreview = function (oBindingContext) {
|
|
690
|
+
const oRowConfiguration = this.getRowConfiguration();
|
|
691
|
+
if (!oRowConfiguration) {
|
|
692
|
+
Log.error("Row configuration is not set for the plugin. File preview is not possible.");
|
|
693
|
+
return;
|
|
694
|
+
}
|
|
695
|
+
this.getConfig("openFilePreview", oBindingContext);
|
|
696
|
+
};
|
|
697
|
+
|
|
698
|
+
/**
|
|
699
|
+
* Downloads the file. Only possible when the context passed has a valid URL specified.
|
|
700
|
+
* @param {sap.ui.model.Context} oBindingContext Context of the item to be downloaded.
|
|
701
|
+
* @param {boolean} bAskForLocation Whether to ask for a location where to download the file or not.
|
|
702
|
+
* @public
|
|
703
|
+
*/
|
|
704
|
+
UploadSetwithTable.prototype.download = function (oBindingContext, bAskForLocation) {
|
|
705
|
+
const oRowConfiguration = this.getRowConfiguration();
|
|
706
|
+
if (!oRowConfiguration) {
|
|
707
|
+
Log.error("Row configuration is not set for the plugin. Download is not possible.");
|
|
708
|
+
return;
|
|
709
|
+
}
|
|
710
|
+
this.getConfig("download", {
|
|
711
|
+
oBindingContext: oBindingContext,
|
|
712
|
+
bAskForLocation: bAskForLocation
|
|
713
|
+
});
|
|
714
|
+
};
|
|
715
|
+
|
|
716
|
+
/**
|
|
717
|
+
* API to rename the document of an item.
|
|
718
|
+
* @param {sap.ui.model.Context} oBindingContext Context of the item to be renamed.
|
|
719
|
+
* @public
|
|
720
|
+
*/
|
|
721
|
+
UploadSetwithTable.prototype.renameItem = function (oBindingContext) {
|
|
722
|
+
const oRowConfiguration = this.getRowConfiguration();
|
|
723
|
+
if (!oRowConfiguration) {
|
|
724
|
+
Log.error("Row configuration is not set for the plugin. Rename action is not possible.");
|
|
725
|
+
return;
|
|
726
|
+
}
|
|
727
|
+
if (oBindingContext) {
|
|
728
|
+
const oItem = this.getConfig("getItemForContext", oBindingContext);
|
|
729
|
+
const oDialog = this._getFileRenameDialog(oItem);
|
|
730
|
+
oDialog.open();
|
|
731
|
+
}
|
|
732
|
+
};
|
|
733
|
+
|
|
734
|
+
// Private API's
|
|
735
|
+
|
|
736
|
+
/**
|
|
737
|
+
* Internal API return the dialog for document rename.
|
|
738
|
+
* @param {sap.m.upload.UploadItem} oItem item to be renamed.
|
|
739
|
+
* @private
|
|
740
|
+
* @returns {sap.m.Dialog} oDialog, created dialog instance
|
|
741
|
+
*/
|
|
742
|
+
UploadSetwithTable.prototype._getFileRenameDialog = function(oItem) {
|
|
743
|
+
const oSplit = UploadItem._splitFileName(oItem.getFileName());
|
|
744
|
+
let iMaxLength = this.getMaxFileNameLength();
|
|
745
|
+
const iFileExtensionLength = oSplit.extension ? oSplit.extension.length + 1 : 0;
|
|
746
|
+
iMaxLength = iMaxLength ? iMaxLength : 0;
|
|
747
|
+
let iNameMaxLength = iMaxLength - iFileExtensionLength;
|
|
748
|
+
iNameMaxLength = iNameMaxLength < 0 ? 0 : iNameMaxLength;
|
|
749
|
+
|
|
750
|
+
// Input field
|
|
751
|
+
const oInput = new Input({
|
|
752
|
+
type: Library.InputType.Text,
|
|
753
|
+
value: oSplit.name,
|
|
754
|
+
width: "90%",
|
|
755
|
+
maxLength: iNameMaxLength,
|
|
756
|
+
liveChange: [this._handleItemNameValidation, this]
|
|
757
|
+
});
|
|
758
|
+
oInput.addStyleClass("sapUiTinyMarginTop");
|
|
759
|
+
oInput.addStyleClass("sapUiSmallMarginBegin");
|
|
760
|
+
// Label for Input
|
|
761
|
+
const oLabel = new Label({
|
|
762
|
+
text: this._oRb.getText("UPLOADSET_WITH_TABLE_DOCUMENT_RENAME_INPUT_LABEL"),
|
|
763
|
+
labelFor: oInput.getId()
|
|
764
|
+
});
|
|
765
|
+
oLabel.addStyleClass("sapUiSmallMarginTop");
|
|
766
|
+
oLabel.addStyleClass("sapUiSmallMarginBegin");
|
|
767
|
+
oLabel.addStyleClass("sapUiSmallMarginEnd");
|
|
768
|
+
// Dialog creation
|
|
769
|
+
var oDialog = new Dialog({
|
|
770
|
+
title: this._oRb.getText("UPLOADSET_WITH_TABLE_DOCUMENT_RENAME_DIALOG_TEXT"),
|
|
771
|
+
contentWidth: "22.5rem",
|
|
772
|
+
contentHeight: "12rem",
|
|
773
|
+
content: [oLabel,oInput],
|
|
774
|
+
beginButton: new Button({
|
|
775
|
+
type: Library.ButtonType.Emphasized,
|
|
776
|
+
text: this._oRb.getText("UPLOADSET_WITH_TABLE_DOCUMENT_RENAME_APPLY_BUTTON_TEXT"),
|
|
777
|
+
press: this._handleItemRenameConfirmation.bind(this),
|
|
778
|
+
enabled: oInput.getValueState() !== "Error"
|
|
779
|
+
}),
|
|
780
|
+
endButton: new Button({
|
|
781
|
+
text: this._oRb.getText("UPLOADSET_WITH_TABLE_CANCELBUTTON_TEXT"),
|
|
782
|
+
press: this._handleItemRenameCancel.bind(this)
|
|
783
|
+
}),
|
|
784
|
+
customData: {
|
|
785
|
+
key: "item",
|
|
786
|
+
value: oItem
|
|
787
|
+
},
|
|
788
|
+
afterClose: function () {
|
|
789
|
+
oDialog.destroy();
|
|
790
|
+
}
|
|
791
|
+
});
|
|
792
|
+
|
|
793
|
+
return oDialog;
|
|
794
|
+
};
|
|
795
|
+
|
|
796
|
+
/**
|
|
797
|
+
* Handler for item rename cancel operation.
|
|
798
|
+
* @param {object} oEvent cancel button click event.
|
|
799
|
+
* @private
|
|
800
|
+
*/
|
|
801
|
+
UploadSetwithTable.prototype._handleItemRenameCancel = function(oEvent) {
|
|
802
|
+
const oDialog = oEvent.getSource().getParent();
|
|
803
|
+
const oInput = oDialog.getContent()[1];
|
|
804
|
+
const oItem = oDialog && oDialog.data ? oDialog.data().item : null;
|
|
805
|
+
const oSplit = UploadItem._splitFileName(oItem.getFileName());
|
|
806
|
+
// Check if there are changes made to the existing file name.
|
|
807
|
+
if (oItem && oInput && oSplit.name !== oInput.getValue()) {
|
|
808
|
+
MessageBox.warning(this._oRb.getText("UPLOADSET_WITH_TABLE_DOCUMENT_RENAME_DISCARD_POPUP_CHANGES_TEXT"), {
|
|
809
|
+
actions: [this._oRb.getText("UPLOADSET_WITH_TABLE_DOCUMENT_RENAME_SAVE_BUTTON_TEXT"), this._oRb.getText("UPLOADSET_WITH_TABLE_DOCUMENT_RENAME_DISCARD_CHANGES_BUTTON_TEXT")],
|
|
810
|
+
emphasizedAction: this._oRb.getText("UPLOADSET_WITH_TABLE_DOCUMENT_RENAME_SAVE_BUTTON_TEXT"),
|
|
811
|
+
onClose: (sAction) => {
|
|
812
|
+
if (sAction !== this._oRb.getText("UPLOADSET_WITH_TABLE_DOCUMENT_RENAME_SAVE_BUTTON_TEXT")) {
|
|
813
|
+
oDialog.close();
|
|
814
|
+
} else {
|
|
815
|
+
// fire beginbutton event to save the filename
|
|
816
|
+
var oBeginButton = oDialog.getBeginButton();
|
|
817
|
+
var oEvent = new EventBase("click", oBeginButton);
|
|
818
|
+
oBeginButton.firePress(oEvent);
|
|
819
|
+
}
|
|
820
|
+
}
|
|
821
|
+
});
|
|
822
|
+
} else {
|
|
823
|
+
oDialog.close();
|
|
824
|
+
}
|
|
825
|
+
};
|
|
826
|
+
|
|
827
|
+
/**
|
|
828
|
+
* Handler for item rename confirm operation.
|
|
829
|
+
* @param {object} oEvent confirm button click event.
|
|
830
|
+
* @private
|
|
831
|
+
*/
|
|
832
|
+
UploadSetwithTable.prototype._handleItemRenameConfirmation = function(oEvent) {
|
|
833
|
+
const oDialog = oEvent.getSource().getParent();
|
|
834
|
+
const oInput = oDialog.getContent()[1];
|
|
835
|
+
if (oInput && oInput.getValueState() === "Error") {
|
|
836
|
+
oInput.focus(oInput);
|
|
837
|
+
oInput.setShowValueStateMessage(true);
|
|
838
|
+
return;
|
|
839
|
+
}
|
|
840
|
+
const oItem = oDialog && oDialog.data ? oDialog.data().item : null;
|
|
841
|
+
const oSplit = UploadItem._splitFileName(oItem.getFileName());
|
|
842
|
+
// update only if there is change
|
|
843
|
+
if (oItem && oSplit.name !== oInput.getValue()) {
|
|
844
|
+
// const oContext = oItem.data("context");
|
|
845
|
+
if (oSplit && oSplit.extension) {
|
|
846
|
+
oItem.setFileName(oInput.getValue() + "." + oSplit.extension);
|
|
847
|
+
} else {
|
|
848
|
+
oItem.setFileName(oInput.getValue());
|
|
849
|
+
}
|
|
850
|
+
oDialog.close();
|
|
851
|
+
this.fireItemRenamed({item: oItem});
|
|
852
|
+
} else {
|
|
853
|
+
oDialog.close();
|
|
854
|
+
}
|
|
855
|
+
};
|
|
856
|
+
|
|
857
|
+
/**
|
|
858
|
+
* Handler for file name validation.
|
|
859
|
+
* @param {object} oEvent Input keyevent.
|
|
860
|
+
* @private
|
|
861
|
+
*/
|
|
862
|
+
UploadSetwithTable.prototype._handleItemNameValidation = function(oEvent) {
|
|
863
|
+
const oInput = oEvent.getSource();
|
|
864
|
+
let sValue = oInput.getValue();
|
|
865
|
+
sValue = sValue.trim();
|
|
866
|
+
|
|
867
|
+
// empty file validation
|
|
868
|
+
if (sValue === "") {
|
|
869
|
+
oInput.setProperty("valueState", "Error", true);
|
|
870
|
+
oInput.setValueStateText(this._oRb.getText("UPLOADSET_WITH_TABLE_DOCUMENT_RENAME_EMPTY_NAME_VALIDATION_ERROR_MESSAGE"));
|
|
871
|
+
oInput.setShowValueStateMessage(true);
|
|
872
|
+
return;
|
|
873
|
+
}
|
|
874
|
+
|
|
875
|
+
const oCharacterRegex = new RegExp(/[@#$]/);
|
|
876
|
+
if (oCharacterRegex.test(sValue)) {
|
|
877
|
+
oInput.setShowValueStateMessage(true);
|
|
878
|
+
oInput.setProperty("valueState", "Error", true);
|
|
879
|
+
oInput.setValueStateText(this._oRb.getText("UPLOADSET_WITH_TABLE_DOCUMENT_RENAME_SPLC_VALIDATION_ERROR_MESSAGE", '@#$'));
|
|
880
|
+
} else {
|
|
881
|
+
oInput.setShowValueStateMessage(false);
|
|
882
|
+
oInput.setProperty("valueState", "None", true);
|
|
883
|
+
}
|
|
884
|
+
};
|
|
885
|
+
|
|
886
|
+
UploadSetwithTable.prototype._onFileUploaderChange = function (oEvent) {
|
|
887
|
+
var oFiles = oEvent.getParameter("files");
|
|
888
|
+
|
|
889
|
+
if (oFiles && oFiles.length) {
|
|
890
|
+
// var aSelectedItems = this.getConfig("getSelectedItems", oControl);
|
|
891
|
+
// var oSelectedItem = aSelectedItems && aSelectedItems.length == 1 ? aSelectedItems[0] : null;
|
|
892
|
+
// var bEmptyFileSelected = oSelectedItem ? oSelectedItem && oSelectedItem.getFileName && oSelectedItem.getFileName() === "-" : false;
|
|
893
|
+
|
|
894
|
+
// // update existing file after upload
|
|
895
|
+
// if (bEmptyFileSelected) {
|
|
896
|
+
// this._oItemToUpdate = oFiles[0];
|
|
897
|
+
// }
|
|
898
|
+
this._processSelectedFileObjects(oFiles);
|
|
899
|
+
}
|
|
900
|
+
};
|
|
901
|
+
|
|
902
|
+
UploadSetwithTable.prototype._processSelectedFileObjects = function (oFiles) {
|
|
903
|
+
var aFiles = [];
|
|
904
|
+
|
|
905
|
+
// Need to explicitly copy the file list, FileUploader deliberately resets its form completely
|
|
906
|
+
// along with 'files' parameter when it (mistakenly) thinks that all is done.
|
|
907
|
+
for (var i = 0; i < oFiles.length; i++) {
|
|
908
|
+
aFiles.push(oFiles[i]);
|
|
909
|
+
}
|
|
910
|
+
|
|
911
|
+
aFiles.forEach((oFile) => {
|
|
912
|
+
var oItem = new UploadItem({
|
|
913
|
+
uploadState: UploadState.Ready
|
|
914
|
+
});
|
|
915
|
+
oItem.setParent(this); // setting the parent as UploadSetwithTable for file validations
|
|
916
|
+
oItem._setFileObject(oFile);
|
|
917
|
+
oItem.setFileName(oFile.name);
|
|
918
|
+
|
|
919
|
+
|
|
920
|
+
if (this.getItemValidationHandler() && typeof this.getItemValidationHandler() === "function" ) {
|
|
921
|
+
|
|
922
|
+
const oItemInfo = {
|
|
923
|
+
oItem: oItem,
|
|
924
|
+
iTotalItemsForUpload: aFiles.length,
|
|
925
|
+
oSource: this
|
|
926
|
+
};
|
|
927
|
+
|
|
928
|
+
var oPromise = this.getItemValidationHandler()(oItemInfo);
|
|
929
|
+
if (oPromise && oPromise instanceof Promise) {
|
|
930
|
+
oPromise
|
|
931
|
+
.then((item) => {
|
|
932
|
+
if (item instanceof UploadItem) {
|
|
933
|
+
this._initateItemUpload(item);
|
|
934
|
+
}
|
|
935
|
+
})
|
|
936
|
+
.catch((item) => {
|
|
937
|
+
// Reset variable to avoid update if upload rejected.
|
|
938
|
+
if (item && this._oItemToUpdate && item instanceof UploadItem && item.getId() === this._oItemToUpdate.getId()) {
|
|
939
|
+
this._oItemToUpdate = null;
|
|
940
|
+
}
|
|
941
|
+
});
|
|
942
|
+
} else {
|
|
943
|
+
oItem.destroy();
|
|
944
|
+
// if promise is not returned to the ItemValidation hook log error and destroy the item
|
|
945
|
+
Log.error("Invalid usage, missing Promise: ItemValidationHandler callback expects Promise to be returned.");
|
|
946
|
+
}
|
|
947
|
+
} else {
|
|
948
|
+
/* if no validation handler is provided control continues with normal upload else waits for the application to manually
|
|
949
|
+
trigger the upload by resolving the promise */
|
|
950
|
+
this._initateItemUpload(oItem);
|
|
951
|
+
}
|
|
952
|
+
});
|
|
953
|
+
};
|
|
954
|
+
|
|
955
|
+
UploadSetwithTable.prototype._fireFileTypeMismatch = function (oItem) {
|
|
956
|
+
var aMediaTypes = this.getMediaTypes();
|
|
957
|
+
var aFileTypes = this.getFileTypes();
|
|
958
|
+
|
|
959
|
+
var sFileType = oItem.getParameter("fileType");
|
|
960
|
+
var sMediaType = oItem.getParameter("mimeType");
|
|
961
|
+
|
|
962
|
+
var bMediaRestricted = (!!aMediaTypes && (aMediaTypes.length > 0) && !!sMediaType && aMediaTypes.indexOf(sMediaType) === -1);
|
|
963
|
+
var bFileRestricted = (!!aFileTypes && (aFileTypes.length > 0) && !!sFileType && aFileTypes.indexOf(sFileType) === -1);
|
|
964
|
+
|
|
965
|
+
var parts = [new Blob([])];
|
|
966
|
+
|
|
967
|
+
var oFileMetaData = {
|
|
968
|
+
type: oItem.getParameter('fileType'),
|
|
969
|
+
webkitRelativePath: '',
|
|
970
|
+
name: oItem.getParameter('fileName')
|
|
971
|
+
};
|
|
972
|
+
var oFileObject = new File(parts, oItem.getParameter('fileName'), oFileMetaData);
|
|
973
|
+
var oMismatchItem = new UploadItem();
|
|
974
|
+
oMismatchItem._setFileObject(oFileObject);
|
|
975
|
+
oMismatchItem.setFileName(oFileObject.name);
|
|
976
|
+
|
|
977
|
+
if (bMediaRestricted){
|
|
978
|
+
this.fireMediaTypeMismatch({item: oMismatchItem});
|
|
979
|
+
} else if (bFileRestricted){
|
|
980
|
+
this.fireFileTypeMismatch({item: oMismatchItem});
|
|
981
|
+
}
|
|
982
|
+
};
|
|
983
|
+
|
|
984
|
+
UploadSetwithTable.prototype._fireFilenameLengthExceed = function (oItem) {
|
|
985
|
+
var oTargetItem = new UploadItem();
|
|
986
|
+
oTargetItem.setFileName(oItem.getParameter('fileName'));
|
|
987
|
+
this.fireFileNameLengthExceeded({item: oTargetItem});
|
|
988
|
+
};
|
|
989
|
+
|
|
990
|
+
UploadSetwithTable.prototype._fireFileSizeExceed = function (oItem) {
|
|
991
|
+
var oTargetItem = new UploadItem();
|
|
992
|
+
oTargetItem.setFileName(oItem.getParameter('fileName'));
|
|
993
|
+
this.fireFileSizeExceeded({item: oTargetItem});
|
|
994
|
+
};
|
|
995
|
+
|
|
996
|
+
UploadSetwithTable.prototype._onUploadStarted = function (oEvent) {
|
|
997
|
+
var oItem = oEvent.getParameter("item");
|
|
998
|
+
oItem.setUploadState(UploadState.Uploading);
|
|
999
|
+
};
|
|
1000
|
+
|
|
1001
|
+
UploadSetwithTable.prototype._onUploadCompleted = function (oEvent) {
|
|
1002
|
+
var oItem = oEvent.getParameter("item"),
|
|
1003
|
+
oResponseXHRParams = oEvent.getParameter("responseXHR"),
|
|
1004
|
+
sResponse = null;
|
|
1005
|
+
|
|
1006
|
+
if (oResponseXHRParams.responseXML) {
|
|
1007
|
+
sResponse = oResponseXHRParams.responseXML.documentElement.textContent;
|
|
1008
|
+
}
|
|
1009
|
+
var oXhrParams = {
|
|
1010
|
+
"item": oItem,
|
|
1011
|
+
"response": oResponseXHRParams.response,
|
|
1012
|
+
"responseXML": sResponse,
|
|
1013
|
+
"responseText": oResponseXHRParams.responseText,
|
|
1014
|
+
"readyState": oResponseXHRParams.readyState,
|
|
1015
|
+
"status": oResponseXHRParams.status,
|
|
1016
|
+
"headers": oResponseXHRParams.headers
|
|
1017
|
+
};
|
|
1018
|
+
if (this._oItemToUpdate) {
|
|
1019
|
+
this._oItemToUpdate.setFileName(oItem.getFileName());
|
|
1020
|
+
this._oItemToUpdate._setFileObject(oItem.getFileObject());
|
|
1021
|
+
this._oItemToUpdate = null;
|
|
1022
|
+
}
|
|
1023
|
+
oItem.setUploadState(UploadState.Complete);
|
|
1024
|
+
this.fireUploadCompleted(oXhrParams);
|
|
1025
|
+
};
|
|
1026
|
+
|
|
1027
|
+
UploadSetwithTable.prototype._uploadItemIfGoodToGo = function (oItem) {
|
|
1028
|
+
if (oItem.getUploadState() === UploadState.Ready && !oItem._isRestricted()) {
|
|
1029
|
+
if (this.fireBeforeUploadStarts({item: oItem})) {
|
|
1030
|
+
const aHeaderFields = this.getHeaderFields()?.length ? this.getHeaderFields() : [];
|
|
1031
|
+
const aItemHeaderFields = oItem.getHeaderFields()?.length ? oItem.getHeaderFields() : [];
|
|
1032
|
+
const oHeaderFields = [...aHeaderFields, ...aItemHeaderFields]; //Merging headers for request.
|
|
1033
|
+
this._getActiveUploader().uploadItem(oItem, oHeaderFields);
|
|
1034
|
+
}
|
|
1035
|
+
}
|
|
1036
|
+
};
|
|
1037
|
+
|
|
1038
|
+
UploadSetwithTable.prototype._getActiveUploader = function () {
|
|
1039
|
+
return this.getUploader() || this._getImplicitUploader();
|
|
1040
|
+
};
|
|
1041
|
+
|
|
1042
|
+
UploadSetwithTable.prototype._getImplicitUploader = function () {
|
|
1043
|
+
if (!this._oUploader) {
|
|
1044
|
+
this._oUploader = new Uploader({
|
|
1045
|
+
httpRequestMethod : this.getHttpRequestMethod()
|
|
1046
|
+
});
|
|
1047
|
+
this._oUploader.setUploadUrl(this.getUploadUrl());
|
|
1048
|
+
this.registerUploaderEvents(this._oUploader);
|
|
1049
|
+
this.addDependent(this._oUploader);
|
|
1050
|
+
}
|
|
1051
|
+
|
|
1052
|
+
return this._oUploader;
|
|
1053
|
+
};
|
|
1054
|
+
|
|
1055
|
+
UploadSetwithTable.prototype._initateItemUpload = function(oItem) {
|
|
1056
|
+
this.fireBeforeInitiatingItemUpload({item: oItem});
|
|
1057
|
+
if (this._oItemToUpdate) {
|
|
1058
|
+
// Registering item to be update with selected file contents post successful upload.
|
|
1059
|
+
this._oItemToUpdate = oItem;
|
|
1060
|
+
}
|
|
1061
|
+
this._uploadItemIfGoodToGo(oItem);
|
|
1062
|
+
};
|
|
1063
|
+
|
|
1064
|
+
/**
|
|
1065
|
+
* Drag and drop of files implmentation subject to change depending on the thr UX feedback for folder upload scenarios and warning message display scenarios
|
|
1066
|
+
* @param {sap.ui.base.Event} oEvent Drop Event when file is dropped on the Table.
|
|
1067
|
+
* @private
|
|
1068
|
+
*/
|
|
1069
|
+
UploadSetwithTable.prototype._onDropFile = function (oEvent) {
|
|
1070
|
+
oEvent.preventDefault();
|
|
1071
|
+
if (!this.getUploadEnabled()) {
|
|
1072
|
+
Log.error("Upload is not enabled, to continue uploading with drag and drop of files enable property 'UploadEnabled' ");
|
|
1073
|
+
return;
|
|
1074
|
+
}
|
|
1075
|
+
let oItems = oEvent.getParameter("browserEvent")?.dataTransfer?.items || [];
|
|
1076
|
+
oItems = Array.from(oItems);
|
|
1077
|
+
|
|
1078
|
+
// Filtering out only webkitentries (files/folders system entries) by excluding non file / directory types.
|
|
1079
|
+
oItems = oItems.filter(function(item){
|
|
1080
|
+
return item.webkitGetAsEntry() ? true : false;
|
|
1081
|
+
});
|
|
1082
|
+
const aEntryTypes = oItems.map(function (oEntry) {
|
|
1083
|
+
const oWebKitEntry = oEntry.webkitGetAsEntry();
|
|
1084
|
+
return {
|
|
1085
|
+
entryType: oWebKitEntry && oWebKitEntry.isFile ? 'File' : 'Directory'
|
|
1086
|
+
};
|
|
1087
|
+
});
|
|
1088
|
+
// handlding multiple property drag & drop scenarios
|
|
1089
|
+
if (oItems && oItems.length > 1 && !this.getMultiple() && !this.getDirectory()) {
|
|
1090
|
+
// Handling drag and drop of multiple files to upload with multiple property set
|
|
1091
|
+
const sMessage = this._oRb.getText("UPLOADSET_WITH_TABLE_MULTIPLE_RESTRICTED");
|
|
1092
|
+
Log.warning("Multiple files upload is retsricted for this multiple property set");
|
|
1093
|
+
MessageBox.error(sMessage);
|
|
1094
|
+
return;
|
|
1095
|
+
} else if (oItems && oItems.length > 1 && this.getMultiple() && !isFileOrFolderEntry('File', aEntryTypes)) {
|
|
1096
|
+
const sMessageDropFilesOnly = this._oRb.getText("UPLOADSET_WITH_TABLE_DIRECTORY_RESTRICTED");
|
|
1097
|
+
Log.warning("Multiple files upload is retsricted, drag & drop only files");
|
|
1098
|
+
MessageBox.error(sMessageDropFilesOnly);
|
|
1099
|
+
return;
|
|
1100
|
+
}
|
|
1101
|
+
|
|
1102
|
+
// handling directory property drag & drop scenarios
|
|
1103
|
+
if (oItems && oItems.length && !this.getDirectory() && isFileOrFolderEntry('Directory', aEntryTypes)) {
|
|
1104
|
+
const sMessageDirectory = this._oRb.getText("UPLOADSET_WITH_TABLE_DIRECTORY_RESTRICTED");
|
|
1105
|
+
Log.warning("Directory of files upload is retsricted for this directory property set");
|
|
1106
|
+
MessageBox.error(sMessageDirectory);
|
|
1107
|
+
return;
|
|
1108
|
+
} else if (oItems && oItems.length && this.getDirectory() && !isFileOrFolderEntry('Directory', aEntryTypes)) {
|
|
1109
|
+
const sMessageDragDropDirectory = this._oRb.getText("UPLOADSET_WITH_TABLE_DROP_DIRECTORY_ALLOWED");
|
|
1110
|
+
Log.warning("Directory of files upload is retsricted, drag & drop only directories here.");
|
|
1111
|
+
MessageBox.error(sMessageDragDropDirectory);
|
|
1112
|
+
return;
|
|
1113
|
+
}
|
|
1114
|
+
if (oItems && oItems.length) {
|
|
1115
|
+
this._getFilesFromDataTransferItems(oItems).then( (oFiles) => {
|
|
1116
|
+
const oFileUploader = this.getDefaultFileUploader();
|
|
1117
|
+
if (oFiles && oFiles.length && oFileUploader?._areFilesAllowed(oFiles)) {
|
|
1118
|
+
this._processSelectedFileObjects(oFiles);
|
|
1119
|
+
}
|
|
1120
|
+
});
|
|
1121
|
+
}
|
|
1122
|
+
|
|
1123
|
+
function isFileOrFolderEntry(sType, aEntries) {
|
|
1124
|
+
return aEntries.every(function (oEntry) {
|
|
1125
|
+
return oEntry.entryType === sType;
|
|
1126
|
+
});
|
|
1127
|
+
}
|
|
1128
|
+
};
|
|
1129
|
+
|
|
1130
|
+
UploadSetwithTable.prototype._onDragEnterFile = function (oEvent) {
|
|
1131
|
+
var oDragSession = oEvent.getParameter("dragSession");
|
|
1132
|
+
var oDraggedControl = oDragSession.getDragControl();
|
|
1133
|
+
if (oDraggedControl) {
|
|
1134
|
+
oEvent.preventDefault();
|
|
1135
|
+
}
|
|
1136
|
+
};
|
|
1137
|
+
|
|
1138
|
+
/**
|
|
1139
|
+
* Method to extract files from dataTransfer items contianing files / directory of files.
|
|
1140
|
+
* @param {Object} dataTransferItems, DataTransfer items extracted from browserEvent for drop.
|
|
1141
|
+
* @returns {Promise} oPromise, Promise on resolved returns list of files dropped for upload.
|
|
1142
|
+
* @private
|
|
1143
|
+
*/
|
|
1144
|
+
UploadSetwithTable.prototype._getFilesFromDataTransferItems = function (dataTransferItems) {
|
|
1145
|
+
const aFiles = [];
|
|
1146
|
+
return new Promise((resolve, reject) => {
|
|
1147
|
+
const aEntriesPromises = [];
|
|
1148
|
+
for (let i = 0; i < dataTransferItems.length; i++) {
|
|
1149
|
+
aEntriesPromises.push(traverseFileTreePromise(dataTransferItems[i]?.webkitGetAsEntry()));
|
|
1150
|
+
}
|
|
1151
|
+
Promise.all(aEntriesPromises)
|
|
1152
|
+
.then( (entries) => {
|
|
1153
|
+
resolve(aFiles);
|
|
1154
|
+
}, (err) => {
|
|
1155
|
+
reject(err);
|
|
1156
|
+
});
|
|
1157
|
+
});
|
|
1158
|
+
|
|
1159
|
+
function traverseFileTreePromise(item) {
|
|
1160
|
+
return new Promise((resolve, reject) => {
|
|
1161
|
+
if (item.isFile) {
|
|
1162
|
+
item.file((oFile) => {
|
|
1163
|
+
aFiles.push(oFile);
|
|
1164
|
+
resolve(oFile);
|
|
1165
|
+
}, (err) => {
|
|
1166
|
+
reject(err);
|
|
1167
|
+
});
|
|
1168
|
+
} else if (item.isDirectory) {
|
|
1169
|
+
const dirReader = item.createReader();
|
|
1170
|
+
dirReader.readEntries(function (entries) {
|
|
1171
|
+
const aEntriesPromises = [];
|
|
1172
|
+
for (let i = 0; i < entries.length; i++) {
|
|
1173
|
+
aEntriesPromises.push(traverseFileTreePromise(entries[i]));
|
|
1174
|
+
}
|
|
1175
|
+
resolve(Promise.all(aEntriesPromises));
|
|
1176
|
+
});
|
|
1177
|
+
}
|
|
1178
|
+
});
|
|
1179
|
+
}
|
|
1180
|
+
};
|
|
1181
|
+
|
|
1182
|
+
/**
|
|
1183
|
+
* Returns Cloud File picker button
|
|
1184
|
+
* @return {sap.m.Button} Cloudfile Picker button
|
|
1185
|
+
* @private
|
|
1186
|
+
*/
|
|
1187
|
+
UploadSetwithTable.prototype._getCloudFilePickerButton = function () {
|
|
1188
|
+
this._oCloudFilePickerButton = new Button({
|
|
1189
|
+
text: this.getCloudFilePickerButtonText() ? this.getCloudFilePickerButtonText() : this._oRb.getText("UPLOAD_SET_DEFAULT_CFP_BUTTON_TEXT"),
|
|
1190
|
+
press: this._invokeCloudFilePicker.bind(this)
|
|
1191
|
+
});
|
|
1192
|
+
return this._oCloudFilePickerButton;
|
|
1193
|
+
};
|
|
1194
|
+
|
|
1195
|
+
UploadSetwithTable.prototype._itemSelectedCallback = function (oEvent) {
|
|
1196
|
+
var oItem = oEvent.getParameter("item");
|
|
1197
|
+
// eslint-disable-next-line default-case
|
|
1198
|
+
switch (oItem.getText()) {
|
|
1199
|
+
case this.getCloudFilePickerButtonText() ? this.getCloudFilePickerButtonText() : this._oRb.getText("UPLOAD_SET_DEFAULT_CFP_BUTTON_TEXT"):
|
|
1200
|
+
this._oMenuButton
|
|
1201
|
+
.detachEvent("defaultAction", this.fileSelectionHandler.bind(this))
|
|
1202
|
+
.attachEvent("defaultAction", this._invokeCloudFilePicker.bind(this));
|
|
1203
|
+
|
|
1204
|
+
this._invokeCloudFilePicker();
|
|
1205
|
+
this._oMenuButton.setText(oItem.getText());
|
|
1206
|
+
break;
|
|
1207
|
+
case this._oRb.getText("UPLOAD_SET_DEFAULT_LFP_BUTTON_TEXT"):
|
|
1208
|
+
this._oMenuButton
|
|
1209
|
+
.detachEvent("defaultAction", this._invokeCloudFilePicker.bind(this))
|
|
1210
|
+
.attachEvent("defaultAction", this.fileSelectionHandler.bind(this));
|
|
1211
|
+
|
|
1212
|
+
this.fileSelectionHandler();
|
|
1213
|
+
this._oMenuButton.setText(oItem.getText());
|
|
1214
|
+
break;
|
|
1215
|
+
}
|
|
1216
|
+
};
|
|
1217
|
+
|
|
1218
|
+
/**
|
|
1219
|
+
* Creates and invokes CloudFilePicker control instance
|
|
1220
|
+
* @private
|
|
1221
|
+
* @returns {Object} cloudFile picker instance
|
|
1222
|
+
*/
|
|
1223
|
+
UploadSetwithTable.prototype._invokeCloudFilePicker = function () {
|
|
1224
|
+
var oCloudFilePickerInstance = null;
|
|
1225
|
+
if (this._cloudFilePickerControl) {
|
|
1226
|
+
oCloudFilePickerInstance = this._getCloudFilePickerInstance();
|
|
1227
|
+
oCloudFilePickerInstance.open();
|
|
1228
|
+
} else {
|
|
1229
|
+
// Dynamically load and cache CloudFilePicker control for first time
|
|
1230
|
+
this._loadCloudFilePickerDependency()
|
|
1231
|
+
.then( (cloudFilePicker) => {
|
|
1232
|
+
this._cloudFilePickerControl = cloudFilePicker;
|
|
1233
|
+
oCloudFilePickerInstance = this._getCloudFilePickerInstance();
|
|
1234
|
+
oCloudFilePickerInstance.open();
|
|
1235
|
+
})
|
|
1236
|
+
.catch((error) => {
|
|
1237
|
+
Log.error(error);
|
|
1238
|
+
});
|
|
1239
|
+
}
|
|
1240
|
+
return oCloudFilePickerInstance;
|
|
1241
|
+
};
|
|
1242
|
+
|
|
1243
|
+
/**
|
|
1244
|
+
* Event handler for CloudFile picker selector
|
|
1245
|
+
* @param {Object} oEvent CloudFile picker file selection DOM change event
|
|
1246
|
+
* @private
|
|
1247
|
+
*/
|
|
1248
|
+
UploadSetwithTable.prototype._onCloudPickerFileChange = function (oEvent) {
|
|
1249
|
+
|
|
1250
|
+
var mParameters = oEvent.getParameters();
|
|
1251
|
+
var aFiles = [];
|
|
1252
|
+
if (mParameters && mParameters.selectedFiles) {
|
|
1253
|
+
mParameters.selectedFiles.forEach( (file) => {
|
|
1254
|
+
aFiles.push(this._createFileFromCloudPickerFile(file));
|
|
1255
|
+
});
|
|
1256
|
+
}
|
|
1257
|
+
|
|
1258
|
+
// invoking this method to handle file uploads
|
|
1259
|
+
this._processNewCloudPickerFileObjects(aFiles);
|
|
1260
|
+
};
|
|
1261
|
+
|
|
1262
|
+
/**
|
|
1263
|
+
* Creates file object that is to be uploaded from the CloudFilePicker file object
|
|
1264
|
+
* @param {sap.suite.ui.commons.CloudFileInfo} oCloudFile CloudFilepicker file object
|
|
1265
|
+
* @returns {Object} file metadata with file object and fileshare properties
|
|
1266
|
+
* @private
|
|
1267
|
+
*/
|
|
1268
|
+
UploadSetwithTable.prototype._createFileFromCloudPickerFile = function (oCloudFile) {
|
|
1269
|
+
var parts = [new Blob([])];
|
|
1270
|
+
var oFileMetaData = {
|
|
1271
|
+
type: oCloudFile.getFileShareItemContentType(),
|
|
1272
|
+
size: oCloudFile.getFileShareItemContentSize(),
|
|
1273
|
+
webkitRelativePath: '',
|
|
1274
|
+
name: oCloudFile.getFileShareItemName()
|
|
1275
|
+
};
|
|
1276
|
+
var oFile = new File(parts, oCloudFile.getFileShareItemName(), oFileMetaData);
|
|
1277
|
+
return {
|
|
1278
|
+
file: oFile,
|
|
1279
|
+
fileShareProperties: oCloudFile.mProperties
|
|
1280
|
+
};
|
|
1281
|
+
};
|
|
1282
|
+
|
|
1283
|
+
/**
|
|
1284
|
+
* Processing and uploading of file objects selected from the CloudFilePicker
|
|
1285
|
+
* @param {Array} oFiles File metadata list containing file to be uploaded and fileshare properties used for mapping
|
|
1286
|
+
* @private
|
|
1287
|
+
*/
|
|
1288
|
+
UploadSetwithTable.prototype._processNewCloudPickerFileObjects = function (oFiles) {
|
|
1289
|
+
|
|
1290
|
+
oFiles.forEach( (oFileMetaData) => {
|
|
1291
|
+
var oFile = oFileMetaData.file;
|
|
1292
|
+
// set the fileshareProperties for the new file created.
|
|
1293
|
+
const oFileShareProperties = oFileMetaData.fileShareProperties;
|
|
1294
|
+
|
|
1295
|
+
var oItem = new UploadItem({
|
|
1296
|
+
uploadState: UploadState.Ready
|
|
1297
|
+
});
|
|
1298
|
+
oItem.setParent(this); // setting the parent as UploadSetwithTable for file validations
|
|
1299
|
+
oItem._setFileObject(oFile);
|
|
1300
|
+
oItem.setFileName(oFile.name);
|
|
1301
|
+
|
|
1302
|
+
// Set the file share properties if its cloud picker selected file. So that the info is avilable on the item getCloudFileInfo API.
|
|
1303
|
+
if (oFile && oFileShareProperties) {
|
|
1304
|
+
oItem._setCloudFileInfo(oFileShareProperties);
|
|
1305
|
+
}
|
|
1306
|
+
|
|
1307
|
+
|
|
1308
|
+
if (this.getItemValidationHandler() && typeof this.getItemValidationHandler() === "function" ) {
|
|
1309
|
+
|
|
1310
|
+
const oItemInfo = {
|
|
1311
|
+
oItem: oItem,
|
|
1312
|
+
iTotalItemsForUpload: oFiles.length,
|
|
1313
|
+
oSource: this
|
|
1314
|
+
};
|
|
1315
|
+
|
|
1316
|
+
var oPromise = this.getItemValidationHandler()(oItemInfo);
|
|
1317
|
+
if (oPromise && oPromise instanceof Promise) {
|
|
1318
|
+
oPromise
|
|
1319
|
+
.then((item) => {
|
|
1320
|
+
if (item instanceof UploadItem) {
|
|
1321
|
+
this._initateItemUpload(item);
|
|
1322
|
+
}
|
|
1323
|
+
})
|
|
1324
|
+
.catch((item) => {
|
|
1325
|
+
// Reset variable to avoid update if upload rejected.
|
|
1326
|
+
if (item && this._oItemToUpdate && item instanceof UploadItem && item.getId() === this._oItemToUpdate.getId()) {
|
|
1327
|
+
this._oItemToUpdate = null;
|
|
1328
|
+
}
|
|
1329
|
+
});
|
|
1330
|
+
} else {
|
|
1331
|
+
oItem.destroy();
|
|
1332
|
+
// if promise is not returned to the ItemValidation hook log error and destroy the item
|
|
1333
|
+
Log.error("Invalid usage, missing Promise: ItemValidationHandler callback expects Promise to be returned.");
|
|
1334
|
+
}
|
|
1335
|
+
} else {
|
|
1336
|
+
/* if no validation handler is provided control continues with normal upload else waits for the application to manually
|
|
1337
|
+
trigger the upload by resolving the promise */
|
|
1338
|
+
this._initateItemUpload(oItem);
|
|
1339
|
+
}
|
|
1340
|
+
});
|
|
1341
|
+
};
|
|
1342
|
+
|
|
1343
|
+
/**
|
|
1344
|
+
* Dynamically require CloudFilePicker Control
|
|
1345
|
+
* @returns {Promise} Promise that resolves on sucessful load of CloudFilePicker control
|
|
1346
|
+
* @private
|
|
1347
|
+
*/
|
|
1348
|
+
UploadSetwithTable.prototype._loadCloudFilePickerDependency = function () {
|
|
1349
|
+
return new Promise( (resolve, reject) => {
|
|
1350
|
+
Core.loadLibrary("sap.suite.ui.commons", { async: true })
|
|
1351
|
+
.then(function (data) {
|
|
1352
|
+
sap.ui.require(["sap/suite/ui/commons/CloudFilePicker"], function (cloudFilePicker) {
|
|
1353
|
+
resolve(cloudFilePicker);
|
|
1354
|
+
}, function (error) {
|
|
1355
|
+
reject(error);
|
|
1356
|
+
});
|
|
1357
|
+
})
|
|
1358
|
+
.catch(function () {
|
|
1359
|
+
reject("CloudFilePicker Control not available.");
|
|
1360
|
+
});
|
|
1361
|
+
});
|
|
1362
|
+
};
|
|
1363
|
+
|
|
1364
|
+
/**
|
|
1365
|
+
* Internal API to initiate file preview dialog.
|
|
1366
|
+
* Invoked from the plugin configuration with the items created on the fly from the contexts of the table.
|
|
1367
|
+
* @param {sap.m.upload.UploadSetwitTableItem} oItem target item to be previewed.
|
|
1368
|
+
* @param {sap.m.upload.UploadSetwitTableItem[]} aItems all items in the table.
|
|
1369
|
+
* @private
|
|
1370
|
+
*/
|
|
1371
|
+
UploadSetwithTable.prototype._initiateFilePreview = function (oItem, aItems) {
|
|
1372
|
+
if (!this.getPreviewDialog()) {
|
|
1373
|
+
const oAssociatedPreviewDialog = new FilePreviewDialog();
|
|
1374
|
+
this.setPreviewDialog(oAssociatedPreviewDialog);
|
|
1375
|
+
}
|
|
1376
|
+
this._filePreviewDialogControl = Element.getElementById(this.getPreviewDialog());
|
|
1377
|
+
|
|
1378
|
+
if (this._filePreviewDialogControl) {
|
|
1379
|
+
this._filePreviewDialogControl._previewItem = oItem;
|
|
1380
|
+
this._filePreviewDialogControl._items = aItems;
|
|
1381
|
+
this._filePreviewDialogControl._open();
|
|
1382
|
+
}
|
|
1383
|
+
};
|
|
1384
|
+
|
|
1385
|
+
UploadSetwithTable.prototype._getActionToReplacePlaceholder = function(sPlaceHolderFor) {
|
|
1386
|
+
switch (sPlaceHolderFor) {
|
|
1387
|
+
case UploadSetwithTableActionPlaceHolder.UploadButtonPlaceholder:
|
|
1388
|
+
return !this.getUploadButtonInvisible() ? this.getDefaultFileUploader() : null;
|
|
1389
|
+
// return this.getCloudFilePickerEnabled() && !this.getUploadButtonInvisible() ? this._getCloudFilePickerMenu() : this.getDefaultFileUploader();
|
|
1390
|
+
case UploadSetwithTableActionPlaceHolder.CloudFilePickerButtonPlaceholder:
|
|
1391
|
+
return this.getCloudFilePickerEnabled() ? this._getCloudFilePickerButton() : null;
|
|
1392
|
+
default:
|
|
1393
|
+
break;
|
|
1394
|
+
}
|
|
1395
|
+
return null;
|
|
1396
|
+
};
|
|
1397
|
+
|
|
1398
|
+
/**
|
|
1399
|
+
* Internal API to han
|
|
1400
|
+
*/
|
|
1401
|
+
UploadSetwithTable.prototype._setActions = function () {
|
|
1402
|
+
// Fetch all the associated actions set to the plugin actions association.
|
|
1403
|
+
const aActions = this.getActions();
|
|
1404
|
+
aActions.forEach((oAction) => {
|
|
1405
|
+
const oActionRef = Element.getElementById(oAction);
|
|
1406
|
+
oActionRef?.setAggregation("_actionButton", this._getActionToReplacePlaceholder(oActionRef.getPlaceholderFor()), true);
|
|
1407
|
+
});
|
|
1408
|
+
};
|
|
1409
|
+
|
|
1410
|
+
/**
|
|
1411
|
+
* Internal API to handle the file upload for the selected item.
|
|
1412
|
+
* @param {sap.m.upload.UploadItem} oItem item to be downloaded.
|
|
1413
|
+
* @param {boolean} bAskForLocation Whether to ask for a location where to download the file or not.
|
|
1414
|
+
* @returns {boolean} <code>true</code> if download is possible, <code>false</code> otherwise.
|
|
1415
|
+
* @private
|
|
1416
|
+
*/
|
|
1417
|
+
UploadSetwithTable.prototype._initiateFileDownload = function (oItem, bAskForLocation) {
|
|
1418
|
+
return this._getActiveUploader ? this._getActiveUploader().download(oItem, [], bAskForLocation) : false;
|
|
1419
|
+
};
|
|
1420
|
+
|
|
1421
|
+
UploadSetwithTable.prototype._getDefaultNoDataIllustration = function() {
|
|
1422
|
+
const oIllustratedMessage = new IllustratedMessage({
|
|
1423
|
+
illustrationType: IllustratedMessageType.UploadCollection,
|
|
1424
|
+
illustrationSize: IllustratedMessageSize.Spot,
|
|
1425
|
+
title: this._oRb.getText("UPLOADSET_WITH_TABLE_NO_DATA_TEXT"),
|
|
1426
|
+
description: this._oRb.getText("UPLOADSET_WITH_TABLE_NO_DATA_DESCRIPTION")
|
|
1427
|
+
});
|
|
1428
|
+
oIllustratedMessage.addStyleClass("sapMUSTP-IllustratedMessage-container");
|
|
1429
|
+
return oIllustratedMessage;
|
|
1430
|
+
};
|
|
1431
|
+
|
|
1432
|
+
|
|
1433
|
+
PluginBase.setConfigs({
|
|
1434
|
+
"sap.ui.mdc.Table": {
|
|
1435
|
+
_oPluginInstance: null,
|
|
1436
|
+
_oControlInstance: null,
|
|
1437
|
+
_sModelName: undefined,
|
|
1438
|
+
_bIsTableBound: false,
|
|
1439
|
+
setPluginInstance: function(oPlugin) {
|
|
1440
|
+
this._oPluginInstance = oPlugin;
|
|
1441
|
+
},
|
|
1442
|
+
getPluginInstance: function() {
|
|
1443
|
+
return this._oPluginInstance;
|
|
1444
|
+
},
|
|
1445
|
+
setControlInstance: function(oControl) {
|
|
1446
|
+
this._oControlInstance = oControl;
|
|
1447
|
+
},
|
|
1448
|
+
getControlInstance: function() {
|
|
1449
|
+
return this._oControlInstance;
|
|
1450
|
+
},
|
|
1451
|
+
setPluginDefaultSettings: function() {
|
|
1452
|
+
this.setDragDropConfig();
|
|
1453
|
+
this.setDefaultIllustrations();
|
|
1454
|
+
},
|
|
1455
|
+
setIsTableBound: function(oControl) {
|
|
1456
|
+
const oTable = oControl?._oTable;
|
|
1457
|
+
if (oTable && (oTable?.getBinding("rows") || oTable?.getBinding("items"))) {
|
|
1458
|
+
this._bIsTableBound = true;
|
|
1459
|
+
} else {
|
|
1460
|
+
this._bIsTableBound = false;
|
|
1461
|
+
}
|
|
1462
|
+
},
|
|
1463
|
+
getIsTableBound: function() {
|
|
1464
|
+
return this._bIsTableBound;
|
|
1465
|
+
},
|
|
1466
|
+
setModelName: function(oControl) {
|
|
1467
|
+
const oTable = oControl?._oTable;
|
|
1468
|
+
if (oTable?.isA("sap.m.Table")) {
|
|
1469
|
+
this._sModelName = oTable?.getBindingInfo("items")?.model;
|
|
1470
|
+
} else if (oTable?.isA("sap.ui.table.Table")) {
|
|
1471
|
+
this._sModelName = oTable?.getBindingInfo("rows")?.model;
|
|
1472
|
+
}
|
|
1473
|
+
},
|
|
1474
|
+
getModelName: function() {
|
|
1475
|
+
return this._sModelName;
|
|
1476
|
+
},
|
|
1477
|
+
// Set Drag and Drop configuration for the table when upload plugin is activated.
|
|
1478
|
+
setDragDropConfig: function () {
|
|
1479
|
+
// Loading MDC library's Drag and Drop configuration for the table.
|
|
1480
|
+
sap.ui.require(["sap/ui/mdc/table/DragDropConfig"], (MDCDragDropConfig) => {
|
|
1481
|
+
|
|
1482
|
+
const oPlugin = this.getPluginInstance();
|
|
1483
|
+
const oControl = this.getControlInstance();
|
|
1484
|
+
const oDragDropConfig = oPlugin._oDragDropConfig = new MDCDragDropConfig({
|
|
1485
|
+
droppable: true
|
|
1486
|
+
});
|
|
1487
|
+
|
|
1488
|
+
oDragDropConfig.attachDrop(oPlugin._onDropFile.bind(oPlugin));
|
|
1489
|
+
oControl.addDragDropConfig(oDragDropConfig);
|
|
1490
|
+
|
|
1491
|
+
}, () => {
|
|
1492
|
+
Log.error("Failed to load MDC library for Drag and Drop configuration.");
|
|
1493
|
+
});
|
|
1494
|
+
},
|
|
1495
|
+
// Set default illustrations for the table when no data is available. set only when upload plugin is activated.
|
|
1496
|
+
setDefaultIllustrations: function() {
|
|
1497
|
+
const oPlugin = this.getPluginInstance();
|
|
1498
|
+
const oControl = this.getControlInstance();
|
|
1499
|
+
const oNoDataIllustration = oPlugin?.getNoDataIllustration();
|
|
1500
|
+
|
|
1501
|
+
if (oControl && oPlugin) {
|
|
1502
|
+
if (!oNoDataIllustration) {
|
|
1503
|
+
oPlugin._illustratedMessage = oPlugin._getDefaultNoDataIllustration();
|
|
1504
|
+
} else {
|
|
1505
|
+
oPlugin._illustratedMessage = oNoDataIllustration;
|
|
1506
|
+
}
|
|
1507
|
+
oControl.setNoData(oPlugin._illustratedMessage);
|
|
1508
|
+
}
|
|
1509
|
+
},
|
|
1510
|
+
cleanupPluginInstanceSettings: function() {
|
|
1511
|
+
const oPlugin = this.getPluginInstance();
|
|
1512
|
+
const oControl = this.getControlInstance();
|
|
1513
|
+
|
|
1514
|
+
// remove nodata aggregations added from plugin activation.
|
|
1515
|
+
if (oControl) {
|
|
1516
|
+
oControl.setNoData(null);
|
|
1517
|
+
}
|
|
1518
|
+
if (oPlugin) {
|
|
1519
|
+
oPlugin.setPreviewDialog(null);
|
|
1520
|
+
oPlugin._illustratedMessage = null;
|
|
1521
|
+
}
|
|
1522
|
+
|
|
1523
|
+
if (oPlugin._oDragDropConfig && oControl) {
|
|
1524
|
+
oControl.removeDragDropConfig(oPlugin._oDragDropConfig);
|
|
1525
|
+
oPlugin._oDragDropConfig = null;
|
|
1526
|
+
}
|
|
1527
|
+
},
|
|
1528
|
+
// Handles preview of the context passed. Requires access to all the contexts of inner table to setup the preview along with carousel.
|
|
1529
|
+
openFilePreview: function(oBindingContext) {
|
|
1530
|
+
const oPlugin = this.getPluginInstance();
|
|
1531
|
+
const oControl = this.getControlInstance();
|
|
1532
|
+
|
|
1533
|
+
const oRowConfiguration = oPlugin.getRowConfiguration();
|
|
1534
|
+
const oContexts = this.getTableContexts(oControl?._oTable);
|
|
1535
|
+
let aUploadSetItems = [];
|
|
1536
|
+
if (oContexts?.length) {
|
|
1537
|
+
aUploadSetItems = this.getItemsMap(oContexts, oRowConfiguration);
|
|
1538
|
+
}
|
|
1539
|
+
|
|
1540
|
+
const oPreviewUploaditem = aUploadSetItems.find((oItem) => oItem?.data("path") === oBindingContext.getPath());
|
|
1541
|
+
|
|
1542
|
+
if (oPreviewUploaditem) {
|
|
1543
|
+
oPlugin._initiateFilePreview(oPreviewUploaditem, aUploadSetItems);
|
|
1544
|
+
}
|
|
1545
|
+
},
|
|
1546
|
+
// Handles download of the file through the context passed.
|
|
1547
|
+
download: function(mDownloadInfo) {
|
|
1548
|
+
const {oBindingContext, bAskForLocation} = mDownloadInfo;
|
|
1549
|
+
const oPlugin = this.getPluginInstance();
|
|
1550
|
+
const oItem = this.getItemForContext(oBindingContext);
|
|
1551
|
+
if (oItem && oItem.getUrl()) {
|
|
1552
|
+
return oPlugin._initiateFileDownload(oItem, bAskForLocation);
|
|
1553
|
+
}
|
|
1554
|
+
return false;
|
|
1555
|
+
},
|
|
1556
|
+
getTableContexts: function(oTable) {
|
|
1557
|
+
if (oTable?.isA("sap.m.Table")) {
|
|
1558
|
+
return oTable.getBinding("items").getContexts();
|
|
1559
|
+
} else if (oTable?.isA("sap.ui.table.Table")) {
|
|
1560
|
+
return oTable?.getBinding("rows")?.getContexts();
|
|
1561
|
+
}
|
|
1562
|
+
return null;
|
|
1563
|
+
},
|
|
1564
|
+
getItemsMap: function(aItemContexts) {
|
|
1565
|
+
return aItemContexts.map((oItemContext) => {
|
|
1566
|
+
return this.getItemForContext(oItemContext);
|
|
1567
|
+
});
|
|
1568
|
+
},
|
|
1569
|
+
bindItemProperty: function(oItem, mBindingInfo) {
|
|
1570
|
+
const {property, propertyPath, modelName} = mBindingInfo;
|
|
1571
|
+
|
|
1572
|
+
oItem.bindProperty(property, {
|
|
1573
|
+
path: modelName ? `${modelName}>${propertyPath}` : propertyPath,
|
|
1574
|
+
mode: sap.ui.model.BindingMode.TwoWay
|
|
1575
|
+
});
|
|
1576
|
+
},
|
|
1577
|
+
getItemForContext: function(oBindingContext) {
|
|
1578
|
+
const oPlugin = this.getPluginInstance();
|
|
1579
|
+
const sModelName = this.getModelName();
|
|
1580
|
+
const oRowConfiguration = oPlugin.getRowConfiguration();
|
|
1581
|
+
|
|
1582
|
+
const oUploadSetItem = new UploadItem({
|
|
1583
|
+
customData: [
|
|
1584
|
+
new sap.ui.core.CustomData({
|
|
1585
|
+
key: "path",
|
|
1586
|
+
value: oBindingContext.getPath()
|
|
1587
|
+
}),
|
|
1588
|
+
new sap.ui.core.CustomData({
|
|
1589
|
+
key: "context",
|
|
1590
|
+
value: oBindingContext
|
|
1591
|
+
})
|
|
1592
|
+
]
|
|
1593
|
+
});
|
|
1594
|
+
|
|
1595
|
+
// Setting plugin as parent to the item to maintain the reference and access to plugin methods.
|
|
1596
|
+
oUploadSetItem.setParent(oPlugin);
|
|
1597
|
+
|
|
1598
|
+
if (sModelName) {
|
|
1599
|
+
oUploadSetItem.setBindingContext(oBindingContext, sModelName);
|
|
1600
|
+
} else {
|
|
1601
|
+
oUploadSetItem.setBindingContext(oBindingContext);
|
|
1602
|
+
}
|
|
1603
|
+
|
|
1604
|
+
// BindProperties only if the types are valid else skip the binding to default value
|
|
1605
|
+
if (oRowConfiguration?._fileNameValidator(oBindingContext)) {
|
|
1606
|
+
this.bindItemProperty(oUploadSetItem, {
|
|
1607
|
+
property: "fileName",
|
|
1608
|
+
propertyPath: oRowConfiguration.getFileNamePath(),
|
|
1609
|
+
modelName: sModelName
|
|
1610
|
+
});
|
|
1611
|
+
}
|
|
1612
|
+
if (oRowConfiguration?._urlValidator(oBindingContext)) {
|
|
1613
|
+
this.bindItemProperty(oUploadSetItem, {
|
|
1614
|
+
property: "url",
|
|
1615
|
+
propertyPath: oRowConfiguration.getUrlPath(),
|
|
1616
|
+
modelName: sModelName
|
|
1617
|
+
});
|
|
1618
|
+
}
|
|
1619
|
+
if (oRowConfiguration?._mediaTypeValidator(oBindingContext)) {
|
|
1620
|
+
this.bindItemProperty(oUploadSetItem, {
|
|
1621
|
+
property: "mediaType",
|
|
1622
|
+
propertyPath: oRowConfiguration.getMediaTypePath(),
|
|
1623
|
+
modelName: sModelName
|
|
1624
|
+
});
|
|
1625
|
+
}
|
|
1626
|
+
if (oRowConfiguration?._uploadUrlValidator(oBindingContext)) {
|
|
1627
|
+
this.bindItemProperty(oUploadSetItem, {
|
|
1628
|
+
property: "uploadUrl",
|
|
1629
|
+
propertyPath: oRowConfiguration.getUploadUrlPath(),
|
|
1630
|
+
modelName: sModelName
|
|
1631
|
+
});
|
|
1632
|
+
}
|
|
1633
|
+
if (oRowConfiguration?._previewableValidator(oBindingContext)) {
|
|
1634
|
+
this.bindItemProperty(oUploadSetItem, {
|
|
1635
|
+
property: "previewable",
|
|
1636
|
+
propertyPath: oRowConfiguration.getPreviewablePath(),
|
|
1637
|
+
modelName: sModelName
|
|
1638
|
+
});
|
|
1639
|
+
}
|
|
1640
|
+
if (oRowConfiguration?._fileSizeValidator(oBindingContext)) {
|
|
1641
|
+
this.bindItemProperty(oUploadSetItem, {
|
|
1642
|
+
property: "fileSize",
|
|
1643
|
+
propertyPath: oRowConfiguration.getFileSizePath(),
|
|
1644
|
+
modelName: sModelName
|
|
1645
|
+
});
|
|
1646
|
+
}
|
|
1647
|
+
return oUploadSetItem;
|
|
1648
|
+
}
|
|
1649
|
+
},
|
|
1650
|
+
"sap.m.Table": {
|
|
1651
|
+
_oPluginInstance: null,
|
|
1652
|
+
_oControlInstance: null,
|
|
1653
|
+
_sModelName: undefined,
|
|
1654
|
+
_bIsTableBound: false,
|
|
1655
|
+
setPluginInstance: function(oPlugin) {
|
|
1656
|
+
this._oPluginInstance = oPlugin;
|
|
1657
|
+
},
|
|
1658
|
+
getPluginInstance: function() {
|
|
1659
|
+
return this._oPluginInstance;
|
|
1660
|
+
},
|
|
1661
|
+
setControlInstance: function(oControl) {
|
|
1662
|
+
this._oControlInstance = oControl;
|
|
1663
|
+
},
|
|
1664
|
+
getControlInstance: function() {
|
|
1665
|
+
return this._oControlInstance;
|
|
1666
|
+
},
|
|
1667
|
+
setPluginDefaultSettings: function() {
|
|
1668
|
+
this.setDragDropConfig();
|
|
1669
|
+
this.setDefaultIllustrations();
|
|
1670
|
+
},
|
|
1671
|
+
setIsTableBound: function(oControl) {
|
|
1672
|
+
if (oControl?.getBinding("items")) {
|
|
1673
|
+
this._bIsTableBound = true;
|
|
1674
|
+
} else {
|
|
1675
|
+
this._bIsTableBound = false;
|
|
1676
|
+
}
|
|
1677
|
+
},
|
|
1678
|
+
getIsTableBound: function() {
|
|
1679
|
+
return this._bIsTableBound;
|
|
1680
|
+
},
|
|
1681
|
+
setModelName: function(oControl) {
|
|
1682
|
+
if (oControl?.isA("sap.m.Table")) {
|
|
1683
|
+
this._sModelName = oControl?.getBindingInfo("items")?.model;
|
|
1684
|
+
}
|
|
1685
|
+
},
|
|
1686
|
+
getModelName: function() {
|
|
1687
|
+
return this._sModelName;
|
|
1688
|
+
},
|
|
1689
|
+
// Set Drag and Drop configuration for the table when upload plugin is activated.
|
|
1690
|
+
setDragDropConfig: function () {
|
|
1691
|
+
const oPlugin = this.getPluginInstance();
|
|
1692
|
+
const oControl = this.getControlInstance();
|
|
1693
|
+
|
|
1694
|
+
var oDragDropConfig = new DragDropInfo({
|
|
1695
|
+
sourceAggregation: "items",
|
|
1696
|
+
targetAggregation: "items"
|
|
1697
|
+
});
|
|
1698
|
+
var oDropConfig = new DropInfo({
|
|
1699
|
+
dropEffect:"Move",
|
|
1700
|
+
dropPosition:"OnOrBetween",
|
|
1701
|
+
dragEnter: [oPlugin?._onDragEnterFile, oPlugin],
|
|
1702
|
+
drop: [oPlugin?._onDropFile, oPlugin]
|
|
1703
|
+
});
|
|
1704
|
+
oControl?.addDragDropConfig(oDragDropConfig);
|
|
1705
|
+
oControl?.addDragDropConfig(oDropConfig);
|
|
1706
|
+
},
|
|
1707
|
+
// Set default illustrations for the table when no data is available. set only when upload plugin is activated.
|
|
1708
|
+
setDefaultIllustrations: function() {
|
|
1709
|
+
const oPlugin = this.getPluginInstance();
|
|
1710
|
+
const oControl = this.getControlInstance();
|
|
1711
|
+
const oNoDataIllustration = oPlugin?.getNoDataIllustration();
|
|
1712
|
+
|
|
1713
|
+
if (oControl && oPlugin) {
|
|
1714
|
+
if (!oNoDataIllustration) {
|
|
1715
|
+
oPlugin._illustratedMessage = oPlugin._getDefaultNoDataIllustration();
|
|
1716
|
+
} else {
|
|
1717
|
+
oPlugin._illustratedMessage = oNoDataIllustration;
|
|
1718
|
+
}
|
|
1719
|
+
oControl.setNoData(oPlugin._illustratedMessage);
|
|
1720
|
+
}
|
|
1721
|
+
},
|
|
1722
|
+
cleanupPluginInstanceSettings: function() {
|
|
1723
|
+
const oPlugin = this.getPluginInstance();
|
|
1724
|
+
const oControl = this.getControlInstance();
|
|
1725
|
+
|
|
1726
|
+
// remove nodata aggregations added from plugin activation.
|
|
1727
|
+
if (oControl) {
|
|
1728
|
+
oControl.setNoData(null);
|
|
1729
|
+
}
|
|
1730
|
+
if (oPlugin) {
|
|
1731
|
+
oPlugin.setPreviewDialog(null);
|
|
1732
|
+
oPlugin._illustratedMessage = null;
|
|
1733
|
+
}
|
|
1734
|
+
|
|
1735
|
+
if (oPlugin._oDragDropConfig && oControl) {
|
|
1736
|
+
oControl.removeDragDropConfig(oPlugin._oDragDropConfig);
|
|
1737
|
+
oPlugin._oDragDropConfig = null;
|
|
1738
|
+
}
|
|
1739
|
+
},
|
|
1740
|
+
// Handles preview of the context passed. Requires access to all the contexts of inner table to setup the preview along with carousel.
|
|
1741
|
+
openFilePreview: function(oBindingContext) {
|
|
1742
|
+
const oPlugin = this.getPluginInstance();
|
|
1743
|
+
const oControl = this.getControlInstance();
|
|
1744
|
+
|
|
1745
|
+
const oRowConfiguration = oPlugin.getRowConfiguration();
|
|
1746
|
+
const oContexts = this.getTableContexts(oControl);
|
|
1747
|
+
let aUploadSetItems = [];
|
|
1748
|
+
if (oContexts?.length) {
|
|
1749
|
+
aUploadSetItems = this.getItemsMap(oContexts, oRowConfiguration);
|
|
1750
|
+
}
|
|
1751
|
+
|
|
1752
|
+
const oPreviewUploaditem = aUploadSetItems.find((oItem) => oItem?.data("path") === oBindingContext.getPath());
|
|
1753
|
+
|
|
1754
|
+
if (oPreviewUploaditem) {
|
|
1755
|
+
oPlugin._initiateFilePreview(oPreviewUploaditem, aUploadSetItems);
|
|
1756
|
+
}
|
|
1757
|
+
},
|
|
1758
|
+
// Handles download of the file through the context passed.
|
|
1759
|
+
download: function(mDownloadInfo) {
|
|
1760
|
+
const {oBindingContext, bAskForLocation} = mDownloadInfo;
|
|
1761
|
+
const oPlugin = this.getPluginInstance();
|
|
1762
|
+
const oItem = this.getItemForContext(oBindingContext);
|
|
1763
|
+
if (oItem && oItem.getUrl()) {
|
|
1764
|
+
return oPlugin._initiateFileDownload(oItem, bAskForLocation);
|
|
1765
|
+
}
|
|
1766
|
+
return false;
|
|
1767
|
+
},
|
|
1768
|
+
getTableContexts: function(oTable) {
|
|
1769
|
+
return oTable?.getBinding("items")?.getContexts() || null;
|
|
1770
|
+
},
|
|
1771
|
+
getItemsMap: function(aItemContexts) {
|
|
1772
|
+
return aItemContexts.map((oItemContext) => {
|
|
1773
|
+
return this.getItemForContext(oItemContext);
|
|
1774
|
+
});
|
|
1775
|
+
},
|
|
1776
|
+
bindItemProperty: function(oItem, mBindingInfo) {
|
|
1777
|
+
const {property, propertyPath, modelName} = mBindingInfo;
|
|
1778
|
+
|
|
1779
|
+
oItem.bindProperty(property, {
|
|
1780
|
+
path: modelName ? `${modelName}>${propertyPath}` : propertyPath,
|
|
1781
|
+
mode: sap.ui.model.BindingMode.TwoWay
|
|
1782
|
+
});
|
|
1783
|
+
},
|
|
1784
|
+
getItemForContext: function(oBindingContext) {
|
|
1785
|
+
const oPlugin = this.getPluginInstance();
|
|
1786
|
+
const sModelName = this.getModelName();
|
|
1787
|
+
const oRowConfiguration = oPlugin.getRowConfiguration();
|
|
1788
|
+
|
|
1789
|
+
const oUploadSetItem = new UploadItem({
|
|
1790
|
+
customData: [
|
|
1791
|
+
new sap.ui.core.CustomData({
|
|
1792
|
+
key: "path",
|
|
1793
|
+
value: oBindingContext.getPath()
|
|
1794
|
+
}),
|
|
1795
|
+
new sap.ui.core.CustomData({
|
|
1796
|
+
key: "context",
|
|
1797
|
+
value: oBindingContext
|
|
1798
|
+
})
|
|
1799
|
+
]
|
|
1800
|
+
});
|
|
1801
|
+
|
|
1802
|
+
// Setting plugin as parent to the item to maintain the reference and access to plugin methods.
|
|
1803
|
+
oUploadSetItem.setParent(oPlugin);
|
|
1804
|
+
|
|
1805
|
+
if (sModelName) {
|
|
1806
|
+
oUploadSetItem.setBindingContext(oBindingContext, sModelName);
|
|
1807
|
+
} else {
|
|
1808
|
+
oUploadSetItem.setBindingContext(oBindingContext);
|
|
1809
|
+
}
|
|
1810
|
+
|
|
1811
|
+
// BindProperties only if the types are valid else skip the binding to default value
|
|
1812
|
+
if (oRowConfiguration?._fileNameValidator(oBindingContext)) {
|
|
1813
|
+
this.bindItemProperty(oUploadSetItem, {
|
|
1814
|
+
property: "fileName",
|
|
1815
|
+
propertyPath: oRowConfiguration.getFileNamePath(),
|
|
1816
|
+
modelName: sModelName
|
|
1817
|
+
});
|
|
1818
|
+
}
|
|
1819
|
+
if (oRowConfiguration?._urlValidator(oBindingContext)) {
|
|
1820
|
+
this.bindItemProperty(oUploadSetItem, {
|
|
1821
|
+
property: "url",
|
|
1822
|
+
propertyPath: oRowConfiguration.getUrlPath(),
|
|
1823
|
+
modelName: sModelName
|
|
1824
|
+
});
|
|
1825
|
+
}
|
|
1826
|
+
if (oRowConfiguration?._mediaTypeValidator(oBindingContext)) {
|
|
1827
|
+
this.bindItemProperty(oUploadSetItem, {
|
|
1828
|
+
property: "mediaType",
|
|
1829
|
+
propertyPath: oRowConfiguration.getMediaTypePath(),
|
|
1830
|
+
modelName: sModelName
|
|
1831
|
+
});
|
|
1832
|
+
}
|
|
1833
|
+
if (oRowConfiguration?._uploadUrlValidator(oBindingContext)) {
|
|
1834
|
+
this.bindItemProperty(oUploadSetItem, {
|
|
1835
|
+
property: "uploadUrl",
|
|
1836
|
+
propertyPath: oRowConfiguration.getUploadUrlPath(),
|
|
1837
|
+
modelName: sModelName
|
|
1838
|
+
});
|
|
1839
|
+
}
|
|
1840
|
+
if (oRowConfiguration?._previewableValidator(oBindingContext)) {
|
|
1841
|
+
this.bindItemProperty(oUploadSetItem, {
|
|
1842
|
+
property: "previewable",
|
|
1843
|
+
propertyPath: oRowConfiguration.getPreviewablePath(),
|
|
1844
|
+
modelName: sModelName
|
|
1845
|
+
});
|
|
1846
|
+
}
|
|
1847
|
+
if (oRowConfiguration?._fileSizeValidator(oBindingContext)) {
|
|
1848
|
+
this.bindItemProperty(oUploadSetItem, {
|
|
1849
|
+
property: "fileSize",
|
|
1850
|
+
propertyPath: oRowConfiguration.getFileSizePath(),
|
|
1851
|
+
modelName: sModelName
|
|
1852
|
+
});
|
|
1853
|
+
}
|
|
1854
|
+
return oUploadSetItem;
|
|
1855
|
+
}
|
|
1856
|
+
},
|
|
1857
|
+
"sap.ui.table.Table": {
|
|
1858
|
+
_oPluginInstance: null,
|
|
1859
|
+
_oControlInstance: null,
|
|
1860
|
+
_sModelName: undefined,
|
|
1861
|
+
_bIsTableBound: false,
|
|
1862
|
+
setPluginInstance: function(oPlugin) {
|
|
1863
|
+
this._oPluginInstance = oPlugin;
|
|
1864
|
+
},
|
|
1865
|
+
getPluginInstance: function() {
|
|
1866
|
+
return this._oPluginInstance;
|
|
1867
|
+
},
|
|
1868
|
+
setControlInstance: function(oControl) {
|
|
1869
|
+
this._oControlInstance = oControl;
|
|
1870
|
+
},
|
|
1871
|
+
getControlInstance: function() {
|
|
1872
|
+
return this._oControlInstance;
|
|
1873
|
+
},
|
|
1874
|
+
setPluginDefaultSettings: function() {
|
|
1875
|
+
this.setDragDropConfig();
|
|
1876
|
+
this.setDefaultIllustrations();
|
|
1877
|
+
},
|
|
1878
|
+
setIsTableBound: function(oControl) {
|
|
1879
|
+
if (oControl?.getBinding("rows")) {
|
|
1880
|
+
this._bIsTableBound = true;
|
|
1881
|
+
} else {
|
|
1882
|
+
this._bIsTableBound = false;
|
|
1883
|
+
}
|
|
1884
|
+
},
|
|
1885
|
+
getIsTableBound: function() {
|
|
1886
|
+
return this._bIsTableBound;
|
|
1887
|
+
},
|
|
1888
|
+
setModelName: function(oControl) {
|
|
1889
|
+
if (oControl?.isA("sap.ui.table.Table")) {
|
|
1890
|
+
this._sModelName = oControl?.getBindingInfo("rows")?.model;
|
|
1891
|
+
}
|
|
1892
|
+
},
|
|
1893
|
+
getModelName: function() {
|
|
1894
|
+
return this._sModelName;
|
|
1895
|
+
},
|
|
1896
|
+
// Set Drag and Drop configuration for the table when upload plugin is activated.
|
|
1897
|
+
setDragDropConfig: function () {
|
|
1898
|
+
const oPlugin = this.getPluginInstance();
|
|
1899
|
+
const oControl = this.getControlInstance();
|
|
1900
|
+
|
|
1901
|
+
var oDragDropConfig = new DragDropInfo({
|
|
1902
|
+
sourceAggregation: "rows",
|
|
1903
|
+
targetAggregation: "rows"
|
|
1904
|
+
});
|
|
1905
|
+
var oDropConfig = new DropInfo({
|
|
1906
|
+
dropEffect:"Move",
|
|
1907
|
+
dropPosition:"OnOrBetween",
|
|
1908
|
+
dragEnter: [oPlugin?._onDragEnterFile, oPlugin],
|
|
1909
|
+
drop: [oPlugin?._onDropFile, oPlugin]
|
|
1910
|
+
});
|
|
1911
|
+
oControl?.addDragDropConfig(oDragDropConfig);
|
|
1912
|
+
oControl?.addDragDropConfig(oDropConfig);
|
|
1913
|
+
},
|
|
1914
|
+
// Set default illustrations for the table when no data is available. set only when upload plugin is activated.
|
|
1915
|
+
setDefaultIllustrations: function() {
|
|
1916
|
+
const oPlugin = this.getPluginInstance();
|
|
1917
|
+
const oControl = this.getControlInstance();
|
|
1918
|
+
const oNoDataIllustration = oPlugin?.getNoDataIllustration();
|
|
1919
|
+
|
|
1920
|
+
if (oControl && oPlugin) {
|
|
1921
|
+
if (!oNoDataIllustration) {
|
|
1922
|
+
oPlugin._illustratedMessage = oPlugin._getDefaultNoDataIllustration();
|
|
1923
|
+
} else {
|
|
1924
|
+
oPlugin._illustratedMessage = oNoDataIllustration;
|
|
1925
|
+
}
|
|
1926
|
+
oControl.setNoData(oPlugin._illustratedMessage);
|
|
1927
|
+
}
|
|
1928
|
+
},
|
|
1929
|
+
cleanupPluginInstanceSettings: function() {
|
|
1930
|
+
const oPlugin = this.getPluginInstance();
|
|
1931
|
+
const oControl = this.getControlInstance();
|
|
1932
|
+
|
|
1933
|
+
// remove nodata aggregations added from plugin activation.
|
|
1934
|
+
if (oControl) {
|
|
1935
|
+
oControl.setNoData(null);
|
|
1936
|
+
}
|
|
1937
|
+
if (oPlugin) {
|
|
1938
|
+
oPlugin.setPreviewDialog(null);
|
|
1939
|
+
oPlugin._illustratedMessage = null;
|
|
1940
|
+
}
|
|
1941
|
+
|
|
1942
|
+
if (oPlugin._oDragDropConfig && oControl) {
|
|
1943
|
+
oControl.removeDragDropConfig(oPlugin._oDragDropConfig);
|
|
1944
|
+
oPlugin._oDragDropConfig = null;
|
|
1945
|
+
}
|
|
1946
|
+
},
|
|
1947
|
+
// Handles preview of the context passed. Requires access to all the contexts of inner table to setup the preview along with carousel.
|
|
1948
|
+
openFilePreview: function(oBindingContext) {
|
|
1949
|
+
const oPlugin = this.getPluginInstance();
|
|
1950
|
+
const oControl = this.getControlInstance();
|
|
1951
|
+
|
|
1952
|
+
const oRowConfiguration = oPlugin.getRowConfiguration();
|
|
1953
|
+
const oContexts = this.getTableContexts(oControl);
|
|
1954
|
+
let aUploadSetItems = [];
|
|
1955
|
+
if (oContexts?.length) {
|
|
1956
|
+
aUploadSetItems = this.getItemsMap(oContexts, oRowConfiguration);
|
|
1957
|
+
}
|
|
1958
|
+
|
|
1959
|
+
const oPreviewUploaditem = aUploadSetItems.find((oItem) => oItem?.data("path") === oBindingContext.getPath());
|
|
1960
|
+
|
|
1961
|
+
if (oPreviewUploaditem) {
|
|
1962
|
+
oPlugin._initiateFilePreview(oPreviewUploaditem, aUploadSetItems);
|
|
1963
|
+
}
|
|
1964
|
+
},
|
|
1965
|
+
// Handles download of the file through the context passed.
|
|
1966
|
+
download: function(mDownloadInfo) {
|
|
1967
|
+
const {oBindingContext, bAskForLocation} = mDownloadInfo;
|
|
1968
|
+
const oPlugin = this.getPluginInstance();
|
|
1969
|
+
const oItem = this.getItemForContext(oBindingContext);
|
|
1970
|
+
if (oItem && oItem.getUrl()) {
|
|
1971
|
+
return oPlugin._initiateFileDownload(oItem, bAskForLocation);
|
|
1972
|
+
}
|
|
1973
|
+
return false;
|
|
1974
|
+
},
|
|
1975
|
+
getTableContexts: function(oTable) {
|
|
1976
|
+
return oTable?.getBinding("rows")?.getContexts() || null;
|
|
1977
|
+
},
|
|
1978
|
+
getItemsMap: function(aItemContexts) {
|
|
1979
|
+
return aItemContexts.map((oItemContext) => {
|
|
1980
|
+
return this.getItemForContext(oItemContext);
|
|
1981
|
+
});
|
|
1982
|
+
},
|
|
1983
|
+
bindItemProperty: function(oItem, mBindingInfo) {
|
|
1984
|
+
const {property, propertyPath, modelName} = mBindingInfo;
|
|
1985
|
+
|
|
1986
|
+
oItem.bindProperty(property, {
|
|
1987
|
+
path: modelName ? `${modelName}>${propertyPath}` : propertyPath,
|
|
1988
|
+
mode: sap.ui.model.BindingMode.TwoWay
|
|
1989
|
+
});
|
|
1990
|
+
},
|
|
1991
|
+
getItemForContext: function(oBindingContext) {
|
|
1992
|
+
const oPlugin = this.getPluginInstance();
|
|
1993
|
+
const sModelName = this.getModelName();
|
|
1994
|
+
const oRowConfiguration = oPlugin.getRowConfiguration();
|
|
1995
|
+
|
|
1996
|
+
const oUploadSetItem = new UploadItem({
|
|
1997
|
+
customData: [
|
|
1998
|
+
new sap.ui.core.CustomData({
|
|
1999
|
+
key: "path",
|
|
2000
|
+
value: oBindingContext.getPath()
|
|
2001
|
+
}),
|
|
2002
|
+
new sap.ui.core.CustomData({
|
|
2003
|
+
key: "context",
|
|
2004
|
+
value: oBindingContext
|
|
2005
|
+
})
|
|
2006
|
+
]
|
|
2007
|
+
});
|
|
2008
|
+
|
|
2009
|
+
// Setting plugin as parent to the item to maintain the reference and access to plugin methods.
|
|
2010
|
+
oUploadSetItem.setParent(oPlugin);
|
|
2011
|
+
|
|
2012
|
+
if (sModelName) {
|
|
2013
|
+
oUploadSetItem.setBindingContext(oBindingContext, sModelName);
|
|
2014
|
+
} else {
|
|
2015
|
+
oUploadSetItem.setBindingContext(oBindingContext);
|
|
2016
|
+
}
|
|
2017
|
+
|
|
2018
|
+
// BindProperties only if the types are valid else skip the binding to default value
|
|
2019
|
+
if (oRowConfiguration?._fileNameValidator(oBindingContext)) {
|
|
2020
|
+
this.bindItemProperty(oUploadSetItem, {
|
|
2021
|
+
property: "fileName",
|
|
2022
|
+
propertyPath: oRowConfiguration.getFileNamePath(),
|
|
2023
|
+
modelName: sModelName
|
|
2024
|
+
});
|
|
2025
|
+
}
|
|
2026
|
+
if (oRowConfiguration?._urlValidator(oBindingContext)) {
|
|
2027
|
+
this.bindItemProperty(oUploadSetItem, {
|
|
2028
|
+
property: "url",
|
|
2029
|
+
propertyPath: oRowConfiguration.getUrlPath(),
|
|
2030
|
+
modelName: sModelName
|
|
2031
|
+
});
|
|
2032
|
+
}
|
|
2033
|
+
if (oRowConfiguration?._mediaTypeValidator(oBindingContext)) {
|
|
2034
|
+
this.bindItemProperty(oUploadSetItem, {
|
|
2035
|
+
property: "mediaType",
|
|
2036
|
+
propertyPath: oRowConfiguration.getMediaTypePath(),
|
|
2037
|
+
modelName: sModelName
|
|
2038
|
+
});
|
|
2039
|
+
}
|
|
2040
|
+
if (oRowConfiguration?._uploadUrlValidator(oBindingContext)) {
|
|
2041
|
+
this.bindItemProperty(oUploadSetItem, {
|
|
2042
|
+
property: "uploadUrl",
|
|
2043
|
+
propertyPath: oRowConfiguration.getUploadUrlPath(),
|
|
2044
|
+
modelName: sModelName
|
|
2045
|
+
});
|
|
2046
|
+
}
|
|
2047
|
+
if (oRowConfiguration?._previewableValidator(oBindingContext)) {
|
|
2048
|
+
this.bindItemProperty(oUploadSetItem, {
|
|
2049
|
+
property: "previewable",
|
|
2050
|
+
propertyPath: oRowConfiguration.getPreviewablePath(),
|
|
2051
|
+
modelName: sModelName
|
|
2052
|
+
});
|
|
2053
|
+
}
|
|
2054
|
+
if (oRowConfiguration?._fileSizeValidator(oBindingContext)) {
|
|
2055
|
+
this.bindItemProperty(oUploadSetItem, {
|
|
2056
|
+
property: "fileSize",
|
|
2057
|
+
propertyPath: oRowConfiguration.getFileSizePath(),
|
|
2058
|
+
modelName: sModelName
|
|
2059
|
+
});
|
|
2060
|
+
}
|
|
2061
|
+
return oUploadSetItem;
|
|
2062
|
+
}
|
|
2063
|
+
}
|
|
2064
|
+
}, UploadSetwithTable);
|
|
2065
|
+
|
|
2066
|
+
return UploadSetwithTable;
|
|
2067
|
+
});
|