@nextcloud/vue 3.10.2 → 4.1.1
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/CHANGELOG.md +114 -19
- package/README.md +9 -10
- package/dist/Components/ActionButton.js +24 -3
- package/dist/Components/ActionButton.js.map +1 -1
- package/dist/Components/ActionCaption.js +23 -0
- package/dist/Components/ActionCaption.js.map +1 -0
- package/dist/Components/ActionCheckbox.js +24 -3
- package/dist/Components/ActionCheckbox.js.map +1 -1
- package/dist/Components/ActionInput.js +124 -21
- package/dist/Components/ActionInput.js.map +1 -1
- package/dist/Components/ActionLink.js +24 -3
- package/dist/Components/ActionLink.js.map +1 -1
- package/dist/Components/ActionRadio.js +24 -3
- package/dist/Components/ActionRadio.js.map +1 -1
- package/dist/Components/ActionRouter.js +23 -2
- package/dist/Components/ActionRouter.js.map +1 -1
- package/dist/Components/ActionSeparator.js +1 -1
- package/dist/Components/ActionSeparator.js.map +1 -1
- package/dist/Components/ActionText.js +23 -2
- package/dist/Components/ActionText.js.map +1 -1
- package/dist/Components/ActionTextEditable.js +45 -3
- package/dist/Components/ActionTextEditable.js.map +1 -1
- package/dist/Components/Actions.js +25 -4
- package/dist/Components/Actions.js.map +1 -1
- package/dist/Components/AppContent.js +21 -1
- package/dist/Components/AppContent.js.map +1 -1
- package/dist/Components/AppContentDetails.js +1 -1
- package/dist/Components/AppContentDetails.js.map +1 -1
- package/dist/Components/AppContentList.js +1 -1
- package/dist/Components/AppContentList.js.map +1 -1
- package/dist/Components/AppNavigation.js +109 -2
- package/dist/Components/AppNavigation.js.map +1 -1
- package/dist/Components/AppNavigationCaption.js +66 -1
- package/dist/Components/AppNavigationCaption.js.map +1 -1
- package/dist/Components/AppNavigationCounter.js +2 -2
- package/dist/Components/AppNavigationCounter.js.map +1 -1
- package/dist/Components/AppNavigationIconBullet.js +2 -2
- package/dist/Components/AppNavigationIconBullet.js.map +1 -1
- package/dist/Components/AppNavigationItem.js +49 -7
- package/dist/Components/AppNavigationItem.js.map +1 -1
- package/dist/Components/AppNavigationNew.js +1 -1
- package/dist/Components/AppNavigationNew.js.map +1 -1
- package/dist/Components/AppNavigationNewItem.js +2 -2
- package/dist/Components/AppNavigationNewItem.js.map +1 -1
- package/dist/Components/AppNavigationSettings.js +5 -5
- package/dist/Components/AppNavigationSettings.js.map +1 -1
- package/dist/Components/AppNavigationSpacer.js +1 -1
- package/dist/Components/AppNavigationSpacer.js.map +1 -1
- package/dist/Components/AppNavigationToggle.js +109 -2
- package/dist/Components/AppNavigationToggle.js.map +1 -1
- package/dist/Components/AppSettingsDialog.js +64 -22
- package/dist/Components/AppSettingsDialog.js.map +1 -1
- package/dist/Components/AppSettingsSection.js +1 -1
- package/dist/Components/AppSettingsSection.js.map +1 -1
- package/dist/Components/AppSidebar.js +38 -17
- package/dist/Components/AppSidebar.js.map +1 -1
- package/dist/Components/AppSidebarTab.js +1 -1
- package/dist/Components/AppSidebarTab.js.map +1 -1
- package/dist/Components/Avatar.js +9 -10
- package/dist/Components/Avatar.js.map +1 -1
- package/dist/Components/Breadcrumb.js +33 -12
- package/dist/Components/Breadcrumb.js.map +1 -1
- package/dist/Components/Breadcrumbs.js +59 -17
- package/dist/Components/Breadcrumbs.js.map +1 -1
- package/dist/Components/CheckboxRadioSwitch.js +44 -0
- package/dist/Components/CheckboxRadioSwitch.js.map +1 -0
- package/dist/Components/ColorPicker.js +6 -7
- package/dist/Components/ColorPicker.js.map +1 -1
- package/dist/Components/Content.js +2 -2
- package/dist/Components/Content.js.map +1 -1
- package/dist/Components/CounterBubble.js +23 -0
- package/dist/Components/CounterBubble.js.map +1 -0
- package/dist/Components/DatetimePicker.js +341 -3
- package/dist/Components/DatetimePicker.js.map +1 -1
- package/dist/Components/EmojiPicker.js +14 -14
- package/dist/Components/EmojiPicker.js.map +1 -1
- package/dist/Components/EmptyContent.js +2 -2
- package/dist/Components/EmptyContent.js.map +1 -1
- package/dist/Components/Highlight.js +3 -3
- package/dist/Components/Highlight.js.map +1 -1
- package/dist/Components/ListItem.js +130 -0
- package/dist/Components/ListItem.js.map +1 -0
- package/dist/Components/ListItemIcon.js +20 -21
- package/dist/Components/ListItemIcon.js.map +1 -1
- package/dist/Components/Modal.js +53 -11
- package/dist/Components/Modal.js.map +1 -1
- package/dist/Components/Multiselect.js +22 -23
- package/dist/Components/Multiselect.js.map +1 -1
- package/dist/Components/MultiselectTags.js +24 -25
- package/dist/Components/MultiselectTags.js.map +1 -1
- package/dist/Components/Popover.js +2 -2
- package/dist/Components/Popover.js.map +1 -1
- package/dist/Components/PopoverMenu.js +1 -1
- package/dist/Components/PopoverMenu.js.map +1 -1
- package/dist/Components/ProgressBar.js +2 -2
- package/dist/Components/ProgressBar.js.map +1 -1
- package/dist/Components/RichContenteditable.js +2 -2
- package/dist/Components/RichContenteditable.js.map +1 -1
- package/dist/Components/SettingsInputText.js +22 -1
- package/dist/Components/SettingsInputText.js.map +1 -1
- package/dist/Components/SettingsSection.js +2 -2
- package/dist/Components/SettingsSection.js.map +1 -1
- package/dist/Components/SettingsSelectGroup.js +41 -21
- package/dist/Components/SettingsSelectGroup.js.map +1 -1
- package/dist/Components/TimezonePicker.js +340 -0
- package/dist/Components/TimezonePicker.js.map +1 -0
- package/dist/Components/UserBubble.js +35 -36
- package/dist/Components/UserBubble.js.map +1 -1
- package/dist/Directives/Focus.js +1 -1
- package/dist/Directives/Focus.js.map +1 -1
- package/dist/Directives/Linkify.js +1 -1
- package/dist/Directives/Linkify.js.map +1 -1
- package/dist/Directives/Tooltip.js +2 -2
- package/dist/Directives/Tooltip.js.map +1 -1
- package/dist/Functions/usernameToColor.js +2 -3
- package/dist/Functions/usernameToColor.js.map +1 -1
- package/dist/Mixins/excludeClickOutsideClasses.js +2 -2
- package/dist/Mixins/excludeClickOutsideClasses.js.map +1 -1
- package/dist/Mixins/isFullscreen.js +1 -1
- package/dist/Mixins/isFullscreen.js.map +1 -1
- package/dist/Mixins/isMobile.js +1 -1
- package/dist/Mixins/isMobile.js.map +1 -1
- package/dist/Mixins/richEditor.js +1 -1
- package/dist/Mixins/richEditor.js.map +1 -1
- package/dist/ncvuecomponents.js +276 -69
- package/dist/ncvuecomponents.js.map +1 -1
- package/package.json +28 -43
- package/src/assets/action.scss +0 -132
- package/src/assets/iconfont/README.md +0 -30
- package/src/assets/iconfont/arrow-left-double.svg +0 -3
- package/src/assets/iconfont/arrow-left.svg +0 -3
- package/src/assets/iconfont/arrow-right-double.svg +0 -3
- package/src/assets/iconfont/arrow-right.svg +0 -3
- package/src/assets/iconfont/breadcrumb.svg +0 -1
- package/src/assets/iconfont/checkmark.svg +0 -1
- package/src/assets/iconfont/close.svg +0 -1
- package/src/assets/iconfont/confirm.svg +0 -1
- package/src/assets/iconfont/info.svg +0 -1
- package/src/assets/iconfont/menu.svg +0 -1
- package/src/assets/iconfont/more.svg +0 -1
- package/src/assets/iconfont/pause.svg +0 -1
- package/src/assets/iconfont/play.svg +0 -1
- package/src/assets/iconfont/triangle-s.svg +0 -1
- package/src/assets/iconfont/user-status-away.svg +0 -2
- package/src/assets/iconfont/user-status-dnd.svg +0 -2
- package/src/assets/iconfont/user-status-invisible.svg +0 -2
- package/src/assets/iconfont/user-status-online.svg +0 -2
- package/src/assets/inputs.scss +0 -104
- package/src/assets/variables.scss +0 -57
- package/src/components/ActionButton/ActionButton.vue +0 -160
- package/src/components/ActionButton/index.js +0 -24
- package/src/components/ActionCheckbox/ActionCheckbox.vue +0 -220
- package/src/components/ActionCheckbox/index.js +0 -24
- package/src/components/ActionInput/ActionInput.vue +0 -418
- package/src/components/ActionInput/index.js +0 -24
- package/src/components/ActionLink/ActionLink.vue +0 -132
- package/src/components/ActionLink/index.js +0 -24
- package/src/components/ActionRadio/ActionRadio.vue +0 -219
- package/src/components/ActionRadio/index.js +0 -24
- package/src/components/ActionRouter/ActionRouter.vue +0 -100
- package/src/components/ActionRouter/index.js +0 -24
- package/src/components/ActionSeparator/ActionSeparator.vue +0 -43
- package/src/components/ActionSeparator/index.js +0 -24
- package/src/components/ActionText/ActionText.vue +0 -87
- package/src/components/ActionText/index.js +0 -24
- package/src/components/ActionTextEditable/ActionTextEditable.vue +0 -306
- package/src/components/ActionTextEditable/index.js +0 -24
- package/src/components/Actions/Actions.vue +0 -764
- package/src/components/Actions/index.js +0 -24
- package/src/components/AppContent/AppContent.vue +0 -93
- package/src/components/AppContent/index.js +0 -23
- package/src/components/AppContentDetails/AppContentDetails.vue +0 -34
- package/src/components/AppContentDetails/index.js +0 -23
- package/src/components/AppContentList/AppContentList.vue +0 -44
- package/src/components/AppContentList/index.js +0 -23
- package/src/components/AppNavigation/AppNavigation.vue +0 -190
- package/src/components/AppNavigation/index.js +0 -23
- package/src/components/AppNavigationCaption/AppNavigationCaption.vue +0 -39
- package/src/components/AppNavigationCaption/index.js +0 -3
- package/src/components/AppNavigationCounter/AppNavigationCounter.vue +0 -82
- package/src/components/AppNavigationCounter/index.js +0 -25
- package/src/components/AppNavigationIconBullet/AppNavigationIconBullet.vue +0 -95
- package/src/components/AppNavigationIconBullet/index.js +0 -24
- package/src/components/AppNavigationItem/AppNavigationIconCollapsible.vue +0 -90
- package/src/components/AppNavigationItem/AppNavigationItem.vue +0 -629
- package/src/components/AppNavigationItem/InputConfirmCancel.vue +0 -134
- package/src/components/AppNavigationItem/index.js +0 -24
- package/src/components/AppNavigationNew/AppNavigationNew.vue +0 -76
- package/src/components/AppNavigationNew/index.js +0 -23
- package/src/components/AppNavigationNewItem/AppNavigationNewItem.vue +0 -165
- package/src/components/AppNavigationNewItem/index.js +0 -24
- package/src/components/AppNavigationSettings/AppNavigationSettings.vue +0 -105
- package/src/components/AppNavigationSettings/index.js +0 -23
- package/src/components/AppNavigationSpacer/AppNavigationSpacer.vue +0 -39
- package/src/components/AppNavigationSpacer/index.js +0 -23
- package/src/components/AppNavigationToggle/AppNavigationToggle.vue +0 -78
- package/src/components/AppNavigationToggle/index.js +0 -24
- package/src/components/AppSettingsDialog/AppSettingsDialog.vue +0 -331
- package/src/components/AppSettingsDialog/index.js +0 -25
- package/src/components/AppSettingsSection/AppSettingsSection.vue +0 -64
- package/src/components/AppSettingsSection/index.js +0 -25
- package/src/components/AppSidebar/AppSidebar.vue +0 -802
- package/src/components/AppSidebar/AppSidebarTabs.vue +0 -348
- package/src/components/AppSidebar/index.js +0 -23
- package/src/components/AppSidebarTab/AppSidebarTab.vue +0 -103
- package/src/components/AppSidebarTab/index.js +0 -23
- package/src/components/Avatar/Avatar.vue +0 -758
- package/src/components/Avatar/index.js +0 -25
- package/src/components/Breadcrumb/Breadcrumb.vue +0 -262
- package/src/components/Breadcrumb/index.js +0 -25
- package/src/components/Breadcrumbs/Breadcrumbs.vue +0 -537
- package/src/components/Breadcrumbs/index.js +0 -25
- package/src/components/ColorPicker/ColorPicker.vue +0 -380
- package/src/components/ColorPicker/index.js +0 -25
- package/src/components/Content/Content.vue +0 -77
- package/src/components/Content/index.js +0 -23
- package/src/components/DatetimePicker/DatetimePicker.vue +0 -195
- package/src/components/DatetimePicker/index.js +0 -28
- package/src/components/DatetimePicker/index.scss +0 -405
- package/src/components/EmojiPicker/EmojiPicker.vue +0 -302
- package/src/components/EmojiPicker/index.js +0 -23
- package/src/components/EmptyContent/EmptyContent.vue +0 -120
- package/src/components/EmptyContent/index.js +0 -24
- package/src/components/Highlight/Highlight.vue +0 -183
- package/src/components/Highlight/index.js +0 -25
- package/src/components/ListItemIcon/ListItemIcon.vue +0 -277
- package/src/components/ListItemIcon/index.js +0 -25
- package/src/components/Modal/Modal.vue +0 -833
- package/src/components/Modal/index.js +0 -27
- package/src/components/Multiselect/EllipsisedOption.vue +0 -141
- package/src/components/Multiselect/Multiselect.vue +0 -430
- package/src/components/Multiselect/index.js +0 -28
- package/src/components/Multiselect/index.scss +0 -290
- package/src/components/MultiselectTags/MultiselectTags.vue +0 -179
- package/src/components/MultiselectTags/api.js +0 -115
- package/src/components/MultiselectTags/index.js +0 -23
- package/src/components/Popover/Popover.vue +0 -208
- package/src/components/Popover/index.js +0 -25
- package/src/components/PopoverMenu/PopoverMenu.vue +0 -62
- package/src/components/PopoverMenu/PopoverMenuItem.vue +0 -382
- package/src/components/PopoverMenu/index.js +0 -24
- package/src/components/ProgressBar/ProgressBar.vue +0 -135
- package/src/components/ProgressBar/index.js +0 -25
- package/src/components/RichContenteditable/AutoCompleteResult.vue +0 -191
- package/src/components/RichContenteditable/MentionBubble.vue +0 -165
- package/src/components/RichContenteditable/RichContenteditable.vue +0 -517
- package/src/components/RichContenteditable/index.js +0 -25
- package/src/components/SettingsInputText/SettingsInputText.vue +0 -207
- package/src/components/SettingsInputText/index.js +0 -24
- package/src/components/SettingsSection/SettingsSection.vue +0 -151
- package/src/components/SettingsSection/index.js +0 -24
- package/src/components/SettingsSelectGroup/SettingsSelectGroup.vue +0 -149
- package/src/components/SettingsSelectGroup/index.js +0 -25
- package/src/components/UserBubble/UserBubble.vue +0 -319
- package/src/components/UserBubble/index.js +0 -25
- package/src/components/index.js +0 -110
- package/src/directives/Focus/index.js +0 -29
- package/src/directives/Linkify/index.js +0 -31
- package/src/directives/Tooltip/index.js +0 -32
- package/src/directives/Tooltip/index.scss +0 -117
- package/src/directives/index.js +0 -31
- package/src/fonts/iconfont-vue-f56d517.eot +0 -0
- package/src/fonts/iconfont-vue-f56d517.svg +0 -1
- package/src/fonts/iconfont-vue-f56d517.ttf +0 -0
- package/src/fonts/iconfont-vue-f56d517.woff +0 -0
- package/src/fonts/scss/iconfont-vue.scss +0 -115
- package/src/functions/usernameToColor/index.js +0 -25
- package/src/functions/usernameToColor/usernameToColor.js +0 -68
- package/src/index.js +0 -40
- package/src/l10n.js +0 -42
- package/src/mixins/actionGlobal.js +0 -59
- package/src/mixins/actionText.js +0 -85
- package/src/mixins/excludeClickOutsideClasses/index.js +0 -72
- package/src/mixins/index.js +0 -35
- package/src/mixins/isFullscreen/index.js +0 -46
- package/src/mixins/isMobile/index.js +0 -43
- package/src/mixins/l10n.js +0 -8
- package/src/mixins/richEditor/index.js +0 -160
- package/src/mixins/userStatus.js +0 -76
- package/src/utils/FindRanges.js +0 -47
- package/src/utils/GenColors.js +0 -79
- package/src/utils/GenRandomId.js +0 -31
- package/src/utils/GetChildren.js +0 -47
- package/src/utils/GetParent.js +0 -41
- package/src/utils/IsMobileState.js +0 -49
- package/src/utils/IsOutOfViewport.js +0 -36
- package/src/utils/ScopeComponent.js +0 -37
- package/src/utils/Timer.js +0 -61
- package/src/utils/ValidateChildren.js +0 -50
- package/src/utils/ValidateSlot.js +0 -57
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @copyright Copyright (c) 2018 Julius Härtl <jus@bitgrid.net>
|
|
3
|
-
*
|
|
4
|
-
* @author Julius Härtl <jus@bitgrid.net>
|
|
5
|
-
*
|
|
6
|
-
* @license GNU AGPL version 3 or any later version
|
|
7
|
-
*
|
|
8
|
-
* This program is free software: you can redistribute it and/or modify
|
|
9
|
-
* it under the terms of the GNU Affero General Public License as
|
|
10
|
-
* published by the Free Software Foundation, either version 3 of the
|
|
11
|
-
* License, or (at your option) any later version.
|
|
12
|
-
*
|
|
13
|
-
* This program is distributed in the hope that it will be useful,
|
|
14
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
15
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
16
|
-
* GNU Affero General Public License for more details.
|
|
17
|
-
*
|
|
18
|
-
* You should have received a copy of the GNU Affero General Public License
|
|
19
|
-
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
20
|
-
*
|
|
21
|
-
*/
|
|
22
|
-
|
|
23
|
-
import Avatar from './Avatar'
|
|
24
|
-
|
|
25
|
-
export default Avatar
|
|
@@ -1,262 +0,0 @@
|
|
|
1
|
-
<!--
|
|
2
|
-
- @copyright Copyright (c) 2020 Raimund Schlüßler <raimund.schluessler@mailbox.org>
|
|
3
|
-
-
|
|
4
|
-
- @author Raimund Schlüßler <raimund.schluessler@mailbox.org>
|
|
5
|
-
-
|
|
6
|
-
- @license GNU AGPL version 3 or any later version
|
|
7
|
-
-
|
|
8
|
-
- This program is free software: you can redistribute it and/or modify
|
|
9
|
-
- it under the terms of the GNU Affero General Public License as
|
|
10
|
-
- published by the Free Software Foundation, either version 3 of the
|
|
11
|
-
- License, or (at your option) any later version.
|
|
12
|
-
-
|
|
13
|
-
- This program is distributed in the hope that it will be useful,
|
|
14
|
-
- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
15
|
-
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
16
|
-
- GNU Affero General Public License for more details.
|
|
17
|
-
-
|
|
18
|
-
- You should have received a copy of the GNU Affero General Public License
|
|
19
|
-
- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
20
|
-
-
|
|
21
|
-
-->
|
|
22
|
-
|
|
23
|
-
<docs>
|
|
24
|
-
|
|
25
|
-
### General description
|
|
26
|
-
|
|
27
|
-
This component is meant to be used inside a Breadcrumbs component.
|
|
28
|
-
|
|
29
|
-
</docs>
|
|
30
|
-
|
|
31
|
-
<template>
|
|
32
|
-
<div ref="crumb"
|
|
33
|
-
class="crumb"
|
|
34
|
-
:class="{'crumb--with-action': $slots.default, 'crumb--hovered': hovering}"
|
|
35
|
-
draggable="false"
|
|
36
|
-
@dragstart.prevent="() => {/** Prevent the breadcrumb from being draggable. */}"
|
|
37
|
-
@drop.prevent="dropped"
|
|
38
|
-
@dragover.prevent="() => {}"
|
|
39
|
-
@dragenter="dragEnter"
|
|
40
|
-
@dragleave="dragLeave">
|
|
41
|
-
<element
|
|
42
|
-
:is="tag"
|
|
43
|
-
v-if="title || icon"
|
|
44
|
-
:to="to"
|
|
45
|
-
:href="href">
|
|
46
|
-
<span v-if="icon" :class="icon" class="icon" />
|
|
47
|
-
<span v-else>{{ title }}</span>
|
|
48
|
-
</element>
|
|
49
|
-
<Actions ref="actions"
|
|
50
|
-
:force-menu="forceMenu"
|
|
51
|
-
:open="open"
|
|
52
|
-
@update:open="onOpenChange">
|
|
53
|
-
<!-- @slot All action elements passed into the default slot will be used -->
|
|
54
|
-
<slot />
|
|
55
|
-
</Actions>
|
|
56
|
-
</div>
|
|
57
|
-
</template>
|
|
58
|
-
|
|
59
|
-
<script>
|
|
60
|
-
import Actions from '../Actions'
|
|
61
|
-
|
|
62
|
-
export default {
|
|
63
|
-
name: 'Breadcrumb',
|
|
64
|
-
components: {
|
|
65
|
-
Actions,
|
|
66
|
-
},
|
|
67
|
-
props: {
|
|
68
|
-
/**
|
|
69
|
-
* The displayed title of the breadcrumb.
|
|
70
|
-
*/
|
|
71
|
-
title: {
|
|
72
|
-
type: String,
|
|
73
|
-
required: true,
|
|
74
|
-
},
|
|
75
|
-
/**
|
|
76
|
-
* The router-link to prop [https://router.vuejs.org/api/#to](https://router.vuejs.org/api/#to)
|
|
77
|
-
* If set, the breadcrumbs will be rendered by router-link.
|
|
78
|
-
*/
|
|
79
|
-
to: {
|
|
80
|
-
type: String,
|
|
81
|
-
default: undefined,
|
|
82
|
-
},
|
|
83
|
-
/**
|
|
84
|
-
* Set this prop if your app doesn't use vue-router, breadcrumbs will show as normal links.
|
|
85
|
-
*/
|
|
86
|
-
href: {
|
|
87
|
-
type: String,
|
|
88
|
-
default: undefined,
|
|
89
|
-
},
|
|
90
|
-
/**
|
|
91
|
-
* Set a css icon-class to show an icon instead of the title text.
|
|
92
|
-
*/
|
|
93
|
-
icon: {
|
|
94
|
-
type: String,
|
|
95
|
-
default: '',
|
|
96
|
-
},
|
|
97
|
-
/**
|
|
98
|
-
* Disable dropping on this breadcrumb.
|
|
99
|
-
*/
|
|
100
|
-
disableDrop: {
|
|
101
|
-
type: Boolean,
|
|
102
|
-
default: false,
|
|
103
|
-
},
|
|
104
|
-
/**
|
|
105
|
-
* Force the actions to display in a three dot menu
|
|
106
|
-
*/
|
|
107
|
-
forceMenu: {
|
|
108
|
-
type: Boolean,
|
|
109
|
-
default: false,
|
|
110
|
-
},
|
|
111
|
-
/**
|
|
112
|
-
* Open state of the Actions menu
|
|
113
|
-
*/
|
|
114
|
-
open: {
|
|
115
|
-
type: Boolean,
|
|
116
|
-
default: false,
|
|
117
|
-
},
|
|
118
|
-
},
|
|
119
|
-
data() {
|
|
120
|
-
return {
|
|
121
|
-
/**
|
|
122
|
-
* Variable to track if we hover over the breadcrumb
|
|
123
|
-
*/
|
|
124
|
-
hovering: false,
|
|
125
|
-
}
|
|
126
|
-
},
|
|
127
|
-
computed: {
|
|
128
|
-
/**
|
|
129
|
-
* Determines which element tag to use
|
|
130
|
-
*
|
|
131
|
-
* @returns {String} the tag
|
|
132
|
-
*/
|
|
133
|
-
tag() {
|
|
134
|
-
return this.to ? 'router-link' : 'a'
|
|
135
|
-
},
|
|
136
|
-
},
|
|
137
|
-
methods: {
|
|
138
|
-
/**
|
|
139
|
-
* Function to handle changing the open state of the Actions menu
|
|
140
|
-
* $emit the open state.
|
|
141
|
-
*
|
|
142
|
-
* @param {boolean} open The open state of the Actions menu
|
|
143
|
-
*/
|
|
144
|
-
onOpenChange(open) {
|
|
145
|
-
/**
|
|
146
|
-
* Event emitted when the open state of the Actions menu changes
|
|
147
|
-
* @type {null}
|
|
148
|
-
*/
|
|
149
|
-
this.$emit('update:open', open)
|
|
150
|
-
},
|
|
151
|
-
/**
|
|
152
|
-
* Function to handle a drop on the breadcrumb.
|
|
153
|
-
* $emit the event and the path, remove the hovering state.
|
|
154
|
-
*
|
|
155
|
-
* @param {Object} e The drop event
|
|
156
|
-
* @returns {boolean}
|
|
157
|
-
*/
|
|
158
|
-
dropped(e) {
|
|
159
|
-
/**
|
|
160
|
-
* Don't do anything if dropping is disabled.
|
|
161
|
-
*/
|
|
162
|
-
if (this.disableDrop) {
|
|
163
|
-
return false
|
|
164
|
-
}
|
|
165
|
-
/**
|
|
166
|
-
* Event emitted when something is dropped on the breadcrumb.
|
|
167
|
-
* @type {null}
|
|
168
|
-
*/
|
|
169
|
-
this.$emit('dropped', e, this.to || this.href)
|
|
170
|
-
this.$parent.$emit('dropped', e, this.to || this.href)
|
|
171
|
-
this.hovering = false
|
|
172
|
-
return false
|
|
173
|
-
},
|
|
174
|
-
/**
|
|
175
|
-
* Add the hovering state on drag enter
|
|
176
|
-
*
|
|
177
|
-
* @param {Object} e The drag enter event
|
|
178
|
-
*/
|
|
179
|
-
dragEnter(e) {
|
|
180
|
-
/**
|
|
181
|
-
* Don't do anything if dropping is disabled.
|
|
182
|
-
*/
|
|
183
|
-
if (this.disableDrop) {
|
|
184
|
-
return
|
|
185
|
-
}
|
|
186
|
-
this.hovering = true
|
|
187
|
-
},
|
|
188
|
-
/**
|
|
189
|
-
* Remove the hovering state on drag leave
|
|
190
|
-
*
|
|
191
|
-
* @param {Object} e The drag leave event
|
|
192
|
-
*/
|
|
193
|
-
dragLeave(e) {
|
|
194
|
-
/**
|
|
195
|
-
* Don't do anything if dropping is disabled.
|
|
196
|
-
*/
|
|
197
|
-
if (this.disableDrop) {
|
|
198
|
-
return
|
|
199
|
-
}
|
|
200
|
-
// Don't do anything if we
|
|
201
|
-
// - leave towards a child element.
|
|
202
|
-
// - or are still within the crumb
|
|
203
|
-
if (e.target.contains(e.relatedTarget)
|
|
204
|
-
|| this.$refs.crumb.contains(e.relatedTarget)) {
|
|
205
|
-
return
|
|
206
|
-
}
|
|
207
|
-
this.hovering = false
|
|
208
|
-
},
|
|
209
|
-
},
|
|
210
|
-
}
|
|
211
|
-
</script>
|
|
212
|
-
|
|
213
|
-
<style lang="scss" scoped>
|
|
214
|
-
@import '../../fonts/scss/iconfont-vue';
|
|
215
|
-
|
|
216
|
-
.crumb {
|
|
217
|
-
@include iconfont('breadcrumb');
|
|
218
|
-
background-image: none;
|
|
219
|
-
display: inline-flex;
|
|
220
|
-
height: $clickable-area;
|
|
221
|
-
padding: 0;
|
|
222
|
-
|
|
223
|
-
&:last-child {
|
|
224
|
-
max-width: 210px;
|
|
225
|
-
|
|
226
|
-
a {
|
|
227
|
-
flex-shrink: 1;
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
&::before {
|
|
232
|
-
display: flex;
|
|
233
|
-
align-items: center;
|
|
234
|
-
order: 1;
|
|
235
|
-
color: var(--color-border-dark);
|
|
236
|
-
font-size: 26px;
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
&--hidden {
|
|
240
|
-
display: none;
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
&--with-action a {
|
|
244
|
-
padding-right: 2px;
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
> a, > span {
|
|
248
|
-
max-width: 100%;
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
a {
|
|
252
|
-
align-items: center;
|
|
253
|
-
display: inline-flex;
|
|
254
|
-
|
|
255
|
-
> span {
|
|
256
|
-
overflow: hidden;
|
|
257
|
-
text-overflow: ellipsis;
|
|
258
|
-
white-space: nowrap;
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
</style>
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @copyright Copyright (c) 2020 Raimund Schlüßler <raimund.schluessler@mailbox.org>
|
|
3
|
-
*
|
|
4
|
-
* @author Raimund Schlüßler <raimund.schluessler@mailbox.org>
|
|
5
|
-
*
|
|
6
|
-
* @license GNU AGPL version 3 or any later version
|
|
7
|
-
*
|
|
8
|
-
* This program is free software: you can redistribute it and/or modify
|
|
9
|
-
* it under the terms of the GNU Affero General Public License as
|
|
10
|
-
* published by the Free Software Foundation, either version 3 of the
|
|
11
|
-
* License, or (at your option) any later version.
|
|
12
|
-
*
|
|
13
|
-
* This program is distributed in the hope that it will be useful,
|
|
14
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
15
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
16
|
-
* GNU Affero General Public License for more details.
|
|
17
|
-
*
|
|
18
|
-
* You should have received a copy of the GNU Affero General Public License
|
|
19
|
-
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
20
|
-
*
|
|
21
|
-
*/
|
|
22
|
-
|
|
23
|
-
import Breadcrumb from './Breadcrumb'
|
|
24
|
-
|
|
25
|
-
export default Breadcrumb
|
|
@@ -1,537 +0,0 @@
|
|
|
1
|
-
<!--
|
|
2
|
-
- @copyright Copyright (c) 2020 Raimund Schlüßler <raimund.schluessler@mailbox.org>
|
|
3
|
-
-
|
|
4
|
-
- @author Raimund Schlüßler <raimund.schluessler@mailbox.org>
|
|
5
|
-
-
|
|
6
|
-
- @license GNU AGPL version 3 or any later version
|
|
7
|
-
-
|
|
8
|
-
- This program is free software: you can redistribute it and/or modify
|
|
9
|
-
- it under the terms of the GNU Affero General Public License as
|
|
10
|
-
- published by the Free Software Foundation, either version 3 of the
|
|
11
|
-
- License, or (at your option) any later version.
|
|
12
|
-
-
|
|
13
|
-
- This program is distributed in the hope that it will be useful,
|
|
14
|
-
- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
15
|
-
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
16
|
-
- GNU Affero General Public License for more details.
|
|
17
|
-
-
|
|
18
|
-
- You should have received a copy of the GNU Affero General Public License
|
|
19
|
-
- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
20
|
-
-
|
|
21
|
-
-->
|
|
22
|
-
|
|
23
|
-
<docs>
|
|
24
|
-
|
|
25
|
-
### General description
|
|
26
|
-
|
|
27
|
-
This component renders a breadcrumb bar. It adjusts to the available width
|
|
28
|
-
by hiding breadcrumbs in a dropdown menu and emits an event when something
|
|
29
|
-
is dropped on a creadcrumb.
|
|
30
|
-
|
|
31
|
-
### Usage
|
|
32
|
-
|
|
33
|
-
```vue
|
|
34
|
-
<template>
|
|
35
|
-
<div>
|
|
36
|
-
<div class="container">
|
|
37
|
-
<Breadcrumbs @dropped="dropped">
|
|
38
|
-
<Breadcrumb title="Home" href="/" @dropped="droppedOnCrumb" />
|
|
39
|
-
<Breadcrumb title="Folder 1" href="/Folder 1" />
|
|
40
|
-
<Breadcrumb title="Folder 2" href="/Folder 1/Folder 2" :disable-drop="true" />
|
|
41
|
-
<Breadcrumb title="Folder 3" href="/Folder 1/Folder 2/Folder 3" />
|
|
42
|
-
<Breadcrumb title="Folder 4" href="/Folder 1/Folder 2/Folder 3/Folder 4" />
|
|
43
|
-
<Breadcrumb title="Folder 5" href="/Folder 1/Folder 2/Folder 3/Folder 4/Folder 5" :disable-drop="true">
|
|
44
|
-
<ActionButton icon="icon-share" @click="alert('Share')">
|
|
45
|
-
Share
|
|
46
|
-
</ActionButton>
|
|
47
|
-
</Breadcrumb>
|
|
48
|
-
</Breadcrumbs>
|
|
49
|
-
</div>
|
|
50
|
-
<br />
|
|
51
|
-
<div class="dragme" draggable="true" @dragstart="dragStart">
|
|
52
|
-
<span>Drag me onto the breadcrumbs.</span>
|
|
53
|
-
</div>
|
|
54
|
-
</div>
|
|
55
|
-
</template>
|
|
56
|
-
|
|
57
|
-
<script>
|
|
58
|
-
export default {
|
|
59
|
-
methods: {
|
|
60
|
-
dropped(e, path) {
|
|
61
|
-
alert('Global drop on ' + path)
|
|
62
|
-
},
|
|
63
|
-
droppedOnCrumb(e, path) {
|
|
64
|
-
alert('Drop on crumb ' + path)
|
|
65
|
-
},
|
|
66
|
-
dragStart(e) {
|
|
67
|
-
e.dataTransfer.setData('text/plain', 'dragging')
|
|
68
|
-
},
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
</script>
|
|
72
|
-
<style>
|
|
73
|
-
.container {
|
|
74
|
-
display: inline-flex;
|
|
75
|
-
width: 100%;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
.dragme {
|
|
79
|
-
display: block;
|
|
80
|
-
width: 100px;
|
|
81
|
-
height: 44px;
|
|
82
|
-
background-color: var(--color-background-dark);
|
|
83
|
-
}
|
|
84
|
-
</style>
|
|
85
|
-
```
|
|
86
|
-
</docs>
|
|
87
|
-
|
|
88
|
-
<script>
|
|
89
|
-
import Vue from 'vue'
|
|
90
|
-
import debounce from 'debounce'
|
|
91
|
-
import Actions from '../Actions'
|
|
92
|
-
import ActionRouter from '../ActionRouter'
|
|
93
|
-
import ActionLink from '../ActionLink'
|
|
94
|
-
import ValidateSlot from '../../utils/ValidateSlot'
|
|
95
|
-
import Breadcrumb from '../Breadcrumb'
|
|
96
|
-
import { subscribe, unsubscribe } from '@nextcloud/event-bus'
|
|
97
|
-
|
|
98
|
-
export default {
|
|
99
|
-
name: 'Breadcrumbs',
|
|
100
|
-
components: {
|
|
101
|
-
Actions,
|
|
102
|
-
ActionRouter,
|
|
103
|
-
ActionLink,
|
|
104
|
-
Breadcrumb,
|
|
105
|
-
},
|
|
106
|
-
props: {
|
|
107
|
-
/**
|
|
108
|
-
* Set a css icon-class for the icon of the root breadcrumb to be used.
|
|
109
|
-
*/
|
|
110
|
-
rootIcon: {
|
|
111
|
-
type: String,
|
|
112
|
-
default: 'icon-home',
|
|
113
|
-
},
|
|
114
|
-
},
|
|
115
|
-
data() {
|
|
116
|
-
return {
|
|
117
|
-
/**
|
|
118
|
-
* The breadcrumbs which should be shown in a dropdown Actions menu.
|
|
119
|
-
*/
|
|
120
|
-
hiddenCrumbs: [],
|
|
121
|
-
/**
|
|
122
|
-
* Array to track the hidden breadcrumbs by their index.
|
|
123
|
-
* Comparing two crumbs somehow does not work, so we use the indices.
|
|
124
|
-
*/
|
|
125
|
-
hiddenIndices: [],
|
|
126
|
-
|
|
127
|
-
/**
|
|
128
|
-
* This is the props of the middle Action menu
|
|
129
|
-
* that show the ellipsised breadcrumbs
|
|
130
|
-
*/
|
|
131
|
-
menuBreadcrumbProps: {
|
|
132
|
-
// Don't show a title for this breadcrumb, only the Actions menu
|
|
133
|
-
title: '',
|
|
134
|
-
forceMenu: true,
|
|
135
|
-
// Don't allow dropping directly on the actions breadcrumb
|
|
136
|
-
disableDrop: true,
|
|
137
|
-
// Is the menu open or not
|
|
138
|
-
open: false,
|
|
139
|
-
},
|
|
140
|
-
}
|
|
141
|
-
},
|
|
142
|
-
beforeMount() {
|
|
143
|
-
// Filter all invalid items, only Breadcrumb components are allowed
|
|
144
|
-
ValidateSlot(this.$slots.default, ['Breadcrumb'], this)
|
|
145
|
-
},
|
|
146
|
-
beforeUpdate() {
|
|
147
|
-
// Also check before every update
|
|
148
|
-
ValidateSlot(this.$slots.default, ['Breadcrumb'], this)
|
|
149
|
-
},
|
|
150
|
-
created() {
|
|
151
|
-
/**
|
|
152
|
-
* Add a listener so the component reacts on resize
|
|
153
|
-
*/
|
|
154
|
-
window.addEventListener('resize', debounce(() => {
|
|
155
|
-
this.handleWindowResize()
|
|
156
|
-
}, 100))
|
|
157
|
-
subscribe('navigation-toggled', this.delayedResize)
|
|
158
|
-
},
|
|
159
|
-
mounted() {
|
|
160
|
-
this.handleWindowResize()
|
|
161
|
-
},
|
|
162
|
-
updated() {
|
|
163
|
-
/**
|
|
164
|
-
* Check the size on update
|
|
165
|
-
*/
|
|
166
|
-
this.delayedResize()
|
|
167
|
-
/**
|
|
168
|
-
* Check that crumbs to hide are hidden
|
|
169
|
-
*/
|
|
170
|
-
this.delayedHideCrumbs()
|
|
171
|
-
},
|
|
172
|
-
beforeDestroy() {
|
|
173
|
-
window.removeEventListener('resize', this.handleWindowResize)
|
|
174
|
-
unsubscribe('navigation-toggled', this.delayedResize)
|
|
175
|
-
},
|
|
176
|
-
methods: {
|
|
177
|
-
/**
|
|
178
|
-
* Check that all crumbs to hide are really hidden
|
|
179
|
-
*/
|
|
180
|
-
delayedHideCrumbs() {
|
|
181
|
-
this.$nextTick(() => {
|
|
182
|
-
const crumbs = this.$slots.default || []
|
|
183
|
-
this.hideCrumbs(crumbs)
|
|
184
|
-
})
|
|
185
|
-
},
|
|
186
|
-
/**
|
|
187
|
-
* Close the actions menu
|
|
188
|
-
*
|
|
189
|
-
* @param {Object} e The event
|
|
190
|
-
*/
|
|
191
|
-
closeActions(e) {
|
|
192
|
-
// Don't do anything if we leave towards a child element.
|
|
193
|
-
if (this.$refs.actionsBreadcrumb.$el.contains(e.relatedTarget)) {
|
|
194
|
-
return
|
|
195
|
-
}
|
|
196
|
-
this.menuBreadcrumbProps.open = false
|
|
197
|
-
},
|
|
198
|
-
/**
|
|
199
|
-
* Call the resize function after a delay
|
|
200
|
-
*/
|
|
201
|
-
delayedResize() {
|
|
202
|
-
this.$nextTick(() => {
|
|
203
|
-
this.handleWindowResize()
|
|
204
|
-
})
|
|
205
|
-
},
|
|
206
|
-
/**
|
|
207
|
-
* Check the width of the breadcrumb and hide breadcrumbs
|
|
208
|
-
* if we overflow otherwise.
|
|
209
|
-
*/
|
|
210
|
-
handleWindowResize() {
|
|
211
|
-
// All breadcrumb components passed into the default slot
|
|
212
|
-
const breadcrumbs = this.$slots.default || []
|
|
213
|
-
// If there is no container yet, we cannot determine its size
|
|
214
|
-
if (this.$refs.container) {
|
|
215
|
-
const nrCrumbs = breadcrumbs.length
|
|
216
|
-
const hiddenIndices = []
|
|
217
|
-
const availableWidth = this.$refs.container.offsetWidth
|
|
218
|
-
const totalWidth = this.getTotalWidth(breadcrumbs)
|
|
219
|
-
let overflow = totalWidth - availableWidth
|
|
220
|
-
// If we overflow, we have to take the action-item width into account as well.
|
|
221
|
-
overflow += (overflow > 0) ? 51 : 0
|
|
222
|
-
let i = 0
|
|
223
|
-
// We start hiding the breadcrumb in the center
|
|
224
|
-
const startIndex = Math.floor(nrCrumbs / 2)
|
|
225
|
-
// Don't hide the first and last breadcrumb
|
|
226
|
-
while (overflow > 0 && i < nrCrumbs - 2) {
|
|
227
|
-
// We hide elements alternating to the left and right
|
|
228
|
-
const currentIndex = startIndex + ((i % 2) ? i + 1 : i) / 2 * Math.pow(-1, i + (nrCrumbs % 2))
|
|
229
|
-
// Calculate the remaining overflow width after hiding this breadcrumb
|
|
230
|
-
overflow -= this.getWidth(breadcrumbs[currentIndex].elm)
|
|
231
|
-
hiddenIndices.push(currentIndex)
|
|
232
|
-
i++
|
|
233
|
-
}
|
|
234
|
-
// We only update the hidden crumbs if they have changed,
|
|
235
|
-
// otherwise we will run into an infinite update loop.
|
|
236
|
-
if (!this.arraysEqual(this.hiddenIndices, hiddenIndices.sort((a, b) => a - b))) {
|
|
237
|
-
// Get all breadcrumbs based on the hidden indices
|
|
238
|
-
this.hiddenCrumbs = hiddenIndices.map((index) => { return breadcrumbs[index] })
|
|
239
|
-
this.hiddenIndices = hiddenIndices
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
},
|
|
243
|
-
/**
|
|
244
|
-
* Checks if two arrays are equal.
|
|
245
|
-
* Only works for primitive arrays, but that's enough here.
|
|
246
|
-
*
|
|
247
|
-
* @param {Array} a The first array
|
|
248
|
-
* @param {Array} b The second array
|
|
249
|
-
* @returns {boolean} Wether the arrays are equal
|
|
250
|
-
*/
|
|
251
|
-
arraysEqual(a, b) {
|
|
252
|
-
if (a.length !== b.length) return false
|
|
253
|
-
if (a === b) return true
|
|
254
|
-
if (a === null || b === null) return false
|
|
255
|
-
|
|
256
|
-
for (let i = 0; i < a.length; ++i) {
|
|
257
|
-
if (a[i] !== b[i]) {
|
|
258
|
-
return false
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
return true
|
|
262
|
-
},
|
|
263
|
-
/**
|
|
264
|
-
* Calculates the total width of all breadcrumbs
|
|
265
|
-
*
|
|
266
|
-
* @param {Array} breadcrumbs All breadcrumbs
|
|
267
|
-
* @returns {Integer} The total width
|
|
268
|
-
*/
|
|
269
|
-
getTotalWidth(breadcrumbs) {
|
|
270
|
-
return breadcrumbs.reduce((width, crumb, index) => width + this.getWidth(crumb.elm), 0)
|
|
271
|
-
},
|
|
272
|
-
/**
|
|
273
|
-
* Calculates the width of the provided element
|
|
274
|
-
*
|
|
275
|
-
* @param {Object} el The element
|
|
276
|
-
* @returns {Integer} The width
|
|
277
|
-
*/
|
|
278
|
-
getWidth(el) {
|
|
279
|
-
if (!el.classList) return 0
|
|
280
|
-
const hide = el.classList.contains('crumb--hidden')
|
|
281
|
-
el.style.minWidth = 'auto'
|
|
282
|
-
el.classList.remove('crumb--hidden')
|
|
283
|
-
const w = el.offsetWidth
|
|
284
|
-
if (hide) {
|
|
285
|
-
el.classList.add('crumb--hidden')
|
|
286
|
-
}
|
|
287
|
-
el.style.minWidth = ''
|
|
288
|
-
return w
|
|
289
|
-
},
|
|
290
|
-
/**
|
|
291
|
-
* Prevents the default of a provided event
|
|
292
|
-
*
|
|
293
|
-
* @param {Object} e The event
|
|
294
|
-
* @returns {boolean}
|
|
295
|
-
*/
|
|
296
|
-
preventDefault(e) {
|
|
297
|
-
if (e.preventDefault) {
|
|
298
|
-
e.preventDefault()
|
|
299
|
-
}
|
|
300
|
-
return false
|
|
301
|
-
},
|
|
302
|
-
/**
|
|
303
|
-
* Handles the drag start.
|
|
304
|
-
* Prevents a breadcrumb from being draggable.
|
|
305
|
-
*
|
|
306
|
-
* @param {Object} e The event
|
|
307
|
-
* @returns {boolean}
|
|
308
|
-
*/
|
|
309
|
-
dragStart(e) {
|
|
310
|
-
return this.preventDefault(e)
|
|
311
|
-
},
|
|
312
|
-
/**
|
|
313
|
-
* Handles when something is dropped on the breadcrumb.
|
|
314
|
-
*
|
|
315
|
-
* @param {Object} e The drop event
|
|
316
|
-
* @param {String} path The path of the breadcrumb
|
|
317
|
-
* @param {boolean} disabled Whether dropping is disabled for this breadcrumb
|
|
318
|
-
* @returns {boolean}
|
|
319
|
-
*/
|
|
320
|
-
dropped(e, path, disabled) {
|
|
321
|
-
/**
|
|
322
|
-
* Don't emit if dropping is disabled.
|
|
323
|
-
*/
|
|
324
|
-
if (!disabled) {
|
|
325
|
-
/**
|
|
326
|
-
* Event emitted when something is dropped on the breadcrumb.
|
|
327
|
-
* @type {null}
|
|
328
|
-
*/
|
|
329
|
-
this.$emit('dropped', e, path)
|
|
330
|
-
}
|
|
331
|
-
// Close the actions menu after the drop
|
|
332
|
-
this.menuBreadcrumbProps.open = false
|
|
333
|
-
|
|
334
|
-
// Remove all hovering classes
|
|
335
|
-
const crumbs = document.querySelectorAll('.crumb')
|
|
336
|
-
crumbs.forEach((f) => { f.classList.remove('crumb--hovered') })
|
|
337
|
-
return this.preventDefault(e)
|
|
338
|
-
},
|
|
339
|
-
/**
|
|
340
|
-
* Handles the drag over event
|
|
341
|
-
*
|
|
342
|
-
* @param {Object} e The drag over event
|
|
343
|
-
* @returns {boolean}
|
|
344
|
-
*/
|
|
345
|
-
dragOver(e) {
|
|
346
|
-
return this.preventDefault(e)
|
|
347
|
-
},
|
|
348
|
-
/**
|
|
349
|
-
* Handles the drag enter event
|
|
350
|
-
*
|
|
351
|
-
* @param {Object} e The drag over event
|
|
352
|
-
* @param {boolean} disabled Whether dropping is disabled for this breadcrumb
|
|
353
|
-
*/
|
|
354
|
-
dragEnter(e, disabled) {
|
|
355
|
-
/**
|
|
356
|
-
* Don't do anything if dropping is disabled.
|
|
357
|
-
*/
|
|
358
|
-
if (disabled) {
|
|
359
|
-
return
|
|
360
|
-
}
|
|
361
|
-
// Get the correct element, in case we hover a child.
|
|
362
|
-
if (e.target.closest) {
|
|
363
|
-
const target = e.target.closest('.crumb')
|
|
364
|
-
if (target.classList && target.classList.contains('crumb')) {
|
|
365
|
-
const crumbs = document.querySelectorAll('.crumb')
|
|
366
|
-
crumbs.forEach((f) => { f.classList.remove('crumb--hovered') })
|
|
367
|
-
target.classList.add('crumb--hovered')
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
},
|
|
371
|
-
/**
|
|
372
|
-
* Handles the drag leave event
|
|
373
|
-
*
|
|
374
|
-
* @param {Object} e The drag leave event
|
|
375
|
-
* @param {boolean} disabled Whether dropping is disabled for this breadcrumb
|
|
376
|
-
*/
|
|
377
|
-
dragLeave(e, disabled) {
|
|
378
|
-
/**
|
|
379
|
-
* Don't do anything if dropping is disabled.
|
|
380
|
-
*/
|
|
381
|
-
if (disabled) {
|
|
382
|
-
return
|
|
383
|
-
}
|
|
384
|
-
// Don't do anything if we leave towards a child element.
|
|
385
|
-
if (e.target.contains(e.relatedTarget)) {
|
|
386
|
-
return
|
|
387
|
-
}
|
|
388
|
-
// Get the correct element, in case we leave directly from a child.
|
|
389
|
-
if (e.target.closest) {
|
|
390
|
-
const target = e.target.closest('.crumb')
|
|
391
|
-
if (target.contains(e.relatedTarget)) {
|
|
392
|
-
return
|
|
393
|
-
}
|
|
394
|
-
if (target.classList && target.classList.contains('crumb')) {
|
|
395
|
-
target.classList.remove('crumb--hovered')
|
|
396
|
-
}
|
|
397
|
-
}
|
|
398
|
-
},
|
|
399
|
-
/**
|
|
400
|
-
* Check for each crumb if we have to hide it and
|
|
401
|
-
* add it to the array of all crumbs.
|
|
402
|
-
*
|
|
403
|
-
* @param {Array} crumbs The array of the crumbs to hide
|
|
404
|
-
* @param {Integer} offset The offset of the indices of the provided crumbs array
|
|
405
|
-
*/
|
|
406
|
-
hideCrumbs(crumbs, offset = 0) {
|
|
407
|
-
crumbs.forEach((crumb, i) => {
|
|
408
|
-
if (crumb?.elm?.classList) {
|
|
409
|
-
if (this.hiddenIndices.includes(i + offset)) {
|
|
410
|
-
crumb.elm.classList.add('crumb--hidden')
|
|
411
|
-
} else {
|
|
412
|
-
crumb.elm.classList.remove('crumb--hidden')
|
|
413
|
-
}
|
|
414
|
-
}
|
|
415
|
-
})
|
|
416
|
-
},
|
|
417
|
-
},
|
|
418
|
-
/**
|
|
419
|
-
* The render function to display the component
|
|
420
|
-
*
|
|
421
|
-
* @param {Function} createElement The function to create VNodes
|
|
422
|
-
* @returns {VNodes} The created VNodes
|
|
423
|
-
*/
|
|
424
|
-
render(createElement) {
|
|
425
|
-
// Get the breadcrumbs
|
|
426
|
-
const breadcrumbs = this.$slots.default || []
|
|
427
|
-
|
|
428
|
-
// Check that we have at least one breadcrumb
|
|
429
|
-
if (breadcrumbs.length === 0) {
|
|
430
|
-
return
|
|
431
|
-
}
|
|
432
|
-
|
|
433
|
-
// Add the root icon to the first breadcrumb
|
|
434
|
-
Vue.set(breadcrumbs[0].componentOptions.propsData, 'icon', this.rootIcon)
|
|
435
|
-
|
|
436
|
-
// The array of all created VNodes
|
|
437
|
-
let crumbs = []
|
|
438
|
-
/**
|
|
439
|
-
* We show the first half of the breadcrumbs before the Actions dropdown menu
|
|
440
|
-
* which shows the hidden breadcrumbs.
|
|
441
|
-
*/
|
|
442
|
-
const crumbs1 = this.hiddenCrumbs.length
|
|
443
|
-
? breadcrumbs.slice(0, Math.round(breadcrumbs.length / 2))
|
|
444
|
-
: breadcrumbs
|
|
445
|
-
// Add the breadcrumbs to the array of the created VNodes, check if hiding them is necessary.
|
|
446
|
-
crumbs = crumbs.concat(crumbs1)
|
|
447
|
-
this.hideCrumbs(crumbs1)
|
|
448
|
-
|
|
449
|
-
// The Actions menu
|
|
450
|
-
if (this.hiddenCrumbs.length) {
|
|
451
|
-
// Use a breadcrumb component for the hidden breadcrumbs
|
|
452
|
-
crumbs.push(createElement('Breadcrumb', {
|
|
453
|
-
class: 'dropdown',
|
|
454
|
-
|
|
455
|
-
props: this.menuBreadcrumbProps,
|
|
456
|
-
|
|
457
|
-
// Add a ref to the Actions menu
|
|
458
|
-
ref: 'actionsBreadcrumb',
|
|
459
|
-
key: 'actions-breadcrumb-1',
|
|
460
|
-
// Add handlers so the Actions menu opens on hover
|
|
461
|
-
nativeOn: {
|
|
462
|
-
dragstart: this.dragStart,
|
|
463
|
-
dragenter: () => { this.menuBreadcrumbProps.open = true },
|
|
464
|
-
dragleave: this.closeActions,
|
|
465
|
-
},
|
|
466
|
-
on: {
|
|
467
|
-
// Make sure we keep the same open state
|
|
468
|
-
// as the Actions component
|
|
469
|
-
'update:open': (open) => {
|
|
470
|
-
this.menuBreadcrumbProps.open = open
|
|
471
|
-
},
|
|
472
|
-
},
|
|
473
|
-
// Add all hidden breadcrumbs as ActionRouter or ActionLink
|
|
474
|
-
}, this.hiddenCrumbs.map(crumb => {
|
|
475
|
-
// Get the parameters from the breadcrumb component props
|
|
476
|
-
const to = crumb.componentOptions.propsData.to
|
|
477
|
-
const href = crumb.componentOptions.propsData.href
|
|
478
|
-
const disabled = crumb.componentOptions.propsData.disableDrop
|
|
479
|
-
// Decide whether to show the breadcrumbs as ActionRouter or ActionLink
|
|
480
|
-
let element = 'ActionLink'
|
|
481
|
-
let path = href
|
|
482
|
-
if (to) {
|
|
483
|
-
element = 'ActionRouter'
|
|
484
|
-
path = to
|
|
485
|
-
}
|
|
486
|
-
return createElement(element, {
|
|
487
|
-
class: 'crumb',
|
|
488
|
-
props: {
|
|
489
|
-
to,
|
|
490
|
-
href,
|
|
491
|
-
icon: 'icon-folder',
|
|
492
|
-
},
|
|
493
|
-
// Prevent the breadcrumbs from being draggable
|
|
494
|
-
attrs: {
|
|
495
|
-
draggable: false,
|
|
496
|
-
},
|
|
497
|
-
// Add the drag and drop handlers
|
|
498
|
-
nativeOn: {
|
|
499
|
-
dragstart: this.dragStart,
|
|
500
|
-
drop: ($event) => this.dropped($event, path, disabled),
|
|
501
|
-
dragover: this.dragOver,
|
|
502
|
-
dragenter: ($event) => this.dragEnter($event, disabled),
|
|
503
|
-
dragleave: ($event) => this.dragLeave($event, disabled),
|
|
504
|
-
},
|
|
505
|
-
},
|
|
506
|
-
crumb.componentOptions.propsData.title
|
|
507
|
-
)
|
|
508
|
-
}))
|
|
509
|
-
)
|
|
510
|
-
}
|
|
511
|
-
// The second half of the breadcrumbs
|
|
512
|
-
const crumbs2 = this.hiddenCrumbs.length
|
|
513
|
-
? breadcrumbs.slice(Math.round(breadcrumbs.length / 2))
|
|
514
|
-
: []
|
|
515
|
-
crumbs = crumbs.concat(crumbs2)
|
|
516
|
-
this.hideCrumbs(crumbs2, crumbs1.length)
|
|
517
|
-
|
|
518
|
-
return createElement('div', { class: ['breadcrumb', { 'breadcrumb--collapsed': (this.hiddenCrumbs.length === breadcrumbs.length - 2) }], ref: 'container' }, crumbs)
|
|
519
|
-
},
|
|
520
|
-
}
|
|
521
|
-
</script>
|
|
522
|
-
|
|
523
|
-
<style lang="scss" scoped>
|
|
524
|
-
.breadcrumb {
|
|
525
|
-
width: 100%;
|
|
526
|
-
flex-grow: 1;
|
|
527
|
-
|
|
528
|
-
&--collapsed .crumb:last-child {
|
|
529
|
-
min-width: 100px;
|
|
530
|
-
flex-shrink: 1;
|
|
531
|
-
}
|
|
532
|
-
|
|
533
|
-
.crumb--hovered{
|
|
534
|
-
background-color: var(--color-primary-light);
|
|
535
|
-
}
|
|
536
|
-
}
|
|
537
|
-
</style>
|