@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,183 +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
|
-
Highlight a string with html <strong>. Accepts a substring to highlight or an array with ranges.
|
|
28
|
-
|
|
29
|
-
### Usage
|
|
30
|
-
|
|
31
|
-
```vue
|
|
32
|
-
<template>
|
|
33
|
-
<div>
|
|
34
|
-
<Highlight text="Highlight me please!" search="me" />
|
|
35
|
-
<br />
|
|
36
|
-
<Highlight text="Highlight me please!" :highlight="[{ start: 4, end: 12 }]" />
|
|
37
|
-
</div>
|
|
38
|
-
</template>
|
|
39
|
-
```
|
|
40
|
-
</docs>
|
|
41
|
-
|
|
42
|
-
<script>
|
|
43
|
-
import FindRanges from '../../utils/FindRanges'
|
|
44
|
-
|
|
45
|
-
export default {
|
|
46
|
-
name: 'Highlight',
|
|
47
|
-
props: {
|
|
48
|
-
/**
|
|
49
|
-
* The string to display
|
|
50
|
-
*/
|
|
51
|
-
text: {
|
|
52
|
-
type: String,
|
|
53
|
-
default: '',
|
|
54
|
-
},
|
|
55
|
-
/**
|
|
56
|
-
* The string to match and highlight
|
|
57
|
-
*/
|
|
58
|
-
search: {
|
|
59
|
-
type: String,
|
|
60
|
-
default: '',
|
|
61
|
-
},
|
|
62
|
-
/**
|
|
63
|
-
* The ranges to highlight, takes precedence over the search prop.
|
|
64
|
-
*/
|
|
65
|
-
highlight: {
|
|
66
|
-
type: Array,
|
|
67
|
-
default: () => [],
|
|
68
|
-
},
|
|
69
|
-
},
|
|
70
|
-
computed: {
|
|
71
|
-
/**
|
|
72
|
-
* The indice ranges which should be highlighted.
|
|
73
|
-
* If an array with ranges is provided, we use it. Otherwise
|
|
74
|
-
* we calculate it based on the provided substring to highlight.
|
|
75
|
-
*
|
|
76
|
-
* @returns {Array} The array of ranges to highlight
|
|
77
|
-
*/
|
|
78
|
-
ranges() {
|
|
79
|
-
let ranges = []
|
|
80
|
-
// If the search term and the highlight array is empty, return early with empty array
|
|
81
|
-
if (!this.search && this.highlight.length === 0) {
|
|
82
|
-
return ranges
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
// If there are ranges to highlight provided, we use this array.
|
|
86
|
-
if (this.highlight.length > 0) {
|
|
87
|
-
ranges = this.highlight
|
|
88
|
-
// Otherwise we check the text to highlight for matches of the search term.
|
|
89
|
-
} else {
|
|
90
|
-
ranges = FindRanges(this.text, this.search)
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* Validate the ranges array to be within the string length
|
|
95
|
-
* and discard ranges which are completely out of bonds.
|
|
96
|
-
*/
|
|
97
|
-
return ranges.reduce((validRanges, range) => {
|
|
98
|
-
if (range.start < this.text.length && range.end > 0) {
|
|
99
|
-
validRanges.push({
|
|
100
|
-
start: (range.start < 0) ? 0 : range.start,
|
|
101
|
-
end: (range.end > this.text.length) ? this.text.length : range.end,
|
|
102
|
-
})
|
|
103
|
-
}
|
|
104
|
-
return validRanges
|
|
105
|
-
}, [])
|
|
106
|
-
},
|
|
107
|
-
/**
|
|
108
|
-
* Calculate the different chunks to show based on the ranges to highlight.
|
|
109
|
-
*
|
|
110
|
-
* @returns {Array} The chunks
|
|
111
|
-
*/
|
|
112
|
-
chunks() {
|
|
113
|
-
// If the ranges array is empty, show only one chunk with all text
|
|
114
|
-
if (this.ranges.length === 0) {
|
|
115
|
-
return [{
|
|
116
|
-
start: 0,
|
|
117
|
-
end: this.text.length,
|
|
118
|
-
highlight: false,
|
|
119
|
-
text: this.text,
|
|
120
|
-
}]
|
|
121
|
-
}
|
|
122
|
-
// Calculate the chunks
|
|
123
|
-
const chunks = []
|
|
124
|
-
let currentIndex = 0
|
|
125
|
-
let currentRange = 0
|
|
126
|
-
// Iterate over all characters in the text
|
|
127
|
-
while (currentIndex < this.text.length) {
|
|
128
|
-
// Get the first range to highlight
|
|
129
|
-
const range = this.ranges[currentRange]
|
|
130
|
-
// If the range starts at the current index, construct a chunk to highlight,
|
|
131
|
-
// set the next range and continue with the next iteration.
|
|
132
|
-
if (range.start === currentIndex) {
|
|
133
|
-
chunks.push({
|
|
134
|
-
...range,
|
|
135
|
-
highlight: true,
|
|
136
|
-
text: this.text.substr(range.start, range.end - range.start),
|
|
137
|
-
})
|
|
138
|
-
currentRange++
|
|
139
|
-
currentIndex = range.end
|
|
140
|
-
// If this was the last range to highlight and we haven't reached the end of the text,
|
|
141
|
-
// add the rest of the text without highlighting.
|
|
142
|
-
if (currentRange >= this.ranges.length && currentIndex < this.text.length) {
|
|
143
|
-
chunks.push({
|
|
144
|
-
start: currentIndex,
|
|
145
|
-
end: this.text.length,
|
|
146
|
-
highlight: false,
|
|
147
|
-
text: this.text.substr(currentIndex, this.text.length - currentIndex),
|
|
148
|
-
})
|
|
149
|
-
// Set the current index so the while loop ends.
|
|
150
|
-
currentIndex = this.text.length
|
|
151
|
-
}
|
|
152
|
-
continue
|
|
153
|
-
}
|
|
154
|
-
// If the current range does start after the current index, construct a chunk without
|
|
155
|
-
// highlighting and set the current index to the start of the current range.
|
|
156
|
-
chunks.push({
|
|
157
|
-
start: currentIndex,
|
|
158
|
-
end: range.start,
|
|
159
|
-
highlight: false,
|
|
160
|
-
text: this.text.substr(currentIndex, range.start - currentIndex),
|
|
161
|
-
})
|
|
162
|
-
currentIndex = range.start
|
|
163
|
-
}
|
|
164
|
-
return chunks
|
|
165
|
-
},
|
|
166
|
-
},
|
|
167
|
-
/**
|
|
168
|
-
* The render function to display the component
|
|
169
|
-
*
|
|
170
|
-
* @param {Function} createElement The function to create VNodes
|
|
171
|
-
* @returns {VNodes} The created VNodes
|
|
172
|
-
*/
|
|
173
|
-
render(createElement) {
|
|
174
|
-
if (!this.ranges.length) {
|
|
175
|
-
return createElement('span', {}, this.text)
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
return createElement('span', {}, this.chunks.map(chunk => {
|
|
179
|
-
return chunk.highlight ? createElement('strong', {}, chunk.text) : chunk.text
|
|
180
|
-
}))
|
|
181
|
-
},
|
|
182
|
-
}
|
|
183
|
-
</script>
|
|
@@ -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 Highlight from './Highlight'
|
|
24
|
-
|
|
25
|
-
export default Highlight
|
|
@@ -1,277 +0,0 @@
|
|
|
1
|
-
<!--
|
|
2
|
-
- @copyright Copyright (c) 2018 John Molakvoæ <skjnldsv@protonmail.com>
|
|
3
|
-
-
|
|
4
|
-
- @author John Molakvoæ <skjnldsv@protonmail.com>
|
|
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
|
-
<docs>
|
|
23
|
-
## This is used to display a avatar-title/subtitle + icon layout
|
|
24
|
-
It might be used for list rendering or within the multiselect for example
|
|
25
|
-
|
|
26
|
-
> **Note:** Any binding will be forwarded on the Avatar component root
|
|
27
|
-
|
|
28
|
-
```vue
|
|
29
|
-
<ListItemIcon title="User 1" />
|
|
30
|
-
<ListItemIcon title="User 1" subtitle="Hidden subtitle because size is too small" :avatar-size="24" />
|
|
31
|
-
```
|
|
32
|
-
```vue
|
|
33
|
-
<ListItemIcon title="User 1" :avatar-size="44" icon="icon-user" />
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
### With icon
|
|
37
|
-
```vue
|
|
38
|
-
<ListItemIcon title="Group 1" subtitle="13 members" icon="icon-group" :is-no-user="true" />
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
### Searching
|
|
42
|
-
```vue
|
|
43
|
-
<ListItemIcon title="Test user 1" subtitle="callmetest@domain.com" search="test" />
|
|
44
|
-
<ListItemIcon title="Testing admin" subtitle="testme@example.com" search="test" />
|
|
45
|
-
<ListItemIcon title="Test group 2" subtitle="loremipsum@domain.com" icon="icon-group" :is-no-user="true" search="test" />
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
### With actions
|
|
49
|
-
```vue
|
|
50
|
-
<ListItemIcon title="Test user 1" subtitle="callmetest@domain.com">
|
|
51
|
-
<Actions>
|
|
52
|
-
<ActionButton icon="icon-edit" @click="alert('Edit')">Edit</ActionButton>
|
|
53
|
-
<ActionButton icon="icon-delete" @click="alert('Delete')">Delete</ActionButton>
|
|
54
|
-
</Actions>
|
|
55
|
-
</ListItemIcon>
|
|
56
|
-
```
|
|
57
|
-
</docs>
|
|
58
|
-
|
|
59
|
-
<template>
|
|
60
|
-
<span :id="id"
|
|
61
|
-
class="option"
|
|
62
|
-
:style="cssVars"
|
|
63
|
-
v-on="$listeners">
|
|
64
|
-
<Avatar
|
|
65
|
-
v-bind="$attrs"
|
|
66
|
-
:disable-menu="true"
|
|
67
|
-
:disable-tooltip="true"
|
|
68
|
-
:display-name="displayName || title"
|
|
69
|
-
:is-no-user="isNoUser"
|
|
70
|
-
:size="avatarSize"
|
|
71
|
-
class="option__avatar" />
|
|
72
|
-
<div class="option__details">
|
|
73
|
-
<Highlight
|
|
74
|
-
class="option__lineone"
|
|
75
|
-
:text="title"
|
|
76
|
-
:search="search" />
|
|
77
|
-
<Highlight
|
|
78
|
-
v-if="isValidSubtitle && isSizeBigEnough"
|
|
79
|
-
class="option__linetwo"
|
|
80
|
-
:text="subtitle"
|
|
81
|
-
:search="search" />
|
|
82
|
-
<span v-else-if="hasStatus">
|
|
83
|
-
<span>{{ userStatus.icon }}</span>
|
|
84
|
-
<span>{{ userStatus.message }}</span>
|
|
85
|
-
</span>
|
|
86
|
-
</div>
|
|
87
|
-
|
|
88
|
-
<!-- @slot use this slot to add a custom icon or actions -->
|
|
89
|
-
<slot />
|
|
90
|
-
<span v-if="hasIcon && !hasSlot" class="icon option__icon" :class="icon" />
|
|
91
|
-
</span>
|
|
92
|
-
</template>
|
|
93
|
-
|
|
94
|
-
<script>
|
|
95
|
-
import Avatar from '../Avatar'
|
|
96
|
-
import Highlight from '../Highlight'
|
|
97
|
-
import { userStatus } from '../../mixins'
|
|
98
|
-
|
|
99
|
-
// global margin, ^2 ratio
|
|
100
|
-
const margin = 8
|
|
101
|
-
const defaultSize = 32
|
|
102
|
-
|
|
103
|
-
export default {
|
|
104
|
-
name: 'ListItemIcon',
|
|
105
|
-
|
|
106
|
-
components: {
|
|
107
|
-
Avatar,
|
|
108
|
-
Highlight,
|
|
109
|
-
},
|
|
110
|
-
mixins: [userStatus],
|
|
111
|
-
|
|
112
|
-
props: {
|
|
113
|
-
/**
|
|
114
|
-
* Default first line text
|
|
115
|
-
*/
|
|
116
|
-
title: {
|
|
117
|
-
type: String,
|
|
118
|
-
required: true,
|
|
119
|
-
},
|
|
120
|
-
|
|
121
|
-
/**
|
|
122
|
-
* Secondary optional line
|
|
123
|
-
* Only visible on size of 32 and above
|
|
124
|
-
*/
|
|
125
|
-
subtitle: {
|
|
126
|
-
type: String,
|
|
127
|
-
default: '',
|
|
128
|
-
},
|
|
129
|
-
|
|
130
|
-
/**
|
|
131
|
-
* Icon class to be displayed at the end of the component
|
|
132
|
-
*/
|
|
133
|
-
icon: {
|
|
134
|
-
type: String,
|
|
135
|
-
default: '',
|
|
136
|
-
},
|
|
137
|
-
|
|
138
|
-
/**
|
|
139
|
-
* Search within the highlight of title/subtitle
|
|
140
|
-
*/
|
|
141
|
-
search: {
|
|
142
|
-
type: String,
|
|
143
|
-
default: '',
|
|
144
|
-
},
|
|
145
|
-
|
|
146
|
-
/**
|
|
147
|
-
* Set a size in px that will define the avatar height/width
|
|
148
|
-
* and therefore, the height of the component
|
|
149
|
-
*/
|
|
150
|
-
avatarSize: {
|
|
151
|
-
type: Number,
|
|
152
|
-
default: defaultSize,
|
|
153
|
-
},
|
|
154
|
-
|
|
155
|
-
/**
|
|
156
|
-
* Disable the margins of this component.
|
|
157
|
-
* Useful for integration in Multiselect for example
|
|
158
|
-
*/
|
|
159
|
-
noMargin: {
|
|
160
|
-
type: Boolean,
|
|
161
|
-
default: false,
|
|
162
|
-
},
|
|
163
|
-
|
|
164
|
-
/**
|
|
165
|
-
* See the [Avatar](#Avatar) displayName prop
|
|
166
|
-
* Fallback to title
|
|
167
|
-
*/
|
|
168
|
-
displayName: {
|
|
169
|
-
type: String,
|
|
170
|
-
default: null,
|
|
171
|
-
},
|
|
172
|
-
/**
|
|
173
|
-
* See the [Avatar](#Avatar) isNoUser prop
|
|
174
|
-
* Enable/disable the UserStatus fetching
|
|
175
|
-
*/
|
|
176
|
-
isNoUser: {
|
|
177
|
-
type: Boolean,
|
|
178
|
-
default: false,
|
|
179
|
-
},
|
|
180
|
-
|
|
181
|
-
/**
|
|
182
|
-
* Unique list item ID
|
|
183
|
-
*/
|
|
184
|
-
id: {
|
|
185
|
-
type: String,
|
|
186
|
-
default: null,
|
|
187
|
-
},
|
|
188
|
-
},
|
|
189
|
-
|
|
190
|
-
data() {
|
|
191
|
-
return {
|
|
192
|
-
margin,
|
|
193
|
-
}
|
|
194
|
-
},
|
|
195
|
-
|
|
196
|
-
computed: {
|
|
197
|
-
hasIcon() {
|
|
198
|
-
return this.icon !== ''
|
|
199
|
-
},
|
|
200
|
-
hasSlot() {
|
|
201
|
-
return !!this.$slots.default
|
|
202
|
-
},
|
|
203
|
-
|
|
204
|
-
isValidSubtitle() {
|
|
205
|
-
return this.subtitle?.trim?.() !== ''
|
|
206
|
-
},
|
|
207
|
-
isSizeBigEnough() {
|
|
208
|
-
return this.avatarSize >= defaultSize
|
|
209
|
-
},
|
|
210
|
-
|
|
211
|
-
cssVars() {
|
|
212
|
-
// Don't use margin to calculate the height if noMargin
|
|
213
|
-
const margin = this.noMargin ? 0 : this.margin
|
|
214
|
-
|
|
215
|
-
return {
|
|
216
|
-
'--height': this.avatarSize + 2 * margin + 'px',
|
|
217
|
-
'--margin': this.margin + 'px',
|
|
218
|
-
}
|
|
219
|
-
},
|
|
220
|
-
},
|
|
221
|
-
|
|
222
|
-
beforeMount() {
|
|
223
|
-
// If we don't have a subtitle and if this is a user
|
|
224
|
-
if (!this.isNoUser && !this.subtitle) {
|
|
225
|
-
this.fetchUserStatus(this.user)
|
|
226
|
-
}
|
|
227
|
-
},
|
|
228
|
-
}
|
|
229
|
-
</script>
|
|
230
|
-
|
|
231
|
-
<style lang="scss" scoped>
|
|
232
|
-
.option {
|
|
233
|
-
display: flex;
|
|
234
|
-
align-items: center;
|
|
235
|
-
width: 100%;
|
|
236
|
-
height: var(--height);
|
|
237
|
-
|
|
238
|
-
&__avatar {
|
|
239
|
-
margin-right: var(--margin);
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
&__details {
|
|
243
|
-
display: flex;
|
|
244
|
-
flex: 1 1;
|
|
245
|
-
flex-direction: column;
|
|
246
|
-
justify-content: center;
|
|
247
|
-
min-width: 0;
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
&__lineone {
|
|
251
|
-
color: var(--color-text-light);
|
|
252
|
-
}
|
|
253
|
-
&__linetwo {
|
|
254
|
-
opacity: $opacity_normal;
|
|
255
|
-
}
|
|
256
|
-
&__lineone,
|
|
257
|
-
&__linetwo {
|
|
258
|
-
overflow: hidden;
|
|
259
|
-
white-space: nowrap;
|
|
260
|
-
text-overflow: ellipsis;
|
|
261
|
-
line-height: 1.1em;
|
|
262
|
-
strong {
|
|
263
|
-
font-weight: bold;
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
&__icon {
|
|
268
|
-
flex: 0 0 $clickable-area;
|
|
269
|
-
width: $clickable-area;
|
|
270
|
-
height: $clickable-area;
|
|
271
|
-
opacity: $opacity_disabled;
|
|
272
|
-
background-position: center;
|
|
273
|
-
background-size: 16px;
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
</style>
|