mediacube-ui 0.1.346 → 0.1.347
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 +2 -0
- package/dist/0.mediacube-ui.umd.js +50 -0
- package/dist/assets/img/icons.3b7d59b2f49c67a2a3a4566b8ab233fd.svg +1 -0
- package/dist/assets/img/no_table_data.236cd56f46cfb71fc363b008d4ca70d5.png +0 -0
- package/dist/assets/img/no_user.e0030d6e54e2400e1181fd22b83cf8ae.png +0 -0
- package/dist/mediacube-ui.umd.js +1 -0
- package/package.json +14 -16
- package/src/assets/tokens/tokens.json +5 -0
- package/dist/mediacube-ui.common.js +0 -378
- package/src/elements/McAvatar/McAvatar.vue +0 -274
- package/src/elements/McBadge/McBadge.vue +0 -148
- package/src/elements/McButton/McButton.vue +0 -841
- package/src/elements/McChip/McChip.vue +0 -300
- package/src/elements/McCropper/McCropper.vue +0 -133
- package/src/elements/McDate/McDate.vue +0 -105
- package/src/elements/McDatePicker/McDatePicker.vue +0 -902
- package/src/elements/McField/McFieldCheckbox/McFieldCheckbox.vue +0 -332
- package/src/elements/McField/McFieldRadio/McFieldRadioButton/McFieldRadioButton.vue +0 -201
- package/src/elements/McField/McFieldRadio/McFieldRadioGroup/McFieldRadioGroup.vue +0 -194
- package/src/elements/McField/McFieldSelect/McFieldSelect.vue +0 -1087
- package/src/elements/McField/McFieldText/McFieldText.vue +0 -969
- package/src/elements/McField/McFieldToggle/McFieldToggle.vue +0 -268
- package/src/elements/McInfinityLoadingIndicator/McInfinityLoadingIndicator.vue +0 -97
- package/src/elements/McNotification/McNotification.vue +0 -209
- package/src/elements/McProgress/McProgress.vue +0 -218
- package/src/elements/McRangeSlider/McRangeSlider.vue +0 -195
- package/src/elements/McSeparator/McSeparator.vue +0 -143
- package/src/elements/McSlideUpDown/McSlideUpDown.vue +0 -157
- package/src/elements/McSvgIcon/McSvgIcon.vue +0 -127
- package/src/elements/McTabs/McTab/McTab.vue +0 -187
- package/src/elements/McTabs/McTabs/McTabs.vue +0 -531
- package/src/elements/McTitle/McTitle.vue +0 -365
- package/src/elements/McTooltip/McTooltip.vue +0 -334
- package/src/helpers/consts.js +0 -3
- package/src/helpers/delayedAction.js +0 -26
- package/src/helpers/storybookFunctions.js +0 -20
- package/src/helpers/storybookVariables.js +0 -24
- package/src/mixins/equalFieldHeight.js +0 -59
- package/src/mixins/fieldErrors.js +0 -28
- package/src/patterns/McAccordion/McAccordion.vue +0 -53
- package/src/patterns/McCells/McCell/McCell.vue +0 -101
- package/src/patterns/McChat/McChat.vue +0 -305
- package/src/patterns/McChat/McChatComment/McChatComment.vue +0 -265
- package/src/patterns/McChat/McChatForm/McChatForm.vue +0 -147
- package/src/patterns/McCollapse/McCollapse.vue +0 -280
- package/src/patterns/McDrawer/McDrawer.vue +0 -146
- package/src/patterns/McDropdown/McDropdown.vue +0 -247
- package/src/patterns/McDropdown/McDropdownPanel/McDropdownPanel.vue +0 -40
- package/src/patterns/McFakeScroll/McFakeScroll.vue +0 -277
- package/src/patterns/McFilter/McFilter.vue +0 -847
- package/src/patterns/McFilter/McFilterChip/McFilterChip.vue +0 -83
- package/src/patterns/McFilter/McFilterTags/McFilterTags.vue +0 -374
- package/src/patterns/McFilter/McFilterTypeDate/McFilterTypeDate.vue +0 -70
- package/src/patterns/McFilter/McFilterTypeRange/McFilterTypeRange.vue +0 -132
- package/src/patterns/McFilter/McFilterTypeRelation/McFilterTypeRelation.vue +0 -221
- package/src/patterns/McFilter/McFilterTypeSimple/McFilterTypeSimple.vue +0 -161
- package/src/patterns/McFilter/McFilterTypeText/McFilterTypeText.vue +0 -62
- package/src/patterns/McGrid/McGridCol/McGridCol.vue +0 -165
- package/src/patterns/McGrid/McGridRow/McGridRow.vue +0 -158
- package/src/patterns/McModal/McModal.vue +0 -680
- package/src/patterns/McOverlay/McOverlay.vue +0 -78
- package/src/patterns/McPreview/McPreview.vue +0 -118
- package/src/patterns/McSideBar/McSideBar/McSideBar.vue +0 -387
- package/src/patterns/McSideBar/McSideBarBottom/McSideBarBottom.vue +0 -125
- package/src/patterns/McSideBar/McSideBarButton/McSideBarButton.vue +0 -252
- package/src/patterns/McSideBar/McSideBarCenter/McSideBarCenter.vue +0 -367
- package/src/patterns/McSideBar/McSideBarTop/McSideBarTop.vue +0 -238
- package/src/patterns/McStack/McStack.vue +0 -158
- package/src/patterns/McTable/McTable/McTable.vue +0 -854
- package/src/patterns/McTable/McTableCol/McTableCol.vue +0 -296
- package/src/patterns/McTableCard/McTableCard.vue +0 -135
- package/src/patterns/McTableCard/McTableCardHeader/McTableCardHeader.vue +0 -74
- package/src/patterns/McTopBar/McTopBar.vue +0 -153
- package/src/patterns/McWrapScroll/McWrapScroll.vue +0 -291
- package/src/styles/_functions.scss +0 -187
- package/src/styles/_mixins.scss +0 -612
- package/src/styles/_spacing.scss +0 -33
- package/src/styles/_variables.scss +0 -23
- package/src/styles/global.scss +0 -308
- package/src/styles/main.scss +0 -4
- package/src/styles/table.scss +0 -10
- package/src/styles/toast.scss +0 -55
- package/src/templates/layouts/McContentFixed/McContentFixed.vue +0 -60
- package/src/templates/layouts/McMain/McMain.vue +0 -115
- package/src/templates/layouts/McRoot/McRoot.vue +0 -45
- package/src/tokens/animations.scss +0 -9
- package/src/tokens/border-radius.scss +0 -26
- package/src/tokens/box-shadows.scss +0 -28
- package/src/tokens/colors.scss +0 -82
- package/src/tokens/durations.scss +0 -7
- package/src/tokens/easings.scss +0 -6
- package/src/tokens/font-families.scss +0 -8
- package/src/tokens/font-sizes.scss +0 -23
- package/src/tokens/font-weights.scss +0 -9
- package/src/tokens/gradients.scss +0 -19
- package/src/tokens/letter-spacings.scss +0 -6
- package/src/tokens/line-heights.scss +0 -22
- package/src/tokens/media-queries.scss +0 -32
- package/src/tokens/opacities.scss +0 -8
- package/src/tokens/sizes.scss +0 -47
- package/src/tokens/spacings.scss +0 -38
- package/src/tokens/z-indexes.scss +0 -14
- package/src/utils/dayjs.js +0 -19
- package/src/utils/filters.js +0 -11
- package/src/utils/getTokens.js +0 -41
- package/src/utils/load-icons.js +0 -3
- package/src/utils/treeSearch.js +0 -30
- package/src/utils/webFontLoader.js +0 -12
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<mc-chip :closable="closable" :variation="computedVariation" :class="classes" size="s" @click="handleChipClick">
|
|
3
|
-
<mc-title v-if="tag.categoryName" weight="semi-bold">{{ computedCategory }}</mc-title>
|
|
4
|
-
<mc-title v-if="tag.title">{{ tag.title }}</mc-title>
|
|
5
|
-
</mc-chip>
|
|
6
|
-
</template>
|
|
7
|
-
<script>
|
|
8
|
-
import McTitle from '../../../elements/McTitle/McTitle'
|
|
9
|
-
import McChip from '../../../elements/McChip/McChip'
|
|
10
|
-
export default {
|
|
11
|
-
name: 'McFilterChip',
|
|
12
|
-
components: { McChip, McTitle },
|
|
13
|
-
props: {
|
|
14
|
-
/**
|
|
15
|
-
* Объект тэга
|
|
16
|
-
*/
|
|
17
|
-
tag: {
|
|
18
|
-
type: Object,
|
|
19
|
-
required: true,
|
|
20
|
-
},
|
|
21
|
-
/**
|
|
22
|
-
* Закрывающийся
|
|
23
|
-
*/
|
|
24
|
-
closable: {
|
|
25
|
-
type: Boolean,
|
|
26
|
-
default: false,
|
|
27
|
-
},
|
|
28
|
-
/**
|
|
29
|
-
* Активный
|
|
30
|
-
*/
|
|
31
|
-
isActive: {
|
|
32
|
-
type: Boolean,
|
|
33
|
-
default: false,
|
|
34
|
-
},
|
|
35
|
-
},
|
|
36
|
-
computed: {
|
|
37
|
-
computedCategory() {
|
|
38
|
-
const append = this.tag.title ? ':' : ''
|
|
39
|
-
return `${this.tag.categoryName}${append}`
|
|
40
|
-
},
|
|
41
|
-
computedVariation() {
|
|
42
|
-
return this.closable ? 'purple-invert' : 'hover-gray'
|
|
43
|
-
},
|
|
44
|
-
classes() {
|
|
45
|
-
return {
|
|
46
|
-
'mc-filter-chip': true,
|
|
47
|
-
'mc-filter-chip--closable': this.closable,
|
|
48
|
-
'mc-filter-chip--is-active': this.isActive,
|
|
49
|
-
}
|
|
50
|
-
},
|
|
51
|
-
},
|
|
52
|
-
methods: {
|
|
53
|
-
handleChipClick(e) {
|
|
54
|
-
/**
|
|
55
|
-
* Событие по закрытию тэга
|
|
56
|
-
*/
|
|
57
|
-
this.$emit('close')
|
|
58
|
-
e.stopPropagation()
|
|
59
|
-
},
|
|
60
|
-
},
|
|
61
|
-
}
|
|
62
|
-
</script>
|
|
63
|
-
<style lang="scss">
|
|
64
|
-
.mc-filter-chip {
|
|
65
|
-
$block-name: &;
|
|
66
|
-
border-radius: $space-50;
|
|
67
|
-
|
|
68
|
-
&--closable {
|
|
69
|
-
border-radius: $space-150;
|
|
70
|
-
&:hover {
|
|
71
|
-
cursor: pointer;
|
|
72
|
-
background-color: fade-out($color-purple, 0.6);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
&--is-active {
|
|
76
|
-
background-color: fade-out($color-purple, 0.6);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
.mc-title {
|
|
80
|
-
width: auto;
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
</style>
|
|
@@ -1,374 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="mc-filter-tags">
|
|
3
|
-
<mc-title>{{ placeholders.added_filters }}</mc-title>
|
|
4
|
-
<div class="mc-filter-tags__body">
|
|
5
|
-
<div class="mc-filter-tags__body-left">
|
|
6
|
-
<mc-grid-row v-if="tagsWithoutFast.length" :gutter-x="4" :gutter-y="8">
|
|
7
|
-
<mc-grid-col v-for="tag in tagsWithoutFast" :key="tag.id">
|
|
8
|
-
<mc-filter-chip
|
|
9
|
-
:tag="tag"
|
|
10
|
-
:is-active="checkTagIsActive(tag)"
|
|
11
|
-
closable
|
|
12
|
-
@click.native="() => onTagClick(tag)"
|
|
13
|
-
@close="() => onTagClose(tag)"
|
|
14
|
-
/>
|
|
15
|
-
</mc-grid-col>
|
|
16
|
-
</mc-grid-row>
|
|
17
|
-
<template v-if="relationRows.length">
|
|
18
|
-
<mc-grid-row v-for="(row, index) in relationRows" :key="index" :gutter-x="4" :gutter-y="8">
|
|
19
|
-
<mc-grid-col v-for="tag in row" :key="tag.id">
|
|
20
|
-
<mc-filter-chip
|
|
21
|
-
:tag="tag"
|
|
22
|
-
:is-active="checkTagIsActive(tag)"
|
|
23
|
-
:closable="tag.closable"
|
|
24
|
-
@click.native="() => onTagClick(tag)"
|
|
25
|
-
@close="() => onTagClose(tag, row[0].relationKey)"
|
|
26
|
-
/>
|
|
27
|
-
</mc-grid-col>
|
|
28
|
-
</mc-grid-row>
|
|
29
|
-
</template>
|
|
30
|
-
<mc-grid-row v-if="fastFilterTags.length" :gutter-x="4" :gutter-y="8">
|
|
31
|
-
<mc-grid-col v-for="tag in fastFilterTags" :key="tag.id">
|
|
32
|
-
<mc-tooltip :content="tag.description || ''" placement="top" size="s">
|
|
33
|
-
<mc-filter-chip :tag="tag" closable @close="() => onTagClose(tag)" />
|
|
34
|
-
</mc-tooltip>
|
|
35
|
-
</mc-grid-col>
|
|
36
|
-
</mc-grid-row>
|
|
37
|
-
</div>
|
|
38
|
-
<div class="mc-filter-tags__body-right">
|
|
39
|
-
<mc-button v-if="hasButtonClear" variation="dark-gray-outline" @click="handleClear">
|
|
40
|
-
{{ placeholders.actions.clear }}
|
|
41
|
-
</mc-button>
|
|
42
|
-
</div>
|
|
43
|
-
</div>
|
|
44
|
-
</div>
|
|
45
|
-
</template>
|
|
46
|
-
|
|
47
|
-
<script>
|
|
48
|
-
import _XEUtils from 'xe-utils'
|
|
49
|
-
import _isEqual from 'lodash/isEqual'
|
|
50
|
-
import _isEmpty from 'lodash/isEmpty'
|
|
51
|
-
import _cloneDeep from 'lodash/cloneDeep'
|
|
52
|
-
import { dayjs } from '../../../utils/dayjs'
|
|
53
|
-
|
|
54
|
-
import McButton from '../../../elements/McButton/McButton'
|
|
55
|
-
import McTooltip from '../../../elements/McTooltip/McTooltip'
|
|
56
|
-
import McTitle from '../../../elements/McTitle/McTitle'
|
|
57
|
-
import McGridRow from '../../../patterns/McGrid/McGridRow/McGridRow'
|
|
58
|
-
import McGridCol from '../../../patterns/McGrid/McGridCol/McGridCol'
|
|
59
|
-
import McFilterChip from '../McFilterChip/McFilterChip'
|
|
60
|
-
export default {
|
|
61
|
-
name: 'McFilterTags',
|
|
62
|
-
components: {
|
|
63
|
-
McFilterChip,
|
|
64
|
-
McButton,
|
|
65
|
-
McTooltip,
|
|
66
|
-
McTitle,
|
|
67
|
-
McGridRow,
|
|
68
|
-
McGridCol,
|
|
69
|
-
},
|
|
70
|
-
props: {
|
|
71
|
-
/**
|
|
72
|
-
* Данные фильтра
|
|
73
|
-
*/
|
|
74
|
-
value: {
|
|
75
|
-
type: Object,
|
|
76
|
-
default: () => {},
|
|
77
|
-
},
|
|
78
|
-
/**
|
|
79
|
-
* Типы фильтров
|
|
80
|
-
*
|
|
81
|
-
* [{
|
|
82
|
-
name: Filter title,
|
|
83
|
-
value: [String] - Filter value(key),
|
|
84
|
-
type: [String] - Filter type(relation / date / text / fast),
|
|
85
|
-
options: [Array] - Filter options,
|
|
86
|
-
getAjaxOne: [Function] - Method for get selected options when filter initialize,
|
|
87
|
-
getAjaxOptions: [Function] - Method for get options by API,
|
|
88
|
-
[default]: [String, Number, Boolean] - Only for fast filter type. Fast filter haven't options, we set default value
|
|
89
|
-
[description]: [String] - Only for fast filter type. Description of fast filter
|
|
90
|
-
}, ...]
|
|
91
|
-
*/
|
|
92
|
-
filters: {
|
|
93
|
-
type: Array,
|
|
94
|
-
required: true,
|
|
95
|
-
},
|
|
96
|
-
/**
|
|
97
|
-
* Переводы локализаций
|
|
98
|
-
*/
|
|
99
|
-
placeholders: {
|
|
100
|
-
type: Object,
|
|
101
|
-
required: true,
|
|
102
|
-
},
|
|
103
|
-
/**
|
|
104
|
-
* Активный тэг
|
|
105
|
-
*/
|
|
106
|
-
activeTag: {
|
|
107
|
-
type: Object,
|
|
108
|
-
default: null,
|
|
109
|
-
},
|
|
110
|
-
useTimezone: {
|
|
111
|
-
type: Boolean,
|
|
112
|
-
default: false,
|
|
113
|
-
},
|
|
114
|
-
},
|
|
115
|
-
data() {
|
|
116
|
-
return {
|
|
117
|
-
simpleValues: {},
|
|
118
|
-
relationValues: {},
|
|
119
|
-
prettyActiveTag: null,
|
|
120
|
-
}
|
|
121
|
-
},
|
|
122
|
-
computed: {
|
|
123
|
-
fastFilterTags() {
|
|
124
|
-
return this.simpleTags.filter(st => st && st.type === 'fast')
|
|
125
|
-
},
|
|
126
|
-
tagsWithoutFast() {
|
|
127
|
-
return this.simpleTags.filter(st => st && st.type !== 'fast')
|
|
128
|
-
},
|
|
129
|
-
simpleTags() {
|
|
130
|
-
const tags = []
|
|
131
|
-
!_isEmpty(this.simpleValues) &&
|
|
132
|
-
Object.entries(this.simpleValues).forEach(([key, value]) => {
|
|
133
|
-
const filter = this.filters.find(f => f.value === key)
|
|
134
|
-
if (filter && filter.type === 'simple') {
|
|
135
|
-
tags.push({
|
|
136
|
-
id: _XEUtils.uniqueId(),
|
|
137
|
-
categoryName: filter?.name,
|
|
138
|
-
category: key,
|
|
139
|
-
...filter,
|
|
140
|
-
title: filter.options.find(o => String(o.value) === String(value))?.name,
|
|
141
|
-
})
|
|
142
|
-
} else if (filter && filter.type === 'fast') {
|
|
143
|
-
tags.push({
|
|
144
|
-
id: _XEUtils.uniqueId(),
|
|
145
|
-
categoryName: filter?.name,
|
|
146
|
-
category: key,
|
|
147
|
-
type: 'fast',
|
|
148
|
-
...filter,
|
|
149
|
-
})
|
|
150
|
-
} else if (filter) {
|
|
151
|
-
const from = value.more
|
|
152
|
-
? `${this.placeholders.from} ${this.getFormattedVal(value.more, filter)}`
|
|
153
|
-
: ''
|
|
154
|
-
|
|
155
|
-
const to = value.less
|
|
156
|
-
? `${this.placeholders.to} ${this.getFormattedVal(
|
|
157
|
-
filter.type === 'date'
|
|
158
|
-
? this.useTimezone
|
|
159
|
-
? dayjs(value.less)
|
|
160
|
-
.subtract(1, 'days')
|
|
161
|
-
.format()
|
|
162
|
-
: dayjs(value.less).format()
|
|
163
|
-
: value.less,
|
|
164
|
-
filter,
|
|
165
|
-
)}`
|
|
166
|
-
: ''
|
|
167
|
-
const space = from && to ? ' ' : ''
|
|
168
|
-
const title = typeof value === 'object' ? `${from}${space}${to}`.toLowerCase() : value
|
|
169
|
-
tags.push({
|
|
170
|
-
id: _XEUtils.uniqueId(),
|
|
171
|
-
categoryName: filter?.name,
|
|
172
|
-
title,
|
|
173
|
-
value,
|
|
174
|
-
category: key,
|
|
175
|
-
})
|
|
176
|
-
}
|
|
177
|
-
})
|
|
178
|
-
return tags
|
|
179
|
-
},
|
|
180
|
-
relationRows() {
|
|
181
|
-
let tags = []
|
|
182
|
-
if (!_isEmpty(this.relationValues)) {
|
|
183
|
-
tags = Object.entries(this.relationValues).map(([relationKey, relationVal]) => {
|
|
184
|
-
if (relationKey === 'exists') {
|
|
185
|
-
const empties = Object.keys(relationVal).map(key => {
|
|
186
|
-
const filter = this.filters.find(f => f.value === key)
|
|
187
|
-
return {
|
|
188
|
-
id: _XEUtils.uniqueId(),
|
|
189
|
-
categoryName: filter?.name,
|
|
190
|
-
value: key,
|
|
191
|
-
category: key,
|
|
192
|
-
relationKey,
|
|
193
|
-
closable: true,
|
|
194
|
-
}
|
|
195
|
-
})
|
|
196
|
-
const head = {
|
|
197
|
-
id: _XEUtils.uniqueId(),
|
|
198
|
-
categoryName: this.placeholders.actions.empty,
|
|
199
|
-
relationKey: 'exists',
|
|
200
|
-
}
|
|
201
|
-
return [head, ...empties]
|
|
202
|
-
}
|
|
203
|
-
const values = []
|
|
204
|
-
Object.entries(relationVal).forEach(([categoryKey, categoryVal]) => {
|
|
205
|
-
const filter = this.filters.find(f => f.value === categoryKey)
|
|
206
|
-
Object.entries(categoryVal).forEach(([key, val]) => {
|
|
207
|
-
values.push({
|
|
208
|
-
id: _XEUtils.uniqueId(),
|
|
209
|
-
categoryName: filter?.name,
|
|
210
|
-
title: val,
|
|
211
|
-
value: key,
|
|
212
|
-
category: categoryKey,
|
|
213
|
-
relationKey,
|
|
214
|
-
closable: true,
|
|
215
|
-
})
|
|
216
|
-
})
|
|
217
|
-
})
|
|
218
|
-
const head = {
|
|
219
|
-
id: _XEUtils.uniqueId(),
|
|
220
|
-
categoryName: this.placeholders.actions[relationKey],
|
|
221
|
-
relationKey,
|
|
222
|
-
}
|
|
223
|
-
return [head, ...values]
|
|
224
|
-
})
|
|
225
|
-
}
|
|
226
|
-
return tags.filter(t => t.length > 1)
|
|
227
|
-
},
|
|
228
|
-
hasButtonClear() {
|
|
229
|
-
return this.relationRows.length || this.simpleTags.length
|
|
230
|
-
},
|
|
231
|
-
},
|
|
232
|
-
watch: {
|
|
233
|
-
value: {
|
|
234
|
-
handler(val) {
|
|
235
|
-
this.splitTags(val)
|
|
236
|
-
},
|
|
237
|
-
immediate: true,
|
|
238
|
-
deep: true,
|
|
239
|
-
},
|
|
240
|
-
activeTag: {
|
|
241
|
-
handler(val) {
|
|
242
|
-
this.prettyActiveTag = val
|
|
243
|
-
},
|
|
244
|
-
immediate: true,
|
|
245
|
-
},
|
|
246
|
-
},
|
|
247
|
-
methods: {
|
|
248
|
-
splitTags(value) {
|
|
249
|
-
this.simpleValues = {}
|
|
250
|
-
this.relationValues = {}
|
|
251
|
-
if (_isEmpty(value)) return
|
|
252
|
-
this.addInitTags(value)
|
|
253
|
-
},
|
|
254
|
-
addInitTags(parentVal, parentKey = null) {
|
|
255
|
-
const relationKeys = ['is', 'is_not', 'exists']
|
|
256
|
-
for (let [key, val] of Object.entries(parentVal)) {
|
|
257
|
-
if (relationKeys.includes(key)) {
|
|
258
|
-
const relationValuesKey = {
|
|
259
|
-
...(key in this.relationValues ? this.relationValues[key] : {}),
|
|
260
|
-
...(parentKey ? { [parentKey]: val } : {}),
|
|
261
|
-
}
|
|
262
|
-
this.$set(this.relationValues, key, relationValuesKey)
|
|
263
|
-
continue
|
|
264
|
-
}
|
|
265
|
-
if (typeof val !== 'object' && parentKey) {
|
|
266
|
-
this.$set(this.simpleValues, parentKey, parentVal)
|
|
267
|
-
continue
|
|
268
|
-
}
|
|
269
|
-
const filter = this.filters.find(f => f.value === key)
|
|
270
|
-
if (filter && filter.type === 'fast') {
|
|
271
|
-
this.$set(this.simpleValues, key, { value: key })
|
|
272
|
-
continue
|
|
273
|
-
}
|
|
274
|
-
val && this.addInitTags(val, key)
|
|
275
|
-
}
|
|
276
|
-
},
|
|
277
|
-
onTagClick(tag) {
|
|
278
|
-
this.prettyActiveTag = _isEqual(this.prettyActiveTag, tag) ? null : tag
|
|
279
|
-
/**
|
|
280
|
-
* Событие по клику на тэг
|
|
281
|
-
*/
|
|
282
|
-
this.$emit('tag-click', tag)
|
|
283
|
-
},
|
|
284
|
-
onTagClose(tag, relationKey = null) {
|
|
285
|
-
const value = _cloneDeep(this.value)
|
|
286
|
-
switch (relationKey) {
|
|
287
|
-
case 'exists':
|
|
288
|
-
delete value[tag.category][relationKey]
|
|
289
|
-
break
|
|
290
|
-
case 'is':
|
|
291
|
-
case 'is_not':
|
|
292
|
-
delete value[tag.category][relationKey][tag.value]
|
|
293
|
-
if (_isEmpty(value[tag.category][relationKey])) {
|
|
294
|
-
delete value[tag.category][relationKey]
|
|
295
|
-
}
|
|
296
|
-
break
|
|
297
|
-
default:
|
|
298
|
-
delete value[tag.category]
|
|
299
|
-
break
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
if (_isEmpty(value[tag.category])) {
|
|
303
|
-
delete value[tag.category]
|
|
304
|
-
}
|
|
305
|
-
/**
|
|
306
|
-
* Событие по изменению набора тэгов
|
|
307
|
-
*/
|
|
308
|
-
this.$emit('tag-change', value)
|
|
309
|
-
},
|
|
310
|
-
handleClear() {
|
|
311
|
-
/**
|
|
312
|
-
* Событие по очистке всех тэгов
|
|
313
|
-
*/
|
|
314
|
-
this.$emit('clear')
|
|
315
|
-
},
|
|
316
|
-
getFormattedVal(val, filter) {
|
|
317
|
-
switch (filter.type) {
|
|
318
|
-
case 'date':
|
|
319
|
-
return dayjs(val).format('DD.MM.YYYY')
|
|
320
|
-
case 'range':
|
|
321
|
-
return this.getFormattedNum(val)
|
|
322
|
-
default:
|
|
323
|
-
return val
|
|
324
|
-
}
|
|
325
|
-
},
|
|
326
|
-
getFormattedNum(num) {
|
|
327
|
-
const numeral = require('numeral')
|
|
328
|
-
if (!numeral) return num
|
|
329
|
-
let decimalsString = ''.padStart(0, '0')
|
|
330
|
-
return numeral(num)
|
|
331
|
-
.format('0,0.' + decimalsString)
|
|
332
|
-
.replace(/,/g, ' ')
|
|
333
|
-
},
|
|
334
|
-
checkTagIsActive(tag) {
|
|
335
|
-
return _isEqual(this.prettyActiveTag, tag)
|
|
336
|
-
},
|
|
337
|
-
},
|
|
338
|
-
}
|
|
339
|
-
</script>
|
|
340
|
-
|
|
341
|
-
<style lang="scss">
|
|
342
|
-
@import '../../../styles/mixins';
|
|
343
|
-
.mc-filter-tags {
|
|
344
|
-
$block-name: &;
|
|
345
|
-
|
|
346
|
-
@include child-indent-bottom($space-100);
|
|
347
|
-
&__body {
|
|
348
|
-
display: flex;
|
|
349
|
-
justify-content: space-between;
|
|
350
|
-
padding: $space-100;
|
|
351
|
-
border: 1px solid $color-outline-gray;
|
|
352
|
-
border-radius: $radius-100;
|
|
353
|
-
background-color: $color-white;
|
|
354
|
-
min-height: $space-500;
|
|
355
|
-
overflow-x: auto;
|
|
356
|
-
&-left {
|
|
357
|
-
flex-grow: 1;
|
|
358
|
-
}
|
|
359
|
-
&-right {
|
|
360
|
-
margin-inline-start: $space-100;
|
|
361
|
-
.mc-button {
|
|
362
|
-
padding: $space-50 $space-150;
|
|
363
|
-
height: $space-300;
|
|
364
|
-
}
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
.mc-grid-row {
|
|
368
|
-
&:not(:last-child) {
|
|
369
|
-
margin-bottom: $space-50 !important;
|
|
370
|
-
}
|
|
371
|
-
}
|
|
372
|
-
}
|
|
373
|
-
}
|
|
374
|
-
</style>
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<mc-date-picker
|
|
3
|
-
v-model="period"
|
|
4
|
-
:placeholders="placeholders.calendar"
|
|
5
|
-
:placeholder="filter.placeholder || placeholders.choose"
|
|
6
|
-
:use-timezone="useTimezone"
|
|
7
|
-
name="condition_dates"
|
|
8
|
-
class="mc-filter-type-date"
|
|
9
|
-
range
|
|
10
|
-
/>
|
|
11
|
-
</template>
|
|
12
|
-
|
|
13
|
-
<script>
|
|
14
|
-
import McDatePicker from '../../../elements/McDatePicker/McDatePicker'
|
|
15
|
-
export default {
|
|
16
|
-
name: 'McFilterTypeDate',
|
|
17
|
-
components: {
|
|
18
|
-
McDatePicker,
|
|
19
|
-
},
|
|
20
|
-
props: {
|
|
21
|
-
/**
|
|
22
|
-
* Значение
|
|
23
|
-
*/
|
|
24
|
-
value: {
|
|
25
|
-
type: Object,
|
|
26
|
-
default: () => {},
|
|
27
|
-
},
|
|
28
|
-
/**
|
|
29
|
-
* Объект выбранного
|
|
30
|
-
* фильтра
|
|
31
|
-
*/
|
|
32
|
-
filter: {
|
|
33
|
-
type: Object,
|
|
34
|
-
default: () => {},
|
|
35
|
-
},
|
|
36
|
-
/**
|
|
37
|
-
* Переводы локализаций
|
|
38
|
-
*/
|
|
39
|
-
placeholders: {
|
|
40
|
-
type: Object,
|
|
41
|
-
required: true,
|
|
42
|
-
},
|
|
43
|
-
useTimezone: {
|
|
44
|
-
type: Boolean,
|
|
45
|
-
default: false,
|
|
46
|
-
},
|
|
47
|
-
},
|
|
48
|
-
computed: {
|
|
49
|
-
period: {
|
|
50
|
-
get() {
|
|
51
|
-
return this.value ? [this.value.more, this.value.less] : []
|
|
52
|
-
},
|
|
53
|
-
set(val) {
|
|
54
|
-
const period = (val || []).every(d => !!d?.trim()?.length) ? { more: val[0], less: val[1] } : {}
|
|
55
|
-
/**
|
|
56
|
-
* Событие по изменению периода
|
|
57
|
-
*/
|
|
58
|
-
this.$emit('input', period)
|
|
59
|
-
},
|
|
60
|
-
},
|
|
61
|
-
},
|
|
62
|
-
}
|
|
63
|
-
</script>
|
|
64
|
-
|
|
65
|
-
<style lang="scss">
|
|
66
|
-
.mc-filter-type-Date {
|
|
67
|
-
$block-name: &;
|
|
68
|
-
width: 300px;
|
|
69
|
-
}
|
|
70
|
-
</style>
|
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="mc-filter-type-range">
|
|
3
|
-
<mc-field-text v-model="more" :placeholder="placeholders.from.toLowerCase()" type="number" name="range_more" />
|
|
4
|
-
<mc-field-text v-model="less" :placeholder="placeholders.to.toLowerCase()" type="number" name="range_less" />
|
|
5
|
-
</div>
|
|
6
|
-
</template>
|
|
7
|
-
|
|
8
|
-
<script>
|
|
9
|
-
import McFieldText from '../../../elements/McField/McFieldText/McFieldText'
|
|
10
|
-
export default {
|
|
11
|
-
name: 'McFilterTypeRange',
|
|
12
|
-
components: {
|
|
13
|
-
McFieldText,
|
|
14
|
-
},
|
|
15
|
-
props: {
|
|
16
|
-
/**
|
|
17
|
-
* Значение
|
|
18
|
-
*/
|
|
19
|
-
value: {
|
|
20
|
-
type: Object,
|
|
21
|
-
default: () => {
|
|
22
|
-
return {
|
|
23
|
-
more: null,
|
|
24
|
-
less: null,
|
|
25
|
-
}
|
|
26
|
-
},
|
|
27
|
-
},
|
|
28
|
-
/**
|
|
29
|
-
* Объект выбранного
|
|
30
|
-
* фильтра
|
|
31
|
-
*/
|
|
32
|
-
filter: {
|
|
33
|
-
type: Object,
|
|
34
|
-
default: () => {},
|
|
35
|
-
},
|
|
36
|
-
/**
|
|
37
|
-
* Переводы локализаций
|
|
38
|
-
*/
|
|
39
|
-
placeholders: {
|
|
40
|
-
type: Object,
|
|
41
|
-
required: true,
|
|
42
|
-
},
|
|
43
|
-
},
|
|
44
|
-
data() {
|
|
45
|
-
return {
|
|
46
|
-
currentMore: null,
|
|
47
|
-
currentLess: null,
|
|
48
|
-
}
|
|
49
|
-
},
|
|
50
|
-
computed: {
|
|
51
|
-
more: {
|
|
52
|
-
get() {
|
|
53
|
-
return this.value && this.value.more
|
|
54
|
-
},
|
|
55
|
-
set(val) {
|
|
56
|
-
this.currentMore = val
|
|
57
|
-
this.emitValue()
|
|
58
|
-
},
|
|
59
|
-
},
|
|
60
|
-
less: {
|
|
61
|
-
get() {
|
|
62
|
-
return this.value && this.value.less
|
|
63
|
-
},
|
|
64
|
-
set(val) {
|
|
65
|
-
this.currentLess = val
|
|
66
|
-
this.emitValue()
|
|
67
|
-
},
|
|
68
|
-
},
|
|
69
|
-
},
|
|
70
|
-
watch: {
|
|
71
|
-
value: {
|
|
72
|
-
handler(val) {
|
|
73
|
-
if (val) {
|
|
74
|
-
this.currentMore = this.value ? this.value.more : null
|
|
75
|
-
this.currentLess = this.value ? this.value.less : null
|
|
76
|
-
}
|
|
77
|
-
},
|
|
78
|
-
deep: true,
|
|
79
|
-
},
|
|
80
|
-
},
|
|
81
|
-
methods: {
|
|
82
|
-
emitValue() {
|
|
83
|
-
const hasMore = this.hasValue(this.currentMore)
|
|
84
|
-
const hasLess = this.hasValue(this.currentLess)
|
|
85
|
-
const hasMin = this.hasValue(this.filter.min)
|
|
86
|
-
const hasMax = this.hasValue(this.filter.max)
|
|
87
|
-
|
|
88
|
-
let more = hasMore ? Number(this.currentMore) : null
|
|
89
|
-
let less = hasLess ? Number(this.currentLess) : null
|
|
90
|
-
|
|
91
|
-
if (more < this.filter.min && hasMin) {
|
|
92
|
-
more = this.filter.min
|
|
93
|
-
}
|
|
94
|
-
if (less > this.filter.max && hasMax) {
|
|
95
|
-
less = this.filter.max
|
|
96
|
-
}
|
|
97
|
-
if (more > this.filter.max && hasMax) {
|
|
98
|
-
more = this.filter.max
|
|
99
|
-
}
|
|
100
|
-
if (less < this.filter.min && hasMin) {
|
|
101
|
-
less = this.filter.min
|
|
102
|
-
}
|
|
103
|
-
const result = {
|
|
104
|
-
...(hasMore ? { more } : {}),
|
|
105
|
-
...(hasLess ? { less } : {}),
|
|
106
|
-
}
|
|
107
|
-
this.currentLess = less
|
|
108
|
-
this.currentMore = more
|
|
109
|
-
|
|
110
|
-
/**
|
|
111
|
-
* Событие по изменению интервала
|
|
112
|
-
*/
|
|
113
|
-
this.$emit('input', result)
|
|
114
|
-
},
|
|
115
|
-
hasValue(val) {
|
|
116
|
-
return val || Number.isInteger(val)
|
|
117
|
-
},
|
|
118
|
-
},
|
|
119
|
-
}
|
|
120
|
-
</script>
|
|
121
|
-
|
|
122
|
-
<style lang="scss">
|
|
123
|
-
@import '../../../styles/mixins';
|
|
124
|
-
.mc-filter-type-range {
|
|
125
|
-
$block-name: &;
|
|
126
|
-
display: flex;
|
|
127
|
-
@include child-indent-right($space-100);
|
|
128
|
-
.mc-field-text {
|
|
129
|
-
width: 146px;
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
</style>
|