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,105 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<el-popover
|
|
3
|
-
popper-class="filter-chip-popper"
|
|
4
|
-
class="filter-chip"
|
|
5
|
-
placement="bottom-start"
|
|
6
|
-
width="288"
|
|
7
|
-
trigger="manual"
|
|
8
|
-
v-model="editing"
|
|
9
|
-
@after-enter="afterEnterPopover"
|
|
10
|
-
>
|
|
11
|
-
<l-button type="primary" round size="small" slot="reference" @click="editing = !editing">
|
|
12
|
-
<component ref="view" v-bind:is="viewComponent" v-model="filter" :schema="schema"></component>
|
|
13
|
-
<l-icon @click.stop="remove" class="close-button">uil-times-circle</l-icon>
|
|
14
|
-
</l-button>
|
|
15
|
-
<component
|
|
16
|
-
ref="editor"
|
|
17
|
-
v-bind:is="editorComponent"
|
|
18
|
-
v-model="filter"
|
|
19
|
-
:schema="schema"
|
|
20
|
-
@cancel="cancel"
|
|
21
|
-
@change="change"
|
|
22
|
-
></component>
|
|
23
|
-
</el-popover>
|
|
24
|
-
</template>
|
|
25
|
-
|
|
26
|
-
<script>
|
|
27
|
-
import Editors from "./Editors";
|
|
28
|
-
import Views from "./Views";
|
|
29
|
-
|
|
30
|
-
import { Popover } from "element-ui";
|
|
31
|
-
|
|
32
|
-
Editors.register();
|
|
33
|
-
Views.register();
|
|
34
|
-
|
|
35
|
-
export default {
|
|
36
|
-
name: "FilterChip",
|
|
37
|
-
|
|
38
|
-
props: ["filter", "schema"],
|
|
39
|
-
|
|
40
|
-
components: {
|
|
41
|
-
'el-popover': Popover
|
|
42
|
-
},
|
|
43
|
-
|
|
44
|
-
data() {
|
|
45
|
-
return {
|
|
46
|
-
editing: false
|
|
47
|
-
};
|
|
48
|
-
},
|
|
49
|
-
|
|
50
|
-
mounted() {
|
|
51
|
-
if (!this.$refs.editor || !this.$refs.view) {
|
|
52
|
-
this.remove()
|
|
53
|
-
}
|
|
54
|
-
this.$refs.editor.validate(valid => {
|
|
55
|
-
if (!valid) {
|
|
56
|
-
this.editing = true;
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
},
|
|
60
|
-
|
|
61
|
-
methods: {
|
|
62
|
-
afterEnterPopover() {
|
|
63
|
-
if (this.$refs.editor.focus) {
|
|
64
|
-
this.$refs.editor.focus();
|
|
65
|
-
}
|
|
66
|
-
},
|
|
67
|
-
cancel() {
|
|
68
|
-
this.editing = false;
|
|
69
|
-
this.$refs.editor.validate(valid => {
|
|
70
|
-
if (!valid) {
|
|
71
|
-
this.remove();
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
},
|
|
75
|
-
change() {
|
|
76
|
-
this.editing = false;
|
|
77
|
-
},
|
|
78
|
-
remove() {
|
|
79
|
-
this.$emit("onRemove");
|
|
80
|
-
}
|
|
81
|
-
},
|
|
82
|
-
|
|
83
|
-
computed: {
|
|
84
|
-
editorComponent() {
|
|
85
|
-
return this.$L.FieldTypeComponents.get(this.schema, 'filterChipEditor');
|
|
86
|
-
},
|
|
87
|
-
viewComponent() {
|
|
88
|
-
return this.$L.FieldTypeComponents.get(this.schema, 'filterChipView');
|
|
89
|
-
}
|
|
90
|
-
},
|
|
91
|
-
};
|
|
92
|
-
</script>
|
|
93
|
-
|
|
94
|
-
<style>
|
|
95
|
-
.filter-chip-popper {
|
|
96
|
-
padding: 16px;
|
|
97
|
-
box-sizing: border-box;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
.close-button {
|
|
101
|
-
margin-left: 8px;
|
|
102
|
-
transform: scale(1.5);
|
|
103
|
-
display: inline-block;
|
|
104
|
-
}
|
|
105
|
-
</style>
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<span>
|
|
3
|
-
<l-icon>{{ $L.Icons.get(schema) }}</l-icon>
|
|
4
|
-
<strong>{{ schema.title }}</strong>
|
|
5
|
-
|
|
6
|
-
<span v-if="filter.comparison == 'eq'">=</span>
|
|
7
|
-
<span v-else-if="filter.comparison == 'lt'"><</span>
|
|
8
|
-
<span v-else-if="filter.comparison == 'lte'"><=</span>
|
|
9
|
-
<span v-else-if="filter.comparison == 'gt'">></span>
|
|
10
|
-
<span v-else-if="filter.comparison == 'gte'">>=</span>
|
|
11
|
-
|
|
12
|
-
{{ formattedValue }}
|
|
13
|
-
</span>
|
|
14
|
-
</template>
|
|
15
|
-
<script>
|
|
16
|
-
export default {
|
|
17
|
-
model: {
|
|
18
|
-
prop: "filter",
|
|
19
|
-
event: "change"
|
|
20
|
-
},
|
|
21
|
-
props: ["filter", "schema"],
|
|
22
|
-
computed: {
|
|
23
|
-
formattedValue() {
|
|
24
|
-
return this.$n(this.filter.value / 100, 'currency')
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
</script>
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<span>
|
|
3
|
-
<l-icon>{{ $L.Icons.get(schema) }}</l-icon>
|
|
4
|
-
<strong>{{ schema.title }}</strong>
|
|
5
|
-
{{ comparisonLabel }} {{ formattedValue }}
|
|
6
|
-
</span>
|
|
7
|
-
</template>
|
|
8
|
-
<script>
|
|
9
|
-
import get from "lodash/get";
|
|
10
|
-
import dayjs from 'dayjs';
|
|
11
|
-
|
|
12
|
-
export default {
|
|
13
|
-
model: {
|
|
14
|
-
prop: "filter",
|
|
15
|
-
event: "change"
|
|
16
|
-
},
|
|
17
|
-
props: ["filter", "schema"],
|
|
18
|
-
computed: {
|
|
19
|
-
comparisonLabel() {
|
|
20
|
-
return {
|
|
21
|
-
relative_past_gte: "há menos de",
|
|
22
|
-
relative_past_lt: "há mais de",
|
|
23
|
-
relative_past_eq: "há exatamente",
|
|
24
|
-
relative_future_gte: "daqui a mais de",
|
|
25
|
-
relative_future_lt: "daqui a menos de",
|
|
26
|
-
relative_future_eq: "daqui a exatamente",
|
|
27
|
-
absolute_eq: "em",
|
|
28
|
-
absolute_gte: "a partir de",
|
|
29
|
-
absolute_lt: "até"
|
|
30
|
-
}[this.filter.comparison];
|
|
31
|
-
},
|
|
32
|
-
isRelative() {
|
|
33
|
-
return this.filter.comparison && this.filter.comparison.indexOf("relative_") === 0
|
|
34
|
-
},
|
|
35
|
-
formattedValue() {
|
|
36
|
-
if (!this.filter.value) return "-"
|
|
37
|
-
|
|
38
|
-
if (this.filter.comparison.indexOf("relative_") === 0) {
|
|
39
|
-
return `${this.filter.value} ${this.filter.value > 1 ? 'dias' : 'dia'}`
|
|
40
|
-
}
|
|
41
|
-
const format = get(this.schema, 'options.format', 'LL')
|
|
42
|
-
return dayjs(this.filter.value, { locale: 'pt-br' }).format(format)
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
</script>
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<span>
|
|
3
|
-
<l-icon>{{ $L.Icons.get(schema) }}</l-icon>
|
|
4
|
-
<strong>{{ schema.title }}</strong>
|
|
5
|
-
|
|
6
|
-
<span v-if="filter.comparison == 'eq'">=</span>
|
|
7
|
-
<span v-else-if="filter.comparison == 'neq'">≠</span>
|
|
8
|
-
<span v-else-if="filter.comparison == 'lt'"><</span>
|
|
9
|
-
<span v-else-if="filter.comparison == 'lte'">≤</span>
|
|
10
|
-
<span v-else-if="filter.comparison == 'gt'">></span>
|
|
11
|
-
<span v-else-if="filter.comparison == 'gte'">≥</span>
|
|
12
|
-
|
|
13
|
-
{{ filter.value }}
|
|
14
|
-
</span>
|
|
15
|
-
</template>
|
|
16
|
-
<script>
|
|
17
|
-
export default {
|
|
18
|
-
model: {
|
|
19
|
-
prop: "filter",
|
|
20
|
-
event: "change"
|
|
21
|
-
},
|
|
22
|
-
props: ["filter", "schema"],
|
|
23
|
-
};
|
|
24
|
-
</script>
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<span>
|
|
3
|
-
<l-icon>{{ $L.Icons.get(schema) }}</l-icon>
|
|
4
|
-
<strong>{{ schema.title }}</strong>
|
|
5
|
-
{{ comparisonLabel }}
|
|
6
|
-
<template v-if="filter.comparison === 'in'">
|
|
7
|
-
<span v-for="(value, idx) in filter.value" :key="idx">
|
|
8
|
-
<component v-if="inlineComponent" v-bind:is="inlineComponent" :value="value" :schema="schema"></component>
|
|
9
|
-
<span v-else v-text="value"></span>
|
|
10
|
-
|
|
11
|
-
<template v-if="idx < filter.value.length - 1">
|
|
12
|
-
<span v-if="idx < filter.value.length - 2">, </span>
|
|
13
|
-
<span v-else> ou </span>
|
|
14
|
-
</template>
|
|
15
|
-
</span>
|
|
16
|
-
</template>
|
|
17
|
-
<template v-else>"{{ filter.value }}"</template>
|
|
18
|
-
</span>
|
|
19
|
-
</template>
|
|
20
|
-
<script>
|
|
21
|
-
export default {
|
|
22
|
-
model: {
|
|
23
|
-
prop: "filter",
|
|
24
|
-
event: "change"
|
|
25
|
-
},
|
|
26
|
-
props: ["filter", "schema"],
|
|
27
|
-
computed: {
|
|
28
|
-
inlineComponent() {
|
|
29
|
-
try {
|
|
30
|
-
return this.$L.FieldTypeComponents.get(this.schema, 'textOnly');
|
|
31
|
-
} catch(e) {
|
|
32
|
-
return null // Ignore error
|
|
33
|
-
}
|
|
34
|
-
},
|
|
35
|
-
comparisonLabel() {
|
|
36
|
-
return {
|
|
37
|
-
in: "é",
|
|
38
|
-
eq: "é",
|
|
39
|
-
neq: "não é",
|
|
40
|
-
starts_with: "começa com",
|
|
41
|
-
ends_with: "termina com",
|
|
42
|
-
contains: "contém"
|
|
43
|
-
}[this.filter.comparison];
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
</script>
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import StringView from "./StringView.vue";
|
|
2
|
-
import AmountView from "./AmountView.vue";
|
|
3
|
-
import NumberView from "./NumberView.vue";
|
|
4
|
-
import DateView from "./DateView.vue";
|
|
5
|
-
|
|
6
|
-
import { FieldTypeComponents } from '../../../../helpers/FieldTypeComponents'
|
|
7
|
-
|
|
8
|
-
const Views = {}
|
|
9
|
-
Views.register = function () {
|
|
10
|
-
FieldTypeComponents.register({ type: 'String' }, 'filterChipView', StringView);
|
|
11
|
-
FieldTypeComponents.register({ type: 'Number' }, 'filterChipView', NumberView);
|
|
12
|
-
FieldTypeComponents.register({ type: 'Date' }, 'filterChipView', DateView);
|
|
13
|
-
|
|
14
|
-
FieldTypeComponents.register({ format: 'Amount' }, 'filterChipView', AmountView);
|
|
15
|
-
}
|
|
16
|
-
export default Views
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div id="app">
|
|
3
|
-
<h1>SearchBar</h1>
|
|
4
|
-
|
|
5
|
-
<div>
|
|
6
|
-
<h2>Basic</h2>
|
|
7
|
-
<div class="row">
|
|
8
|
-
<l-search-bar
|
|
9
|
-
v-model="filterValue"
|
|
10
|
-
:availableModes="['simple', 'advanced']"
|
|
11
|
-
:schema="schema"
|
|
12
|
-
/>
|
|
13
|
-
</div>
|
|
14
|
-
<div class="row">
|
|
15
|
-
<pre>{{ filterValue }}</pre>
|
|
16
|
-
</div>
|
|
17
|
-
</div>
|
|
18
|
-
</div>
|
|
19
|
-
</template>
|
|
20
|
-
|
|
21
|
-
<script>
|
|
22
|
-
import pickBy from "lodash/pickBy";
|
|
23
|
-
|
|
24
|
-
export default {
|
|
25
|
-
name: "SearchBar",
|
|
26
|
-
data() {
|
|
27
|
-
return {
|
|
28
|
-
filterValue: null,
|
|
29
|
-
query: null
|
|
30
|
-
};
|
|
31
|
-
},
|
|
32
|
-
mounted() {
|
|
33
|
-
if (this.$route.query.q) {
|
|
34
|
-
try {
|
|
35
|
-
const newValue = JSON.parse(decodeURIComponent(this.$route.query.q));
|
|
36
|
-
this.filterValue = newValue;
|
|
37
|
-
} catch (e) {
|
|
38
|
-
// Ignore malformed filter
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
},
|
|
42
|
-
watch: {
|
|
43
|
-
filterValue(v) {
|
|
44
|
-
const q = encodeURIComponent(JSON.stringify(v));
|
|
45
|
-
this.$router.push({ query: { ...this.$route.query, q } }).catch(() => {});
|
|
46
|
-
}
|
|
47
|
-
},
|
|
48
|
-
computed: {
|
|
49
|
-
schema() {
|
|
50
|
-
return this.$L.Schemas.get('payable')
|
|
51
|
-
}
|
|
52
|
-
},
|
|
53
|
-
methods: {
|
|
54
|
-
fetchQuery() {
|
|
55
|
-
// Pick only values that are not empty string
|
|
56
|
-
return pickBy(this.query, val => (val === "" ? false : true));
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
</script>
|
|
@@ -1,240 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div
|
|
3
|
-
:class="{
|
|
4
|
-
disabled,
|
|
5
|
-
}"
|
|
6
|
-
>
|
|
7
|
-
<l-toggle-button-group
|
|
8
|
-
:disabled="disabled"
|
|
9
|
-
v-model="mode"
|
|
10
|
-
:options="availableModesOptions"
|
|
11
|
-
></l-toggle-button-group>
|
|
12
|
-
<template v-if="mode == 'simple'">
|
|
13
|
-
<l-input
|
|
14
|
-
:disabled="disabled"
|
|
15
|
-
size="large"
|
|
16
|
-
v-model="queryText"
|
|
17
|
-
style="flex: 1 1 auto"
|
|
18
|
-
:placeholder="disabled ? '' : 'Digite algo para buscar'"
|
|
19
|
-
/>
|
|
20
|
-
</template>
|
|
21
|
-
<template v-else>
|
|
22
|
-
<div class="filters">
|
|
23
|
-
<filter-chip
|
|
24
|
-
v-for="filter in filters"
|
|
25
|
-
ref="filterChips"
|
|
26
|
-
:key="filter.path"
|
|
27
|
-
:filter="filter"
|
|
28
|
-
:schema="getFilterSchema(filter)"
|
|
29
|
-
@onRemove="removeFilter(filter)"
|
|
30
|
-
/>
|
|
31
|
-
<add-filter-button
|
|
32
|
-
:schema="schema"
|
|
33
|
-
:filters="filters"
|
|
34
|
-
@addFilter="addFilter"
|
|
35
|
-
/>
|
|
36
|
-
</div>
|
|
37
|
-
</template>
|
|
38
|
-
<div class="clear-button">
|
|
39
|
-
<l-button type="text" v-show="showClearButton" @click="clear">
|
|
40
|
-
<l-icon>uil-times</l-icon>
|
|
41
|
-
</l-button>
|
|
42
|
-
</div>
|
|
43
|
-
</div>
|
|
44
|
-
</template>
|
|
45
|
-
<script>
|
|
46
|
-
import get from "lodash/get";
|
|
47
|
-
import cloneDeep from "lodash/cloneDeep";
|
|
48
|
-
import isEqual from "lodash/isEqual";
|
|
49
|
-
import findIndex from "lodash/findIndex";
|
|
50
|
-
import find from "lodash/find";
|
|
51
|
-
|
|
52
|
-
import AddFilterButton from "./AddFilterButton.vue";
|
|
53
|
-
import FilterChip from "./Filters/FilterChip.vue";
|
|
54
|
-
|
|
55
|
-
export default {
|
|
56
|
-
tagName: "l-search-bar",
|
|
57
|
-
model: {
|
|
58
|
-
prop: "value",
|
|
59
|
-
event: "change",
|
|
60
|
-
},
|
|
61
|
-
props: {
|
|
62
|
-
availableModes: {
|
|
63
|
-
type: Array,
|
|
64
|
-
default: () => ["simple"],
|
|
65
|
-
},
|
|
66
|
-
value: {
|
|
67
|
-
type: Object,
|
|
68
|
-
default: () => {
|
|
69
|
-
return {
|
|
70
|
-
mode: this.availableModes[0],
|
|
71
|
-
queryText: "",
|
|
72
|
-
filters: [],
|
|
73
|
-
};
|
|
74
|
-
},
|
|
75
|
-
},
|
|
76
|
-
schema: {
|
|
77
|
-
type: Object,
|
|
78
|
-
default: () => {
|
|
79
|
-
return {};
|
|
80
|
-
},
|
|
81
|
-
},
|
|
82
|
-
disabled: {
|
|
83
|
-
type: Boolean,
|
|
84
|
-
default: false,
|
|
85
|
-
},
|
|
86
|
-
},
|
|
87
|
-
data() {
|
|
88
|
-
return {
|
|
89
|
-
mode: get(this.value, "mode", this.availableModes[0]),
|
|
90
|
-
queryText: get(this.value, "queryText", ""),
|
|
91
|
-
filters: cloneDeep(get(this.value, "filters", [])),
|
|
92
|
-
};
|
|
93
|
-
},
|
|
94
|
-
watch: {
|
|
95
|
-
value(newValue) {
|
|
96
|
-
this.mode = get(newValue, "mode", this.availableModes[0]);
|
|
97
|
-
this.queryText = get(newValue, "queryText", "");
|
|
98
|
-
|
|
99
|
-
const newFilters = get(newValue, "filters", []);
|
|
100
|
-
if (!isEqual(this.filters, newFilters)) {
|
|
101
|
-
this.filters = cloneDeep(newFilters);
|
|
102
|
-
}
|
|
103
|
-
},
|
|
104
|
-
queryValue: {
|
|
105
|
-
deep: true,
|
|
106
|
-
handler(newValue) {
|
|
107
|
-
if (this.isValid) {
|
|
108
|
-
this.$emit("change", cloneDeep(newValue));
|
|
109
|
-
}
|
|
110
|
-
},
|
|
111
|
-
},
|
|
112
|
-
},
|
|
113
|
-
methods: {
|
|
114
|
-
getFilterSchema(filter) {
|
|
115
|
-
const { path } = filter;
|
|
116
|
-
return find(this.schema.fields, { path });
|
|
117
|
-
},
|
|
118
|
-
addFilter(option) {
|
|
119
|
-
this.filters.push(Object.assign({}, option));
|
|
120
|
-
},
|
|
121
|
-
removeFilter(filter) {
|
|
122
|
-
const index = findIndex(this.filters, filter);
|
|
123
|
-
this.$delete(this.filters, index);
|
|
124
|
-
},
|
|
125
|
-
clear() {
|
|
126
|
-
switch (this.mode) {
|
|
127
|
-
case "simple":
|
|
128
|
-
this.queryText = "";
|
|
129
|
-
return;
|
|
130
|
-
case "advanced":
|
|
131
|
-
this.filters.splice(0, this.filters.length);
|
|
132
|
-
return;
|
|
133
|
-
default:
|
|
134
|
-
throw new Error(`Unknown mode ${this.mode}`);
|
|
135
|
-
}
|
|
136
|
-
},
|
|
137
|
-
},
|
|
138
|
-
computed: {
|
|
139
|
-
queryValue() {
|
|
140
|
-
return {
|
|
141
|
-
mode: this.mode,
|
|
142
|
-
queryText: this.queryText,
|
|
143
|
-
filters: this.filters,
|
|
144
|
-
};
|
|
145
|
-
},
|
|
146
|
-
isValid() {
|
|
147
|
-
return this.filters.filter((filter) => !filter.valid).length === 0;
|
|
148
|
-
},
|
|
149
|
-
availableModesOptions() {
|
|
150
|
-
return [
|
|
151
|
-
{ icon: "uil-search", value: "simple", title: "Filtro simples" },
|
|
152
|
-
{ icon: "uil-filter", value: "advanced", title: "Filtro avançado" },
|
|
153
|
-
].filter((option) => this.availableModes.includes(option.value));
|
|
154
|
-
},
|
|
155
|
-
showClearButton() {
|
|
156
|
-
switch (this.mode) {
|
|
157
|
-
case "simple":
|
|
158
|
-
return this.queryText.length > 0;
|
|
159
|
-
case "advanced":
|
|
160
|
-
return this.filters.length > 0;
|
|
161
|
-
default:
|
|
162
|
-
throw new Error(`Unknown mode ${this.mode}`);
|
|
163
|
-
}
|
|
164
|
-
},
|
|
165
|
-
},
|
|
166
|
-
components: {
|
|
167
|
-
AddFilterButton,
|
|
168
|
-
FilterChip,
|
|
169
|
-
},
|
|
170
|
-
};
|
|
171
|
-
</script>
|
|
172
|
-
<style lang="scss">
|
|
173
|
-
@import "../../style/main.scss";
|
|
174
|
-
|
|
175
|
-
.l-search-bar {
|
|
176
|
-
$height: 48px;
|
|
177
|
-
min-height: 48px;
|
|
178
|
-
border: 1px solid #c8d0d8;
|
|
179
|
-
border-radius: 4px;
|
|
180
|
-
box-sizing: border-box;
|
|
181
|
-
transition: border-color 0.35s linear;
|
|
182
|
-
display: flex;
|
|
183
|
-
flex-direction: row;
|
|
184
|
-
flex: 1 1 auto;
|
|
185
|
-
|
|
186
|
-
.l-toggle-button-group {
|
|
187
|
-
display: flex;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
.filters {
|
|
191
|
-
display: flex;
|
|
192
|
-
flex-flow: row wrap;
|
|
193
|
-
flex-grow: 1;
|
|
194
|
-
padding: 8px 4px 4px 4px;
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
&:focus-within,
|
|
198
|
-
&:hover {
|
|
199
|
-
border-color: $--color-primary;
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
.el-input {
|
|
203
|
-
margin-top: 4px;
|
|
204
|
-
input {
|
|
205
|
-
border: 0;
|
|
206
|
-
padding: 0 0 0 4px;
|
|
207
|
-
outline: none;
|
|
208
|
-
&::placeholder {
|
|
209
|
-
color: #c8d0d8;
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
.l-toggle-button-group {
|
|
215
|
-
position: relative;
|
|
216
|
-
margin: 8px;
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
.filter-chip,
|
|
220
|
-
.add-filter-button {
|
|
221
|
-
margin: 0px 4px 4px 0px;
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
.clear-button {
|
|
225
|
-
padding: 0 12px;
|
|
226
|
-
|
|
227
|
-
.el-button {
|
|
228
|
-
color: $gray-70;
|
|
229
|
-
font-size: 20px;
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
.disabled {
|
|
234
|
-
border-color: #c8d0d8 !important;
|
|
235
|
-
background: #f5f7fa;
|
|
236
|
-
&:hover {
|
|
237
|
-
cursor: not-allowed;
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
</style>
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="l-d-flex l-align-items-center lead--text recent-topic">
|
|
3
|
-
<l-icon size="16">uil-history</l-icon>
|
|
4
|
-
<div class="l-flex l-text-regular mx-2">{{ term }}</div>
|
|
5
|
-
<l-button
|
|
6
|
-
@click.stop="$emit('remove')"
|
|
7
|
-
circle
|
|
8
|
-
icon="uil-multiply"
|
|
9
|
-
class="border-none lead--text f-18 p-1"
|
|
10
|
-
>
|
|
11
|
-
</l-button>
|
|
12
|
-
</div>
|
|
13
|
-
</template>
|
|
14
|
-
<script>
|
|
15
|
-
export default {
|
|
16
|
-
props: {
|
|
17
|
-
term: {
|
|
18
|
-
type: String,
|
|
19
|
-
},
|
|
20
|
-
},
|
|
21
|
-
}
|
|
22
|
-
</script>
|
|
23
|
-
<style scoped>
|
|
24
|
-
.recent-topic {
|
|
25
|
-
min-height: 32px;
|
|
26
|
-
}
|
|
27
|
-
.border-none {
|
|
28
|
-
border: none !important;
|
|
29
|
-
}
|
|
30
|
-
</style>
|