layers-design-system 2.4.0 → 2.6.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/dist/layers-design-system.js +78505 -0
- package/dist/layers-design-system.umd.cjs +285 -0
- package/dist/style.css +1 -0
- package/package.json +26 -12
- package/.nvmrc +0 -1
- package/babel.config.js +0 -5
- package/public/favicon.ico +0 -0
- package/public/index.html +0 -20
- package/src/assets/button-text-editor/double-quotes.svg +0 -4
- package/src/assets/button-text-editor/remove-formatting.svg +0 -5
- package/src/assets/button-text-editor/title.svg +0 -4
- package/src/assets/failed-to-load/failed-to-load.svg +0 -60
- package/src/assets/l-presentation/external-apps.png +0 -0
- package/src/assets/l-presentation/notification.png +0 -0
- package/src/assets/search-topics/empty-tags.svg +0 -59
- package/src/components/LAlert/docs.vue +0 -81
- package/src/components/LAlert/index.vue +0 -43
- package/src/components/LAttachmentChip/docs.vue +0 -84
- package/src/components/LAttachmentChip/index.vue +0 -179
- package/src/components/LBox/docs.vue +0 -26
- package/src/components/LBox/index.vue +0 -19
- package/src/components/LBoxHeader/index.vue +0 -24
- package/src/components/LBreadcrumb/docs.vue +0 -21
- package/src/components/LBreadcrumb/index.vue +0 -22
- package/src/components/LBreadcrumbItem/index.vue +0 -7
- package/src/components/LButton/docs.vue +0 -205
- package/src/components/LButton/index.vue +0 -369
- package/src/components/LButtonGroup/index.vue +0 -7
- package/src/components/LCarousel/docs.vue +0 -32
- package/src/components/LCarousel/index.vue +0 -88
- package/src/components/LCheckbox/docs.vue +0 -62
- package/src/components/LCheckbox/index.vue +0 -34
- package/src/components/LCheckboxButton/index.vue +0 -30
- package/src/components/LCheckboxGroup/index.vue +0 -53
- package/src/components/LChip/docs.vue +0 -113
- package/src/components/LChip/index.vue +0 -78
- package/src/components/LCircularLoader/docs.vue +0 -30
- package/src/components/LCircularLoader/index.vue +0 -97
- package/src/components/LCollapse/docs.vue +0 -68
- package/src/components/LCollapse/index.vue +0 -13
- package/src/components/LCollapseItem/index.vue +0 -28
- package/src/components/LDatePicker/docs.vue +0 -66
- package/src/components/LDatePicker/index.vue +0 -63
- package/src/components/LDialog/docs.vue +0 -36
- package/src/components/LDialog/index.vue +0 -37
- package/src/components/LDropdown/index.vue +0 -7
- package/src/components/LDropdownItem/index.vue +0 -13
- package/src/components/LDropdownMenu/docs.vue +0 -44
- package/src/components/LDropdownMenu/index.vue +0 -12
- package/src/components/LFailedToLoad/docs.vue +0 -37
- package/src/components/LFailedToLoad/index.vue +0 -61
- package/src/components/LForm/index.vue +0 -7
- package/src/components/LFormItem/index.vue +0 -12
- package/src/components/LHelperBox/assets/link.svg +0 -4
- package/src/components/LHelperBox/assets/open-envelope.svg +0 -9
- package/src/components/LHelperBox/docs.vue +0 -29
- package/src/components/LHelperBox/index.vue +0 -83
- package/src/components/LIcon/docs.vue +0 -174
- package/src/components/LIcon/index.vue +0 -55
- package/src/components/LImage/index.vue +0 -7
- package/src/components/LImageViewer/docs.vue +0 -111
- package/src/components/LImageViewer/index.vue +0 -449
- package/src/components/LInput/docs.vue +0 -43
- package/src/components/LInput/index.vue +0 -60
- package/src/components/LLinearProgress/docs.vue +0 -21
- package/src/components/LLinearProgress/index.vue +0 -74
- package/src/components/LNotice/docs.vue +0 -26
- package/src/components/LNotice/index.vue +0 -86
- package/src/components/LNotification/index.vue +0 -182
- package/src/components/LOption/index.vue +0 -7
- package/src/components/LOptionGroup/index.vue +0 -7
- package/src/components/LPresentation/docs.vue +0 -35
- package/src/components/LPresentation/index.vue +0 -182
- package/src/components/LProgress/index.vue +0 -7
- package/src/components/LPromptDialog/index.vue +0 -82
- package/src/components/LRadio/docs.vue +0 -54
- package/src/components/LRadio/index.vue +0 -13
- package/src/components/LRadioButton/index.vue +0 -30
- package/src/components/LRadioGroup/index.vue +0 -54
- package/src/components/LSearchBar/AddFilterButton.vue +0 -71
- package/src/components/LSearchBar/Filters/Editors/AmountEditor.vue +0 -110
- package/src/components/LSearchBar/Filters/Editors/DateEditor.vue +0 -146
- package/src/components/LSearchBar/Filters/Editors/NumberEditor.vue +0 -141
- package/src/components/LSearchBar/Filters/Editors/StringEditor.vue +0 -140
- package/src/components/LSearchBar/Filters/Editors/index.js +0 -16
- package/src/components/LSearchBar/Filters/FilterChip.vue +0 -105
- package/src/components/LSearchBar/Filters/Views/AmountView.vue +0 -28
- package/src/components/LSearchBar/Filters/Views/DateView.vue +0 -46
- package/src/components/LSearchBar/Filters/Views/NumberView.vue +0 -24
- package/src/components/LSearchBar/Filters/Views/StringView.vue +0 -47
- package/src/components/LSearchBar/Filters/Views/index.js +0 -16
- package/src/components/LSearchBar/docs.vue +0 -60
- package/src/components/LSearchBar/index.vue +0 -240
- package/src/components/LSearchTopics/RecentTermSearched.vue +0 -30
- package/src/components/LSearchTopics/TopicItem.vue +0 -346
- package/src/components/LSearchTopics/docs/drawer.vue +0 -254
- package/src/components/LSearchTopics/docs.vue +0 -60
- package/src/components/LSearchTopics/header.vue +0 -199
- package/src/components/LSearchTopics/helpers/showDialogConfirmation.js +0 -30
- package/src/components/LSearchTopics/helpers/showDiscardChangesDialog.js +0 -27
- package/src/components/LSearchTopics/index.vue +0 -750
- package/src/components/LSelect/docs.vue +0 -129
- package/src/components/LSelect/index.vue +0 -9
- package/src/components/LSlider/index.vue +0 -7
- package/src/components/LSwitch/docs.vue +0 -24
- package/src/components/LSwitch/index.vue +0 -60
- package/src/components/LTabPane/index.vue +0 -7
- package/src/components/LTable/FieldTypes/AmountView.vue +0 -16
- package/src/components/LTable/FieldTypes/DateView.vue +0 -18
- package/src/components/LTable/FieldTypes/EmailView.vue +0 -8
- package/src/components/LTable/FieldTypes/NumberView.vue +0 -13
- package/src/components/LTable/FieldTypes/PaymentStatusView.vue +0 -8
- package/src/components/LTable/FieldTypes/StringView.vue +0 -24
- package/src/components/LTable/FieldTypes/index.js +0 -18
- package/src/components/LTable/LTableBody.vue +0 -245
- package/src/components/LTable/LTableBodySpacer.vue +0 -17
- package/src/components/LTable/LTableEndspace.vue +0 -20
- package/src/components/LTable/LTableHeader.vue +0 -155
- package/src/components/LTable/LTableHeaderCell.vue +0 -188
- package/src/components/LTable/LTableHeaderLoader.vue +0 -62
- package/src/components/LTable/LTableHeaderResizer.vue +0 -162
- package/src/components/LTable/LTableLoadMore.vue +0 -56
- package/src/components/LTable/LTablePagination.vue +0 -174
- package/src/components/LTable/LTableReloader.vue +0 -61
- package/src/components/LTable/ListAdapter.js +0 -74
- package/src/components/LTable/docs.vue +0 -111
- package/src/components/LTable/helpers.js +0 -194
- package/src/components/LTable/index.vue +0 -961
- package/src/components/LTabs/docs.vue +0 -28
- package/src/components/LTabs/index.vue +0 -37
- package/src/components/LTargetChip/docs.vue +0 -86
- package/src/components/LTargetChip/index.vue +0 -64
- package/src/components/LTargetInput/docs.vue +0 -72
- package/src/components/LTargetInput/index.vue +0 -78
- package/src/components/LTextEditor/FloatingLink.vue +0 -91
- package/src/components/LTextEditor/LinkBox.vue +0 -94
- package/src/components/LTextEditor/docs.vue +0 -32
- package/src/components/LTextEditor/extensions/LayersBlockquote.js +0 -12
- package/src/components/LTextEditor/extensions/LayersBold.js +0 -11
- package/src/components/LTextEditor/extensions/LayersBreakLine.js +0 -16
- package/src/components/LTextEditor/extensions/LayersBubbleMenu.js +0 -10
- package/src/components/LTextEditor/extensions/LayersBulletList.js +0 -12
- package/src/components/LTextEditor/extensions/LayersHeading.js +0 -13
- package/src/components/LTextEditor/extensions/LayersHistory.js +0 -10
- package/src/components/LTextEditor/extensions/LayersItalic.js +0 -11
- package/src/components/LTextEditor/extensions/LayersLink.js +0 -29
- package/src/components/LTextEditor/extensions/LayersOrderedList.js +0 -12
- package/src/components/LTextEditor/extensions/LayersParagraph.js +0 -44
- package/src/components/LTextEditor/extensions/LayersPlaceholder.js +0 -11
- package/src/components/LTextEditor/extensions/LayersUnderline.js +0 -29
- package/src/components/LTextEditor/helpers/addProtocol.js +0 -5
- package/src/components/LTextEditor/helpers/removeEmptyTags.js +0 -5
- package/src/components/LTextEditor/index.vue +0 -421
- package/src/components/LTimeSelect/docs.vue +0 -41
- package/src/components/LTimeSelect/index.vue +0 -49
- package/src/components/LToggleButtonGroup/index.vue +0 -87
- package/src/components/LTooltip/docs.vue +0 -66
- package/src/components/LTooltip/index.vue +0 -28
- package/src/components/LTransitionExpand/docs.vue +0 -26
- package/src/components/LTransitionExpand/index.vue +0 -88
- package/src/components/LUpload/index.vue +0 -7
- package/src/docs/Colors.vue +0 -50
- package/src/docs/Home.vue +0 -11
- package/src/docs/Notifications.vue +0 -88
- package/src/docs/index.vue +0 -76
- package/src/docs/routes.js +0 -20
- package/src/helpers/Colors.js +0 -79
- package/src/helpers/FieldTypeComponents.js +0 -43
- package/src/helpers/Icons.js +0 -67
- package/src/helpers/Notification.js +0 -94
- package/src/helpers/PrettySize.js +0 -25
- package/src/helpers/RegisterElementUIComponents.js +0 -9
- package/src/helpers/Schemas.js +0 -18
- package/src/helpers/util.js +0 -15
- package/src/main-docs.js +0 -132
- package/src/main.js +0 -100
- package/src/style/colors.scss +0 -31
- package/src/style/element-variables.scss +0 -21
- package/src/style/icons.scss +0 -5
- package/src/style/layers-variables.scss +0 -73
- package/src/style/layout.scss +0 -2288
- package/src/style/main.scss +0 -11
- package/src/style/notifications.scss +0 -88
- package/src/style/transitions.scss +0 -43
- package/src/style/typography.scss +0 -155
- package/vue.config.js +0 -14
|
@@ -1,346 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="topic-item-group">
|
|
3
|
-
<div class="topic-item-group-header l-d-flex l-align-items-center pl-3">
|
|
4
|
-
<div
|
|
5
|
-
class="l-flex l-d-flex l-align-items-center"
|
|
6
|
-
@click.stop="toggleShowIncludes()"
|
|
7
|
-
>
|
|
8
|
-
<div
|
|
9
|
-
v-if="topic.kind == 'group' || topic.kind == 'tag'"
|
|
10
|
-
class="topic-chevron mr-2"
|
|
11
|
-
>
|
|
12
|
-
<l-icon class="gray-60--text" size="24">
|
|
13
|
-
{{ showIncludes ? 'uil-angle-down' : 'uil-angle-right' }}
|
|
14
|
-
</l-icon>
|
|
15
|
-
</div>
|
|
16
|
-
<div class="topic-icon">
|
|
17
|
-
<div class="bg-icon" :class="color(topic.kind)"></div>
|
|
18
|
-
<l-icon :class="color(topic.kind) + '--text'">
|
|
19
|
-
{{ icon(topic.kind) }}
|
|
20
|
-
</l-icon>
|
|
21
|
-
</div>
|
|
22
|
-
|
|
23
|
-
<div
|
|
24
|
-
class="l-flex ml-2 mr-3 l-text-regular ellipsis-2"
|
|
25
|
-
:class="disabled ? 'gray-70--text' : 'lead-light--text'"
|
|
26
|
-
>
|
|
27
|
-
{{ topic.name }}
|
|
28
|
-
</div>
|
|
29
|
-
</div>
|
|
30
|
-
<l-checkbox
|
|
31
|
-
:disabled="disabled"
|
|
32
|
-
:checked="isCheckedFunction(topic)"
|
|
33
|
-
:indeterminate="hasChildChecked()"
|
|
34
|
-
:key="isCheckedFunction(topic)"
|
|
35
|
-
@change="updateSelectedTopics(topic, $event)"
|
|
36
|
-
class="p-3"
|
|
37
|
-
></l-checkbox>
|
|
38
|
-
</div>
|
|
39
|
-
<hr />
|
|
40
|
-
<l-transition-expand>
|
|
41
|
-
<div class="px-3" v-if="showIncludes">
|
|
42
|
-
<template v-if="initialFetching">
|
|
43
|
-
<div
|
|
44
|
-
class="l-d-flex l-align-items-center my-2"
|
|
45
|
-
style="justify-content: center; width: 100%; height: 40px"
|
|
46
|
-
>
|
|
47
|
-
<l-circular-loader :width="40" :height="40"></l-circular-loader>
|
|
48
|
-
</div>
|
|
49
|
-
<hr />
|
|
50
|
-
</template>
|
|
51
|
-
|
|
52
|
-
<div v-else>
|
|
53
|
-
<template v-if="(!includes.length && !hasMore) || error">
|
|
54
|
-
<div class="no-data-includes l-text-regular gray-60--text">
|
|
55
|
-
{{ includesNoData }}
|
|
56
|
-
</div>
|
|
57
|
-
<hr />
|
|
58
|
-
</template>
|
|
59
|
-
<div v-else>
|
|
60
|
-
<div
|
|
61
|
-
v-for="includedTopic in includes"
|
|
62
|
-
:key="includedTopic.id"
|
|
63
|
-
class="topic-item-group-includes"
|
|
64
|
-
>
|
|
65
|
-
<div
|
|
66
|
-
class="topic-item-group-header l-d-flex l-align-items-center pl-4 ml-2"
|
|
67
|
-
>
|
|
68
|
-
<div class="l-flex l-d-flex l-align-items-center">
|
|
69
|
-
<div class="topic-icon">
|
|
70
|
-
<div
|
|
71
|
-
class="bg-icon"
|
|
72
|
-
:class="color(includedTopic.kind)"
|
|
73
|
-
></div>
|
|
74
|
-
<l-icon :class="color(includedTopic.kind) + '--text'">{{
|
|
75
|
-
icon(includedTopic.kind)
|
|
76
|
-
}}</l-icon>
|
|
77
|
-
</div>
|
|
78
|
-
|
|
79
|
-
<div
|
|
80
|
-
class="l-flex ml-2 mr-3 l-text-regular ellipsis-2"
|
|
81
|
-
:class="disabled ? 'gray-70--text' : 'lead-light--text'"
|
|
82
|
-
>
|
|
83
|
-
{{ includedTopic.name }}
|
|
84
|
-
</div>
|
|
85
|
-
</div>
|
|
86
|
-
|
|
87
|
-
<l-checkbox
|
|
88
|
-
:disabled="disabled"
|
|
89
|
-
:checked="isChildChecked(includedTopic)"
|
|
90
|
-
:key="isChildChecked(includedTopic)"
|
|
91
|
-
@change="topicIncludedChanged(includedTopic, $event)"
|
|
92
|
-
class="pl-3 py-3"
|
|
93
|
-
></l-checkbox>
|
|
94
|
-
</div>
|
|
95
|
-
<hr />
|
|
96
|
-
</div>
|
|
97
|
-
|
|
98
|
-
<div class="mx-3 my-3" v-if="hasMore">
|
|
99
|
-
<l-button
|
|
100
|
-
:loading="fetchingIncludes"
|
|
101
|
-
@click.native="fetch()"
|
|
102
|
-
plain
|
|
103
|
-
fill
|
|
104
|
-
>
|
|
105
|
-
Carregar mais
|
|
106
|
-
</l-button>
|
|
107
|
-
</div>
|
|
108
|
-
</div>
|
|
109
|
-
</div>
|
|
110
|
-
</div>
|
|
111
|
-
</l-transition-expand>
|
|
112
|
-
</div>
|
|
113
|
-
</template>
|
|
114
|
-
<script>
|
|
115
|
-
import cloneDeep from 'lodash/cloneDeep'
|
|
116
|
-
import { errorHandler } from 'layers-utils'
|
|
117
|
-
export default {
|
|
118
|
-
props: {
|
|
119
|
-
topic: {
|
|
120
|
-
type: Object,
|
|
121
|
-
},
|
|
122
|
-
disabled: {
|
|
123
|
-
type: Boolean,
|
|
124
|
-
},
|
|
125
|
-
checked: {
|
|
126
|
-
type: Boolean,
|
|
127
|
-
},
|
|
128
|
-
isCheckedFunction: {
|
|
129
|
-
type: Function,
|
|
130
|
-
},
|
|
131
|
-
populateTopic: {
|
|
132
|
-
type: Function,
|
|
133
|
-
},
|
|
134
|
-
},
|
|
135
|
-
data: function() {
|
|
136
|
-
return {
|
|
137
|
-
showIncludes: false,
|
|
138
|
-
fetchingIncludes: false,
|
|
139
|
-
initialFetching: true,
|
|
140
|
-
fetched: false,
|
|
141
|
-
error: false,
|
|
142
|
-
includes: [],
|
|
143
|
-
generator: null,
|
|
144
|
-
buffer: [],
|
|
145
|
-
hasMore: false,
|
|
146
|
-
limit: 30,
|
|
147
|
-
}
|
|
148
|
-
},
|
|
149
|
-
created() {
|
|
150
|
-
this.generator = this.combinedGenerator()
|
|
151
|
-
},
|
|
152
|
-
watch: {
|
|
153
|
-
async showIncludes(v) {
|
|
154
|
-
if (v === true && this.fetched === false) {
|
|
155
|
-
this.fetched = true
|
|
156
|
-
await this.fetch()
|
|
157
|
-
|
|
158
|
-
this.initialFetching = false
|
|
159
|
-
}
|
|
160
|
-
},
|
|
161
|
-
},
|
|
162
|
-
|
|
163
|
-
computed: {
|
|
164
|
-
includesNoData() {
|
|
165
|
-
return {
|
|
166
|
-
group: 'Esta turma ainda não tem alunos',
|
|
167
|
-
tag: 'Esta tag ainda não tem turmas',
|
|
168
|
-
}[this.topic.kind]
|
|
169
|
-
},
|
|
170
|
-
},
|
|
171
|
-
methods: {
|
|
172
|
-
async *fetchToGenerator(kind, groupContext = null) {
|
|
173
|
-
const params = {
|
|
174
|
-
id: this.topic.id,
|
|
175
|
-
kind: kind,
|
|
176
|
-
limit: this.limit + 1,
|
|
177
|
-
page: 0,
|
|
178
|
-
}
|
|
179
|
-
if (groupContext) params.groupContext = groupContext
|
|
180
|
-
let { hits, total } = await this.populateTopic(params)
|
|
181
|
-
while (total > 0) {
|
|
182
|
-
if (hits.length > 0) {
|
|
183
|
-
yield hits.shift()
|
|
184
|
-
total--
|
|
185
|
-
continue
|
|
186
|
-
}
|
|
187
|
-
params.page += 1
|
|
188
|
-
hits = (await this.populateTopic(params)).hits
|
|
189
|
-
}
|
|
190
|
-
},
|
|
191
|
-
async *combinedGenerator() {
|
|
192
|
-
if (this.topic.kind === 'group') {
|
|
193
|
-
// populate group
|
|
194
|
-
yield* this.fetchToGenerator('group', 'member')
|
|
195
|
-
yield* this.fetchToGenerator('group', 'user')
|
|
196
|
-
} else {
|
|
197
|
-
// populate tag
|
|
198
|
-
yield* this.fetchToGenerator('tag')
|
|
199
|
-
}
|
|
200
|
-
},
|
|
201
|
-
async fetchPage() {
|
|
202
|
-
const pageSize = this.limit
|
|
203
|
-
while (this.buffer.length < pageSize + 1) {
|
|
204
|
-
let result = await this.generator.next()
|
|
205
|
-
if (result.value) {
|
|
206
|
-
this.buffer.push(result.value)
|
|
207
|
-
continue
|
|
208
|
-
}
|
|
209
|
-
break
|
|
210
|
-
}
|
|
211
|
-
return { results: this.buffer.splice(0, pageSize), hasMore: this.buffer.length > 0 }
|
|
212
|
-
},
|
|
213
|
-
async fetch() {
|
|
214
|
-
const includes = cloneDeep(this.includes)
|
|
215
|
-
this.fetchingIncludes = true
|
|
216
|
-
try {
|
|
217
|
-
const { results, hasMore } = await this.fetchPage()
|
|
218
|
-
|
|
219
|
-
this.includes = [...includes, ...results]
|
|
220
|
-
this.hasMore = hasMore
|
|
221
|
-
} catch (error) {
|
|
222
|
-
this.error = error
|
|
223
|
-
this.$notify({
|
|
224
|
-
...errorHandler('Erro ao carregar mais.'),
|
|
225
|
-
duration: 10000,
|
|
226
|
-
position: 'bottom',
|
|
227
|
-
showClose: true,
|
|
228
|
-
})
|
|
229
|
-
} finally {
|
|
230
|
-
this.fetchingIncludes = false
|
|
231
|
-
}
|
|
232
|
-
},
|
|
233
|
-
|
|
234
|
-
hasChildChecked() {
|
|
235
|
-
if (this.checked) return false
|
|
236
|
-
|
|
237
|
-
if (!this.includes) return false
|
|
238
|
-
return this.includes.map(this.isCheckedFunction).some((v) => v === true)
|
|
239
|
-
},
|
|
240
|
-
|
|
241
|
-
color(kind) {
|
|
242
|
-
if (this.disabled) return 'gray-50'
|
|
243
|
-
|
|
244
|
-
return (
|
|
245
|
-
{
|
|
246
|
-
member: 'purple',
|
|
247
|
-
group: 'aqua',
|
|
248
|
-
user: 'link',
|
|
249
|
-
tag: 'warning',
|
|
250
|
-
}[kind] || 'lead'
|
|
251
|
-
)
|
|
252
|
-
},
|
|
253
|
-
icon(kind) {
|
|
254
|
-
return {
|
|
255
|
-
member: 'uil-graduation-cap',
|
|
256
|
-
group: 'uil-users-alt',
|
|
257
|
-
user: 'uil-user',
|
|
258
|
-
tag: 'uil-tag-alt',
|
|
259
|
-
}[kind]
|
|
260
|
-
},
|
|
261
|
-
|
|
262
|
-
isChildChecked(includedTopic) {
|
|
263
|
-
// it is selected or parent is selected
|
|
264
|
-
return (
|
|
265
|
-
this.isCheckedFunction(includedTopic) ||
|
|
266
|
-
this.isCheckedFunction(this.topic)
|
|
267
|
-
)
|
|
268
|
-
},
|
|
269
|
-
|
|
270
|
-
toggleShowIncludes() {
|
|
271
|
-
if (this.topic.kind === 'group' || this.topic.kind === 'tag') {
|
|
272
|
-
this.showIncludes = !this.showIncludes
|
|
273
|
-
}
|
|
274
|
-
},
|
|
275
|
-
|
|
276
|
-
updateSelectedTopics(topic, value) {
|
|
277
|
-
this.$emit('input', { topic, value })
|
|
278
|
-
},
|
|
279
|
-
|
|
280
|
-
topicIncludedChanged(topic, value) {
|
|
281
|
-
if (this.checked && !value) {
|
|
282
|
-
// uncheck parent
|
|
283
|
-
this.updateSelectedTopics(this.topic, false)
|
|
284
|
-
// check all childs
|
|
285
|
-
this.includes.forEach((includedTopic) => {
|
|
286
|
-
// excluding unchecked topic
|
|
287
|
-
if (includedTopic.id !== topic.id) {
|
|
288
|
-
this.updateSelectedTopics(includedTopic, true)
|
|
289
|
-
}
|
|
290
|
-
})
|
|
291
|
-
}
|
|
292
|
-
this.updateSelectedTopics(topic, value)
|
|
293
|
-
},
|
|
294
|
-
},
|
|
295
|
-
}
|
|
296
|
-
</script>
|
|
297
|
-
|
|
298
|
-
<style scoped>
|
|
299
|
-
.topic-item-group {
|
|
300
|
-
position: relative;
|
|
301
|
-
}
|
|
302
|
-
.topic-item-group-header {
|
|
303
|
-
min-height: 48px;
|
|
304
|
-
cursor: pointer;
|
|
305
|
-
}
|
|
306
|
-
.topic-icon {
|
|
307
|
-
width: 24px;
|
|
308
|
-
height: 24px;
|
|
309
|
-
border-radius: 12px;
|
|
310
|
-
position: relative;
|
|
311
|
-
overflow: hidden;
|
|
312
|
-
display: flex;
|
|
313
|
-
align-items: center;
|
|
314
|
-
justify-content: center;
|
|
315
|
-
flex: none;
|
|
316
|
-
}
|
|
317
|
-
.bg-icon {
|
|
318
|
-
width: 100%;
|
|
319
|
-
height: 100%;
|
|
320
|
-
position: absolute;
|
|
321
|
-
opacity: 0.1;
|
|
322
|
-
}
|
|
323
|
-
hr {
|
|
324
|
-
left: 0px;
|
|
325
|
-
margin: 0px;
|
|
326
|
-
padding: 0px;
|
|
327
|
-
border: none;
|
|
328
|
-
border-bottom: 1px solid var(--gray-30);
|
|
329
|
-
width: 100vw;
|
|
330
|
-
position: absolute;
|
|
331
|
-
}
|
|
332
|
-
.topic-item-group:last-child > hr,
|
|
333
|
-
.topic-item-group-includes:last-child > hr {
|
|
334
|
-
display: none;
|
|
335
|
-
}
|
|
336
|
-
.topic-included {
|
|
337
|
-
margin-left: 32px;
|
|
338
|
-
min-height: 48px;
|
|
339
|
-
}
|
|
340
|
-
.no-data-includes {
|
|
341
|
-
margin-left: 32px;
|
|
342
|
-
min-height: 48px;
|
|
343
|
-
display: flex;
|
|
344
|
-
align-items: center;
|
|
345
|
-
}
|
|
346
|
-
</style>
|
|
@@ -1,254 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="search-topics-page l-col l-d-flex column">
|
|
3
|
-
<!-- {{ JSON.stringify(topics, null, '\t') }} -->
|
|
4
|
-
<l-search-topics
|
|
5
|
-
:canSendForAll="true"
|
|
6
|
-
:searchTopics="searchTopics"
|
|
7
|
-
:populateTopic="populateTopic"
|
|
8
|
-
:alreadySelectedTopics="selected"
|
|
9
|
-
:recentTopicsSearched="{
|
|
10
|
-
data: recentTopicsSearchedData,
|
|
11
|
-
remove: removeFromRecentTopicsSearched,
|
|
12
|
-
push: pushToRecentTopicsSearched,
|
|
13
|
-
}"
|
|
14
|
-
@answer="$emit('answer', $event)"
|
|
15
|
-
@close="$emit('close', null)"
|
|
16
|
-
/>
|
|
17
|
-
</div>
|
|
18
|
-
</template>
|
|
19
|
-
|
|
20
|
-
<script>
|
|
21
|
-
import cloneDeep from 'lodash/cloneDeep'
|
|
22
|
-
export default {
|
|
23
|
-
name: 'Drawer',
|
|
24
|
-
|
|
25
|
-
props: {
|
|
26
|
-
selected: Array,
|
|
27
|
-
},
|
|
28
|
-
|
|
29
|
-
data() {
|
|
30
|
-
return {
|
|
31
|
-
topics: null,
|
|
32
|
-
selectedTopics: [],
|
|
33
|
-
recentTopicsSearchedData: [
|
|
34
|
-
'user 1',
|
|
35
|
-
'member 2',
|
|
36
|
-
'grupo',
|
|
37
|
-
'grup',
|
|
38
|
-
'manha',
|
|
39
|
-
],
|
|
40
|
-
member: {
|
|
41
|
-
id: 'member',
|
|
42
|
-
name: 'aluno ',
|
|
43
|
-
kind: 'member',
|
|
44
|
-
hash: '',
|
|
45
|
-
includes: [],
|
|
46
|
-
},
|
|
47
|
-
user: {
|
|
48
|
-
id: 'user',
|
|
49
|
-
name: 'user ',
|
|
50
|
-
kind: 'user',
|
|
51
|
-
hash: '',
|
|
52
|
-
includes: [],
|
|
53
|
-
},
|
|
54
|
-
group: {
|
|
55
|
-
id: 'group',
|
|
56
|
-
name: 'turma ',
|
|
57
|
-
kind: 'group',
|
|
58
|
-
hash: '',
|
|
59
|
-
includes: [],
|
|
60
|
-
},
|
|
61
|
-
tag: {
|
|
62
|
-
id: 'tag',
|
|
63
|
-
name: 'marcador',
|
|
64
|
-
kind: 'tag',
|
|
65
|
-
hash: '',
|
|
66
|
-
includes: [],
|
|
67
|
-
},
|
|
68
|
-
forAllTag: {
|
|
69
|
-
id: '*',
|
|
70
|
-
name: 'Todos',
|
|
71
|
-
kind: 'tag',
|
|
72
|
-
hash: '',
|
|
73
|
-
includes: [],
|
|
74
|
-
},
|
|
75
|
-
}
|
|
76
|
-
},
|
|
77
|
-
computed: {},
|
|
78
|
-
created() {
|
|
79
|
-
this.topics = {
|
|
80
|
-
result: {
|
|
81
|
-
tag: {
|
|
82
|
-
hits: [this.forAllTag, ...this.getEntities(this.tag, 30)],
|
|
83
|
-
total: 30,
|
|
84
|
-
},
|
|
85
|
-
group: {
|
|
86
|
-
hits: this.getEntities(this.group, 30),
|
|
87
|
-
total: 30,
|
|
88
|
-
},
|
|
89
|
-
member: {
|
|
90
|
-
hits: this.getEntities(this.member, 30),
|
|
91
|
-
total: 30,
|
|
92
|
-
},
|
|
93
|
-
user: {
|
|
94
|
-
hits: this.getEntities(this.user, 30),
|
|
95
|
-
total: 30,
|
|
96
|
-
},
|
|
97
|
-
},
|
|
98
|
-
total: 120,
|
|
99
|
-
}
|
|
100
|
-
},
|
|
101
|
-
methods: {
|
|
102
|
-
pushToRecentTopicsSearched(term) {
|
|
103
|
-
const clone = cloneDeep(this.recentTopicsSearchedData)
|
|
104
|
-
clone.push(term)
|
|
105
|
-
this.recentTopicsSearchedData = clone
|
|
106
|
-
},
|
|
107
|
-
removeFromRecentTopicsSearched(term) {
|
|
108
|
-
const clone = cloneDeep(this.recentTopicsSearchedData)
|
|
109
|
-
const indexToRemove = clone.findIndex((v) => v === term)
|
|
110
|
-
clone.splice(indexToRemove, 1)
|
|
111
|
-
this.recentTopicsSearchedData = clone
|
|
112
|
-
},
|
|
113
|
-
filterEntities(query, entity) {
|
|
114
|
-
return entity.filter((v) => {
|
|
115
|
-
if (v.kind === 'tag' && v.id === '*') return false
|
|
116
|
-
const matchQ = v.name.includes(query.q) || !query.q
|
|
117
|
-
const matchKind = v.kind === query.kind || query.kind === '*'
|
|
118
|
-
return matchQ && matchKind
|
|
119
|
-
})
|
|
120
|
-
},
|
|
121
|
-
async simulateRequest() {
|
|
122
|
-
await new Promise(r => setTimeout(r, 1500));
|
|
123
|
-
},
|
|
124
|
-
async searchTopics(query) {
|
|
125
|
-
await this.simulateRequest()
|
|
126
|
-
|
|
127
|
-
const limit = 15
|
|
128
|
-
const startingIndex = limit * query.page
|
|
129
|
-
|
|
130
|
-
if (!query.q && query.kind === '*') {
|
|
131
|
-
return {
|
|
132
|
-
result: {
|
|
133
|
-
group: {
|
|
134
|
-
hits: this.topics.result.group.hits.slice(0, 10),
|
|
135
|
-
total: this.topics.result.group.total,
|
|
136
|
-
},
|
|
137
|
-
tag: {
|
|
138
|
-
hits: this.topics.result.tag.hits.slice(0, 11),
|
|
139
|
-
total: this.topics.result.tag.total,
|
|
140
|
-
},
|
|
141
|
-
user: { hits: [], total: 0 },
|
|
142
|
-
member: { hits: [], total: 0 },
|
|
143
|
-
},
|
|
144
|
-
total: this.topics.result.group.total + this.topics.result.tag.total,
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
const filteredMembers = this.filterEntities(
|
|
148
|
-
query,
|
|
149
|
-
this.topics.result.member.hits
|
|
150
|
-
)
|
|
151
|
-
const filteredUsers = this.filterEntities(
|
|
152
|
-
query,
|
|
153
|
-
this.topics.result.user.hits
|
|
154
|
-
)
|
|
155
|
-
const filteredGroups = this.filterEntities(
|
|
156
|
-
query,
|
|
157
|
-
this.topics.result.group.hits
|
|
158
|
-
)
|
|
159
|
-
const filteredTags = this.filterEntities(
|
|
160
|
-
query,
|
|
161
|
-
this.topics.result.tag.hits
|
|
162
|
-
)
|
|
163
|
-
|
|
164
|
-
return {
|
|
165
|
-
result: {
|
|
166
|
-
member: {
|
|
167
|
-
hits: filteredMembers.slice(startingIndex, startingIndex + limit),
|
|
168
|
-
total: filteredMembers.length,
|
|
169
|
-
},
|
|
170
|
-
group: {
|
|
171
|
-
hits: filteredGroups.slice(startingIndex, startingIndex + limit),
|
|
172
|
-
total: filteredGroups.length,
|
|
173
|
-
},
|
|
174
|
-
user: {
|
|
175
|
-
hits: filteredUsers.slice(startingIndex, startingIndex + limit),
|
|
176
|
-
total: filteredUsers.length,
|
|
177
|
-
},
|
|
178
|
-
tag: {
|
|
179
|
-
hits: filteredTags.slice(startingIndex, startingIndex + limit),
|
|
180
|
-
total: filteredTags.length,
|
|
181
|
-
},
|
|
182
|
-
},
|
|
183
|
-
total:
|
|
184
|
-
filteredMembers.length +
|
|
185
|
-
filteredGroups.length +
|
|
186
|
-
filteredUsers.length +
|
|
187
|
-
filteredTags.length,
|
|
188
|
-
}
|
|
189
|
-
},
|
|
190
|
-
getEntity(entity, index) {
|
|
191
|
-
return {
|
|
192
|
-
name: `${entity.name} ${index + 1}`,
|
|
193
|
-
id: `${entity.id}${index}`,
|
|
194
|
-
hash: `${entity.hash}${index}`,
|
|
195
|
-
kind: entity.kind,
|
|
196
|
-
}
|
|
197
|
-
},
|
|
198
|
-
getEntities(entity, number) {
|
|
199
|
-
let entities = []
|
|
200
|
-
for (let i = 0; i < number; i++) {
|
|
201
|
-
entities.push(this.getEntity(entity, i))
|
|
202
|
-
}
|
|
203
|
-
return entities
|
|
204
|
-
},
|
|
205
|
-
|
|
206
|
-
sliceTopic(kind, index, limit) {
|
|
207
|
-
const result = this.topics.result[kind].hits.slice(index, index + limit)
|
|
208
|
-
return result
|
|
209
|
-
},
|
|
210
|
-
|
|
211
|
-
async populateTopic(params) {
|
|
212
|
-
await this.simulateRequest()
|
|
213
|
-
|
|
214
|
-
const startingIndex = params.page * params.limit
|
|
215
|
-
|
|
216
|
-
if (params.kind === 'tag') {
|
|
217
|
-
const groups = this.sliceTopic('group', startingIndex, params.limit)
|
|
218
|
-
return {
|
|
219
|
-
hits: groups,
|
|
220
|
-
total: 30,
|
|
221
|
-
}
|
|
222
|
-
} else if (params.groupContext === 'member') {
|
|
223
|
-
const members = this.sliceTopic('member', startingIndex, params.limit)
|
|
224
|
-
return {
|
|
225
|
-
hits: members,
|
|
226
|
-
total: 30,
|
|
227
|
-
}
|
|
228
|
-
} else if (params.groupContext === 'user') {
|
|
229
|
-
const users = this.sliceTopic('user', startingIndex, params.limit)
|
|
230
|
-
return {
|
|
231
|
-
hits: users,
|
|
232
|
-
total: 30,
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
},
|
|
236
|
-
},
|
|
237
|
-
}
|
|
238
|
-
</script>
|
|
239
|
-
<style type="text/css" scoped>
|
|
240
|
-
.search-topics-page {
|
|
241
|
-
flex: 1 1 auto;
|
|
242
|
-
position: relative;
|
|
243
|
-
min-height: 100%;
|
|
244
|
-
padding: 0px !important;
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
@media (min-width: 768px) {
|
|
248
|
-
.search-topics-page {
|
|
249
|
-
width: 600px !important;
|
|
250
|
-
min-width: 600px;
|
|
251
|
-
max-width: 600px;
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
</style>
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div id="app">
|
|
3
|
-
<h1>SearchTopics</h1>
|
|
4
|
-
|
|
5
|
-
<h3 class="mt-3">Selected Topics</h3>
|
|
6
|
-
<div @click="openModal()">
|
|
7
|
-
<l-target-input
|
|
8
|
-
style="cursor:pointer"
|
|
9
|
-
:topics="answer"
|
|
10
|
-
:limit="3"
|
|
11
|
-
editable
|
|
12
|
-
></l-target-input>
|
|
13
|
-
</div>
|
|
14
|
-
</div>
|
|
15
|
-
</template>
|
|
16
|
-
|
|
17
|
-
<script>
|
|
18
|
-
import Drawer from './docs/drawer.vue'
|
|
19
|
-
import VueModals from '@tenda.digital/vue-modals'
|
|
20
|
-
|
|
21
|
-
export default {
|
|
22
|
-
name: 'SearchTopics',
|
|
23
|
-
data() {
|
|
24
|
-
return {
|
|
25
|
-
answer: [{ id: '*', kind: 'tag', name: 'Todos' }],
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
computed: {},
|
|
29
|
-
methods: {
|
|
30
|
-
async openModal() {
|
|
31
|
-
// eslint-disable-next-line no-console
|
|
32
|
-
console.log('open modal')
|
|
33
|
-
const modalStack = VueModals.Modals.stack()
|
|
34
|
-
try {
|
|
35
|
-
const modal = await modalStack.push({
|
|
36
|
-
layout: 'drawer',
|
|
37
|
-
component: Drawer,
|
|
38
|
-
props: {
|
|
39
|
-
selected: this.answer,
|
|
40
|
-
},
|
|
41
|
-
})
|
|
42
|
-
if (modal) {
|
|
43
|
-
this.answer = modal
|
|
44
|
-
}
|
|
45
|
-
} catch (error) {
|
|
46
|
-
// ignore
|
|
47
|
-
}
|
|
48
|
-
return
|
|
49
|
-
},
|
|
50
|
-
},
|
|
51
|
-
}
|
|
52
|
-
</script>
|
|
53
|
-
|
|
54
|
-
<style scoped>
|
|
55
|
-
.topics-box {
|
|
56
|
-
border: 1px solid var(--gray-50);
|
|
57
|
-
border-radius: 5px;
|
|
58
|
-
padding: 16px;
|
|
59
|
-
}
|
|
60
|
-
</style>
|