@eturnity/eturnity_reusable_components 7.24.3-EPDM-11250.0 → 7.24.3-EPDM-11320.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/.eslintrc.js +125 -0
- package/package.json +6 -20
- package/src/App.vue +75 -70
- package/src/components/addNewButton/index.vue +24 -27
- package/src/components/banner/actionBanner/index.vue +32 -30
- package/src/components/banner/banner/index.vue +88 -80
- package/src/components/banner/infoBanner/index.vue +36 -44
- package/src/components/buttons/buttonIcon/index.vue +83 -78
- package/src/components/buttons/closeButton/index.vue +26 -26
- package/src/components/buttons/mainButton/index.vue +80 -76
- package/src/components/card/index.vue +56 -52
- package/src/components/collapsableInfoText/index.vue +81 -76
- package/src/components/deleteIcon/index.vue +31 -28
- package/src/components/draggableInputHandle/index.vue +20 -17
- package/src/components/dropdown/Dropdown.stories.js +8 -8
- package/src/components/dropdown/index.vue +75 -72
- package/src/components/errorMessage/index.vue +23 -23
- package/src/components/filter/filterSettings.vue +349 -329
- package/src/components/filter/index.vue +130 -130
- package/src/components/filter/parentDropdown.vue +43 -40
- package/src/components/icon/Icons.stories.js +4 -4
- package/src/components/icon/iconCache.js +1 -1
- package/src/components/icon/iconCollection.vue +40 -37
- package/src/components/icon/index.vue +72 -65
- package/src/components/iconWrapper/index.vue +122 -118
- package/src/components/infoCard/index.vue +20 -17
- package/src/components/infoText/index.vue +88 -82
- package/src/components/inputs/checkbox/index.vue +91 -94
- package/src/components/inputs/inputNumber/index.vue +508 -488
- package/src/components/inputs/inputNumberQuestion/index.vue +127 -124
- package/src/components/inputs/inputText/index.vue +265 -252
- package/src/components/inputs/radioButton/index.vue +135 -120
- package/src/components/inputs/searchInput/index.vue +84 -81
- package/src/components/inputs/select/index.vue +644 -631
- package/src/components/inputs/select/option/index.vue +91 -91
- package/src/components/inputs/select/select.stories.js +7 -7
- package/src/components/inputs/slider/index.vue +46 -46
- package/src/components/inputs/switchField/index.vue +159 -152
- package/src/components/inputs/textAreaInput/index.vue +120 -113
- package/src/components/inputs/toggle/index.vue +137 -127
- package/src/components/label/index.vue +64 -61
- package/src/components/markerItem/index.vue +40 -40
- package/src/components/modals/actionModal/index.vue +32 -29
- package/src/components/modals/infoModal/index.vue +34 -27
- package/src/components/modals/modal/index.vue +88 -80
- package/src/components/navigationTabs/index.vue +50 -47
- package/src/components/pageSubtitle/index.vue +33 -29
- package/src/components/pageTitle/index.vue +47 -39
- package/src/components/pagination/index.vue +64 -62
- package/src/components/progressBar/index.vue +70 -67
- package/src/components/projectMarker/index.vue +172 -163
- package/src/components/rangeSlider/Slider.vue +449 -449
- package/src/components/rangeSlider/index.vue +282 -270
- package/src/components/rangeSlider/utils/dom.js +3 -3
- package/src/components/selectedOptions/index.vue +51 -51
- package/src/components/sideMenu/index.vue +117 -109
- package/src/components/spinner/index.vue +37 -34
- package/src/components/tableDropdown/index.vue +343 -326
- package/src/components/tables/mainTable/index.vue +109 -106
- package/src/components/tables/viewTable/index.vue +105 -92
- package/src/components/threeDots/index.vue +174 -171
- package/src/components/videoThumbnail/index.vue +67 -59
- package/src/components/videoThumbnail/videoThumbnail.stories.js +6 -6
- package/src/helpers/numberConverter.js +1 -3
- package/src/helpers/translateLang.js +10 -13
- package/.prettierrc +0 -7
- package/public/favicon.ico +0 -0
- package/public/index.html +0 -17
@@ -1,70 +1,80 @@
|
|
1
1
|
<template>
|
2
|
-
<
|
3
|
-
<
|
4
|
-
<
|
5
|
-
<
|
6
|
-
|
7
|
-
|
8
|
-
selectHeight="36px"
|
9
|
-
fontSize="13px"
|
2
|
+
<ContainerWrapper @click="$emit('on-container-click')">
|
3
|
+
<UpperContainer v-if="filterViews && filterViews.length">
|
4
|
+
<ViewContainer :max-width="activeView.length">
|
5
|
+
<SelectComponent
|
6
|
+
align-items="vertical"
|
7
|
+
font-size="13px"
|
10
8
|
:label="$gettext('active_filter')"
|
11
|
-
|
9
|
+
select-height="36px"
|
10
|
+
select-width="100%"
|
11
|
+
@click.stop
|
12
12
|
>
|
13
13
|
<template #selector>
|
14
|
-
<
|
14
|
+
<OptionTitle>
|
15
15
|
{{ activeView }}
|
16
|
-
</
|
16
|
+
</OptionTitle>
|
17
17
|
</template>
|
18
18
|
<template #dropdown>
|
19
19
|
<Option
|
20
20
|
v-for="(item, idx) in filterViews"
|
21
21
|
:key="idx + '_view'"
|
22
|
-
@click="$emit('on-view-select', item)"
|
23
22
|
:value="item.name"
|
24
|
-
|
25
|
-
|
26
|
-
|
23
|
+
@click="$emit('on-view-select', item)"
|
24
|
+
>
|
25
|
+
{{ item.name }}
|
26
|
+
<DeleteIcon @click.stop="$emit('on-view-delete', item)" />
|
27
|
+
</Option>
|
27
28
|
</template>
|
28
|
-
</
|
29
|
-
</
|
30
|
-
<
|
31
|
-
<
|
29
|
+
</SelectComponent>
|
30
|
+
</ViewContainer>
|
31
|
+
<ResetButton @click="$emit('on-reset-filters')">
|
32
|
+
<Icon
|
33
|
+
:color="theme.colors.blue"
|
34
|
+
:name="'update'"
|
35
|
+
size="14px"
|
36
|
+
/>
|
32
37
|
<div>{{ $gettext('reset_filters') }}</div>
|
33
|
-
</
|
34
|
-
</
|
35
|
-
<
|
36
|
-
:
|
37
|
-
:
|
38
|
+
</ResetButton>
|
39
|
+
</UpperContainer>
|
40
|
+
<ColumnWrapper
|
41
|
+
:has-active-view="!!filterViews && !!filterViews.length"
|
42
|
+
:num-cols="filterData.length"
|
38
43
|
>
|
39
|
-
<
|
44
|
+
<ColumnContainer
|
40
45
|
v-for="(item, idx) in filterData"
|
41
46
|
:key="idx + '_filterdata'"
|
42
47
|
>
|
43
|
-
<
|
44
|
-
:showBorder="idx + 1 !== filterData.length"
|
48
|
+
<ColumnTitle
|
45
49
|
:data-id="`filter_label_project_view_file_manager_${item.type}`"
|
50
|
+
:show-border="idx + 1 !== filterData.length"
|
46
51
|
>
|
47
52
|
{{ item.columnName }}
|
48
|
-
</
|
49
|
-
<
|
50
|
-
<
|
51
|
-
<
|
52
|
-
|
53
|
+
</ColumnTitle>
|
54
|
+
<RowContainer v-if="item.type === 'columns'">
|
55
|
+
<CheckboxContainer>
|
56
|
+
<Draggable
|
57
|
+
v-model="item.dataOptions"
|
58
|
+
ghost-class="ghost"
|
53
59
|
handle=".drag-container"
|
60
|
+
item-key="choice"
|
61
|
+
:set-data="modifyDragItem"
|
54
62
|
style="display: contents"
|
55
|
-
|
56
|
-
:setData="modifyDragItem"
|
57
|
-
v-model="item.dataOptions"
|
58
|
-
itemKey="choice"
|
63
|
+
@change="onDragChange({ data: item.dataOptions })"
|
59
64
|
>
|
60
65
|
<template #item="{ element: column }">
|
61
|
-
<
|
62
|
-
<
|
63
|
-
<
|
64
|
-
|
65
|
-
|
66
|
+
<CheckboxWrapper>
|
67
|
+
<DragContainer class="drag-container">
|
68
|
+
<Icon
|
69
|
+
:name="'duplicate-1'"
|
70
|
+
size="12px"
|
71
|
+
/>
|
72
|
+
</DragContainer>
|
73
|
+
<Checkbox
|
74
|
+
:is-checked="column.selected"
|
75
|
+
:is-disabled="column.selected && isCheckboxDisabled"
|
66
76
|
:label="column.text"
|
67
|
-
|
77
|
+
size="small"
|
68
78
|
@on-event-handler="
|
69
79
|
onChange({
|
70
80
|
dataType: item.type,
|
@@ -72,43 +82,45 @@
|
|
72
82
|
choice: column.choice
|
73
83
|
})
|
74
84
|
"
|
75
|
-
size="small"
|
76
|
-
:isDisabled="column.selected && isCheckboxDisabled"
|
77
85
|
/>
|
78
|
-
</
|
86
|
+
</CheckboxWrapper>
|
79
87
|
</template>
|
80
|
-
</
|
81
|
-
</
|
82
|
-
</
|
83
|
-
<
|
84
|
-
|
88
|
+
</Draggable>
|
89
|
+
</CheckboxContainer>
|
90
|
+
</RowContainer>
|
91
|
+
<RowContainer
|
92
|
+
v-if="item.type === 'filter'"
|
93
|
+
show-border
|
94
|
+
>
|
95
|
+
<RowWrapper
|
85
96
|
v-for="(filter, index) in item.dataOptions"
|
86
97
|
:key="index + '_field'"
|
87
98
|
>
|
88
|
-
<
|
99
|
+
<SelectComponent
|
89
100
|
v-if="isMultipleSelector(filter.filter_type)"
|
90
|
-
|
91
|
-
selectHeight="36px"
|
92
|
-
fontSize="13px"
|
93
|
-
:label="filter.label"
|
94
|
-
:labelDataId="filter.dataId"
|
95
|
-
:isSearchable="filter.choices.length > 7"
|
96
|
-
alignItems="vertical"
|
101
|
+
align-items="vertical"
|
97
102
|
:disabled="!filter.choices.length"
|
98
|
-
|
103
|
+
font-size="13px"
|
104
|
+
:is-searchable="filter.choices.length > 7"
|
105
|
+
:label="filter.label"
|
106
|
+
:label-data-id="filter.dataId"
|
107
|
+
:min-option-length="1"
|
108
|
+
select-height="36px"
|
109
|
+
select-width="100%"
|
99
110
|
>
|
100
111
|
<template #selector>
|
101
|
-
<
|
112
|
+
<OptionTitle> {{ filter.selectedText }} </OptionTitle>
|
102
113
|
</template>
|
103
114
|
<template #dropdown>
|
104
|
-
<
|
115
|
+
<DropdownCheckboxContainer
|
105
116
|
v-for="(filterOption, optionIdx) in filter.choices"
|
106
117
|
:key="optionIdx + 'optionIdx'"
|
107
118
|
@click.stop
|
108
119
|
>
|
109
|
-
<
|
120
|
+
<Checkbox
|
121
|
+
:is-checked="filterOption.selected"
|
110
122
|
:label="filterOption.text"
|
111
|
-
|
123
|
+
size="small"
|
112
124
|
@on-event-handler="
|
113
125
|
onChange({
|
114
126
|
dataType: item.type,
|
@@ -117,21 +129,25 @@
|
|
117
129
|
field: filter.field
|
118
130
|
})
|
119
131
|
"
|
120
|
-
size="small"
|
121
132
|
/>
|
122
|
-
</
|
133
|
+
</DropdownCheckboxContainer>
|
123
134
|
</template>
|
124
|
-
</
|
125
|
-
<
|
126
|
-
<
|
127
|
-
|
128
|
-
|
135
|
+
</SelectComponent>
|
136
|
+
<SectionContainer v-else-if="isRangeSelector(filter.filter_type)">
|
137
|
+
<RowLabel :data-id="filter.dataId">
|
138
|
+
{{ filter.label }}
|
139
|
+
</RowLabel>
|
140
|
+
<GridContainer>
|
141
|
+
<InputNumber
|
142
|
+
font-size="13px"
|
143
|
+
input-height="36px"
|
144
|
+
:number-precision="isIntegerRange(filter.filter_type) ? 0 : 2"
|
129
145
|
:placeholder="
|
130
146
|
filter.unit
|
131
147
|
? $gettext('min') + ' (' + filter.unit + ')'
|
132
148
|
: $gettext('min')
|
133
149
|
"
|
134
|
-
:
|
150
|
+
:unit-name="filter.unit"
|
135
151
|
:value="filter.range.start"
|
136
152
|
@input-change="
|
137
153
|
onChange({
|
@@ -141,17 +157,17 @@
|
|
141
157
|
field: filter.field
|
142
158
|
})
|
143
159
|
"
|
144
|
-
fontSize="13px"
|
145
|
-
inputHeight="36px"
|
146
|
-
:unitName="filter.unit"
|
147
160
|
/>
|
148
|
-
<
|
161
|
+
<InputNumber
|
162
|
+
font-size="13px"
|
163
|
+
input-height="36px"
|
164
|
+
:number-precision="isIntegerRange(filter.filter_type) ? 0 : 2"
|
149
165
|
:placeholder="
|
150
166
|
filter.unit
|
151
167
|
? $gettext('max') + ' (' + filter.unit + ')'
|
152
168
|
: $gettext('max')
|
153
169
|
"
|
154
|
-
:
|
170
|
+
:unit-name="filter.unit"
|
155
171
|
:value="filter.range.end"
|
156
172
|
@input-change="
|
157
173
|
onChange({
|
@@ -161,31 +177,30 @@
|
|
161
177
|
field: filter.field
|
162
178
|
})
|
163
179
|
"
|
164
|
-
fontSize="13px"
|
165
|
-
inputHeight="36px"
|
166
|
-
:unitName="filter.unit"
|
167
180
|
/>
|
168
|
-
</
|
169
|
-
</
|
170
|
-
<
|
181
|
+
</GridContainer>
|
182
|
+
</SectionContainer>
|
183
|
+
<SectionContainer
|
171
184
|
v-else-if="isDateSelector(filter.filter_type)"
|
172
185
|
@click.stop
|
173
186
|
>
|
174
|
-
<
|
175
|
-
|
187
|
+
<RowLabel :data-id="filter.dataId">
|
188
|
+
{{ filter.label }}
|
189
|
+
</RowLabel>
|
190
|
+
<GridContainer>
|
176
191
|
<VueDatePicker
|
177
|
-
text-input
|
178
|
-
:placeholder="$gettext('Date from')"
|
179
|
-
:locale="getDatePickerLanguage()"
|
180
|
-
:model-value="filter.range.start"
|
181
|
-
:enable-time-picker="false"
|
182
|
-
:clearable="true"
|
183
192
|
:auto-apply="true"
|
193
|
+
:clearable="true"
|
184
194
|
:disabled-dates="disableFutureDates"
|
195
|
+
:enable-time-picker="false"
|
185
196
|
format="yyyy-MM-dd"
|
197
|
+
:locale="getDatePickerLanguage()"
|
186
198
|
model-type="format"
|
187
|
-
|
199
|
+
:model-value="filter.range.start"
|
200
|
+
:placeholder="$gettext('Date from')"
|
201
|
+
text-input
|
188
202
|
@close="onDatepickerBlur()"
|
203
|
+
@focus="onDatepickerFocus(filter.range)"
|
189
204
|
@update:model-value="
|
190
205
|
onChange({
|
191
206
|
dataType: item.type,
|
@@ -196,18 +211,18 @@
|
|
196
211
|
"
|
197
212
|
/>
|
198
213
|
<VueDatePicker
|
199
|
-
text-input
|
200
|
-
:placeholder="$gettext('Date to')"
|
201
|
-
:locale="getDatePickerLanguage()"
|
202
|
-
:model-value="filter.range.end"
|
203
|
-
:enable-time-picker="false"
|
204
|
-
:clearable="true"
|
205
214
|
:auto-apply="true"
|
215
|
+
:clearable="true"
|
206
216
|
:disabled-dates="disablePastDates"
|
217
|
+
:enable-time-picker="false"
|
207
218
|
format="yyyy-MM-dd"
|
219
|
+
:locale="getDatePickerLanguage()"
|
208
220
|
model-type="format"
|
209
|
-
|
221
|
+
:model-value="filter.range.end"
|
222
|
+
:placeholder="$gettext('Date to')"
|
223
|
+
text-input
|
210
224
|
@close="onDatepickerBlur()"
|
225
|
+
@focus="onDatepickerFocus(filter.range)"
|
211
226
|
@update:model-value="
|
212
227
|
onChange({
|
213
228
|
dataType: item.type,
|
@@ -217,20 +232,20 @@
|
|
217
232
|
})
|
218
233
|
"
|
219
234
|
/>
|
220
|
-
</
|
221
|
-
</
|
222
|
-
<
|
235
|
+
</GridContainer>
|
236
|
+
</SectionContainer>
|
237
|
+
<SelectComponent
|
223
238
|
v-else
|
224
|
-
|
225
|
-
selectHeight="36px"
|
226
|
-
fontSize="13px"
|
227
|
-
:label="filter.label"
|
228
|
-
alignItems="vertical"
|
229
|
-
:isSearchable="filter.choices.length > 7"
|
239
|
+
align-items="vertical"
|
230
240
|
:disabled="!filter.choices.length"
|
241
|
+
font-size="13px"
|
242
|
+
:is-searchable="filter.choices.length > 7"
|
243
|
+
:label="filter.label"
|
244
|
+
select-height="36px"
|
245
|
+
select-width="100%"
|
231
246
|
>
|
232
247
|
<template #selector="{ selectedValue }">
|
233
|
-
<
|
248
|
+
<OptionTitle>
|
234
249
|
{{
|
235
250
|
getSelectedValue({
|
236
251
|
value: selectedValue,
|
@@ -238,65 +253,70 @@
|
|
238
253
|
filter
|
239
254
|
})
|
240
255
|
}}
|
241
|
-
</
|
256
|
+
</OptionTitle>
|
242
257
|
</template>
|
243
258
|
<template #dropdown>
|
244
259
|
<Option
|
245
260
|
v-for="(filterOption, filterIdx) in filter.choices"
|
246
261
|
:key="filterIdx + '_filterIdx'"
|
247
262
|
:value="filterOption.choice"
|
248
|
-
>{{ filterOption.text }}</Option
|
249
263
|
>
|
264
|
+
{{ filterOption.text }}
|
265
|
+
</Option>
|
250
266
|
</template>
|
251
|
-
</
|
252
|
-
</
|
253
|
-
</
|
254
|
-
</
|
255
|
-
</
|
256
|
-
<
|
257
|
-
<
|
267
|
+
</SelectComponent>
|
268
|
+
</RowWrapper>
|
269
|
+
</RowContainer>
|
270
|
+
</ColumnContainer>
|
271
|
+
</ColumnWrapper>
|
272
|
+
<ButtonContainer>
|
273
|
+
<MainButton
|
258
274
|
v-if="buttonText.apply_view"
|
259
|
-
type="primary"
|
260
275
|
:text="buttonText.apply_view"
|
276
|
+
type="primary"
|
261
277
|
@click="$emit('on-apply-current-view')"
|
262
278
|
/>
|
263
|
-
<
|
264
|
-
type="secondary"
|
279
|
+
<MainButton
|
265
280
|
v-if="buttonText.save_view"
|
266
281
|
:text="buttonText.save_view"
|
282
|
+
type="secondary"
|
267
283
|
@click="$emit('on-save-new-view')"
|
268
284
|
/>
|
269
|
-
<
|
270
|
-
type="cancel"
|
285
|
+
<MainButton
|
271
286
|
v-if="buttonText.cancel"
|
272
287
|
:text="buttonText.cancel"
|
288
|
+
type="cancel"
|
273
289
|
@click="$emit('on-cancel-view')"
|
274
290
|
/>
|
275
|
-
<
|
276
|
-
<
|
277
|
-
<
|
291
|
+
<ResetContainer v-if="!filterViews || !filterViews.length">
|
292
|
+
<ResetButton @click="$emit('on-reset-filters')">
|
293
|
+
<Icon
|
294
|
+
:color="theme.colors.blue"
|
295
|
+
:name="'update'"
|
296
|
+
size="14px"
|
297
|
+
/>
|
278
298
|
<div>{{ $gettext('reset_filters') }}</div>
|
279
|
-
</
|
280
|
-
</
|
281
|
-
</
|
282
|
-
</
|
299
|
+
</ResetButton>
|
300
|
+
</ResetContainer>
|
301
|
+
</ButtonContainer>
|
302
|
+
</ContainerWrapper>
|
283
303
|
</template>
|
284
304
|
|
285
305
|
<script>
|
286
|
-
import styled from 'vue3-styled-components'
|
287
|
-
import SelectComponent from '../inputs/select'
|
288
|
-
import Option from '../inputs/select/option'
|
289
|
-
import InputNumber from '../inputs/inputNumber'
|
290
|
-
import MainButton from '../buttons/mainButton'
|
291
|
-
import Checkbox from '../inputs/checkbox'
|
292
|
-
import draggable from 'vuedraggable'
|
293
|
-
import Icon from '../icon'
|
294
|
-
import DeleteIcon from '../deleteIcon'
|
295
|
-
import { datePickerLang } from '../../helpers/translateLang'
|
296
|
-
import theme from '@/assets/theme.js'
|
297
|
-
import VueDatePicker from '@vuepic/vue-datepicker'
|
306
|
+
import styled from 'vue3-styled-components'
|
307
|
+
import SelectComponent from '../inputs/select'
|
308
|
+
import Option from '../inputs/select/option'
|
309
|
+
import InputNumber from '../inputs/inputNumber'
|
310
|
+
import MainButton from '../buttons/mainButton'
|
311
|
+
import Checkbox from '../inputs/checkbox'
|
312
|
+
import draggable from 'vuedraggable'
|
313
|
+
import Icon from '../icon'
|
314
|
+
import DeleteIcon from '../deleteIcon'
|
315
|
+
import { datePickerLang } from '../../helpers/translateLang'
|
316
|
+
import theme from '@/assets/theme.js'
|
317
|
+
import VueDatePicker from '@vuepic/vue-datepicker'
|
298
318
|
|
299
|
-
const ContainerWrapper = styled.div`
|
319
|
+
const ContainerWrapper = styled.div`
|
300
320
|
position: absolute;
|
301
321
|
margin-top: 4px;
|
302
322
|
background-color: ${(props) => props.theme.colors.white};
|
@@ -308,8 +328,8 @@ const ContainerWrapper = styled.div`
|
|
308
328
|
font-size: 13px;
|
309
329
|
`
|
310
330
|
|
311
|
-
const ColAttrs = { numCols: Number, hasActiveView: Boolean }
|
312
|
-
const ColumnWrapper = styled('div', ColAttrs)`
|
331
|
+
const ColAttrs = { numCols: Number, hasActiveView: Boolean }
|
332
|
+
const ColumnWrapper = styled('div', ColAttrs)`
|
313
333
|
display: grid;
|
314
334
|
grid-template-columns: repeat(${(props) => props.numCols}, auto);
|
315
335
|
|
@@ -320,8 +340,8 @@ const ColumnWrapper = styled('div', ColAttrs)`
|
|
320
340
|
`}
|
321
341
|
`
|
322
342
|
|
323
|
-
const TitleAttrs = { showBorder: Boolean }
|
324
|
-
const ColumnTitle = styled('div', TitleAttrs)`
|
343
|
+
const TitleAttrs = { showBorder: Boolean }
|
344
|
+
const ColumnTitle = styled('div', TitleAttrs)`
|
325
345
|
font-size: 14px;
|
326
346
|
font-weight: 700;
|
327
347
|
color: ${(props) => props.theme.colors.eturnityGrey};
|
@@ -333,13 +353,13 @@ const ColumnTitle = styled('div', TitleAttrs)`
|
|
333
353
|
`}
|
334
354
|
`
|
335
355
|
|
336
|
-
const ButtonContainer = styled.div`
|
356
|
+
const ButtonContainer = styled.div`
|
337
357
|
display: flex;
|
338
358
|
gap: 10px;
|
339
359
|
padding: 15px;
|
340
360
|
`
|
341
361
|
|
342
|
-
const ResetContainer = styled.div`
|
362
|
+
const ResetContainer = styled.div`
|
343
363
|
display: grid;
|
344
364
|
align-content: center;
|
345
365
|
margin-left: auto;
|
@@ -349,9 +369,9 @@ const ResetContainer = styled.div`
|
|
349
369
|
}
|
350
370
|
`
|
351
371
|
|
352
|
-
const ColumnContainer = styled.div``
|
372
|
+
const ColumnContainer = styled.div``
|
353
373
|
|
354
|
-
const DragContainer = styled.div`
|
374
|
+
const DragContainer = styled.div`
|
355
375
|
cursor: grab;
|
356
376
|
|
357
377
|
&:active {
|
@@ -359,7 +379,7 @@ const DragContainer = styled.div`
|
|
359
379
|
}
|
360
380
|
`
|
361
381
|
|
362
|
-
const RowContainer = styled('div', TitleAttrs)`
|
382
|
+
const RowContainer = styled('div', TitleAttrs)`
|
363
383
|
padding: 10px 14px;
|
364
384
|
min-width: 300px;
|
365
385
|
|
@@ -375,16 +395,16 @@ const RowContainer = styled('div', TitleAttrs)`
|
|
375
395
|
}
|
376
396
|
`
|
377
397
|
|
378
|
-
const OptionTitle = styled.div`
|
398
|
+
const OptionTitle = styled.div`
|
379
399
|
cursor: pointer !important;
|
380
400
|
`
|
381
401
|
|
382
|
-
const CheckboxContainer = styled.div`
|
402
|
+
const CheckboxContainer = styled.div`
|
383
403
|
display: grid;
|
384
404
|
gap: 6px;
|
385
405
|
`
|
386
406
|
|
387
|
-
const CheckboxWrapper = styled.div`
|
407
|
+
const CheckboxWrapper = styled.div`
|
388
408
|
display: grid;
|
389
409
|
grid-template-columns: auto 1fr;
|
390
410
|
gap: 16px;
|
@@ -392,7 +412,7 @@ const CheckboxWrapper = styled.div`
|
|
392
412
|
align-items: center;
|
393
413
|
`
|
394
414
|
|
395
|
-
const DropdownCheckboxContainer = styled.div`
|
415
|
+
const DropdownCheckboxContainer = styled.div`
|
396
416
|
display: grid;
|
397
417
|
gap: 6px;
|
398
418
|
width: 100%;
|
@@ -400,42 +420,42 @@ const DropdownCheckboxContainer = styled.div`
|
|
400
420
|
background: ${(props) => props.theme.colors.grey5};
|
401
421
|
`
|
402
422
|
|
403
|
-
const RowWrapper = styled.div`
|
423
|
+
const RowWrapper = styled.div`
|
404
424
|
margin-bottom: 12px;
|
405
425
|
`
|
406
426
|
|
407
|
-
const LabelAttrs = {
|
408
|
-
|
409
|
-
}
|
410
|
-
const RowLabel = styled('div', LabelAttrs)`
|
427
|
+
const LabelAttrs = {
|
428
|
+
marginTop: Boolean
|
429
|
+
}
|
430
|
+
const RowLabel = styled('div', LabelAttrs)`
|
411
431
|
font-weight: 700;
|
412
432
|
font-size: 13px;
|
413
433
|
margin-bottom: 8px;
|
414
434
|
margin-top: ${(props) => (props.marginTop ? '12px' : '0')};
|
415
435
|
`
|
416
436
|
|
417
|
-
const SectionContainer = styled.div``
|
437
|
+
const SectionContainer = styled.div``
|
418
438
|
|
419
|
-
const GridContainer = styled.div`
|
439
|
+
const GridContainer = styled.div`
|
420
440
|
display: grid;
|
421
441
|
grid-template-columns: 1fr 1fr;
|
422
442
|
grid-gap: 12px;
|
423
443
|
`
|
424
444
|
|
425
|
-
const ViewContainerAttrs = { maxWidth: Number }
|
426
|
-
const ViewContainer = styled('div', ViewContainerAttrs)`
|
445
|
+
const ViewContainerAttrs = { maxWidth: Number }
|
446
|
+
const ViewContainer = styled('div', ViewContainerAttrs)`
|
427
447
|
max-width: ${(props) =>
|
428
|
-
|
448
|
+
props.maxWidth && props.maxWidth > 300 ? props.maxWidth + 'ch' : '300px'};
|
429
449
|
`
|
430
450
|
|
431
|
-
const UpperContainer = styled.div`
|
451
|
+
const UpperContainer = styled.div`
|
432
452
|
display: grid;
|
433
453
|
grid-gap: 20px
|
434
454
|
grid-template-columns: 1fr 1fr;
|
435
455
|
padding: 10px 14px;
|
436
456
|
`
|
437
457
|
|
438
|
-
const ResetButton = styled.div`
|
458
|
+
const ResetButton = styled.div`
|
439
459
|
display: inline-flex;
|
440
460
|
gap: 16px;
|
441
461
|
width: max-content;
|
@@ -446,188 +466,188 @@ const ResetButton = styled.div`
|
|
446
466
|
cursor: pointer;
|
447
467
|
`
|
448
468
|
|
449
|
-
export default {
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
},
|
481
|
-
props: {
|
482
|
-
filterData: {
|
483
|
-
required: true
|
484
|
-
},
|
485
|
-
hasActiveView: {
|
486
|
-
required: false
|
469
|
+
export default {
|
470
|
+
name: 'FilterSettings',
|
471
|
+
components: {
|
472
|
+
ContainerWrapper,
|
473
|
+
ColumnWrapper,
|
474
|
+
ColumnTitle,
|
475
|
+
ColumnContainer,
|
476
|
+
SelectComponent,
|
477
|
+
RowContainer,
|
478
|
+
OptionTitle,
|
479
|
+
Option,
|
480
|
+
ButtonContainer,
|
481
|
+
MainButton,
|
482
|
+
CheckboxContainer,
|
483
|
+
CheckboxWrapper,
|
484
|
+
Checkbox,
|
485
|
+
RowWrapper,
|
486
|
+
DropdownCheckboxContainer,
|
487
|
+
draggable,
|
488
|
+
Icon,
|
489
|
+
DragContainer,
|
490
|
+
InputNumber,
|
491
|
+
RowLabel,
|
492
|
+
SectionContainer,
|
493
|
+
GridContainer,
|
494
|
+
ViewContainer,
|
495
|
+
DeleteIcon,
|
496
|
+
UpperContainer,
|
497
|
+
ResetButton,
|
498
|
+
ResetContainer,
|
499
|
+
VueDatePicker
|
487
500
|
},
|
488
|
-
|
489
|
-
|
501
|
+
props: {
|
502
|
+
filterData: {
|
503
|
+
required: true
|
504
|
+
},
|
505
|
+
hasActiveView: {
|
506
|
+
required: false
|
507
|
+
},
|
508
|
+
buttonText: {
|
509
|
+
required: true
|
490
510
|
// example:
|
491
511
|
// {
|
492
512
|
// 'save_new_view': '$gettext("save_new_view")',
|
493
513
|
// 'cancel': '$gettext("cancel")',
|
494
514
|
// 'save_view': '$gettext("save_view")'
|
495
515
|
// }
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
}
|
509
|
-
},
|
510
|
-
data() {
|
511
|
-
return {
|
512
|
-
selectedDates: null,
|
513
|
-
value1: null,
|
514
|
-
dateStart: null,
|
515
|
-
dateEnd: null
|
516
|
-
}
|
517
|
-
},
|
518
|
-
methods: {
|
519
|
-
onChange({ dataType, value, choice, field }) {
|
520
|
-
if (
|
521
|
-
dataType === 'columns' &&
|
522
|
-
this.isCheckboxDisabled &&
|
523
|
-
value === false
|
524
|
-
) {
|
525
|
-
return
|
516
|
+
},
|
517
|
+
filterViews: {
|
518
|
+
required: true
|
519
|
+
},
|
520
|
+
activeLanguage: {
|
521
|
+
required: false
|
522
|
+
},
|
523
|
+
settingsTranslations: {
|
524
|
+
required: false
|
525
|
+
},
|
526
|
+
activeView: {
|
527
|
+
required: false
|
526
528
|
}
|
527
|
-
const data = { dataType, value, choice, field }
|
528
|
-
this.$emit('on-filter-change', data)
|
529
|
-
},
|
530
|
-
onDatepickerFocus(range) {
|
531
|
-
this.dateStart = range.start
|
532
|
-
this.dateEnd = range.end
|
533
|
-
this.$emit('on-prevent-close', true)
|
534
529
|
},
|
535
|
-
|
536
|
-
|
530
|
+
data() {
|
531
|
+
return {
|
532
|
+
selectedDates: null,
|
533
|
+
value1: null,
|
534
|
+
dateStart: null,
|
535
|
+
dateEnd: null
|
536
|
+
}
|
537
537
|
},
|
538
|
-
|
539
|
-
|
540
|
-
|
541
|
-
|
538
|
+
computed: {
|
539
|
+
isCheckboxDisabled() {
|
540
|
+
// if only 1 item left, disable checkbox
|
541
|
+
let isDisabled = false
|
542
|
+
let columnsData = this.filterData.filter(
|
543
|
+
(item) => item.type === 'columns'
|
544
|
+
)
|
545
|
+
if (columnsData.length) {
|
546
|
+
columnsData = columnsData[0]
|
547
|
+
const filteredColumns = columnsData.dataOptions.filter(
|
548
|
+
(item) => item.selected
|
549
|
+
)
|
550
|
+
if (filteredColumns.length === 1) {
|
551
|
+
isDisabled = true
|
552
|
+
}
|
553
|
+
}
|
554
|
+
return isDisabled
|
555
|
+
},
|
556
|
+
theme() {
|
557
|
+
return theme
|
542
558
|
}
|
543
|
-
|
559
|
+
},
|
560
|
+
methods: {
|
561
|
+
onChange({ dataType, value, choice, field }) {
|
562
|
+
if (
|
563
|
+
dataType === 'columns' &&
|
564
|
+
this.isCheckboxDisabled &&
|
565
|
+
value === false
|
566
|
+
) {
|
567
|
+
return
|
568
|
+
}
|
569
|
+
const data = { dataType, value, choice, field }
|
570
|
+
this.$emit('on-filter-change', data)
|
571
|
+
},
|
572
|
+
onDatepickerFocus(range) {
|
573
|
+
this.dateStart = range.start
|
574
|
+
this.dateEnd = range.end
|
575
|
+
this.$emit('on-prevent-close', true)
|
576
|
+
},
|
577
|
+
onDatepickerBlur() {
|
578
|
+
this.$emit('on-prevent-close', false)
|
579
|
+
},
|
580
|
+
disablePastDates(date) {
|
581
|
+
const dateString = this.dateStart
|
582
|
+
if (!dateString) {
|
583
|
+
return
|
584
|
+
}
|
585
|
+
const dateParts = dateString.split('-')
|
544
586
|
|
545
|
-
|
546
|
-
|
547
|
-
|
587
|
+
const year = parseInt(dateParts[0])
|
588
|
+
const month = parseInt(dateParts[1]) - 1 // Subtract 1 since January is month 0
|
589
|
+
const day = parseInt(dateParts[2])
|
548
590
|
|
549
|
-
|
550
|
-
|
591
|
+
const currentDate = new Date(year, month, day)
|
592
|
+
const selectedDate = new Date(date)
|
551
593
|
|
552
|
-
|
553
|
-
|
554
|
-
|
555
|
-
|
556
|
-
|
557
|
-
|
558
|
-
|
559
|
-
|
560
|
-
|
594
|
+
// Disable dates that are greater than or equal to the current date
|
595
|
+
return selectedDate <= currentDate
|
596
|
+
},
|
597
|
+
disableFutureDates(date) {
|
598
|
+
const dateString = this.dateEnd
|
599
|
+
if (!dateString) {
|
600
|
+
return
|
601
|
+
}
|
602
|
+
const dateParts = dateString.split('-')
|
561
603
|
|
562
|
-
|
563
|
-
|
564
|
-
|
604
|
+
const year = parseInt(dateParts[0])
|
605
|
+
const month = parseInt(dateParts[1]) - 1 // Subtract 1 since January is month 0
|
606
|
+
const day = parseInt(dateParts[2])
|
565
607
|
|
566
|
-
|
567
|
-
|
608
|
+
const currentDate = new Date(year, month, day)
|
609
|
+
const selectedDate = new Date(date)
|
568
610
|
|
569
|
-
|
570
|
-
|
571
|
-
|
572
|
-
|
573
|
-
|
574
|
-
|
575
|
-
|
576
|
-
|
577
|
-
|
578
|
-
|
579
|
-
|
580
|
-
|
581
|
-
)
|
582
|
-
// prevents the dragged element from dragging the whole row as a "ghost"
|
583
|
-
// Safari fix because this does not work on Safari
|
584
|
-
let img = new Image()
|
585
|
-
if (!isSafari) {
|
586
|
-
dataTransfer.setDragImage(img, 0, 0)
|
587
|
-
} else {
|
588
|
-
img.src =
|
589
|
-
'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7'
|
590
|
-
dataTransfer.setDragImage(img, 0, 0)
|
591
|
-
}
|
592
|
-
},
|
593
|
-
getSelectedValue({ value, options, filter }) {
|
594
|
-
const foundItem = options.find((item) => item.choice === value)
|
595
|
-
return foundItem ? foundItem.text : value ? value : filter.selectedText
|
596
|
-
},
|
597
|
-
isMultipleSelector(type) {
|
598
|
-
return type === 'multi_select_integer' || type === 'multi_select_string'
|
599
|
-
},
|
600
|
-
isRangeSelector(type) {
|
601
|
-
return type === 'integer_range' || type === 'number_range'
|
602
|
-
},
|
603
|
-
isIntegerRange(type) {
|
604
|
-
return type === 'integer_range'
|
605
|
-
},
|
606
|
-
isDateSelector(type) {
|
607
|
-
return type === 'datetime'
|
608
|
-
}
|
609
|
-
},
|
610
|
-
computed: {
|
611
|
-
isCheckboxDisabled() {
|
612
|
-
// if only 1 item left, disable checkbox
|
613
|
-
let isDisabled = false
|
614
|
-
let columnsData = this.filterData.filter(
|
615
|
-
(item) => item.type === 'columns'
|
616
|
-
)
|
617
|
-
if (columnsData.length) {
|
618
|
-
columnsData = columnsData[0]
|
619
|
-
const filteredColumns = columnsData.dataOptions.filter(
|
620
|
-
(item) => item.selected
|
611
|
+
// Disable dates that are greater than or equal to the current date
|
612
|
+
return selectedDate >= currentDate
|
613
|
+
},
|
614
|
+
getDatePickerLanguage() {
|
615
|
+
return datePickerLang(this.activeLanguage)
|
616
|
+
},
|
617
|
+
onDragChange({ data }) {
|
618
|
+
this.$emit('on-drag-change', data)
|
619
|
+
},
|
620
|
+
modifyDragItem(dataTransfer) {
|
621
|
+
const isSafari = /^((?!chrome|android).)*safari/i.test(
|
622
|
+
navigator.userAgent
|
621
623
|
)
|
622
|
-
|
623
|
-
|
624
|
+
// prevents the dragged element from dragging the whole row as a "ghost"
|
625
|
+
// Safari fix because this does not work on Safari
|
626
|
+
let img = new Image()
|
627
|
+
if (!isSafari) {
|
628
|
+
dataTransfer.setDragImage(img, 0, 0)
|
629
|
+
} else {
|
630
|
+
img.src =
|
631
|
+
'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7'
|
632
|
+
dataTransfer.setDragImage(img, 0, 0)
|
624
633
|
}
|
634
|
+
},
|
635
|
+
getSelectedValue({ value, options, filter }) {
|
636
|
+
const foundItem = options.find((item) => item.choice === value)
|
637
|
+
return foundItem ? foundItem.text : value ? value : filter.selectedText
|
638
|
+
},
|
639
|
+
isMultipleSelector(type) {
|
640
|
+
return type === 'multi_select_integer' || type === 'multi_select_string'
|
641
|
+
},
|
642
|
+
isRangeSelector(type) {
|
643
|
+
return type === 'integer_range' || type === 'number_range'
|
644
|
+
},
|
645
|
+
isIntegerRange(type) {
|
646
|
+
return type === 'integer_range'
|
647
|
+
},
|
648
|
+
isDateSelector(type) {
|
649
|
+
return type === 'datetime'
|
625
650
|
}
|
626
|
-
return isDisabled
|
627
|
-
},
|
628
|
-
theme() {
|
629
|
-
return theme
|
630
651
|
}
|
631
652
|
}
|
632
|
-
}
|
633
653
|
</script>
|